[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*/
|
---|
[12365] | 16 | /*FUNCTION SpcStatic::SpcStatic(){{{*/
|
---|
[9285] | 17 | SpcStatic::SpcStatic(){
|
---|
[3683] | 18 | return;
|
---|
| 19 | }
|
---|
[12365] | 20 | /*}}}*/
|
---|
| 21 | /*FUNCTION SpcStatic::SpcStatic(int spc_sid,int spc_nodeid,...){{{*/
|
---|
[12462] | 22 | SpcStatic::SpcStatic(int spc_sid,int spc_nodeid, int spc_dof,IssmDouble spc_value,int spc_analysis_type){
|
---|
[3683] | 23 |
|
---|
| 24 | sid=spc_sid;
|
---|
| 25 | nodeid=spc_nodeid;
|
---|
| 26 | dof=spc_dof;
|
---|
| 27 | value=spc_value;
|
---|
[4003] | 28 | analysis_type=spc_analysis_type;
|
---|
[3683] | 29 |
|
---|
| 30 | return;
|
---|
| 31 | }
|
---|
[12365] | 32 | /*}}}*/
|
---|
| 33 | /*FUNCTION SpcStatic::~SpcStatic{{{*/
|
---|
[9285] | 34 | SpcStatic::~SpcStatic(){
|
---|
[3683] | 35 | return;
|
---|
| 36 | }
|
---|
[12365] | 37 | /*}}}*/
|
---|
[13622] | 38 |
|
---|
[4248] | 39 | /*Object virtual functions definitions:*/
|
---|
[12365] | 40 | /*FUNCTION SpcStatic::Echo {{{*/
|
---|
[9285] | 41 | void SpcStatic::Echo(void){
|
---|
[4248] | 42 |
|
---|
[15100] | 43 | _printf_("SpcStatic:" << "\n");
|
---|
| 44 | _printf_(" sid: " << sid << "\n");
|
---|
| 45 | _printf_(" nodeid: " << nodeid << "\n");
|
---|
| 46 | _printf_(" dof: " << dof << "\n");
|
---|
| 47 | _printf_(" value: " << value << "\n");
|
---|
| 48 | _printf_(" analysis_type: " << EnumToStringx(analysis_type) << "\n");
|
---|
[4248] | 49 | return;
|
---|
| 50 | }
|
---|
[12365] | 51 | /*}}}*/
|
---|
| 52 | /*FUNCTION SpcStatic::DeepEcho {{{*/
|
---|
[9285] | 53 | void SpcStatic::DeepEcho(void){
|
---|
[4248] | 54 |
|
---|
[15100] | 55 | _printf_("SpcStatic:" << "\n");
|
---|
| 56 | _printf_(" sid: " << sid << "\n");
|
---|
| 57 | _printf_(" nodeid: " << nodeid << "\n");
|
---|
| 58 | _printf_(" dof: " << dof << "\n");
|
---|
| 59 | _printf_(" value: " << value << "\n");
|
---|
| 60 | _printf_(" analysis_type: " << EnumToStringx(analysis_type) << "\n");
|
---|
[4248] | 61 | return;
|
---|
| 62 | }
|
---|
[12365] | 63 | /*}}}*/
|
---|
| 64 | /*FUNCTION SpcStatic::Id {{{*/
|
---|
[9285] | 65 | int SpcStatic::Id(void){ return sid; }
|
---|
[12365] | 66 | /*}}}*/
|
---|
| 67 | /*FUNCTION SpcStatic::ObjectEnum{{{*/
|
---|
[9883] | 68 | int SpcStatic::ObjectEnum(void){
|
---|
[3683] | 69 |
|
---|
[9285] | 70 | return SpcStaticEnum;
|
---|
[4248] | 71 |
|
---|
| 72 | }
|
---|
[12365] | 73 | /*}}}*/
|
---|
| 74 | /*FUNCTION SpcStatic::copy {{{*/
|
---|
[9285] | 75 | Object* SpcStatic::copy() {
|
---|
| 76 | return new SpcStatic(*this);
|
---|
[3683] | 77 | }
|
---|
[12365] | 78 | /*}}}*/
|
---|
[3683] | 79 |
|
---|
[9002] | 80 | /*Constraint virtual functions definitions: */
|
---|
[12365] | 81 | /*FUNCTION SpcStatic::InAnalysis{{{*/
|
---|
[9285] | 82 | bool SpcStatic::InAnalysis(int in_analysis_type){
|
---|
[9002] | 83 | if (in_analysis_type==this->analysis_type) return true;
|
---|
| 84 | else return false;
|
---|
| 85 | }
|
---|
| 86 | /*}}}*/
|
---|
[12365] | 87 | /*FUNCTION SpcStatic::ConstrainNode{{{*/
|
---|
[9285] | 88 | void SpcStatic::ConstrainNode(Nodes* nodes,Parameters* parameters){
|
---|
[9002] | 89 |
|
---|
| 90 | Node* node=NULL;
|
---|
| 91 |
|
---|
[9285] | 92 | /*Chase through nodes and find the node to which this SpcStatic applys: */
|
---|
[9002] | 93 | node=(Node*)nodes->GetObjectById(NULL,nodeid);
|
---|
| 94 |
|
---|
| 95 | /*Apply constraint: */
|
---|
| 96 | if(node){ //in case the spc is dealing with a node on another cpu
|
---|
| 97 | node->ApplyConstraint(dof,value);
|
---|
| 98 | }
|
---|
| 99 | }
|
---|
| 100 | /*}}}*/
|
---|
| 101 |
|
---|
[9285] | 102 | /*SpcStatic functions*/
|
---|
[12365] | 103 | /*FUNCTION SpcStatic::GetDof {{{*/
|
---|
[9285] | 104 | int SpcStatic::GetDof(){
|
---|
[3683] | 105 | return dof;
|
---|
| 106 | }
|
---|
[12365] | 107 | /*}}}*/
|
---|
| 108 | /*FUNCTION SpcStatic::GetNodeId {{{*/
|
---|
[9285] | 109 | int SpcStatic::GetNodeId(){
|
---|
[13622] | 110 |
|
---|
[3683] | 111 | return nodeid;
|
---|
| 112 | }
|
---|
[12365] | 113 | /*}}}*/
|
---|
| 114 | /*FUNCTION SpcStatic::GetValue {{{*/
|
---|
[12462] | 115 | IssmDouble SpcStatic::GetValue(){
|
---|
[12529] | 116 | _assert_(!xIsNan<IssmDouble>(value));
|
---|
[3683] | 117 | return value;
|
---|
| 118 | }
|
---|
[12365] | 119 | /*}}}*/
|
---|