source: issm/trunk-jpl/src/c/objects/Constraints/SpcStatic.cpp@ 12365

Last change on this file since 12365 was 12365, checked in by Mathieu Morlighem, 13 years ago

Do not number folds (folding is automated)

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