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

Last change on this file since 20810 was 20810, checked in by agscott1, 9 years ago

Started alphabetizing function names under src/classes

File size: 3.0 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 penalty = false;
28
29 return;
30}
31/*}}}*/
32SpcStatic::~SpcStatic(){/*{{{*/
33 return;
34}
35/*}}}*/
36
37/*Object virtual functions definitions:*/
38Object* SpcStatic::copy() {/*{{{*/
39
40 SpcStatic* spcstat = new SpcStatic(*this);
41
42 spcstat->sid=this->sid;
43 spcstat->nodeid=this->nodeid;
44 spcstat->dof=this->dof;
45 spcstat->value=this->value;
46 spcstat->analysis_type=this->analysis_type;
47
48 return (Object*) spcstat;
49}
50/*}}}*/
51void SpcStatic::DeepEcho(void){/*{{{*/
52
53 _printf_("SpcStatic:\n");
54 _printf_(" sid: " << sid << "\n");
55 _printf_(" nodeid: " << nodeid << "\n");
56 _printf_(" dof: " << dof << "\n");
57 _printf_(" value: " << value << "\n");
58 _printf_(" analysis_type: " << EnumToStringx(analysis_type) << "\n");
59 return;
60}
61/*}}}*/
62void SpcStatic::Echo(void){/*{{{*/
63
64 _printf_("SpcStatic:\n");
65 _printf_(" sid: " << sid << "\n");
66 _printf_(" nodeid: " << nodeid << "\n");
67 _printf_(" dof: " << dof << "\n");
68 _printf_(" value: " << value << "\n");
69 _printf_(" analysis_type: " << EnumToStringx(analysis_type) << "\n");
70 return;
71}
72/*}}}*/
73int SpcStatic::Id(void){ return sid; }/*{{{*/
74/*}}}*/
75void SpcStatic::Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ /*{{{*/
76
77 MARSHALLING_ENUM(SpcStaticEnum);
78
79 MARSHALLING(sid);
80 MARSHALLING(nodeid);
81 MARSHALLING(dof);
82 MARSHALLING(value);
83 MARSHALLING(analysis_type);
84 MARSHALLING(penalty);
85
86}
87/*}}}*/
88int SpcStatic::ObjectEnum(void){/*{{{*/
89
90 return SpcStaticEnum;
91
92}
93/*}}}*/
94
95/*Constraint virtual functions definitions: */
96void SpcStatic::ActivatePenaltyMethod(void){/*{{{*/
97 this->penalty = true;
98}
99/*}}}*/
100void SpcStatic::ConstrainNode(Nodes* nodes,Parameters* parameters){/*{{{*/
101
102 Node* node=NULL;
103
104 /*Chase through nodes and find the node to which this SpcStatic applys: */
105 node=(Node*)nodes->GetObjectById(NULL,nodeid);
106
107 /*Apply constraint: */
108 if(node){ //in case the spc is dealing with a node on another cpu
109 node->ApplyConstraint(dof,value);
110 }
111}
112/*}}}*/
113bool SpcStatic::InAnalysis(int in_analysis_type){/*{{{*/
114 if (in_analysis_type==this->analysis_type) return true;
115 else return false;
116}
117/*}}}*/
118
119/*SpcStatic functions*/
120int SpcStatic::GetDof(){/*{{{*/
121 return dof;
122}
123/*}}}*/
124int SpcStatic::GetNodeId(){/*{{{*/
125
126 return nodeid;
127}
128/*}}}*/
129IssmDouble SpcStatic::GetValue(){/*{{{*/
130 _assert_(!xIsNan<IssmDouble>(value));
131 return value;
132}
133/*}}}*/
Note: See TracBrowser for help on using the repository browser.