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 |
|
---|
14 | FemModel::FemModel(){
|
---|
15 |
|
---|
16 | elements=NULL;
|
---|
17 | nodes=NULL;
|
---|
18 | constraints=NULL;
|
---|
19 | loads=NULL;
|
---|
20 | materials=NULL;
|
---|
21 | parameters=NULL;
|
---|
22 |
|
---|
23 | partition=NULL;
|
---|
24 | tpartition=NULL;
|
---|
25 | yg=NULL;
|
---|
26 | Rmg=NULL;
|
---|
27 | nodesets=NULL;
|
---|
28 | ys=NULL;
|
---|
29 | ys0=NULL;
|
---|
30 | Gmn=NULL;
|
---|
31 |
|
---|
32 | }
|
---|
33 |
|
---|
34 | FemModel::FemModel(DataSet* femmodel_elements,DataSet* femmodel_nodes,DataSet* femmodel_constraints,DataSet* femmodel_loads,
|
---|
35 | DataSet* femmodel_materials,DataSet* femmodel_parameters, Vec femmodel_partition,Vec femmodel_tpartition,Vec femmodel_yg,
|
---|
36 | Mat femmodel_Rmg,Mat femmodel_Gmn,NodeSets* femmodel_nodesets,Vec femmodel_ys,Vec femmodel_ys0){
|
---|
37 |
|
---|
38 |
|
---|
39 | elements=femmodel_elements;
|
---|
40 | nodes=femmodel_nodes;
|
---|
41 | constraints=femmodel_constraints;
|
---|
42 | loads=femmodel_loads;
|
---|
43 | materials=femmodel_materials;
|
---|
44 | parameters=femmodel_parameters;
|
---|
45 |
|
---|
46 | partition=femmodel_partition;
|
---|
47 | tpartition=femmodel_tpartition;
|
---|
48 | yg=femmodel_yg;
|
---|
49 | Rmg=femmodel_Rmg;
|
---|
50 | nodesets=femmodel_nodesets;
|
---|
51 | ys=femmodel_ys;
|
---|
52 | ys0=femmodel_ys0;
|
---|
53 | Gmn=femmodel_Gmn;
|
---|
54 |
|
---|
55 | }
|
---|
56 |
|
---|
57 | FemModel::~FemModel(){
|
---|
58 |
|
---|
59 | delete elements;
|
---|
60 | delete nodes;
|
---|
61 | delete loads;
|
---|
62 | delete materials;
|
---|
63 | delete parameters;
|
---|
64 |
|
---|
65 | VecFree(&partition);
|
---|
66 | VecFree(&tpartition);
|
---|
67 | VecFree(&yg);
|
---|
68 | MatFree(&Rmg);
|
---|
69 | delete nodesets;
|
---|
70 | VecFree(&ys);
|
---|
71 | VecFree(&ys0);
|
---|
72 | MatFree(&Gmn);
|
---|
73 |
|
---|
74 | }
|
---|
75 |
|
---|
76 | #undef __FUNCT__
|
---|
77 | #define __FUNCT__ "FemModel::Echo"
|
---|
78 |
|
---|
79 | void FemModel::Echo(void){
|
---|
80 |
|
---|
81 | printf("FemModels echo: \n");
|
---|
82 | printf(" elements: %p\n",elements);
|
---|
83 | printf(" nodes: %p\n",nodes);
|
---|
84 | printf(" loads: %p\n",loads);
|
---|
85 | printf(" materials: %p\n",materials);
|
---|
86 | printf(" parameters: %p\n",parameters);
|
---|
87 |
|
---|
88 | printf(" partition: %p\n",partition);
|
---|
89 | printf(" tpartition: %p\n",tpartition);
|
---|
90 | printf(" yg: %p\n",yg);
|
---|
91 | printf(" Rmg: %p\n",Rmg);
|
---|
92 | printf(" nodesets: %p\n",nodesets);
|
---|
93 | printf(" ys: %p\n",ys);
|
---|
94 | printf(" ys0: %p\n",ys0);
|
---|
95 | printf(" Gmn: %p\n",Gmn);
|
---|
96 |
|
---|
97 | }
|
---|
98 | #undef __FUNCT__
|
---|
99 | #define __FUNCT__ "FemModel::DeepEcho"
|
---|
100 |
|
---|
101 | void FemModel::DeepEcho(void){
|
---|
102 |
|
---|
103 | printf("FemModels echo: \n");
|
---|
104 | printf(" elements: \n");
|
---|
105 | elements->Echo();
|
---|
106 | printf(" nodes: \n");
|
---|
107 | nodes->Echo();
|
---|
108 | printf(" loads: \n");
|
---|
109 | nodes->Echo();
|
---|
110 | printf(" materials: \n");
|
---|
111 | nodes->Echo();
|
---|
112 | printf(" parameters: \n");
|
---|
113 | nodes->Echo();
|
---|
114 |
|
---|
115 | printf(" partition: \n");
|
---|
116 | VecView(partition,PETSC_VIEWER_STDOUT_WORLD);
|
---|
117 | printf(" tpartition: \n");
|
---|
118 | VecView(tpartition,PETSC_VIEWER_STDOUT_WORLD);
|
---|
119 | printf(" yg: \n");
|
---|
120 | VecView(yg,PETSC_VIEWER_STDOUT_WORLD);
|
---|
121 | printf(" Rmg: \n");
|
---|
122 | MatView(Rmg,PETSC_VIEWER_STDOUT_WORLD);
|
---|
123 | printf(" nodesets: \n");
|
---|
124 | nodesets->Echo();
|
---|
125 | printf(" ys: \n");
|
---|
126 | VecView(ys,PETSC_VIEWER_STDOUT_WORLD);
|
---|
127 | printf(" ys0: \n");
|
---|
128 | VecView(ys0,PETSC_VIEWER_STDOUT_WORLD);
|
---|
129 | printf(" Gmn: \n");
|
---|
130 | MatView(Gmn,PETSC_VIEWER_STDOUT_WORLD);
|
---|
131 |
|
---|
132 | }
|
---|
133 |
|
---|
134 | #undef __FUNCT__
|
---|
135 | #define __FUNCT__ "FemModel::FindParam"
|
---|
136 |
|
---|
137 | int FemModel::FindParam(void* pparameter,char* parametername){
|
---|
138 |
|
---|
139 | return parameters->FindParam(pparameter,parametername);
|
---|
140 |
|
---|
141 | }
|
---|
142 |
|
---|
143 |
|
---|
144 | /*access to internal data: */
|
---|
145 | DataSet* FemModel::get_elements(void){return elements;}
|
---|
146 | DataSet* FemModel::get_nodes(void){return nodes ;}
|
---|
147 | DataSet* FemModel::get_constraints(void){return constraints ;}
|
---|
148 | DataSet* FemModel::get_loads(void){return loads;}
|
---|
149 | DataSet* FemModel::get_materials(void){return materials;}
|
---|
150 | DataSet* FemModel::get_parameters(void){return parameters;}
|
---|
151 | Vec FemModel::get_partition(void){return partition;}
|
---|
152 | Vec FemModel::get_tpartition(void){return tpartition;}
|
---|
153 | Vec FemModel::get_yg(void){return yg;}
|
---|
154 | Mat FemModel::get_Rmg(void){return Rmg;}
|
---|
155 | NodeSets* FemModel::get_nodesets(void){return nodesets;}
|
---|
156 | Vec FemModel::get_ys(void){return ys;}
|
---|
157 | Vec FemModel::get_ys0(void){return ys0;}
|
---|
158 | Mat FemModel::get_Gmn(void){return Gmn;}
|
---|