Changeset 21812
- Timestamp:
- 07/18/17 20:26:11 (8 years ago)
- Location:
- issm/trunk-jpl/src/c/classes
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified issm/trunk-jpl/src/c/classes/AmrBamg.cpp ¶
r21804 r21812 17 17 18 18 /*Constructor, copy, clean up and destructor*/ 19 AmrBamg::AmrBamg(IssmDouble hmin, IssmDouble hmax ){/*{{{*/19 AmrBamg::AmrBamg(IssmDouble hmin, IssmDouble hmax,int fieldenum_in,IssmDouble err){/*{{{*/ 20 20 21 this->fieldenum = fieldenum_in; 21 22 this->geometry = NULL; 22 23 this->fathermesh = NULL; … … 47 48 this->options->hmin = hmin; 48 49 this->options->hmax = hmax; 50 51 this->options->err=xNew<IssmDouble>(1); 52 this->options->errSize[0]=1; 53 this->options->errSize[1]=1; 54 this->options->err[0] = err; 49 55 } 50 56 /*}}}*/ … … 80 86 delete Th; 81 87 }/*}}}*/ 82 void AmrBamg::ExecuteRefinementBamg( int* pnewnumberofvertices,int *pnewnumberofelements,IssmDouble** px,IssmDouble** py,IssmDouble** pz,int** pelementslist){/*{{{*/88 void AmrBamg::ExecuteRefinementBamg(IssmDouble* field,int* pnewnumberofvertices,int *pnewnumberofelements,IssmDouble** px,IssmDouble** py,IssmDouble** pz,int** pelementslist){/*{{{*/ 83 89 84 90 /*Intermediaries*/ … … 90 96 _assert_(this->options); 91 97 _assert_(this->fathermesh); 98 _assert_(field); 99 100 /*Prepare field for metric*/ 101 this->options->field = field; 92 102 93 103 /*remesh*/ 94 104 if(this->previousmesh){ 105 this->options->fieldSize[0] = this->previousmesh->VerticesSize[0]; 106 this->options->fieldSize[1] = 1; 95 107 Bamgx(meshout,geomout,this->previousmesh,this->geometry,this->options); 96 108 } 97 109 else{ 110 this->options->fieldSize[0] = this->fathermesh->VerticesSize[0]; 111 this->options->fieldSize[1] = 1; 98 112 Bamgx(meshout,geomout,this->fathermesh,this->geometry,this->options); 99 113 } 114 115 /*remove field for memory management (FemModel is taking care of deleting it)*/ 116 this->options->field = NULL; 117 this->options->fieldSize[0] = 0; 118 this->options->fieldSize[1] = 0; 100 119 101 120 /*Change previous mesh*/ -
TabularUnified issm/trunk-jpl/src/c/classes/AmrBamg.h ¶
r21802 r21812 13 13 14 14 public: 15 int fieldenum; 16 15 17 /* Constructor, destructor etc*/ 16 AmrBamg(IssmDouble hmin, IssmDouble hmax );18 AmrBamg(IssmDouble hmin, IssmDouble hmax,int fieldenum_in,IssmDouble err_in); 17 19 ~AmrBamg(); 18 20 19 21 /*General methods*/ 20 22 void Initialize(int* elements,IssmDouble* x,IssmDouble* y,int numberofvertices,int numberofelements); 21 void ExecuteRefinementBamg( int* pnewnumberofvertices,int *pnewnumberofelements,IssmDouble** px,IssmDouble** py,IssmDouble** pz,int** pelementslist);23 void ExecuteRefinementBamg(IssmDouble* field,int* pnewnumberofvertices,int *pnewnumberofelements,IssmDouble** px,IssmDouble** py,IssmDouble** pz,int** pelementslist); 22 24 23 25 private: -
TabularUnified issm/trunk-jpl/src/c/classes/FemModel.cpp ¶
r21806 r21812 4301 4301 int my_rank = IssmComm::GetRank(); 4302 4302 4303 /*Get vector to create metric*/ 4304 int numberofvertices = this->vertices->NumberOfVertices(); 4305 Vector<IssmDouble> *vector = new Vector<IssmDouble>(numberofvertices); 4306 GetVectorFromInputsx(&vector,this,this->amrbamg->fieldenum,VertexSIdEnum); 4307 vector->Assemble(); 4308 IssmDouble* vector_serial = vector->ToMPISerial(); 4309 delete vector; 4310 4303 4311 if(my_rank==0){ 4304 this->amrbamg->ExecuteRefinementBamg( &newnumberofvertices,&newnumberofelements,&newx,&newy,&newz,&newelementslist);4312 this->amrbamg->ExecuteRefinementBamg(vector_serial,&newnumberofvertices,&newnumberofelements,&newx,&newy,&newz,&newelementslist); 4305 4313 if(newnumberofvertices<=0 || newnumberofelements<=0) _error_("Error in the refinement process."); 4306 4314 } … … 4311 4319 newelementslist=xNew<int>(newnumberofelements*this->GetElementsWidth()); 4312 4320 } 4321 xDelete<IssmDouble>(vector_serial); 4313 4322 4314 4323 /*Send new mesh to others CPU*/ … … 4358 4367 this->parameters->FindParam(&err,AmrErrEnum); 4359 4368 4360 /*Create bamg data structures for bamg (only cpu 0)*/ 4369 /*Create bamg data structures for bamg*/ 4370 this->amrbamg = new AmrBamg(hmin,hmax,fieldenum,err); 4371 4372 /*Re-create original mesh and put it in bamg structure (only cpu 0)*/ 4361 4373 if(my_rank==0){ 4362 /*Re-create original mesh and put it in bamg structure*/4363 this->amrbamg = new AmrBamg(hmin,hmax);4364 4374 this->amrbamg->Initialize(elements,x,y,numberofvertices,numberofelements); 4365 4375 }
Note:
See TracChangeset
for help on using the changeset viewer.