Changeset 23469
- Timestamp:
- 11/17/18 11:53:24 (6 years ago)
- Location:
- issm/trunk-jpl/src/c/classes
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/classes/AdaptiveMeshRefinement.cpp
r23066 r23469 264 264 if(verbose) _printf_(""<<count<<"\n"); 265 265 /*Adjust the connectivities before continue*/ 266 gmesh->BuildConnectivity();266 //gmesh->BuildConnectivity(); this is not necessary 267 267 /*}}}*/ 268 268 … … 301 301 if(verbose) _printf_(""<<count<<"\n"); 302 302 /*Adjust the connectivities before continue*/ 303 gmesh->BuildConnectivity();303 //gmesh->BuildConnectivity();//this is not necessary 304 304 /*}}}*/ 305 305 … … 312 312 } 313 313 /*}}}*/ 314 int AdaptiveMeshRefinement::VerifyRefinementType(TPZGeoEl* geoel ){/*{{{*/314 int AdaptiveMeshRefinement::VerifyRefinementType(TPZGeoEl* geoel,TPZGeoMesh* gmesh){/*{{{*/ 315 315 316 316 /* … … 323 323 /*Output*/ 324 324 int type=0; 325 int count=0;326 325 327 326 /*Intermediaries*/ … … 330 329 /*Loop over neighboors (sides 3, 4 and 5)*/ 331 330 for(int j=3;j<6;j++){ 331 if(!gmesh->Element(geoel->NeighbourIndex(j))->HasSubElement()) continue; 332 332 sons.clear(); 333 geoel->Neighbour(j).Element()->GetHigherSubElements(sons); 334 if(sons.size()) count++; //if neighbour was refined 335 if(sons.size()>4) count++; //if neighbour's level is > element level+1 336 } 337 333 gmesh->Element(geoel->NeighbourIndex(j))->GetHigherSubElements(sons); 334 if(sons.size()) type++; //if neighbour was refined 335 if(sons.size()>4) type++; //if neighbour's level is > element level+1 336 if(type>1) break; 337 } 338 338 339 /*Verify and return*/ 339 if(count>1) type=2; 340 else type=count; 340 if(type>1) type=2; 341 341 342 342 return type; … … 358 358 359 359 count=1; 360 360 361 while(count>0){ 361 362 count=0; … … 367 368 if(gmesh->Element(i)->Level()==this->level_max) continue; 368 369 /*loop over neighboors (sides 3, 4 and 5). Important: neighbours has the same dimension of the element*/ 369 type=this->VerifyRefinementType(gmesh->Element(i) );370 type=this->VerifyRefinementType(gmesh->Element(i),gmesh); 370 371 if(type<2){ 371 372 typecount=0; 372 373 for(int j=3;j<6;j++){ 373 if(gmesh->Element(i)->Neighbour(j).Element()->HasSubElement()) continue; 374 if(gmesh->Element(i)->Neighbour(j).Element()->Index()==i) typecount++;//neighbour==this element, element at the border 375 if(this->VerifyRefinementType(gmesh->Element(i)->Neighbour(j).Element())==1) typecount++; 374 if(gmesh->Element(gmesh->Element(i)->NeighbourIndex(j))->HasSubElement()) continue; 375 if(gmesh->Element(i)->NeighbourIndex(j)==i) typecount++;//neighbour==this element, element at the border 376 if(this->VerifyRefinementType(gmesh->Element(gmesh->Element(i)->NeighbourIndex(j)),gmesh)==1) typecount++; 377 if(typecount>1 && type==1) type=2; 378 else if(typecount>2 && type==0) type=2; 379 if(type==2) break; 376 380 } 377 if(typecount>1 && type==1) type=2;378 else if(typecount>2 && type==0) type=2;379 381 } 382 380 383 /*refine the element if requested*/ 381 384 if(type==2){gmesh->Element(i)->Divide(sons); count++;} … … 386 389 } 387 390 /*Adjust the connectivities before continue*/ 388 gmesh->BuildConnectivity();391 //gmesh->BuildConnectivity();//this is not necessary 389 392 } 390 393 } … … 424 427 else _printf_(""<<count<<", "); 425 428 } 426 gmesh->BuildConnectivity();429 //gmesh->BuildConnectivity();//this is not necessary 427 430 } 428 431 } … … 446 449 this->specialelementsindex.clear(); 447 450 /*Adjust connectivities*/ 448 gmesh->BuildConnectivity();451 //gmesh->BuildConnectivity();//this is not necessary 449 452 } 450 453 /*}}}*/ -
issm/trunk-jpl/src/c/classes/AdaptiveMeshRefinement.h
r23065 r23469 90 90 void PrintGMeshVTK(TPZGeoMesh *gmesh,std::ofstream &file,bool matColor=true); 91 91 int GetVTK_ElType(TPZGeoEl* gel); 92 int VerifyRefinementType(TPZGeoEl* geoel );92 int VerifyRefinementType(TPZGeoEl* geoel,TPZGeoMesh* gmesh); 93 93 /*}}}*/ 94 94 }; -
issm/trunk-jpl/src/c/classes/AmrBamg.h
r23065 r23469 37 37 void ExecuteRefinementBamg(IssmDouble* field,IssmDouble* hmaxVertices,int** pdatalist,IssmDouble** pxylist,int** pelementslist); 38 38 void SetBamgOpts(IssmDouble hmin_in,IssmDouble hmax_in,IssmDouble err_in,IssmDouble gradation_in); 39 39 40 /*Access Method*/ 41 BamgOpts* GetBamgOpts(){return this->options;} 42 40 43 private: 41 44 BamgGeom* geometry; -
issm/trunk-jpl/src/c/classes/FemModel.cpp
r23254 r23469 5106 5106 int numberofelements = this->elements->NumberOfElements(); 5107 5107 int numberofvertices = this->vertices->NumberOfVertices(); 5108 IssmDouble hmax = this->amrbamg->GetBamgOpts()->hmax; 5108 5109 IssmDouble* maxlength = xNew<IssmDouble>(numberofelements); 5109 5110 IssmDouble* error_vertices = xNewZeroInit<IssmDouble>(numberofvertices); … … 5168 5169 /*Fill hmaxvertices with the criteria*/ 5169 5170 for(int i=0;i<numberofelements;i++){ 5170 refine=false;5171 5171 /*Refine any element if its error > phi*maxerror*/ 5172 if(error_elements[i]>threshold*maxerror) refine=true; 5173 /*If the element size is closer to the resolution, verify the sum of error in the vertices*/ 5174 if(resolution/maxlength[i]>0.85){ 5172 if(error_elements[i]>threshold*maxerror){ 5173 /*Now, fill the hmaxvertices if requested*/ 5175 5174 for(int j=0;j<elementswidth;j++){ 5176 5175 vid=index[i*elementswidth+j]-1;//Matlab to C indexing 5177 if(error_vertices[vid]>groupthreshold*maxerror) refine=true; 5178 } 5179 } 5180 /*Now, fill the hmaxvertices if requested*/ 5181 if(refine){ 5182 for(int j=0;j<elementswidth;j++){ 5183 vid=index[i*elementswidth+j]-1;//Matlab to C indexing 5184 if(xIsNan<IssmDouble>(hmaxvertices[vid])) hmaxvertices[vid]=resolution; 5185 else hmaxvertices[vid]=min(resolution,hmaxvertices[vid]); 5186 } 5176 if(xIsNan<IssmDouble>(hmaxvertices[vid])) hmaxvertices[vid]=max(maxlength[i]/2.,resolution);//Try first dividing the element 5177 else hmaxvertices[vid]=min(max(maxlength[i]/2.,resolution),hmaxvertices[vid]);//Try first dividing the element 5178 } 5179 } 5180 else { 5181 /*Try unrefine the element*/ 5182 if(maxlength[i] < 1.1*hmax/2.){ 5183 for(int j=0;j<elementswidth;j++){ 5184 vid=index[i*elementswidth+j]-1;//Matlab to C indexing 5185 if(error_vertices[vid]>groupthreshold*maxerror) hmaxvertices[vid]=maxlength[i]; //keep the current resolution 5186 else{ 5187 if(xIsNan<IssmDouble>(hmaxvertices[vid])) hmaxvertices[vid]=min(maxlength[i]*2.,hmax); 5188 else hmaxvertices[vid]=min(min(maxlength[i]*2.,hmax),hmaxvertices[vid]);//Try first to duplicate the element 5189 } 5190 } 5191 } 5187 5192 } 5188 5193 }
Note:
See TracChangeset
for help on using the changeset viewer.