1 | /*!\file Pengrid.c
|
---|
2 | * \brief: implementation of the Pengrid object
|
---|
3 | */
|
---|
4 |
|
---|
5 |
|
---|
6 | #ifdef HAVE_CONFIG_H
|
---|
7 | #include "config.h"
|
---|
8 | #else
|
---|
9 | #error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
|
---|
10 | #endif
|
---|
11 |
|
---|
12 | #include "stdio.h"
|
---|
13 | #include "./Pengrid.h"
|
---|
14 | #include <string.h>
|
---|
15 | #include "../EnumDefinitions/EnumDefinitions.h"
|
---|
16 | #include "../shared/shared.h"
|
---|
17 | #include "../include/typedefs.h"
|
---|
18 |
|
---|
19 |
|
---|
20 | Pengrid::Pengrid(){
|
---|
21 | return;
|
---|
22 | }
|
---|
23 |
|
---|
24 | Pengrid::Pengrid(int pengrid_id, int pengrid_node_id,int pengrid_dof, int pengrid_active, double pengrid_penalty_offset,int pengrid_thermal_steadystate){
|
---|
25 |
|
---|
26 | id=pengrid_id;
|
---|
27 | dof=pengrid_dof;
|
---|
28 | active=pengrid_active;
|
---|
29 | penalty_offset =pengrid_penalty_offset;
|
---|
30 | thermal_steadystate=pengrid_thermal_steadystate;
|
---|
31 |
|
---|
32 | node_id=pengrid_node_id;
|
---|
33 | node_offset=UNDEF;
|
---|
34 | node=NULL;
|
---|
35 |
|
---|
36 | return;
|
---|
37 | }
|
---|
38 |
|
---|
39 | Pengrid::~Pengrid(){
|
---|
40 | return;
|
---|
41 | }
|
---|
42 |
|
---|
43 | void Pengrid::Echo(void){
|
---|
44 |
|
---|
45 | printf("Pengrid:\n");
|
---|
46 | printf(" id: %i\n",id);
|
---|
47 | printf(" dof: %i\n",dof);
|
---|
48 | printf(" active: %i\n",active);
|
---|
49 | printf(" penalty_offset: %g\n",penalty_offset);
|
---|
50 | printf(" thermal_steadystate: %i\n",thermal_steadystate);
|
---|
51 | printf(" node_id: [%i]\n",node_id);
|
---|
52 | printf(" node_offset: [%i]\n",node_offset);
|
---|
53 |
|
---|
54 | if(node)node->Echo();
|
---|
55 | return;
|
---|
56 | }
|
---|
57 |
|
---|
58 | void Pengrid::Marshall(char** pmarshalled_dataset){
|
---|
59 |
|
---|
60 | char* marshalled_dataset=NULL;
|
---|
61 | int enum_type=0;
|
---|
62 |
|
---|
63 | /*recover marshalled_dataset: */
|
---|
64 | marshalled_dataset=*pmarshalled_dataset;
|
---|
65 |
|
---|
66 | /*get enum type of Pengrid: */
|
---|
67 | enum_type=PengridEnum();
|
---|
68 |
|
---|
69 | /*marshall enum: */
|
---|
70 | memcpy(marshalled_dataset,&enum_type,sizeof(enum_type));marshalled_dataset+=sizeof(enum_type);
|
---|
71 |
|
---|
72 | /*marshall Pengrid data: */
|
---|
73 | memcpy(marshalled_dataset,&id,sizeof(id));marshalled_dataset+=sizeof(id);
|
---|
74 | memcpy(marshalled_dataset,&dof,sizeof(dof));marshalled_dataset+=sizeof(dof);
|
---|
75 | memcpy(marshalled_dataset,&active,sizeof(active));marshalled_dataset+=sizeof(active);
|
---|
76 | memcpy(marshalled_dataset,&penalty_offset,sizeof(penalty_offset));marshalled_dataset+=sizeof(penalty_offset);
|
---|
77 | memcpy(marshalled_dataset,&thermal_steadystate,sizeof(thermal_steadystate));marshalled_dataset+=sizeof(thermal_steadystate);
|
---|
78 | memcpy(marshalled_dataset,&node_id,sizeof(node_id));marshalled_dataset+=sizeof(node_id);
|
---|
79 | memcpy(marshalled_dataset,&node_offset,sizeof(node_offset));marshalled_dataset+=sizeof(node_offset);
|
---|
80 |
|
---|
81 | *pmarshalled_dataset=marshalled_dataset;
|
---|
82 | return;
|
---|
83 | }
|
---|
84 |
|
---|
85 | int Pengrid::MarshallSize(){
|
---|
86 |
|
---|
87 | return sizeof(id)+
|
---|
88 | sizeof(dof)+
|
---|
89 | sizeof(active)+
|
---|
90 | sizeof(penalty_offset)+
|
---|
91 | sizeof(thermal_steadystate)+
|
---|
92 | sizeof(node_id)+
|
---|
93 | sizeof(node_offset)+
|
---|
94 | sizeof(int); //sizeof(int) for enum type
|
---|
95 | }
|
---|
96 |
|
---|
97 | char* Pengrid::GetName(void){
|
---|
98 | return "pengrid";
|
---|
99 | }
|
---|
100 |
|
---|
101 |
|
---|
102 | void Pengrid::Demarshall(char** pmarshalled_dataset){
|
---|
103 |
|
---|
104 | int i;
|
---|
105 | char* marshalled_dataset=NULL;
|
---|
106 |
|
---|
107 | /*recover marshalled_dataset: */
|
---|
108 | marshalled_dataset=*pmarshalled_dataset;
|
---|
109 |
|
---|
110 | /*this time, no need to get enum type, the pointer directly points to the beginning of the
|
---|
111 | *object data (thanks to DataSet::Demarshall):*/
|
---|
112 |
|
---|
113 | memcpy(&id,marshalled_dataset,sizeof(id));marshalled_dataset+=sizeof(id);
|
---|
114 | memcpy(&dof,marshalled_dataset,sizeof(dof));marshalled_dataset+=sizeof(dof);
|
---|
115 | memcpy(&active,marshalled_dataset,sizeof(active));marshalled_dataset+=sizeof(active);
|
---|
116 | memcpy(&penalty_offset,marshalled_dataset,sizeof(penalty_offset));marshalled_dataset+=sizeof(penalty_offset);
|
---|
117 | memcpy(&thermal_steadystate,marshalled_dataset,sizeof(thermal_steadystate));marshalled_dataset+=sizeof(thermal_steadystate);
|
---|
118 | memcpy(&node_id,marshalled_dataset,sizeof(node_id));marshalled_dataset+=sizeof(node_id);
|
---|
119 | memcpy(&node_offset,marshalled_dataset,sizeof(node_offset));marshalled_dataset+=sizeof(node_offset);
|
---|
120 |
|
---|
121 | node=NULL;
|
---|
122 |
|
---|
123 | /*return: */
|
---|
124 | *pmarshalled_dataset=marshalled_dataset;
|
---|
125 | return;
|
---|
126 | }
|
---|
127 | int Pengrid::Enum(void){
|
---|
128 |
|
---|
129 | return PengridEnum();
|
---|
130 | }
|
---|
131 |
|
---|
132 | int Pengrid::GetId(void){ return id; }
|
---|
133 |
|
---|
134 | int Pengrid::MyRank(void){
|
---|
135 | extern int my_rank;
|
---|
136 | return my_rank;
|
---|
137 | }
|
---|
138 | void Pengrid::DistributeNumDofs(int* numdofspernode,int analysis_type){return;}
|
---|
139 |
|
---|
140 | #undef __FUNCT__
|
---|
141 | #define __FUNCT__ "Pengrid::Configure"
|
---|
142 |
|
---|
143 | void Pengrid::Configure(void* pelementsin,void* pnodesin,void* pmaterialsin){
|
---|
144 |
|
---|
145 | DataSet* nodesin=NULL;
|
---|
146 |
|
---|
147 | /*Recover pointers :*/
|
---|
148 | nodesin=(DataSet*)pnodesin;
|
---|
149 |
|
---|
150 | /*Link this load with its nodes: */
|
---|
151 | ResolvePointers((Object**)&node,&node_id,&node_offset,1,nodesin);
|
---|
152 |
|
---|
153 | }
|
---|
154 |
|
---|
155 |
|
---|
156 | #undef __FUNCT__
|
---|
157 | #define __FUNCT__ "Pengrid::CreateKMatrix"
|
---|
158 |
|
---|
159 | void Pengrid::CreateKMatrix(Mat Kgg,void* inputs,int analysis_type){
|
---|
160 |
|
---|
161 | /*No loads applied, do nothing: */
|
---|
162 | return;
|
---|
163 |
|
---|
164 | }
|
---|
165 |
|
---|
166 | #undef __FUNCT__
|
---|
167 | #define __FUNCT__ "Pengrid::CreatePVector"
|
---|
168 | void Pengrid::CreatePVector(Vec pg, void* inputs, int analysis_type){
|
---|
169 |
|
---|
170 | /*No loads applied, do nothing: */
|
---|
171 | return;
|
---|
172 |
|
---|
173 | }
|
---|
174 | #undef __FUNCT__
|
---|
175 | #define __FUNCT__ "Pengrid::UpdateFromInputs"
|
---|
176 | void Pengrid::UpdateFromInputs(void* inputs){
|
---|
177 |
|
---|
178 | }
|
---|
179 |
|
---|
180 | #undef __FUNCT__
|
---|
181 | #define __FUNCT__ "Pengrid::PenaltyCreateKMatrix"
|
---|
182 | void Pengrid::PenaltyCreateKMatrix(Mat Kgg,void* inputs,double kmax,int analysis_type){
|
---|
183 | throw ErrorException(__FUNCT__," not implemented yet!");
|
---|
184 | }
|
---|
185 |
|
---|
186 | #undef __FUNCT__
|
---|
187 | #define __FUNCT__ "Pengrid::PenaltyCreatePVector"
|
---|
188 | void Pengrid::PenaltyCreatePVector(Vec pg,void* inputs,double kmax,int analysis_type){
|
---|
189 | throw ErrorException(__FUNCT__," not implemented yet!");
|
---|
190 | }
|
---|
191 |
|
---|
192 | Object* Pengrid::copy() {
|
---|
193 | return new Pengrid(*this);
|
---|
194 | }
|
---|
195 |
|
---|