[9285] | 1 | /*!\file SpcStatic.c
|
---|
| 2 | * \brief: implementation of the SpcStatic object
|
---|
[3683] | 3 | */
|
---|
| 4 |
|
---|
| 5 | #ifdef HAVE_CONFIG_H
|
---|
[9320] | 6 | #include <config.h>
|
---|
[3683] | 7 | #else
|
---|
| 8 | #error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
|
---|
| 9 | #endif
|
---|
| 10 |
|
---|
[15012] | 11 | #include "../classes.h"
|
---|
| 12 | #include "./Constraint.h"
|
---|
| 13 | #include "../../shared/shared.h"
|
---|
[3683] | 14 |
|
---|
[9285] | 15 | /*SpcStatic constructors and destructor*/
|
---|
[18064] | 16 | SpcStatic::SpcStatic(){/*{{{*/
|
---|
[3683] | 17 | return;
|
---|
| 18 | }
|
---|
[12365] | 19 | /*}}}*/
|
---|
[18064] | 20 | SpcStatic::SpcStatic(int spc_sid,int spc_nodeid, int spc_dof,IssmDouble spc_value,int spc_analysis_type){/*{{{*/
|
---|
[3683] | 21 |
|
---|
[15448] | 22 | sid = spc_sid;
|
---|
| 23 | nodeid = spc_nodeid;
|
---|
| 24 | dof = spc_dof;
|
---|
| 25 | value = spc_value;
|
---|
| 26 | analysis_type = spc_analysis_type;
|
---|
[3683] | 27 |
|
---|
| 28 | return;
|
---|
| 29 | }
|
---|
[12365] | 30 | /*}}}*/
|
---|
[18064] | 31 | SpcStatic::~SpcStatic(){/*{{{*/
|
---|
[3683] | 32 | return;
|
---|
| 33 | }
|
---|
[12365] | 34 | /*}}}*/
|
---|
[13622] | 35 |
|
---|
[4248] | 36 | /*Object virtual functions definitions:*/
|
---|
[18064] | 37 | void SpcStatic::Echo(void){/*{{{*/
|
---|
[4248] | 38 |
|
---|
[15104] | 39 | _printf_("SpcStatic:\n");
|
---|
[15100] | 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");
|
---|
[4248] | 45 | return;
|
---|
| 46 | }
|
---|
[12365] | 47 | /*}}}*/
|
---|
[18064] | 48 | void SpcStatic::DeepEcho(void){/*{{{*/
|
---|
[4248] | 49 |
|
---|
[15104] | 50 | _printf_("SpcStatic:\n");
|
---|
[15100] | 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");
|
---|
[4248] | 56 | return;
|
---|
| 57 | }
|
---|
[12365] | 58 | /*}}}*/
|
---|
[18064] | 59 | int SpcStatic::Id(void){ return sid; }/*{{{*/
|
---|
[12365] | 60 | /*}}}*/
|
---|
[18064] | 61 | int SpcStatic::ObjectEnum(void){/*{{{*/
|
---|
[3683] | 62 |
|
---|
[9285] | 63 | return SpcStaticEnum;
|
---|
[4248] | 64 |
|
---|
| 65 | }
|
---|
[12365] | 66 | /*}}}*/
|
---|
[18064] | 67 | Object* SpcStatic::copy() {/*{{{*/
|
---|
[9285] | 68 | return new SpcStatic(*this);
|
---|
[3683] | 69 | }
|
---|
[12365] | 70 | /*}}}*/
|
---|
[3683] | 71 |
|
---|
[9002] | 72 | /*Constraint virtual functions definitions: */
|
---|
[18064] | 73 | bool SpcStatic::InAnalysis(int in_analysis_type){/*{{{*/
|
---|
[9002] | 74 | if (in_analysis_type==this->analysis_type) return true;
|
---|
| 75 | else return false;
|
---|
| 76 | }
|
---|
| 77 | /*}}}*/
|
---|
[18064] | 78 | void SpcStatic::ConstrainNode(Nodes* nodes,Parameters* parameters){/*{{{*/
|
---|
[9002] | 79 |
|
---|
| 80 | Node* node=NULL;
|
---|
| 81 |
|
---|
[9285] | 82 | /*Chase through nodes and find the node to which this SpcStatic applys: */
|
---|
[9002] | 83 | node=(Node*)nodes->GetObjectById(NULL,nodeid);
|
---|
| 84 |
|
---|
| 85 | /*Apply constraint: */
|
---|
| 86 | if(node){ //in case the spc is dealing with a node on another cpu
|
---|
| 87 | node->ApplyConstraint(dof,value);
|
---|
| 88 | }
|
---|
| 89 | }
|
---|
| 90 | /*}}}*/
|
---|
| 91 |
|
---|
[9285] | 92 | /*SpcStatic functions*/
|
---|
[18064] | 93 | int SpcStatic::GetDof(){/*{{{*/
|
---|
[3683] | 94 | return dof;
|
---|
| 95 | }
|
---|
[12365] | 96 | /*}}}*/
|
---|
[18064] | 97 | int SpcStatic::GetNodeId(){/*{{{*/
|
---|
[13622] | 98 |
|
---|
[3683] | 99 | return nodeid;
|
---|
| 100 | }
|
---|
[12365] | 101 | /*}}}*/
|
---|
[18064] | 102 | IssmDouble SpcStatic::GetValue(){/*{{{*/
|
---|
[12529] | 103 | _assert_(!xIsNan<IssmDouble>(value));
|
---|
[3683] | 104 | return value;
|
---|
| 105 | }
|
---|
[12365] | 106 | /*}}}*/
|
---|