[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;
|
---|
[18388] | 27 | penalty = false;
|
---|
[3683] | 28 |
|
---|
| 29 | return;
|
---|
| 30 | }
|
---|
[12365] | 31 | /*}}}*/
|
---|
[18064] | 32 | SpcStatic::~SpcStatic(){/*{{{*/
|
---|
[3683] | 33 | return;
|
---|
| 34 | }
|
---|
[12365] | 35 | /*}}}*/
|
---|
[13622] | 36 |
|
---|
[4248] | 37 | /*Object virtual functions definitions:*/
|
---|
[18931] | 38 | Object* SpcStatic::copy() {/*{{{*/
|
---|
| 39 |
|
---|
| 40 | SpcStatic* spcstat = new SpcStatic(*this);
|
---|
[4248] | 41 |
|
---|
[18931] | 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 | /*}}}*/
|
---|
| 51 | void SpcStatic::DeepEcho(void){/*{{{*/
|
---|
| 52 |
|
---|
[15104] | 53 | _printf_("SpcStatic:\n");
|
---|
[15100] | 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");
|
---|
[4248] | 59 | return;
|
---|
[18931] | 60 | }
|
---|
[12365] | 61 | /*}}}*/
|
---|
[18931] | 62 | void SpcStatic::Echo(void){/*{{{*/
|
---|
[4248] | 63 |
|
---|
[15104] | 64 | _printf_("SpcStatic:\n");
|
---|
[15100] | 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");
|
---|
[4248] | 70 | return;
|
---|
[18931] | 71 | }
|
---|
[12365] | 72 | /*}}}*/
|
---|
[18931] | 73 | int SpcStatic::Id(void){ return sid; }/*{{{*/
|
---|
[12365] | 74 | /*}}}*/
|
---|
[18931] | 75 | int SpcStatic::ObjectEnum(void){/*{{{*/
|
---|
[3683] | 76 |
|
---|
[9285] | 77 | return SpcStaticEnum;
|
---|
[4248] | 78 |
|
---|
| 79 | }
|
---|
[12365] | 80 | /*}}}*/
|
---|
[18237] | 81 |
|
---|
[9002] | 82 | /*Constraint virtual functions definitions: */
|
---|
[18388] | 83 | void SpcStatic::ActivatePenaltyMethod(void){/*{{{*/
|
---|
| 84 | this->penalty = true;
|
---|
| 85 | }
|
---|
| 86 | /*}}}*/
|
---|
[18064] | 87 | void SpcStatic::ConstrainNode(Nodes* nodes,Parameters* parameters){/*{{{*/
|
---|
[9002] | 88 |
|
---|
| 89 | Node* node=NULL;
|
---|
| 90 |
|
---|
[9285] | 91 | /*Chase through nodes and find the node to which this SpcStatic applys: */
|
---|
[9002] | 92 | node=(Node*)nodes->GetObjectById(NULL,nodeid);
|
---|
| 93 |
|
---|
| 94 | /*Apply constraint: */
|
---|
| 95 | if(node){ //in case the spc is dealing with a node on another cpu
|
---|
| 96 | node->ApplyConstraint(dof,value);
|
---|
| 97 | }
|
---|
| 98 | }
|
---|
| 99 | /*}}}*/
|
---|
[18931] | 100 | bool SpcStatic::InAnalysis(int in_analysis_type){/*{{{*/
|
---|
| 101 | if (in_analysis_type==this->analysis_type) return true;
|
---|
| 102 | else return false;
|
---|
| 103 | }
|
---|
| 104 | /*}}}*/
|
---|
[9002] | 105 |
|
---|
[9285] | 106 | /*SpcStatic functions*/
|
---|
[18931] | 107 | int SpcStatic::GetDof(){/*{{{*/
|
---|
[3683] | 108 | return dof;
|
---|
| 109 | }
|
---|
[12365] | 110 | /*}}}*/
|
---|
[18931] | 111 | int SpcStatic::GetNodeId(){/*{{{*/
|
---|
[13622] | 112 |
|
---|
[3683] | 113 | return nodeid;
|
---|
| 114 | }
|
---|
[12365] | 115 | /*}}}*/
|
---|
[18064] | 116 | IssmDouble SpcStatic::GetValue(){/*{{{*/
|
---|
[12529] | 117 | _assert_(!xIsNan<IssmDouble>(value));
|
---|
[3683] | 118 | return value;
|
---|
| 119 | }
|
---|
[12365] | 120 | /*}}}*/
|
---|