| 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 | SpcStatic::SpcStatic(){/*{{{*/
|
|---|
| 17 | return;
|
|---|
| 18 | }
|
|---|
| 19 | /*}}}*/
|
|---|
| 20 | SpcStatic::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 |
|
|---|
| 28 | return;
|
|---|
| 29 | }
|
|---|
| 30 | /*}}}*/
|
|---|
| 31 | SpcStatic::~SpcStatic(){/*{{{*/
|
|---|
| 32 | return;
|
|---|
| 33 | }
|
|---|
| 34 | /*}}}*/
|
|---|
| 35 |
|
|---|
| 36 | /*Object virtual functions definitions:*/
|
|---|
| 37 | void SpcStatic::Echo(void){/*{{{*/
|
|---|
| 38 |
|
|---|
| 39 | _printf_("SpcStatic:\n");
|
|---|
| 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");
|
|---|
| 45 | return;
|
|---|
| 46 | }
|
|---|
| 47 | /*}}}*/
|
|---|
| 48 | void SpcStatic::DeepEcho(void){/*{{{*/
|
|---|
| 49 |
|
|---|
| 50 | _printf_("SpcStatic:\n");
|
|---|
| 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");
|
|---|
| 56 | return;
|
|---|
| 57 | }
|
|---|
| 58 | /*}}}*/
|
|---|
| 59 | int SpcStatic::Id(void){ return sid; }/*{{{*/
|
|---|
| 60 | /*}}}*/
|
|---|
| 61 | int SpcStatic::ObjectEnum(void){/*{{{*/
|
|---|
| 62 |
|
|---|
| 63 | return SpcStaticEnum;
|
|---|
| 64 |
|
|---|
| 65 | }
|
|---|
| 66 | /*}}}*/
|
|---|
| 67 | Object* SpcStatic::copy() {/*{{{*/
|
|---|
| 68 | return new SpcStatic(*this);
|
|---|
| 69 | }
|
|---|
| 70 | /*}}}*/
|
|---|
| 71 |
|
|---|
| 72 | /*Constraint virtual functions definitions: */
|
|---|
| 73 | bool SpcStatic::InAnalysis(int in_analysis_type){/*{{{*/
|
|---|
| 74 | if (in_analysis_type==this->analysis_type) return true;
|
|---|
| 75 | else return false;
|
|---|
| 76 | }
|
|---|
| 77 | /*}}}*/
|
|---|
| 78 | void SpcStatic::ConstrainNode(Nodes* nodes,Parameters* parameters){/*{{{*/
|
|---|
| 79 |
|
|---|
| 80 | Node* node=NULL;
|
|---|
| 81 |
|
|---|
| 82 | /*Chase through nodes and find the node to which this SpcStatic applys: */
|
|---|
| 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 |
|
|---|
| 92 | /*SpcStatic functions*/
|
|---|
| 93 | int SpcStatic::GetDof(){/*{{{*/
|
|---|
| 94 | return dof;
|
|---|
| 95 | }
|
|---|
| 96 | /*}}}*/
|
|---|
| 97 | int SpcStatic::GetNodeId(){/*{{{*/
|
|---|
| 98 |
|
|---|
| 99 | return nodeid;
|
|---|
| 100 | }
|
|---|
| 101 | /*}}}*/
|
|---|
| 102 | IssmDouble SpcStatic::GetValue(){/*{{{*/
|
|---|
| 103 | _assert_(!xIsNan<IssmDouble>(value));
|
|---|
| 104 | return value;
|
|---|
| 105 | }
|
|---|
| 106 | /*}}}*/
|
|---|