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 | /*FUNCTION SpcStatic::SpcStatic(){{{*/
|
---|
17 | SpcStatic::SpcStatic(){
|
---|
18 | return;
|
---|
19 | }
|
---|
20 | /*}}}*/
|
---|
21 | /*FUNCTION SpcStatic::SpcStatic(int spc_sid,int spc_nodeid,...){{{*/
|
---|
22 | SpcStatic::SpcStatic(int spc_sid,int spc_nodeid, int spc_dof,IssmDouble spc_value,int spc_analysis_type){
|
---|
23 |
|
---|
24 | sid=spc_sid;
|
---|
25 | nodeid=spc_nodeid;
|
---|
26 | dof=spc_dof;
|
---|
27 | value=spc_value;
|
---|
28 | analysis_type=spc_analysis_type;
|
---|
29 |
|
---|
30 | return;
|
---|
31 | }
|
---|
32 | /*}}}*/
|
---|
33 | /*FUNCTION SpcStatic::~SpcStatic{{{*/
|
---|
34 | SpcStatic::~SpcStatic(){
|
---|
35 | return;
|
---|
36 | }
|
---|
37 | /*}}}*/
|
---|
38 |
|
---|
39 | /*Object virtual functions definitions:*/
|
---|
40 | /*FUNCTION SpcStatic::Echo {{{*/
|
---|
41 | void SpcStatic::Echo(void){
|
---|
42 |
|
---|
43 | _printString_("SpcStatic:" << "\n");
|
---|
44 | _printString_(" sid: " << sid << "\n");
|
---|
45 | _printString_(" nodeid: " << nodeid << "\n");
|
---|
46 | _printString_(" dof: " << dof << "\n");
|
---|
47 | _printString_(" value: " << value << "\n");
|
---|
48 | _printString_(" analysis_type: " << EnumToStringx(analysis_type) << "\n");
|
---|
49 | return;
|
---|
50 | }
|
---|
51 | /*}}}*/
|
---|
52 | /*FUNCTION SpcStatic::DeepEcho {{{*/
|
---|
53 | void SpcStatic::DeepEcho(void){
|
---|
54 |
|
---|
55 | _printString_("SpcStatic:" << "\n");
|
---|
56 | _printString_(" sid: " << sid << "\n");
|
---|
57 | _printString_(" nodeid: " << nodeid << "\n");
|
---|
58 | _printString_(" dof: " << dof << "\n");
|
---|
59 | _printString_(" value: " << value << "\n");
|
---|
60 | _printString_(" analysis_type: " << EnumToStringx(analysis_type) << "\n");
|
---|
61 | return;
|
---|
62 | }
|
---|
63 | /*}}}*/
|
---|
64 | /*FUNCTION SpcStatic::Id {{{*/
|
---|
65 | int SpcStatic::Id(void){ return sid; }
|
---|
66 | /*}}}*/
|
---|
67 | /*FUNCTION SpcStatic::ObjectEnum{{{*/
|
---|
68 | int SpcStatic::ObjectEnum(void){
|
---|
69 |
|
---|
70 | return SpcStaticEnum;
|
---|
71 |
|
---|
72 | }
|
---|
73 | /*}}}*/
|
---|
74 | /*FUNCTION SpcStatic::copy {{{*/
|
---|
75 | Object* SpcStatic::copy() {
|
---|
76 | return new SpcStatic(*this);
|
---|
77 | }
|
---|
78 | /*}}}*/
|
---|
79 |
|
---|
80 | /*Constraint virtual functions definitions: */
|
---|
81 | /*FUNCTION SpcStatic::InAnalysis{{{*/
|
---|
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 | /*FUNCTION SpcStatic::ConstrainNode{{{*/
|
---|
88 | void SpcStatic::ConstrainNode(Nodes* nodes,Parameters* parameters){
|
---|
89 |
|
---|
90 | Node* node=NULL;
|
---|
91 |
|
---|
92 | /*Chase through nodes and find the node to which this SpcStatic applys: */
|
---|
93 | node=(Node*)nodes->GetObjectById(NULL,nodeid);
|
---|
94 |
|
---|
95 | /*Apply constraint: */
|
---|
96 | if(node){ //in case the spc is dealing with a node on another cpu
|
---|
97 | node->ApplyConstraint(dof,value);
|
---|
98 | }
|
---|
99 | }
|
---|
100 | /*}}}*/
|
---|
101 |
|
---|
102 | /*SpcStatic functions*/
|
---|
103 | /*FUNCTION SpcStatic::GetDof {{{*/
|
---|
104 | int SpcStatic::GetDof(){
|
---|
105 | return dof;
|
---|
106 | }
|
---|
107 | /*}}}*/
|
---|
108 | /*FUNCTION SpcStatic::GetNodeId {{{*/
|
---|
109 | int SpcStatic::GetNodeId(){
|
---|
110 |
|
---|
111 | return nodeid;
|
---|
112 | }
|
---|
113 | /*}}}*/
|
---|
114 | /*FUNCTION SpcStatic::GetValue {{{*/
|
---|
115 | IssmDouble SpcStatic::GetValue(){
|
---|
116 | _assert_(!xIsNan<IssmDouble>(value));
|
---|
117 | return value;
|
---|
118 | }
|
---|
119 | /*}}}*/
|
---|