source: issm/trunk-jpl/src/c/objects/Constraints/SpcStatic.cpp@ 12529

Last change on this file since 12529 was 12529, checked in by Mathieu Morlighem, 13 years ago

replaced all isnan by template xIsnan

File size: 2.9 KB
RevLine 
[9285]1/*!\file SpcStatic.c
2 * \brief: implementation of the SpcStatic object
[3683]3 */
4
5#ifdef HAVE_CONFIG_H
[9320]6 #include <config.h>
[3683]7#else
8#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
9#endif
10
[9320]11#include <stdio.h>
[3683]12#include <string.h>
[3775]13#include "../../include/include.h"
[3683]14#include "../../shared/shared.h"
15#include "../../EnumDefinitions/EnumDefinitions.h"
[4236]16#include "../../Container/Container.h"
[3683]17#include "../objects.h"
18
[9285]19/*SpcStatic constructors and destructor*/
[12365]20/*FUNCTION SpcStatic::SpcStatic(){{{*/
[9285]21SpcStatic::SpcStatic(){
[3683]22 return;
23}
[12365]24/*}}}*/
25/*FUNCTION SpcStatic::SpcStatic(int spc_sid,int spc_nodeid,...){{{*/
[12462]26SpcStatic::SpcStatic(int spc_sid,int spc_nodeid, int spc_dof,IssmDouble spc_value,int spc_analysis_type){
[3683]27
28 sid=spc_sid;
29 nodeid=spc_nodeid;
30 dof=spc_dof;
31 value=spc_value;
[4003]32 analysis_type=spc_analysis_type;
[3683]33
34 return;
35}
[12365]36/*}}}*/
37/*FUNCTION SpcStatic::~SpcStatic{{{*/
[9285]38SpcStatic::~SpcStatic(){
[3683]39 return;
40}
[12365]41/*}}}*/
[3683]42
[4248]43/*Object virtual functions definitions:*/
[12365]44/*FUNCTION SpcStatic::Echo {{{*/
[9285]45void SpcStatic::Echo(void){
[4248]46
[12511]47 _printLine_("SpcStatic:");
48 _printLine_(" sid: " << sid);
49 _printLine_(" nodeid: " << nodeid);
50 _printLine_(" dof: " << dof);
51 _printLine_(" value: " << value);
52 _printLine_(" analysis_type: " << EnumToStringx(analysis_type));
[4248]53 return;
54}
[12365]55/*}}}*/
56/*FUNCTION SpcStatic::DeepEcho {{{*/
[9285]57void SpcStatic::DeepEcho(void){
[4248]58
[12511]59 _printLine_("SpcStatic:");
60 _printLine_(" sid: " << sid);
61 _printLine_(" nodeid: " << nodeid);
62 _printLine_(" dof: " << dof);
63 _printLine_(" value: " << value);
64 _printLine_(" analysis_type: " << EnumToStringx(analysis_type));
[4248]65 return;
66}
[12365]67/*}}}*/
68/*FUNCTION SpcStatic::Id {{{*/
[9285]69int SpcStatic::Id(void){ return sid; }
[12365]70/*}}}*/
71/*FUNCTION SpcStatic::MyRank {{{*/
[9285]72int SpcStatic::MyRank(void){
[4248]73 extern int my_rank;
74 return my_rank;
75}
[12365]76/*}}}*/
77/*FUNCTION SpcStatic::ObjectEnum{{{*/
[9883]78int SpcStatic::ObjectEnum(void){
[3683]79
[9285]80 return SpcStaticEnum;
[4248]81
82}
[12365]83/*}}}*/
84/*FUNCTION SpcStatic::copy {{{*/
[9285]85Object* SpcStatic::copy() {
86 return new SpcStatic(*this);
[3683]87}
[12365]88/*}}}*/
[3683]89
[9002]90/*Constraint virtual functions definitions: */
[12365]91/*FUNCTION SpcStatic::InAnalysis{{{*/
[9285]92bool SpcStatic::InAnalysis(int in_analysis_type){
[9002]93 if (in_analysis_type==this->analysis_type) return true;
94 else return false;
95}
96/*}}}*/
[12365]97/*FUNCTION SpcStatic::ConstrainNode{{{*/
[9285]98void SpcStatic::ConstrainNode(Nodes* nodes,Parameters* parameters){
[9002]99
100 Node* node=NULL;
101
[9285]102 /*Chase through nodes and find the node to which this SpcStatic applys: */
[9002]103 node=(Node*)nodes->GetObjectById(NULL,nodeid);
104
105 /*Apply constraint: */
106 if(node){ //in case the spc is dealing with a node on another cpu
107 node->ApplyConstraint(dof,value);
108 }
109}
110/*}}}*/
111
[9285]112/*SpcStatic functions*/
[12365]113/*FUNCTION SpcStatic::GetDof {{{*/
[9285]114int SpcStatic::GetDof(){
[3683]115 return dof;
116}
[12365]117/*}}}*/
118/*FUNCTION SpcStatic::GetNodeId {{{*/
[9285]119int SpcStatic::GetNodeId(){
[3683]120
121 return nodeid;
122}
[12365]123/*}}}*/
124/*FUNCTION SpcStatic::GetValue {{{*/
[12462]125IssmDouble SpcStatic::GetValue(){
[12529]126 _assert_(!xIsNan<IssmDouble>(value));
[3683]127 return value;
128}
[12365]129/*}}}*/
Note: See TracBrowser for help on using the repository browser.