[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*/
|
---|
| 20 | /*FUNCTION SpcStatic::SpcStatic(){{{1*/
|
---|
| 21 | SpcStatic::SpcStatic(){
|
---|
[3683] | 22 | return;
|
---|
| 23 | }
|
---|
| 24 | /*}}}1*/
|
---|
[9285] | 25 | /*FUNCTION SpcStatic::SpcStatic(int spc_sid,int spc_nodeid,...){{{1*/
|
---|
| 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 | }
|
---|
| 36 | /*}}}1*/
|
---|
[9285] | 37 | /*FUNCTION SpcStatic::~SpcStatic{{{1*/
|
---|
| 38 | SpcStatic::~SpcStatic(){
|
---|
[3683] | 39 | return;
|
---|
| 40 | }
|
---|
| 41 | /*}}}1*/
|
---|
| 42 |
|
---|
[4248] | 43 | /*Object virtual functions definitions:*/
|
---|
[9285] | 44 | /*FUNCTION SpcStatic::Echo {{{1*/
|
---|
| 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 | }
|
---|
| 55 | /*}}}1*/
|
---|
[9285] | 56 | /*FUNCTION SpcStatic::DeepEcho {{{1*/
|
---|
| 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 | }
|
---|
| 67 | /*}}}1*/
|
---|
[9285] | 68 | /*FUNCTION SpcStatic::Id {{{1*/
|
---|
| 69 | int SpcStatic::Id(void){ return sid; }
|
---|
[4248] | 70 | /*}}}1*/
|
---|
[9285] | 71 | /*FUNCTION SpcStatic::MyRank {{{1*/
|
---|
| 72 | int SpcStatic::MyRank(void){
|
---|
[4248] | 73 | extern int my_rank;
|
---|
| 74 | return my_rank;
|
---|
| 75 | }
|
---|
| 76 | /*}}}1*/
|
---|
[9883] | 77 | /*FUNCTION SpcStatic::ObjectEnum{{{1*/
|
---|
| 78 | int SpcStatic::ObjectEnum(void){
|
---|
[3683] | 79 |
|
---|
[9285] | 80 | return SpcStaticEnum;
|
---|
[4248] | 81 |
|
---|
| 82 | }
|
---|
| 83 | /*}}}1*/
|
---|
[9285] | 84 | /*FUNCTION SpcStatic::copy {{{1*/
|
---|
| 85 | Object* SpcStatic::copy() {
|
---|
| 86 | return new SpcStatic(*this);
|
---|
[3683] | 87 | }
|
---|
| 88 | /*}}}1*/
|
---|
| 89 |
|
---|
[9002] | 90 | /*Constraint virtual functions definitions: */
|
---|
[9285] | 91 | /*FUNCTION SpcStatic::InAnalysis{{{1*/
|
---|
| 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 | /*}}}*/
|
---|
[9285] | 97 | /*FUNCTION SpcStatic::ConstrainNode{{{1*/
|
---|
| 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*/
|
---|
| 113 | /*FUNCTION SpcStatic::GetDof {{{1*/
|
---|
| 114 | int SpcStatic::GetDof(){
|
---|
[3683] | 115 | return dof;
|
---|
| 116 | }
|
---|
| 117 | /*}}}1*/
|
---|
[9285] | 118 | /*FUNCTION SpcStatic::GetNodeId {{{1*/
|
---|
| 119 | int SpcStatic::GetNodeId(){
|
---|
[3683] | 120 |
|
---|
| 121 | return nodeid;
|
---|
| 122 | }
|
---|
| 123 | /*}}}1*/
|
---|
[9285] | 124 | /*FUNCTION SpcStatic::GetValue {{{1*/
|
---|
| 125 | double SpcStatic::GetValue(){
|
---|
| 126 | _assert_(!isnan(value));
|
---|
[3683] | 127 | return value;
|
---|
| 128 | }
|
---|
| 129 | /*}}}1*/
|
---|