[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: */
|
---|
[3703] | 114 | model->FindParam(&dim,DimEnum);
|
---|
| 115 | model->FindParam(&ishutter,IsHutterEnum);
|
---|
| 116 | model->FindParam(&isstokes,IsStokesEnum);
|
---|
[3717] | 117 | model->FindParam(&ismacayealpattyn,IsMacAyealPattynEnum);
|
---|
[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 | }
|
---|
[3588] | 138 | if(analysis_type==Balancedthickness2AnalysisEnum){
|
---|
| 139 | fem_p=model->GetFormulation(Balancedthickness2AnalysisEnum);
|
---|
| 140 | }
|
---|
[3567] | 141 | if(analysis_type==BalancedvelocitiesAnalysisEnum){
|
---|
| 142 | fem_p=model->GetFormulation(BalancedvelocitiesAnalysisEnum);
|
---|
[2722] | 143 | }
|
---|
[3567] | 144 | fem_t=model->GetFormulation(ThermalAnalysisEnum);
|
---|
[928] | 145 |
|
---|
[643] | 146 | for(n=0;n<results->Size();n++){
|
---|
| 147 | result=(Result*)results->GetObjectByOffset(n);
|
---|
[853] | 148 |
|
---|
[643] | 149 | if(strcmp(result->GetFieldName(),"u_g")==0){
|
---|
[853] | 150 |
|
---|
[675] | 151 | /*Ok, are we dealing with velocities coming from MacAyeal, Pattyin, Hutter, on 2,3 dofs or
|
---|
[643] | 152 | *Stokes on 4 dofs: */
|
---|
| 153 | result->GetField(&u_g);
|
---|
| 154 | VecToMPISerial(&u_g_serial,u_g);
|
---|
| 155 |
|
---|
[675] | 156 | //2d results -> 2 dofs per node
|
---|
| 157 | if (dim==2){
|
---|
[643] | 158 | /*ok, 2 dofs, on number of nodes: */
|
---|
| 159 | if(ismacayealpattyn){
|
---|
[3703] | 160 | fem_dh->parameters->FindParam(&numberofnodes,NumberOfNodesEnum);
|
---|
[2316] | 161 | VecToMPISerial(&partition,fem_dh->partition->vector);
|
---|
[3703] | 162 | fem_dh->parameters->FindParam(&yts,YtsEnum);
|
---|
[643] | 163 | }
|
---|
| 164 | else{
|
---|
[3703] | 165 | fem_dhu->parameters->FindParam(&numberofnodes,NumberOfNodesEnum);
|
---|
[2316] | 166 | VecToMPISerial(&partition,fem_dhu->partition->vector);
|
---|
[3703] | 167 | fem_dhu->parameters->FindParam(&yts,YtsEnum);
|
---|
[643] | 168 | }
|
---|
| 169 | vx=(double*)xmalloc(numberofnodes*sizeof(double));
|
---|
| 170 | vy=(double*)xmalloc(numberofnodes*sizeof(double));
|
---|
| 171 | vz=(double*)xmalloc(numberofnodes*sizeof(double));
|
---|
[659] | 172 | vel=(double*)xmalloc(numberofnodes*sizeof(double));
|
---|
[643] | 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;
|
---|
[659] | 178 | vel[i]=sqrt(pow(vx[i],2)+pow(vy[i],2)+pow(vz[i],2));
|
---|
[643] | 179 | }
|
---|
[675] | 180 | }
|
---|
| 181 | //3d results -> 3 or 4 (stokes) dofs per node
|
---|
[643] | 182 | else{
|
---|
[675] | 183 | if(!isstokes){
|
---|
| 184 | /*ok, 3 dofs, on number of nodes: */
|
---|
| 185 | if(ismacayealpattyn){
|
---|
[3703] | 186 | fem_dh->parameters->FindParam(&numberofnodes,NumberOfNodesEnum);
|
---|
[2316] | 187 | VecToMPISerial(&partition,fem_dh->partition->vector);
|
---|
[3703] | 188 | fem_dh->parameters->FindParam(&yts,YtsEnum);
|
---|
[675] | 189 | }
|
---|
| 190 | else{
|
---|
[3703] | 191 | fem_dhu->parameters->FindParam(&numberofnodes,NumberOfNodesEnum);
|
---|
[2316] | 192 | VecToMPISerial(&partition,fem_dhu->partition->vector);
|
---|
[3703] | 193 | fem_dhu->parameters->FindParam(&yts,YtsEnum);
|
---|
[675] | 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 | }
|
---|
[643] | 206 | }
|
---|
[675] | 207 | else{
|
---|
| 208 | /* 4 dofs on number of nodes. discard pressure: */
|
---|
[3703] | 209 | fem_ds->parameters->FindParam(&numberofnodes,NumberOfNodesEnum);
|
---|
[2316] | 210 | VecToMPISerial(&partition,fem_ds->partition->vector);
|
---|
[3703] | 211 | fem_ds->parameters->FindParam(&yts,YtsEnum);
|
---|
[675] | 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 | }
|
---|
[643] | 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 |
|
---|
[659] | 235 | newresult=new Result(newresults->Size()+1,result->GetTime(),result->GetStep(),"vel",vel,numberofnodes);
|
---|
| 236 | newresults->AddObject(newresult);
|
---|
| 237 |
|
---|
[643] | 238 | /*do some cleanup: */
|
---|
| 239 | xfree((void**)&u_g_serial);
|
---|
| 240 | xfree((void**)&partition);
|
---|
[1964] | 241 | xfree((void**)&vx);
|
---|
| 242 | xfree((void**)&vy);
|
---|
| 243 | xfree((void**)&vz);
|
---|
| 244 | xfree((void**)&vel);
|
---|
[1943] | 245 | VecFree(&u_g);
|
---|
[643] | 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){
|
---|
[3703] | 254 | fem_dh->parameters->FindParam(&numberofnodes,NumberOfNodesEnum);
|
---|
[2316] | 255 | VecToMPISerial(&partition,fem_dh->partition->vector);
|
---|
[643] | 256 | }
|
---|
| 257 | else{
|
---|
[3703] | 258 | fem_dhu->parameters->FindParam(&numberofnodes,NumberOfNodesEnum);
|
---|
[2316] | 259 | VecToMPISerial(&partition,fem_dhu->partition->vector);
|
---|
[643] | 260 | }
|
---|
| 261 | }
|
---|
| 262 | else{
|
---|
[3703] | 263 | fem_ds->parameters->FindParam(&numberofnodes,NumberOfNodesEnum);
|
---|
[2316] | 264 | VecToMPISerial(&partition,fem_ds->partition->vector);
|
---|
[643] | 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);
|
---|
[1964] | 280 | xfree((void**)&pressure);
|
---|
[1943] | 281 | VecFree(&p_g);
|
---|
[643] | 282 | }
|
---|
[694] | 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);
|
---|
[3703] | 287 | fem_t->parameters->FindParam(&numberofnodes,NumberOfNodesEnum);
|
---|
[2316] | 288 | VecToMPISerial(&partition,fem_t->partition->vector);
|
---|
[694] | 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);
|
---|
[1964] | 303 | xfree((void**)&temperature);
|
---|
[1943] | 304 | VecFree(&t_g);
|
---|
[694] | 305 | }
|
---|
[2892] | 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);
|
---|
[3703] | 311 | fem_c->parameters->FindParam(&numberofnodes,NumberOfNodesEnum);
|
---|
[2892] | 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 | }
|
---|
[694] | 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);
|
---|
[3703] | 334 | fem_t->parameters->FindParam(&numberofnodes,NumberOfNodesEnum);
|
---|
| 335 | fem_t->parameters->FindParam(&yts,YtsEnum);
|
---|
[2316] | 336 | VecToMPISerial(&partition,fem_t->partition->vector);
|
---|
[694] | 337 |
|
---|
| 338 | melting=(double*)xmalloc(numberofnodes*sizeof(double));
|
---|
| 339 |
|
---|
| 340 | for(i=0;i<numberofnodes;i++){
|
---|
[695] | 341 | melting[i]=m_g_serial[(int)partition[i]]*yts;
|
---|
[694] | 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);
|
---|
[1964] | 351 | xfree((void**)&melting);
|
---|
[1943] | 352 | VecFree(&m_g);
|
---|
[694] | 353 | }
|
---|
[667] | 354 | else if(strcmp(result->GetFieldName(),"h_g")==0){
|
---|
[3556] | 355 | /*easy, h_g is of size numberofvertices, on 1 dof, just repartition: */
|
---|
[667] | 356 | result->GetField(&h_g);
|
---|
| 357 | VecToMPISerial(&h_g_serial,h_g);
|
---|
[3703] | 358 | fem_p->parameters->FindParam(&numberofvertices,NumberOfVerticesEnum);
|
---|
[2316] | 359 | VecToMPISerial(&partition,fem_p->partition->vector);
|
---|
[667] | 360 |
|
---|
[3556] | 361 | thickness=(double*)xmalloc(numberofvertices*sizeof(double));
|
---|
[667] | 362 |
|
---|
[3556] | 363 | for(i=0;i<numberofvertices;i++){
|
---|
[667] | 364 | thickness[i]=h_g_serial[(int)partition[i]];
|
---|
| 365 | }
|
---|
| 366 |
|
---|
| 367 | /*Ok, add pressure to newresults: */
|
---|
[3556] | 368 | newresult=new Result(newresults->Size()+1,result->GetTime(),result->GetStep(),"thickness",thickness,numberofvertices);
|
---|
[667] | 369 | newresults->AddObject(newresult);
|
---|
| 370 |
|
---|
| 371 | /*do some cleanup: */
|
---|
| 372 | xfree((void**)&h_g_serial);
|
---|
[1964] | 373 | xfree((void**)&thickness);
|
---|
[667] | 374 | xfree((void**)&partition);
|
---|
[1943] | 375 | VecFree(&h_g);
|
---|
[667] | 376 | }
|
---|
[2722] | 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);
|
---|
[3703] | 381 | fem_p->parameters->FindParam(&numberofnodes,NumberOfNodesEnum);
|
---|
[2722] | 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 | }
|
---|
[853] | 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);
|
---|
[3703] | 404 | fem_p->parameters->FindParam(&numberofnodes,NumberOfNodesEnum);
|
---|
[2316] | 405 | VecToMPISerial(&partition,fem_p->partition->vector);
|
---|
[853] | 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);
|
---|
[1964] | 420 | xfree((void**)&surface);
|
---|
[1943] | 421 | VecFree(&s_g);
|
---|
[853] | 422 | }
|
---|
[3086] | 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);
|
---|
[3703] | 427 | fem_sl->parameters->FindParam(&numberofnodes,NumberOfNodesEnum);
|
---|
[3086] | 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);
|
---|
[3703] | 450 | fem_sl->parameters->FindParam(&numberofnodes,NumberOfNodesEnum);
|
---|
[3086] | 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 | }
|
---|
[853] | 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);
|
---|
[3703] | 473 | fem_p->parameters->FindParam(&numberofnodes,NumberOfNodesEnum);
|
---|
[2316] | 474 | VecToMPISerial(&partition,fem_p->partition->vector);
|
---|
[853] | 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);
|
---|
[1964] | 489 | xfree((void**)&bed);
|
---|
[1943] | 490 | VecFree(&b_g);
|
---|
[853] | 491 | }
|
---|
[669] | 492 | else if(strcmp(result->GetFieldName(),"param_g")==0){
|
---|
| 493 | /*easy, param_g is of size numberofnodes, on 1 dof, just repartition: */
|
---|
[758] | 494 | result->GetField(¶m_g);
|
---|
[3703] | 495 | fem_dh->parameters->FindParam(&numberofnodes,NumberOfNodesEnum);
|
---|
[2316] | 496 | VecToMPISerial(&partition,fem_dh->partition->vector);
|
---|
[669] | 497 |
|
---|
| 498 | parameter=(double*)xmalloc(numberofnodes*sizeof(double));
|
---|
| 499 |
|
---|
| 500 | for(i=0;i<numberofnodes;i++){
|
---|
[1046] | 501 | parameter[i]=param_g[(int)partition[i]];
|
---|
[669] | 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);
|
---|
[1943] | 510 | xfree((void**)¶m_g);
|
---|
[1964] | 511 | xfree((void**)¶meter);
|
---|
[669] | 512 | }
|
---|
[1805] | 513 | else if(strcmp(result->GetFieldName(),"riftproperties")==0){
|
---|
| 514 | result->GetField(&riftproperties);
|
---|
[3703] | 515 | fem_dh->parameters->FindParam(&numrifts,NumRiftsEnum);
|
---|
[1805] | 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);
|
---|
[1943] | 521 | xfree((void**)&riftproperties);
|
---|
[1805] | 522 |
|
---|
| 523 | }
|
---|
[3529] | 524 | else if(strcmp(result->GetFieldName(),"sigma_zz")==0){
|
---|
| 525 | /*easy, param_g is of size numberofelements, on 1 dof, just repartition: */
|
---|
[3703] | 526 | fem_ds->parameters->FindParam(&numberofelements,NumberOfElementsEnum);
|
---|
[3529] | 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 | }
|
---|
[669] | 538 | else{
|
---|
| 539 | /*Just copy the result into the new results dataset: */
|
---|
[758] | 540 | newresults->AddObject(result->copy());
|
---|
[669] | 541 | }
|
---|
[643] | 542 | }
|
---|
| 543 |
|
---|
| 544 | /*Assign output pointers:*/
|
---|
[2112] | 545 | *pnewresults=newresults;
|
---|
[643] | 546 | }
|
---|