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