1 | /*!\file: ProcessResults.cpp
|
---|
2 | * \brief: go through results dataset, and for each result, process it for easier retrieval
|
---|
3 | * by the Matlab side. This usually means splitting the velocities from the g-size nodeset
|
---|
4 | * to the grid set (ug->vx,vy,vz), same for pressure (p_g->pressure), etc ... It also implies
|
---|
5 | * departitioning of the results.
|
---|
6 | * This phase is necessary prior to outputting the results on disk.
|
---|
7 | */
|
---|
8 |
|
---|
9 | #ifdef HAVE_CONFIG_H
|
---|
10 | #include "config.h"
|
---|
11 | #else
|
---|
12 | #error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
|
---|
13 | #endif
|
---|
14 |
|
---|
15 | #include "../DataSet/DataSet.h"
|
---|
16 | #include "../objects/objects.h"
|
---|
17 | #include "../EnumDefinitions/EnumDefinitions.h"
|
---|
18 | #include "../shared/shared.h"
|
---|
19 |
|
---|
20 | void ProcessResults(DataSet** pnewresults, DataSet* results,Model* model,int analysis_type){
|
---|
21 |
|
---|
22 | int i,n;
|
---|
23 | Result* result=NULL;
|
---|
24 | Result* newresult=NULL;
|
---|
25 |
|
---|
26 | /*output: */
|
---|
27 | DataSet* newresults=NULL;
|
---|
28 |
|
---|
29 | /*fem diagnostic models: */
|
---|
30 | FemModel* fem_dh=NULL;
|
---|
31 | FemModel* fem_dv=NULL;
|
---|
32 | FemModel* fem_dhu=NULL;
|
---|
33 | FemModel* fem_ds=NULL;
|
---|
34 | FemModel* fem_sl=NULL;
|
---|
35 |
|
---|
36 | /*fem thermal models: */
|
---|
37 | FemModel* fem_t=NULL;
|
---|
38 |
|
---|
39 | /*fem prognostic models: */
|
---|
40 | FemModel* fem_p=NULL;
|
---|
41 |
|
---|
42 | /*fem control models: */
|
---|
43 | FemModel* fem_c=NULL;
|
---|
44 |
|
---|
45 | /*some parameters*/
|
---|
46 | int ishutter;
|
---|
47 | int ismacayealpattyn;
|
---|
48 | int isstokes;
|
---|
49 | int dim;
|
---|
50 |
|
---|
51 | /*intermediary: */
|
---|
52 | Vec u_g=NULL;
|
---|
53 | double* u_g_serial=NULL;
|
---|
54 | double* vx=NULL;
|
---|
55 | double* vy=NULL;
|
---|
56 | double* vz=NULL;
|
---|
57 | double* vel=NULL;
|
---|
58 | Vec p_g=NULL;
|
---|
59 | double* p_g_serial=NULL;
|
---|
60 | double* pressure=NULL;
|
---|
61 | double* partition=NULL;
|
---|
62 | double yts;
|
---|
63 |
|
---|
64 | double* param_g=NULL;
|
---|
65 | double* parameter=NULL;
|
---|
66 | Vec riftproperties=NULL;
|
---|
67 | double* riftproperties_serial=NULL;
|
---|
68 | int numrifts=0;
|
---|
69 |
|
---|
70 | Vec s_g=NULL;
|
---|
71 | double* s_g_serial=NULL;
|
---|
72 | double* surface=NULL;
|
---|
73 |
|
---|
74 | Vec sx_g=NULL;
|
---|
75 | double* sx_g_serial=NULL;
|
---|
76 | double* slopex=NULL;
|
---|
77 |
|
---|
78 | Vec sy_g=NULL;
|
---|
79 | double* sy_g_serial=NULL;
|
---|
80 | double* slopey=NULL;
|
---|
81 |
|
---|
82 | Vec b_g=NULL;
|
---|
83 | double* b_g_serial=NULL;
|
---|
84 | double* bed=NULL;
|
---|
85 |
|
---|
86 | Vec h_g=NULL;
|
---|
87 | double* h_g_serial=NULL;
|
---|
88 | double* thickness=NULL;
|
---|
89 |
|
---|
90 | Vec t_g=NULL;
|
---|
91 | double* t_g_serial=NULL;
|
---|
92 | double* temperature=NULL;
|
---|
93 |
|
---|
94 | Vec m_g=NULL;
|
---|
95 | double* m_g_serial=NULL;
|
---|
96 | double* melting=NULL;
|
---|
97 |
|
---|
98 | Vec grad_g=NULL;
|
---|
99 | double* grad_g_serial=NULL;
|
---|
100 | double* gradient=NULL;
|
---|
101 |
|
---|
102 | Vec sigma_zz=NULL;
|
---|
103 | double* sigma_zz_serial=NULL;
|
---|
104 |
|
---|
105 | Vec v_g=NULL;
|
---|
106 | double* v_g_serial=NULL;
|
---|
107 |
|
---|
108 | int numberofnodes,numberofvertices,numberofelements;
|
---|
109 |
|
---|
110 | /*Initialize new results: */
|
---|
111 | newresults=new DataSet(ResultsEnum);
|
---|
112 |
|
---|
113 | /*some flags needed: */
|
---|
114 | model->FindParam(&dim,DimEnum);
|
---|
115 | model->FindParam(&ishutter,IsHutterEnum);
|
---|
116 | model->FindParam(&isstokes,IsStokesEnum);
|
---|
117 | model->FindParam(&ismacayealpattyn,IsMacAyealPattynEnum);
|
---|
118 |
|
---|
119 | /*Recover femmodels first: */
|
---|
120 | fem_dh=model->GetFormulation(DiagnosticAnalysisEnum,HorizAnalysisEnum);
|
---|
121 | fem_c=fem_dh;
|
---|
122 | fem_dv=model->GetFormulation(DiagnosticAnalysisEnum,VertAnalysisEnum);
|
---|
123 | fem_ds=model->GetFormulation(DiagnosticAnalysisEnum,StokesAnalysisEnum);
|
---|
124 | fem_dhu=model->GetFormulation(DiagnosticAnalysisEnum,HutterAnalysisEnum);
|
---|
125 | fem_sl=model->GetFormulation(SlopecomputeAnalysisEnum);
|
---|
126 | if(analysis_type==PrognosticAnalysisEnum){
|
---|
127 | fem_p=model->GetFormulation(PrognosticAnalysisEnum);
|
---|
128 | }
|
---|
129 | if(analysis_type==Prognostic2AnalysisEnum){
|
---|
130 | fem_p=model->GetFormulation(Prognostic2AnalysisEnum);
|
---|
131 | }
|
---|
132 | if(analysis_type==TransientAnalysisEnum){
|
---|
133 | fem_p=model->GetFormulation(PrognosticAnalysisEnum);
|
---|
134 | }
|
---|
135 | if(analysis_type==BalancedthicknessAnalysisEnum){
|
---|
136 | fem_p=model->GetFormulation(BalancedthicknessAnalysisEnum);
|
---|
137 | }
|
---|
138 | if(analysis_type==Balancedthickness2AnalysisEnum){
|
---|
139 | fem_p=model->GetFormulation(Balancedthickness2AnalysisEnum);
|
---|
140 | }
|
---|
141 | if(analysis_type==BalancedvelocitiesAnalysisEnum){
|
---|
142 | fem_p=model->GetFormulation(BalancedvelocitiesAnalysisEnum);
|
---|
143 | }
|
---|
144 | fem_t=model->GetFormulation(ThermalAnalysisEnum);
|
---|
145 |
|
---|
146 | for(n=0;n<results->Size();n++){
|
---|
147 | result=(Result*)results->GetObjectByOffset(n);
|
---|
148 |
|
---|
149 | if(strcmp(result->GetFieldName(),"u_g")==0){
|
---|
150 |
|
---|
151 | /*Ok, are we dealing with velocities coming from MacAyeal, Pattyin, Hutter, on 2,3 dofs or
|
---|
152 | *Stokes on 4 dofs: */
|
---|
153 | result->GetField(&u_g);
|
---|
154 | VecToMPISerial(&u_g_serial,u_g);
|
---|
155 |
|
---|
156 | //2d results -> 2 dofs per node
|
---|
157 | if (dim==2){
|
---|
158 | /*ok, 2 dofs, on number of nodes: */
|
---|
159 | if(ismacayealpattyn){
|
---|
160 | fem_dh->parameters->FindParam(&numberofnodes,NumberOfNodesEnum);
|
---|
161 | VecToMPISerial(&partition,fem_dh->partition->vector);
|
---|
162 | fem_dh->parameters->FindParam(&yts,YtsEnum);
|
---|
163 | }
|
---|
164 | else{
|
---|
165 | fem_dhu->parameters->FindParam(&numberofnodes,NumberOfNodesEnum);
|
---|
166 | VecToMPISerial(&partition,fem_dhu->partition->vector);
|
---|
167 | fem_dhu->parameters->FindParam(&yts,YtsEnum);
|
---|
168 | }
|
---|
169 | vx=(double*)xmalloc(numberofnodes*sizeof(double));
|
---|
170 | vy=(double*)xmalloc(numberofnodes*sizeof(double));
|
---|
171 | vz=(double*)xmalloc(numberofnodes*sizeof(double));
|
---|
172 | vel=(double*)xmalloc(numberofnodes*sizeof(double));
|
---|
173 |
|
---|
174 | for(i=0;i<numberofnodes;i++){
|
---|
175 | vx[i]=u_g_serial[2*(int)partition[i]+0]*yts;
|
---|
176 | vy[i]=u_g_serial[2*(int)partition[i]+1]*yts;
|
---|
177 | vz[i]=0;
|
---|
178 | vel[i]=sqrt(pow(vx[i],2)+pow(vy[i],2)+pow(vz[i],2));
|
---|
179 | }
|
---|
180 | }
|
---|
181 | //3d results -> 3 or 4 (stokes) dofs per node
|
---|
182 | else{
|
---|
183 | if(!isstokes){
|
---|
184 | /*ok, 3 dofs, on number of nodes: */
|
---|
185 | if(ismacayealpattyn){
|
---|
186 | fem_dh->parameters->FindParam(&numberofnodes,NumberOfNodesEnum);
|
---|
187 | VecToMPISerial(&partition,fem_dh->partition->vector);
|
---|
188 | fem_dh->parameters->FindParam(&yts,YtsEnum);
|
---|
189 | }
|
---|
190 | else{
|
---|
191 | fem_dhu->parameters->FindParam(&numberofnodes,NumberOfNodesEnum);
|
---|
192 | VecToMPISerial(&partition,fem_dhu->partition->vector);
|
---|
193 | fem_dhu->parameters->FindParam(&yts,YtsEnum);
|
---|
194 | }
|
---|
195 | vx=(double*)xmalloc(numberofnodes*sizeof(double));
|
---|
196 | vy=(double*)xmalloc(numberofnodes*sizeof(double));
|
---|
197 | vz=(double*)xmalloc(numberofnodes*sizeof(double));
|
---|
198 | vel=(double*)xmalloc(numberofnodes*sizeof(double));
|
---|
199 |
|
---|
200 | for(i=0;i<numberofnodes;i++){
|
---|
201 | vx[i]=u_g_serial[3*(int)partition[i]+0]*yts;
|
---|
202 | vy[i]=u_g_serial[3*(int)partition[i]+1]*yts;
|
---|
203 | vz[i]=u_g_serial[3*(int)partition[i]+2]*yts;
|
---|
204 | vel[i]=sqrt(pow(vx[i],2)+pow(vy[i],2)+pow(vz[i],2));
|
---|
205 | }
|
---|
206 | }
|
---|
207 | else{
|
---|
208 | /* 4 dofs on number of nodes. discard pressure: */
|
---|
209 | fem_ds->parameters->FindParam(&numberofnodes,NumberOfNodesEnum);
|
---|
210 | VecToMPISerial(&partition,fem_ds->partition->vector);
|
---|
211 | fem_ds->parameters->FindParam(&yts,YtsEnum);
|
---|
212 | vx=(double*)xmalloc(numberofnodes*sizeof(double));
|
---|
213 | vy=(double*)xmalloc(numberofnodes*sizeof(double));
|
---|
214 | vz=(double*)xmalloc(numberofnodes*sizeof(double));
|
---|
215 | vel=(double*)xmalloc(numberofnodes*sizeof(double));
|
---|
216 | for(i=0;i<numberofnodes;i++){
|
---|
217 | vx[i]=u_g_serial[4*(int)partition[i]+0]*yts;
|
---|
218 | vy[i]=u_g_serial[4*(int)partition[i]+1]*yts;
|
---|
219 | vz[i]=u_g_serial[4*(int)partition[i]+2]*yts;
|
---|
220 | vel[i]=sqrt(pow(vx[i],2)+pow(vy[i],2)+pow(vz[i],2));
|
---|
221 | }
|
---|
222 | }
|
---|
223 | }
|
---|
224 |
|
---|
225 | /*Ok, add vx,vy and vz to newresults: */
|
---|
226 | newresult=new Result(newresults->Size()+1,result->GetTime(),result->GetStep(),"vx",vx,numberofnodes);
|
---|
227 | newresults->AddObject(newresult);
|
---|
228 |
|
---|
229 | newresult=new Result(newresults->Size()+1,result->GetTime(),result->GetStep(),"vy",vy,numberofnodes);
|
---|
230 | newresults->AddObject(newresult);
|
---|
231 |
|
---|
232 | newresult=new Result(newresults->Size()+1,result->GetTime(),result->GetStep(),"vz",vz,numberofnodes);
|
---|
233 | newresults->AddObject(newresult);
|
---|
234 |
|
---|
235 | newresult=new Result(newresults->Size()+1,result->GetTime(),result->GetStep(),"vel",vel,numberofnodes);
|
---|
236 | newresults->AddObject(newresult);
|
---|
237 |
|
---|
238 | /*do some cleanup: */
|
---|
239 | xfree((void**)&u_g_serial);
|
---|
240 | xfree((void**)&partition);
|
---|
241 | xfree((void**)&vx);
|
---|
242 | xfree((void**)&vy);
|
---|
243 | xfree((void**)&vz);
|
---|
244 | xfree((void**)&vel);
|
---|
245 | VecFree(&u_g);
|
---|
246 | }
|
---|
247 | else if(strcmp(result->GetFieldName(),"p_g")==0){
|
---|
248 | /*easy, p_g is of size numberofnodes, on 1 dof, just repartition: */
|
---|
249 | result->GetField(&p_g);
|
---|
250 | VecToMPISerial(&p_g_serial,p_g);
|
---|
251 |
|
---|
252 | if(!isstokes){
|
---|
253 | if(ismacayealpattyn){
|
---|
254 | fem_dh->parameters->FindParam(&numberofnodes,NumberOfNodesEnum);
|
---|
255 | VecToMPISerial(&partition,fem_dh->partition->vector);
|
---|
256 | }
|
---|
257 | else{
|
---|
258 | fem_dhu->parameters->FindParam(&numberofnodes,NumberOfNodesEnum);
|
---|
259 | VecToMPISerial(&partition,fem_dhu->partition->vector);
|
---|
260 | }
|
---|
261 | }
|
---|
262 | else{
|
---|
263 | fem_ds->parameters->FindParam(&numberofnodes,NumberOfNodesEnum);
|
---|
264 | VecToMPISerial(&partition,fem_ds->partition->vector);
|
---|
265 | }
|
---|
266 |
|
---|
267 | pressure=(double*)xmalloc(numberofnodes*sizeof(double));
|
---|
268 |
|
---|
269 | for(i=0;i<numberofnodes;i++){
|
---|
270 | pressure[i]=p_g_serial[(int)partition[i]];
|
---|
271 | }
|
---|
272 |
|
---|
273 | /*Ok, add pressure,vy and vz to newresults: */
|
---|
274 | newresult=new Result(newresults->Size()+1,result->GetTime(),result->GetStep(),"pressure",pressure,numberofnodes);
|
---|
275 | newresults->AddObject(newresult);
|
---|
276 |
|
---|
277 | /*do some cleanup: */
|
---|
278 | xfree((void**)&p_g_serial);
|
---|
279 | xfree((void**)&partition);
|
---|
280 | xfree((void**)&pressure);
|
---|
281 | VecFree(&p_g);
|
---|
282 | }
|
---|
283 | else if(strcmp(result->GetFieldName(),"t_g")==0){
|
---|
284 | /*easy, t_g is of size numberofnodes, on 1 dof, just repartition: */
|
---|
285 | result->GetField(&t_g);
|
---|
286 | VecToMPISerial(&t_g_serial,t_g);
|
---|
287 | fem_t->parameters->FindParam(&numberofnodes,NumberOfNodesEnum);
|
---|
288 | VecToMPISerial(&partition,fem_t->partition->vector);
|
---|
289 |
|
---|
290 | temperature=(double*)xmalloc(numberofnodes*sizeof(double));
|
---|
291 |
|
---|
292 | for(i=0;i<numberofnodes;i++){
|
---|
293 | temperature[i]=t_g_serial[(int)partition[i]];
|
---|
294 | }
|
---|
295 |
|
---|
296 | /*Ok, add pressure to newresults: */
|
---|
297 | newresult=new Result(newresults->Size()+1,result->GetTime(),result->GetStep(),"temperature",temperature,numberofnodes);
|
---|
298 | newresults->AddObject(newresult);
|
---|
299 |
|
---|
300 | /*do some cleanup: */
|
---|
301 | xfree((void**)&t_g_serial);
|
---|
302 | xfree((void**)&partition);
|
---|
303 | xfree((void**)&temperature);
|
---|
304 | VecFree(&t_g);
|
---|
305 | }
|
---|
306 | else if(strcmp(result->GetFieldName(),"grad_g")==0){
|
---|
307 |
|
---|
308 | /*easy, grad_g is of size numberofnodes, on 1 dof, just repartition: */
|
---|
309 | result->GetField(&grad_g);
|
---|
310 | VecToMPISerial(&grad_g_serial,grad_g);
|
---|
311 | fem_c->parameters->FindParam(&numberofnodes,NumberOfNodesEnum);
|
---|
312 | VecToMPISerial(&partition,fem_c->partition->vector);
|
---|
313 |
|
---|
314 | gradient=(double*)xmalloc(numberofnodes*sizeof(double));
|
---|
315 |
|
---|
316 | for(i=0;i<numberofnodes;i++){
|
---|
317 | gradient[i]=grad_g_serial[(int)partition[i]];
|
---|
318 | }
|
---|
319 |
|
---|
320 | /*Ok, add gradient to newresults: */
|
---|
321 | newresult=new Result(newresults->Size()+1,result->GetTime(),result->GetStep(),"gradient",gradient,numberofnodes);
|
---|
322 | newresults->AddObject(newresult);
|
---|
323 |
|
---|
324 | /*do some cleanup: */
|
---|
325 | xfree((void**)&grad_g_serial);
|
---|
326 | xfree((void**)&partition);
|
---|
327 | xfree((void**)&gradient);
|
---|
328 | VecFree(&grad_g);
|
---|
329 | }
|
---|
330 | else if(strcmp(result->GetFieldName(),"m_g")==0){
|
---|
331 | /*easy, m_g is of size numberofnodes, on 1 dof, just repartition: */
|
---|
332 | result->GetField(&m_g);
|
---|
333 | VecToMPISerial(&m_g_serial,m_g);
|
---|
334 | fem_t->parameters->FindParam(&numberofnodes,NumberOfNodesEnum);
|
---|
335 | fem_t->parameters->FindParam(&yts,YtsEnum);
|
---|
336 | VecToMPISerial(&partition,fem_t->partition->vector);
|
---|
337 |
|
---|
338 | melting=(double*)xmalloc(numberofnodes*sizeof(double));
|
---|
339 |
|
---|
340 | for(i=0;i<numberofnodes;i++){
|
---|
341 | melting[i]=m_g_serial[(int)partition[i]]*yts;
|
---|
342 | }
|
---|
343 |
|
---|
344 | /*Ok, add pressure to newresults: */
|
---|
345 | newresult=new Result(newresults->Size()+1,result->GetTime(),result->GetStep(),"melting",melting,numberofnodes);
|
---|
346 | newresults->AddObject(newresult);
|
---|
347 |
|
---|
348 | /*do some cleanup: */
|
---|
349 | xfree((void**)&m_g_serial);
|
---|
350 | xfree((void**)&partition);
|
---|
351 | xfree((void**)&melting);
|
---|
352 | VecFree(&m_g);
|
---|
353 | }
|
---|
354 | else if(strcmp(result->GetFieldName(),"h_g")==0){
|
---|
355 | /*easy, h_g is of size numberofvertices, on 1 dof, just repartition: */
|
---|
356 | result->GetField(&h_g);
|
---|
357 | VecToMPISerial(&h_g_serial,h_g);
|
---|
358 | fem_p->parameters->FindParam(&numberofvertices,NumberOfVerticesEnum);
|
---|
359 | VecToMPISerial(&partition,fem_p->partition->vector);
|
---|
360 |
|
---|
361 | thickness=(double*)xmalloc(numberofvertices*sizeof(double));
|
---|
362 |
|
---|
363 | for(i=0;i<numberofvertices;i++){
|
---|
364 | thickness[i]=h_g_serial[(int)partition[i]];
|
---|
365 | }
|
---|
366 |
|
---|
367 | /*Ok, add pressure to newresults: */
|
---|
368 | newresult=new Result(newresults->Size()+1,result->GetTime(),result->GetStep(),"thickness",thickness,numberofvertices);
|
---|
369 | newresults->AddObject(newresult);
|
---|
370 |
|
---|
371 | /*do some cleanup: */
|
---|
372 | xfree((void**)&h_g_serial);
|
---|
373 | xfree((void**)&thickness);
|
---|
374 | xfree((void**)&partition);
|
---|
375 | VecFree(&h_g);
|
---|
376 | }
|
---|
377 | else if(strcmp(result->GetFieldName(),"v_g")==0){
|
---|
378 | /*easy, v_g is of size numberofnodes, on 1 dof, just repartition: */
|
---|
379 | result->GetField(&v_g);
|
---|
380 | VecToMPISerial(&v_g_serial,v_g);
|
---|
381 | fem_p->parameters->FindParam(&numberofnodes,NumberOfNodesEnum);
|
---|
382 | VecToMPISerial(&partition,fem_p->partition->vector);
|
---|
383 |
|
---|
384 | vel=(double*)xmalloc(numberofnodes*sizeof(double));
|
---|
385 |
|
---|
386 | for(i=0;i<numberofnodes;i++){
|
---|
387 | vel[i]=v_g_serial[(int)partition[i]];
|
---|
388 | }
|
---|
389 |
|
---|
390 | /*Ok, add pressure to newresults: */
|
---|
391 | newresult=new Result(newresults->Size()+1,result->GetTime(),result->GetStep(),"vel",vel,numberofnodes);
|
---|
392 | newresults->AddObject(newresult);
|
---|
393 |
|
---|
394 | /*do some cleanup: */
|
---|
395 | xfree((void**)&v_g_serial);
|
---|
396 | xfree((void**)&vel);
|
---|
397 | xfree((void**)&partition);
|
---|
398 | VecFree(&v_g);
|
---|
399 | }
|
---|
400 | else if(strcmp(result->GetFieldName(),"s_g")==0){
|
---|
401 | /*easy, s_g is of size numberofnodes, on 1 dof, just repartition: */
|
---|
402 | result->GetField(&s_g);
|
---|
403 | VecToMPISerial(&s_g_serial,s_g);
|
---|
404 | fem_p->parameters->FindParam(&numberofnodes,NumberOfNodesEnum);
|
---|
405 | VecToMPISerial(&partition,fem_p->partition->vector);
|
---|
406 |
|
---|
407 | surface=(double*)xmalloc(numberofnodes*sizeof(double));
|
---|
408 |
|
---|
409 | for(i=0;i<numberofnodes;i++){
|
---|
410 | surface[i]=s_g_serial[(int)partition[i]];
|
---|
411 | }
|
---|
412 |
|
---|
413 | /*Ok, add pressure to newresults: */
|
---|
414 | newresult=new Result(newresults->Size()+1,result->GetTime(),result->GetStep(),"surface",surface,numberofnodes);
|
---|
415 | newresults->AddObject(newresult);
|
---|
416 |
|
---|
417 | /*do some cleanup: */
|
---|
418 | xfree((void**)&s_g_serial);
|
---|
419 | xfree((void**)&partition);
|
---|
420 | xfree((void**)&surface);
|
---|
421 | VecFree(&s_g);
|
---|
422 | }
|
---|
423 | else if(strcmp(result->GetFieldName(),"sx_g")==0){
|
---|
424 | /*easy, s_g is of size numberofnodes, on 1 dof, just repartition: */
|
---|
425 | result->GetField(&sx_g);
|
---|
426 | VecToMPISerial(&sx_g_serial,sx_g);
|
---|
427 | fem_sl->parameters->FindParam(&numberofnodes,NumberOfNodesEnum);
|
---|
428 | VecToMPISerial(&partition,fem_sl->partition->vector);
|
---|
429 |
|
---|
430 | slopex=(double*)xmalloc(numberofnodes*sizeof(double));
|
---|
431 |
|
---|
432 | for(i=0;i<numberofnodes;i++){
|
---|
433 | slopex[i]=sx_g_serial[(int)partition[i]];
|
---|
434 | }
|
---|
435 |
|
---|
436 | /*Ok, add pressure to newresults: */
|
---|
437 | newresult=new Result(newresults->Size()+1,result->GetTime(),result->GetStep(),"slopex",slopex,numberofnodes);
|
---|
438 | newresults->AddObject(newresult);
|
---|
439 |
|
---|
440 | /*do some cleanup: */
|
---|
441 | xfree((void**)&sx_g_serial);
|
---|
442 | xfree((void**)&partition);
|
---|
443 | xfree((void**)&slopex);
|
---|
444 | VecFree(&sx_g);
|
---|
445 | }
|
---|
446 | else if(strcmp(result->GetFieldName(),"sy_g")==0){
|
---|
447 | /*easy, s_g is of size numberofnodes, on 1 dof, just repartition: */
|
---|
448 | result->GetField(&sy_g);
|
---|
449 | VecToMPISerial(&sy_g_serial,sy_g);
|
---|
450 | fem_sl->parameters->FindParam(&numberofnodes,NumberOfNodesEnum);
|
---|
451 | VecToMPISerial(&partition,fem_sl->partition->vector);
|
---|
452 |
|
---|
453 | slopey=(double*)xmalloc(numberofnodes*sizeof(double));
|
---|
454 |
|
---|
455 | for(i=0;i<numberofnodes;i++){
|
---|
456 | slopey[i]=sy_g_serial[(int)partition[i]];
|
---|
457 | }
|
---|
458 |
|
---|
459 | /*Ok, add pressure to newresults: */
|
---|
460 | newresult=new Result(newresults->Size()+1,result->GetTime(),result->GetStep(),"slopey",slopey,numberofnodes);
|
---|
461 | newresults->AddObject(newresult);
|
---|
462 |
|
---|
463 | /*do some cleanup: */
|
---|
464 | xfree((void**)&sy_g_serial);
|
---|
465 | xfree((void**)&partition);
|
---|
466 | xfree((void**)&slopey);
|
---|
467 | VecFree(&sy_g);
|
---|
468 | }
|
---|
469 | else if(strcmp(result->GetFieldName(),"b_g")==0){
|
---|
470 | /*easy, b_g is of size numberofnodes, on 1 dof, just repartition: */
|
---|
471 | result->GetField(&b_g);
|
---|
472 | VecToMPISerial(&b_g_serial,b_g);
|
---|
473 | fem_p->parameters->FindParam(&numberofnodes,NumberOfNodesEnum);
|
---|
474 | VecToMPISerial(&partition,fem_p->partition->vector);
|
---|
475 |
|
---|
476 | bed=(double*)xmalloc(numberofnodes*sizeof(double));
|
---|
477 |
|
---|
478 | for(i=0;i<numberofnodes;i++){
|
---|
479 | bed[i]=b_g_serial[(int)partition[i]];
|
---|
480 | }
|
---|
481 |
|
---|
482 | /*Ok, add pressure to newresults: */
|
---|
483 | newresult=new Result(newresults->Size()+1,result->GetTime(),result->GetStep(),"bed",bed,numberofnodes);
|
---|
484 | newresults->AddObject(newresult);
|
---|
485 |
|
---|
486 | /*do some cleanup: */
|
---|
487 | xfree((void**)&b_g_serial);
|
---|
488 | xfree((void**)&partition);
|
---|
489 | xfree((void**)&bed);
|
---|
490 | VecFree(&b_g);
|
---|
491 | }
|
---|
492 | else if(strcmp(result->GetFieldName(),"param_g")==0){
|
---|
493 | /*easy, param_g is of size numberofnodes, on 1 dof, just repartition: */
|
---|
494 | result->GetField(¶m_g);
|
---|
495 | fem_dh->parameters->FindParam(&numberofnodes,NumberOfNodesEnum);
|
---|
496 | VecToMPISerial(&partition,fem_dh->partition->vector);
|
---|
497 |
|
---|
498 | parameter=(double*)xmalloc(numberofnodes*sizeof(double));
|
---|
499 |
|
---|
500 | for(i=0;i<numberofnodes;i++){
|
---|
501 | parameter[i]=param_g[(int)partition[i]];
|
---|
502 | }
|
---|
503 |
|
---|
504 | /*Ok, add parameter to newresults: */
|
---|
505 | newresult=new Result(newresults->Size()+1,result->GetTime(),result->GetStep(),"parameter",parameter,numberofnodes);
|
---|
506 | newresults->AddObject(newresult);
|
---|
507 |
|
---|
508 | /*do some cleanup: */
|
---|
509 | xfree((void**)&partition);
|
---|
510 | xfree((void**)¶m_g);
|
---|
511 | xfree((void**)¶meter);
|
---|
512 | }
|
---|
513 | else if(strcmp(result->GetFieldName(),"riftproperties")==0){
|
---|
514 | result->GetField(&riftproperties);
|
---|
515 | fem_dh->parameters->FindParam(&numrifts,NumRiftsEnum);
|
---|
516 | VecToMPISerial(&riftproperties_serial,riftproperties);
|
---|
517 |
|
---|
518 | /*Ok, add parameter to newresults: */
|
---|
519 | newresult=new Result(newresults->Size()+1,result->GetTime(),result->GetStep(),"riftproperties",riftproperties_serial,numrifts);
|
---|
520 | newresults->AddObject(newresult);
|
---|
521 | xfree((void**)&riftproperties);
|
---|
522 |
|
---|
523 | }
|
---|
524 | else if(strcmp(result->GetFieldName(),"sigma_zz")==0){
|
---|
525 | /*easy, param_g is of size numberofelements, on 1 dof, just repartition: */
|
---|
526 | fem_ds->parameters->FindParam(&numberofelements,NumberOfElementsEnum);
|
---|
527 | result->GetField(&sigma_zz);
|
---|
528 | VecToMPISerial(&sigma_zz_serial,sigma_zz);
|
---|
529 |
|
---|
530 | /*Ok, add parameter to newresults: */
|
---|
531 | newresult=new Result(newresults->Size()+1,result->GetTime(),result->GetStep(),"sigma_zz",sigma_zz_serial,numberofelements);
|
---|
532 | newresults->AddObject(newresult);
|
---|
533 |
|
---|
534 | /*do some cleanup: */
|
---|
535 | xfree((void**)&sigma_zz_serial);
|
---|
536 |
|
---|
537 | }
|
---|
538 | else{
|
---|
539 | /*Just copy the result into the new results dataset: */
|
---|
540 | newresults->AddObject(result->copy());
|
---|
541 | }
|
---|
542 | }
|
---|
543 |
|
---|
544 | /*Assign output pointers:*/
|
---|
545 | *pnewresults=newresults;
|
---|
546 | }
|
---|