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

Last change on this file since 18388 was 18388, checked in by Mathieu Morlighem, 11 years ago

NEW: extended penlaty method to all Spc classes

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