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