source: issm/trunk/src/c/objects/FemModel.cpp@ 2333

Last change on this file since 2333 was 2333, checked in by Eric.Larour, 15 years ago

Big commit: created Numpar, new object to hold solution parameters necessary
in elements. This lead to creating FetchParams and WriteParams, which now writes
a DataSet* parameters to a matlab workspace structure and vice versa. We now always have
a DataSet* parametes inside the x code. Introduced also a new configuration phase for the paramters
dataset. Also, rewrote the io/ using overloaded functions IoModelFetchData, FetchData and WriteData.
Much cleaner and less error prone, as arguments are consistently checked.

File size: 6.3 KB
Line 
1/*!\file FemModel.c
2 * \brief: implementation of the FemModel 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 "./FemModel.h"
12#include "stdio.h"
13#include "../shared/shared.h"
14
15FemModel::FemModel(){
16
17 elements=NULL;
18 nodes=NULL;
19 constraints=NULL;
20 loads=NULL;
21 materials=NULL;
22 parameters=NULL;
23
24 partition=NULL;
25 tpartition=NULL;
26 yg=NULL;
27 Rmg=NULL;
28 nodesets=NULL;
29 ys=NULL;
30 ys0=NULL;
31 Gmn=NULL;
32
33}
34
35FemModel::FemModel(DataSet* femmodel_elements,DataSet* femmodel_nodes,DataSet* femmodel_constraints,DataSet* femmodel_loads,
36 DataSet* femmodel_materials,DataSet* femmodel_parameters, DofVec* femmodel_partition,DofVec* femmodel_tpartition,DofVec* femmodel_yg,
37 Mat femmodel_Rmg,Mat femmodel_Gmn,NodeSets* femmodel_nodesets,Vec femmodel_ys,Vec femmodel_ys0){
38
39
40 elements=femmodel_elements;
41 nodes=femmodel_nodes;
42 constraints=femmodel_constraints;
43 loads=femmodel_loads;
44 materials=femmodel_materials;
45 parameters=femmodel_parameters;
46
47 partition=femmodel_partition;
48 tpartition=femmodel_tpartition;
49 yg=femmodel_yg;
50 Rmg=femmodel_Rmg;
51 nodesets=femmodel_nodesets;
52 ys=femmodel_ys;
53 ys0=femmodel_ys0;
54 Gmn=femmodel_Gmn;
55
56}
57
58FemModel::~FemModel(){
59
60 delete elements;
61 delete nodes;
62 delete loads;
63 delete constraints;
64 delete materials;
65 delete parameters;
66
67 delete partition;
68 delete tpartition;
69 delete yg;
70 MatFree(&Rmg);
71 delete nodesets;
72 VecFree(&ys);
73 VecFree(&ys0);
74 MatFree(&Gmn);
75
76}
77
78#undef __FUNCT__
79#define __FUNCT__ "FemModel::Echo"
80
81void FemModel::Echo(void){
82
83 printf("FemModels echo: \n");
84 printf(" elements: %p\n",elements);
85 printf(" nodes: %p\n",nodes);
86 printf(" loads: %p\n",loads);
87 printf(" materials: %p\n",materials);
88 printf(" parameters: %p\n",parameters);
89
90 printf(" partition: %p\n",partition);
91 printf(" tpartition: %p\n",tpartition);
92 printf(" yg: %p\n",yg);
93 printf(" Rmg: %p\n",Rmg);
94 printf(" nodesets: %p\n",nodesets);
95 printf(" ys: %p\n",ys);
96 printf(" ys0: %p\n",ys0);
97 printf(" Gmn: %p\n",Gmn);
98
99}
100#undef __FUNCT__
101#define __FUNCT__ "FemModel::DeepEcho"
102
103void FemModel::DeepEcho(void){
104
105 printf("FemModels echo: \n");
106 printf(" elements: \n");
107 elements->Echo();
108 printf(" nodes: \n");
109 nodes->Echo();
110 printf(" loads: \n");
111 nodes->Echo();
112 printf(" materials: \n");
113 nodes->Echo();
114 printf(" parameters: \n");
115 nodes->Echo();
116
117 printf(" partition: \n");
118 partition->Echo();
119 printf(" tpartition: \n");
120 tpartition->Echo();
121 printf(" yg: \n");
122 yg->Echo();
123 printf(" Rmg: \n");
124 MatView(Rmg,PETSC_VIEWER_STDOUT_WORLD);
125 printf(" nodesets: \n");
126 nodesets->Echo();
127 printf(" ys: \n");
128 VecView(ys,PETSC_VIEWER_STDOUT_WORLD);
129 printf(" ys0: \n");
130 VecView(ys0,PETSC_VIEWER_STDOUT_WORLD);
131 printf(" Gmn: \n");
132 MatView(Gmn,PETSC_VIEWER_STDOUT_WORLD);
133
134}
135#undef __FUNCT__
136#define __FUNCT__ "FemModel::GetId"
137int FemModel::GetId(void){
138 throw ErrorException(__FUNCT__,exprintf("%s%s",__FUNCT__," error message: not implemented yet!"));
139}
140
141#undef __FUNCT__
142#define __FUNCT__ "FemModel::MyRank"
143int FemModel::MyRank(void){
144 throw ErrorException(__FUNCT__,exprintf("%s%s",__FUNCT__," error message: not implemented yet!"));
145}
146
147#undef __FUNCT__
148#define __FUNCT__ "FemModel::Marshall"
149void FemModel::Marshall(char** pmarshalled_dataset){
150 throw ErrorException(__FUNCT__,exprintf("%s%s",__FUNCT__," error message: not implemented yet!"));
151}
152
153#undef __FUNCT__
154#define __FUNCT__ "FemModel::MarshallSize"
155int FemModel::MarshallSize(void){
156 throw ErrorException(__FUNCT__,exprintf("%s%s",__FUNCT__," error message: not implemented yet!"));
157}
158#undef __FUNCT__
159#define __FUNCT__ "FemModel::GetName"
160char* FemModel::GetName(void){
161 throw ErrorException(__FUNCT__,exprintf("%s%s",__FUNCT__," error message: not implemented yet!"));
162}
163#undef __FUNCT__
164#define __FUNCT__ "FemModel::Demarshall"
165void FemModel::Demarshall(char** pmarshalled_dataset){
166 throw ErrorException(__FUNCT__,exprintf("%s%s",__FUNCT__," error message: not implemented yet!"));
167}
168#undef __FUNCT__
169#define __FUNCT__ "FemModel::Enum"
170int FemModel::Enum(void){
171 throw ErrorException(__FUNCT__,exprintf("%s%s",__FUNCT__," error message: not implemented yet!"));
172}
173#undef __FUNCT__
174#define __FUNCT__ "FemModel::copy"
175Object* FemModel::copy(void){
176 throw ErrorException(__FUNCT__,exprintf("%s%s",__FUNCT__," error message: not implemented yet!"));
177}
178
179
180#undef __FUNCT__
181#define __FUNCT__ "FemModel::FindParam"
182int FemModel::FindParam(double* pscalar,char* name){
183
184 return parameters->FindParam(pscalar,name);
185
186}
187#undef __FUNCT__
188#define __FUNCT__ "FemModel::FindParam"
189int FemModel::FindParam(int* pinteger,char* name){
190
191 return parameters->FindParam(pinteger,name);
192
193}
194
195#undef __FUNCT__
196#define __FUNCT__ "FemModel::FindParam"
197int FemModel::FindParam(char** pstring,char* name){
198
199 return parameters->FindParam(pstring,name);
200
201}
202
203#undef __FUNCT__
204#define __FUNCT__ "FemModel::FindParam"
205int FemModel::FindParam(char*** pstringarray,int* pM,char* name){
206
207 return parameters->FindParam(pstringarray,pM,name);
208
209}
210
211#undef __FUNCT__
212#define __FUNCT__ "FemModel::FindParam"
213int FemModel::FindParam(double** pdoublearray,int* pM,int* pN,char* name){
214
215 return parameters->FindParam(pdoublearray,pM,pN,name);
216
217}
218
219#undef __FUNCT__
220#define __FUNCT__ "FemModel::FindParam"
221int FemModel::FindParam(Vec* pvec,char* name){
222
223 return parameters->FindParam(pvec,name);
224
225}
226
227#undef __FUNCT__
228#define __FUNCT__ "FemModel::FindParam"
229int FemModel::FindParam(Mat* pmat,char* name){
230
231 return parameters->FindParam(pmat,name);
232
233}
234
235
236/*access to internal data: */
237DataSet* FemModel::get_elements(void){return elements;}
238DataSet* FemModel::get_nodes(void){return nodes ;}
239DataSet* FemModel::get_constraints(void){return constraints ;}
240DataSet* FemModel::get_loads(void){return loads;}
241DataSet* FemModel::get_materials(void){return materials;}
242DataSet* FemModel::get_parameters(void){return parameters;}
243DofVec* FemModel::get_partition(void){return partition;}
244DofVec* FemModel::get_tpartition(void){return tpartition;}
245DofVec* FemModel::get_yg(void){return yg;}
246Mat FemModel::get_Rmg(void){return Rmg;}
247NodeSets* FemModel::get_nodesets(void){return nodesets;}
248Vec FemModel::get_ys(void){return ys;}
249Vec FemModel::get_ys0(void){return ys0;}
250Mat FemModel::get_Gmn(void){return Gmn;}
Note: See TracBrowser for help on using the repository browser.