Ice Sheet System Model  4.18
Code documentation
Public Member Functions | Private Attributes
SpcStatic Class Reference

#include <SpcStatic.h>

Inheritance diagram for SpcStatic:
Constraint Object

Public Member Functions

 SpcStatic ()
 
 SpcStatic (int id, int nodeid, int dof, IssmDouble value, int analysis_type)
 
 ~SpcStatic ()
 
Objectcopy ()
 
void DeepEcho ()
 
void Echo ()
 
int Id ()
 
void Marshall (char **pmarshalled_data, int *pmarshalled_data_size, int marshall_direction)
 
int ObjectEnum ()
 
void ActivatePenaltyMethod (void)
 
void ConstrainNode (Nodes *nodes, Parameters *parameters)
 
void PenaltyDofAndValue (int *dof, IssmDouble *value, Nodes *nodes, Parameters *parameters)
 
void InputUpdateFromVectorDakota (IssmDouble *vector, Nodes *nodes, int name, int type)
 
int GetDof ()
 
int GetNodeId ()
 
IssmDouble GetValue ()
 
- Public Member Functions inherited from Constraint
virtual ~Constraint ()
 
- Public Member Functions inherited from Object
virtual ~Object ()
 

Private Attributes

int id
 
int nodeid
 
int dof
 
IssmDouble value
 
int analysis_type
 
bool penalty
 

Detailed Description

Definition at line 13 of file SpcStatic.h.

Constructor & Destructor Documentation

◆ SpcStatic() [1/2]

SpcStatic::SpcStatic ( )

Definition at line 16 of file SpcStatic.cpp.

16  {/*{{{*/
17  return;
18 }

◆ SpcStatic() [2/2]

SpcStatic::SpcStatic ( int  id,
int  nodeid,
int  dof,
IssmDouble  value,
int  analysis_type 
)

Definition at line 20 of file SpcStatic.cpp.

20  {/*{{{*/
21 
22  id = spc_id;
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 }

◆ ~SpcStatic()

SpcStatic::~SpcStatic ( )

Definition at line 32 of file SpcStatic.cpp.

32  {/*{{{*/
33  return;
34 }

Member Function Documentation

◆ copy()

Object * SpcStatic::copy ( void  )
virtual

Implements Object.

Definition at line 38 of file SpcStatic.cpp.

38  {/*{{{*/
39 
40  SpcStatic* spcstat = new SpcStatic(*this);
41 
42  spcstat->id=this->id;
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 }

◆ DeepEcho()

void SpcStatic::DeepEcho ( void  )
virtual

Implements Object.

Definition at line 51 of file SpcStatic.cpp.

51  {/*{{{*/
52 
53  _printf_("SpcStatic:\n");
54  _printf_(" id: " << id << "\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 }

◆ Echo()

void SpcStatic::Echo ( void  )
virtual

Implements Object.

Definition at line 62 of file SpcStatic.cpp.

62  {/*{{{*/
63 
64  _printf_("SpcStatic:\n");
65  _printf_(" id: " << id << "\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 }

◆ Id()

int SpcStatic::Id ( void  )
virtual

Implements Object.

Definition at line 73 of file SpcStatic.cpp.

73 { return id; }/*{{{*/

◆ Marshall()

void SpcStatic::Marshall ( char **  pmarshalled_data,
int *  pmarshalled_data_size,
int  marshall_direction 
)
virtual

Implements Object.

Definition at line 75 of file SpcStatic.cpp.

75  { /*{{{*/
76 
78 
79  MARSHALLING(id);
85 
86 }

◆ ObjectEnum()

int SpcStatic::ObjectEnum ( void  )
virtual

Implements Object.

Definition at line 88 of file SpcStatic.cpp.

88  {/*{{{*/
89 
90  return SpcStaticEnum;
91 
92 }

◆ ActivatePenaltyMethod()

void SpcStatic::ActivatePenaltyMethod ( void  )
virtual

Implements Constraint.

Definition at line 96 of file SpcStatic.cpp.

96  {/*{{{*/
97  this->penalty = true;
98 }

◆ ConstrainNode()

void SpcStatic::ConstrainNode ( Nodes nodes,
Parameters parameters 
)
virtual

Implements Constraint.

Definition at line 100 of file SpcStatic.cpp.

100  {/*{{{*/
101 
102  /*Chase through nodes and find the node to which this SpcStatic applys: */
103  Node* node=(Node*)nodes->GetObjectById(NULL,nodeid);
104 
105  /*Apply constraint: */
106  if(!this->penalty && node){ //in case the spc is dealing with a node on another cpu
107  node->ApplyConstraint(dof,value);
108  }
109 }

◆ PenaltyDofAndValue()

void SpcStatic::PenaltyDofAndValue ( int *  dof,
IssmDouble value,
Nodes nodes,
Parameters parameters 
)
virtual

Implements Constraint.

Definition at line 127 of file SpcStatic.cpp.

127  {/*{{{*/
128 
129  if(!this->penalty) _error_("cannot return dof and value for non penalty constraint");
130 
131  IssmDouble value_out = this->value;
132  int gdof;
133 
134  /*Chase through nodes and find the node to which this SpcTransient applys: */
135  Node* node=(Node*)nodes->GetObjectById(NULL,nodeid);
136 
137  if(node){ //in case the spc is dealing with a node on another cpu
138 
139  /*Get gdof */
140  gdof = node->GetDof(dof,GsetEnum);
141  if(xIsNan<IssmDouble>(value_out)) gdof = -1;
142  }
143  else{
144  value_out = NAN;
145  gdof = -1;
146  }
147 
148  /*Assign output pointers*/
149  *pdof = gdof;
150  *pvalue = value_out;
151 }

◆ InputUpdateFromVectorDakota()

void SpcStatic::InputUpdateFromVectorDakota ( IssmDouble vector,
Nodes nodes,
int  name,
int  type 
)
virtual

Implements Constraint.

Definition at line 111 of file SpcStatic.cpp.

111  {/*{{{*/
112 
113  /*Only update if this is a constraint parameter*/
114  if(name != BalancethicknessSpcthicknessEnum) return;
115 
116  /*Chase through nodes and find the node to which this SpcStatic applies: */
117  Node* node=(Node*)nodes->GetObjectById(NULL,nodeid);
118 
119  /*Apply constraint: */
120  if(node){ //in case the spc is dealing with a node on another cpu
121  int sid = node->Sid();
122  this->value = vector[sid];
123  _assert_(!xIsNan<IssmDouble>(this->value));
124  }
125 }

◆ GetDof()

int SpcStatic::GetDof ( )

Definition at line 155 of file SpcStatic.cpp.

155  {/*{{{*/
156  return dof;
157 }

◆ GetNodeId()

int SpcStatic::GetNodeId ( )

Definition at line 159 of file SpcStatic.cpp.

159  {/*{{{*/
160 
161  return nodeid;
162 }

◆ GetValue()

IssmDouble SpcStatic::GetValue ( )

Definition at line 164 of file SpcStatic.cpp.

164  {/*{{{*/
165  _assert_(!xIsNan<IssmDouble>(value));
166  return value;
167 }

Field Documentation

◆ id

int SpcStatic::id
private

Definition at line 16 of file SpcStatic.h.

◆ nodeid

int SpcStatic::nodeid
private

id, to track it

Definition at line 17 of file SpcStatic.h.

◆ dof

int SpcStatic::dof
private

node id

Definition at line 18 of file SpcStatic.h.

◆ value

IssmDouble SpcStatic::value
private

component

Definition at line 19 of file SpcStatic.h.

◆ analysis_type

int SpcStatic::analysis_type
private

Definition at line 20 of file SpcStatic.h.

◆ penalty

bool SpcStatic::penalty
private

Definition at line 21 of file SpcStatic.h.


The documentation for this class was generated from the following files:
SpcStatic::SpcStatic
SpcStatic()
Definition: SpcStatic.cpp:16
_assert_
#define _assert_(ignore)
Definition: exceptions.h:37
IssmDouble
double IssmDouble
Definition: types.h:37
DataSet::GetObjectById
Object * GetObjectById(int *poffset, int eid)
Definition: DataSet.cpp:345
_printf_
#define _printf_(StreamArgs)
Definition: Print.h:22
MARSHALLING_ENUM
#define MARSHALLING_ENUM(EN)
Definition: Marshalling.h:14
SpcStatic::value
IssmDouble value
Definition: SpcStatic.h:19
SpcStatic::analysis_type
int analysis_type
Definition: SpcStatic.h:20
SpcStatic
Definition: SpcStatic.h:13
Object
Definition: Object.h:13
SpcStaticEnum
@ SpcStaticEnum
Definition: EnumDefinitions.h:1280
EnumToStringx
const char * EnumToStringx(int enum_in)
Definition: EnumToStringx.cpp:15
GsetEnum
@ GsetEnum
Definition: EnumDefinitions.h:1093
MARSHALLING
#define MARSHALLING(FIELD)
Definition: Marshalling.h:29
SpcStatic::id
int id
Definition: SpcStatic.h:16
SpcStatic::penalty
bool penalty
Definition: SpcStatic.h:21
SpcStatic::dof
int dof
Definition: SpcStatic.h:18
Node
Definition: Node.h:23
Node::Sid
int Sid(void)
Definition: Node.cpp:622
_error_
#define _error_(StreamArgs)
Definition: exceptions.h:49
SpcStatic::nodeid
int nodeid
Definition: SpcStatic.h:17
Node::ApplyConstraint
void ApplyConstraint(int dof, IssmDouble value)
Definition: Node.cpp:646
BalancethicknessSpcthicknessEnum
@ BalancethicknessSpcthicknessEnum
Definition: EnumDefinitions.h:986
Node::GetDof
int GetDof(int dofindex, int setenum)
Definition: Node.cpp:374