source: issm/trunk/src/c/classes/AdaptiveMeshRefinement.h@ 21729

Last change on this file since 21729 was 21729, checked in by Mathieu Morlighem, 8 years ago

merged trunk-jpl and trunk for revision 21727

File size: 4.7 KB
Line 
1#ifndef ADAPTIVEMESHREFINEMENT
2#define ADAPTIVEMESHREFINEMENT
3
4/*Includes*/
5/*{{{*/
6/*Common includes*/
7#include <iostream>
8#include <fstream>
9#include <string>
10
11/*NeoPZ includes*/
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
17#ifndef REALdouble
18 #define REALdouble
19#endif
20
21#ifndef STATEdouble
22 #define STATEdouble
23#endif
24
25#include <pzreal.h>
26#include <pzsave.h>
27#include <pzgmesh.h>
28#include <pzvec.h>
29#include <pzeltype.h>
30
31#include <TPZRefPatternTools.h>
32#include <TPZRefPatternDataBase.h>
33#include <TPZRefPattern.h>
34
35#include <tpzchangeel.h>
36#include <TPZGeoElement.h>
37#include <pzreftriangle.h>
38#include <tpzgeoelrefpattern.h>
39/*}}}*/
40
41class AdaptiveMeshRefinement : public TPZSaveable {
42
43public:
44
45 /*Public methods*/
46 /* Constructor, destructor etc*/
47 AdaptiveMeshRefinement(); // Default constructor
48 AdaptiveMeshRefinement(const AdaptiveMeshRefinement &cp); // Copy constructor
49 AdaptiveMeshRefinement & operator= (const AdaptiveMeshRefinement &cp); // Operator of copy
50 virtual ~AdaptiveMeshRefinement(); // Destructor
51
52 /*Savable methods*/
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
56
57 /*General methods*/
58 void CleanUp(); // Clean all attributes
59 void Initialize(); // Initialize the attributes with NULL and values out of usually range
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
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
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
67
68private:
69
70 /*Private attributes*/
71 int elementswidth; // Geometric nodes for element: 3 == Tria, 4 == Tetra, 6 == Penta
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
75 TPZGeoMesh *fathermesh; // Father Mesh is the entire mesh without refinement
76 TPZGeoMesh *previousmesh; // Previous mesh is a refined mesh of last step
77
78 /*Private methods*/
79 void RefinementProcess(TPZGeoMesh *gmesh,std::vector<TPZVec<REAL> > &GLvec); // Start the refinement process
80 void RefineMesh(TPZGeoMesh *gmesh, std::vector<int> &ElemVec); // Refine the elements in ElemVec
81 void RefineMeshToAvoidHangingNodes(TPZGeoMesh *gmesh); // Refine the elements to avoid hanging nodes
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
85 void CalcGroundingLinePosition(double *masklevelset,std::vector<TPZVec<REAL> > &GLvec); // Calculate the grounding line position using previous mesh
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
87 inline int GetElemMaterialID(){return 1;} // Return element material ID
88 inline int GetBoundaryMaterialID(){return 2;} // Return segment (2D boundary) material ID
89};
90
91#endif
Note: See TracBrowser for help on using the repository browser.