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*/
|
---|
16 | SpcStatic::SpcStatic(){/*{{{*/
|
---|
17 | return;
|
---|
18 | }
|
---|
19 | /*}}}*/
|
---|
20 | SpcStatic::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 | /*}}}*/
|
---|
31 | SpcStatic::~SpcStatic(){/*{{{*/
|
---|
32 | return;
|
---|
33 | }
|
---|
34 | /*}}}*/
|
---|
35 |
|
---|
36 | /*Object virtual functions definitions:*/
|
---|
37 | void 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 | /*}}}*/
|
---|
48 | void 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 | /*}}}*/
|
---|
59 | int SpcStatic::Id(void){ return sid; }/*{{{*/
|
---|
60 | /*}}}*/
|
---|
61 | int SpcStatic::ObjectEnum(void){/*{{{*/
|
---|
62 |
|
---|
63 | return SpcStaticEnum;
|
---|
64 |
|
---|
65 | }
|
---|
66 | /*}}}*/
|
---|
67 | Object* 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: */
|
---|
82 | bool SpcStatic::InAnalysis(int in_analysis_type){/*{{{*/
|
---|
83 | if (in_analysis_type==this->analysis_type) return true;
|
---|
84 | else return false;
|
---|
85 | }
|
---|
86 | /*}}}*/
|
---|
87 | void 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*/
|
---|
102 | int SpcStatic::GetDof(){/*{{{*/
|
---|
103 | return dof;
|
---|
104 | }
|
---|
105 | /*}}}*/
|
---|
106 | int SpcStatic::GetNodeId(){/*{{{*/
|
---|
107 |
|
---|
108 | return nodeid;
|
---|
109 | }
|
---|
110 | /*}}}*/
|
---|
111 | IssmDouble SpcStatic::GetValue(){/*{{{*/
|
---|
112 | _assert_(!xIsNan<IssmDouble>(value));
|
---|
113 | return value;
|
---|
114 | }
|
---|
115 | /*}}}*/
|
---|