[21484] | 1 | #ifndef ADAPTIVEMESHREFINEMENT
|
---|
| 2 | #define ADAPTIVEMESHREFINEMENT
|
---|
| 3 |
|
---|
[21491] | 4 | /*Includes*/
|
---|
| 5 | /*{{{*/
|
---|
[21487] | 6 | /*Common includes*/
|
---|
[21484] | 7 | #include <iostream>
|
---|
| 8 | #include <fstream>
|
---|
| 9 | #include <string>
|
---|
[22758] | 10 | #include <climits>
|
---|
| 11 | #include <cfloat>
|
---|
[21484] | 12 |
|
---|
[21487] | 13 | /*NeoPZ includes*/
|
---|
[22758] | 14 | #include <pz_config.h>
|
---|
[21491] | 15 | #include <pzreal.h>
|
---|
[21487] | 16 | #include <pzgmesh.h>
|
---|
| 17 | #include <pzvec.h>
|
---|
| 18 | #include <pzeltype.h>
|
---|
[21484] | 19 |
|
---|
[21487] | 20 | #include <TPZRefPatternTools.h>
|
---|
| 21 | #include <TPZRefPatternDataBase.h>
|
---|
| 22 | #include <TPZRefPattern.h>
|
---|
[21484] | 23 |
|
---|
[21487] | 24 | #include <tpzchangeel.h>
|
---|
| 25 | #include <TPZGeoElement.h>
|
---|
| 26 | #include <pzreftriangle.h>
|
---|
[22758] | 27 | #include <pzgeotriangle.h>
|
---|
[21487] | 28 | #include <tpzgeoelrefpattern.h>
|
---|
[22758] | 29 | #include <pzgraphmesh.h>
|
---|
| 30 | #include <TPZVTKGeoMesh.h>
|
---|
| 31 |
|
---|
| 32 | #include "../shared/shared.h"
|
---|
| 33 |
|
---|
[21487] | 34 | /*}}}*/
|
---|
[21484] | 35 |
|
---|
[22758] | 36 | class AdaptiveMeshRefinement{
|
---|
[21484] | 37 |
|
---|
| 38 | public:
|
---|
[22758] | 39 | /*Public attributes{{{*/
|
---|
| 40 | /*
|
---|
| 41 | * to refine:
|
---|
| 42 | * distance_h = initial_distance * gradation ^ (level_max-h)
|
---|
| 43 | * to unrefine:
|
---|
| 44 | * distance_h = lag * initial_distance * gradation ^ (level_max-h)
|
---|
| 45 | */
|
---|
| 46 | int refinement_type; //0 uniform (faster); 1 refpattern
|
---|
| 47 | int level_max; //max level of refinement
|
---|
| 48 | double gradation; //geometric progression ratio to calculate radius of level h
|
---|
| 49 | double lag; //lag used in the unrefine process
|
---|
| 50 | /*Target and estimators*/
|
---|
| 51 | double groundingline_distance; //all elements with distance from grounding line <= groundingline_distance will be refined
|
---|
| 52 | double icefront_distance; //all elements with distance from ice front <= icefront_distance will be refined
|
---|
| 53 | double thicknesserror_threshold; //if ==0, it will not be used
|
---|
| 54 | double thicknesserror_groupthreshold;//group threshold
|
---|
| 55 | double thicknesserror_maximum; //max value of the error estimator; in general, it is defined in the first time step. Attention with restart
|
---|
| 56 | double deviatoricerror_threshold; //if ==0, it will not be used
|
---|
| 57 | double deviatoricerror_groupthreshold;//group threshold
|
---|
| 58 | double deviatoricerror_maximum; //max value of the error estimator; in general, it is defined in the first time step. Attention with restart
|
---|
| 59 | /*}}}*/
|
---|
| 60 | /*Public methods{{{*/
|
---|
[21484] | 61 | /* Constructor, destructor etc*/
|
---|
[22758] | 62 | AdaptiveMeshRefinement();
|
---|
| 63 | AdaptiveMeshRefinement(const AdaptiveMeshRefinement &cp);
|
---|
| 64 | AdaptiveMeshRefinement & operator= (const AdaptiveMeshRefinement &cp);
|
---|
| 65 | virtual ~AdaptiveMeshRefinement();
|
---|
[21484] | 66 | /*General methods*/
|
---|
[22758] | 67 | void CleanUp();
|
---|
| 68 | void Initialize();
|
---|
[23189] | 69 | void ExecuteRefinement(double* gl_distance,double* if_distance,double* deviatoricerror,double* thicknesserror,int** pdatalist,double** pxy,int** pelementslist);
|
---|
[22758] | 70 | void CreateInitialMesh(int &nvertices,int &nelements,double* x,double* y,int* elements);
|
---|
[23189] | 71 | void CheckMesh(int** pdata,double** pxy,int** pelements);
|
---|
[22758] | 72 | /*}}}*/
|
---|
| 73 | private:
|
---|
| 74 | /*Private attributes{{{*/
|
---|
| 75 | std::vector<int> sid2index; // Vector that keeps index of PZGeoMesh elements used in the ISSM mesh (sid)
|
---|
| 76 | std::vector<int> index2sid; // Vector that keeps sid of issm mesh elements used in the neopz mesh (index)
|
---|
| 77 | std::vector<int> specialelementsindex; // Vector that keeps index of the special elements (created to avoid haning nodes)
|
---|
| 78 | TPZGeoMesh *fathermesh; // Entire mesh without refinement if refinement_type==1; refined with hanging nodes if efinement_type==0
|
---|
| 79 | TPZGeoMesh *previousmesh; // Refined mesh without hanging nodes (it is always refpattern type), used to generate ISSM mesh
|
---|
| 80 | /*}}}*/
|
---|
| 81 | /*Private methods{{{*/
|
---|
| 82 | void RefineMeshOneLevel(bool &verbose,double* gl_distance,double* if_distance,double* deviatoricerror,double* thicknesserror);
|
---|
| 83 | void RefineMeshWithSmoothing(bool &verbose,TPZGeoMesh* gmesh);
|
---|
| 84 | void RefineMeshToAvoidHangingNodes(bool &verbose,TPZGeoMesh* gmesh);
|
---|
| 85 | void DeleteSpecialElements(bool &verbose,TPZGeoMesh* gmesh);
|
---|
[23189] | 86 | void GetMesh(TPZGeoMesh* gmesh,int** pdata,double** pxy,int** pelements);
|
---|
[21672] | 87 | TPZGeoMesh* CreateRefPatternMesh(TPZGeoMesh* gmesh);
|
---|
[22758] | 88 | inline int GetElemMaterialID(){return 1;}
|
---|
| 89 | inline int GetNumberOfNodes(){return 3;}
|
---|
| 90 | void PrintGMeshVTK(TPZGeoMesh *gmesh,std::ofstream &file,bool matColor=true);
|
---|
| 91 | int GetVTK_ElType(TPZGeoEl* gel);
|
---|
| 92 | int VerifyRefinementType(TPZGeoEl* geoel);
|
---|
| 93 | /*}}}*/
|
---|
[21484] | 94 | };
|
---|
| 95 |
|
---|
[21487] | 96 | #endif
|
---|