source: issm/trunk-jpl/src/c/classes/Constraints/SpcStatic.cpp@ 18237

Last change on this file since 18237 was 18237, checked in by schlegel, 11 years ago

CHG: create femmodel copy for dakota runs

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