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