[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>
|
---|
| 10 |
|
---|
[21487] | 11 | /*NeoPZ includes*/
|
---|
[21528] | 12 | /*REAL and STATE definitions, NeoPZ variables itapopo should be read by NeoPZ's config.h*/
|
---|
| 13 | #ifndef REFPATTERNDIR
|
---|
| 14 | # define REFPATTERNDIR "/home/santos/trunk-jpl/externalpackages/neopz/install/include/refpatterns"
|
---|
| 15 | #endif
|
---|
| 16 |
|
---|
[21491] | 17 | #ifndef REALdouble
|
---|
| 18 | #define REALdouble
|
---|
| 19 | #endif
|
---|
| 20 |
|
---|
| 21 | #ifndef STATEdouble
|
---|
| 22 | #define STATEdouble
|
---|
| 23 | #endif
|
---|
| 24 |
|
---|
| 25 | #include <pzreal.h>
|
---|
[21487] | 26 | #include <pzsave.h>
|
---|
| 27 | #include <pzgmesh.h>
|
---|
| 28 | #include <pzvec.h>
|
---|
| 29 | #include <pzeltype.h>
|
---|
[21484] | 30 |
|
---|
[21487] | 31 | #include <TPZRefPatternTools.h>
|
---|
| 32 | #include <TPZRefPatternDataBase.h>
|
---|
| 33 | #include <TPZRefPattern.h>
|
---|
[21484] | 34 |
|
---|
[21487] | 35 | #include <tpzchangeel.h>
|
---|
| 36 | #include <TPZGeoElement.h>
|
---|
| 37 | #include <pzreftriangle.h>
|
---|
| 38 | #include <tpzgeoelrefpattern.h>
|
---|
| 39 | /*}}}*/
|
---|
[21484] | 40 |
|
---|
| 41 | class AdaptiveMeshRefinement : public TPZSaveable {
|
---|
| 42 |
|
---|
| 43 | public:
|
---|
| 44 |
|
---|
| 45 | /*Public methods*/
|
---|
| 46 | /* Constructor, destructor etc*/
|
---|
[21487] | 47 | AdaptiveMeshRefinement(); // Default constructor
|
---|
| 48 | AdaptiveMeshRefinement(const AdaptiveMeshRefinement &cp); // Copy constructor
|
---|
| 49 | AdaptiveMeshRefinement & operator= (const AdaptiveMeshRefinement &cp); // Operator of copy
|
---|
[21484] | 50 | virtual ~AdaptiveMeshRefinement(); // Destructor
|
---|
| 51 |
|
---|
| 52 | /*Savable methods*/
|
---|
[21487] | 53 | virtual int ClassId() const; // ClassId to save the class
|
---|
| 54 | virtual void Read(TPZStream &buf, void *context); // Read this class
|
---|
| 55 | virtual void Write(TPZStream &buf, int withclassid); // Write this class, using ClassId to identify
|
---|
[21484] | 56 |
|
---|
| 57 | /*General methods*/
|
---|
[21494] | 58 | void CleanUp(); // Clean all attributes
|
---|
[21562] | 59 | void Initialize(); // Initialize the attributes with NULL and values out of usually range
|
---|
[21672] | 60 | void SetLevelMax(int &h); // Define the max level of refinement
|
---|
| 61 | void SetRegions(double &D1,double Dhmax); // Define the regions which will be refined
|
---|
| 62 | void SetElementWidth(int &width); // Define elements width
|
---|
[21528] | 63 | void ExecuteRefinement(int &type_process,double *vx,double *vy,double *masklevelset,int &nvertices,int &nelements,int &nsegments,double** px,double** py,double** pz,int** pelements,int** psegments=NULL); // A new mesh will be created and refined. This returns the new mesh
|
---|
| 64 | void CreateInitialMesh(int &nvertices,int &nelements,int &nsegments,int &width,double* x,double* y,double* z,int* elements,int* segments=NULL); // Create a NeoPZ geometric mesh by coords and elements
|
---|
[21672] | 65 | TPZGeoMesh* CreateRefPatternMesh(TPZGeoMesh* gmesh);
|
---|
| 66 | void CheckMesh(int &nvertices,int &nelements,int &nsegments,int &width,double** px,double** py,double** pz,int** pelements,int** psegments=NULL); // Check the consistency of the mesh
|
---|
[21484] | 67 |
|
---|
| 68 | private:
|
---|
| 69 |
|
---|
| 70 | /*Private attributes*/
|
---|
[21494] | 71 | int elementswidth; // Geometric nodes for element: 3 == Tria, 4 == Tetra, 6 == Penta
|
---|
[21672] | 72 | int levelmax; // Max level of refinement
|
---|
| 73 | double regionlevel1; // Region which will be refined with level 1
|
---|
| 74 | double regionlevelmax; // Region which will be refined with level max
|
---|
[21487] | 75 | TPZGeoMesh *fathermesh; // Father Mesh is the entire mesh without refinement
|
---|
| 76 | TPZGeoMesh *previousmesh; // Previous mesh is a refined mesh of last step
|
---|
[21484] | 77 |
|
---|
| 78 | /*Private methods*/
|
---|
[21487] | 79 | void RefinementProcess(TPZGeoMesh *gmesh,std::vector<TPZVec<REAL> > &GLvec); // Start the refinement process
|
---|
[21503] | 80 | void RefineMesh(TPZGeoMesh *gmesh, std::vector<int> &ElemVec); // Refine the elements in ElemVec
|
---|
[21487] | 81 | void RefineMeshToAvoidHangingNodes(TPZGeoMesh *gmesh); // Refine the elements to avoid hanging nodes
|
---|
[21503] | 82 | void SetElementsToRefine(TPZGeoMesh *gmesh,std::vector<TPZVec<REAL> > &GLvec,int &hlevel, std::vector<int> &ElemVec); //Define wich elements will be refined
|
---|
| 83 | void TagAllElements(TPZGeoMesh *gmesh,std::vector<int> &ElemVec); // This tag all elements to be refined, that is, refine all elements
|
---|
| 84 | void TagElementsNearGroundingLine(TPZGeoMesh *gmesh,std::vector<TPZVec<REAL> > &GLvec,int &hlevel,std::vector<int> &ElemVec); // This tag elements near the grounding line
|
---|
[21494] | 85 | void CalcGroundingLinePosition(double *masklevelset,std::vector<TPZVec<REAL> > &GLvec); // Calculate the grounding line position using previous mesh
|
---|
[21528] | 86 | void GetMesh(TPZGeoMesh *gmesh,int &nvertices,int &nelements,int &nsegments,double** px,double** py,double** pz,int** pelements,int** psegments=NULL); // Return coords and elements in ISSM data structure
|
---|
[21487] | 87 | inline int GetElemMaterialID(){return 1;} // Return element material ID
|
---|
| 88 | inline int GetBoundaryMaterialID(){return 2;} // Return segment (2D boundary) material ID
|
---|
[21484] | 89 | };
|
---|
| 90 |
|
---|
[21487] | 91 | #endif
|
---|