NeoPZ
pzgengrid.h
Go to the documentation of this file.
1 
6 #ifndef _TPZGENGRIDHH_
7 #define _TPZGENGRIDHH_
8 
9 class TPZCompMesh;
10 class TPZGeoMesh;
11 
12 #include "pzvec.h"
13 #include "pzmanvector.h"
14 
15 #include <stdio.h>
16 #include <iostream>
17 #include "pzreal.h"
18 #include "tpzautopointer.h"
19 
20 #include "pzeltype.h"
21 
22 #include <fstream>
23 
29 class TPZGenGrid {
30 
31 public:
32 
42  TPZGenGrid(TPZVec<int> &nx, TPZVec<REAL> &x0, TPZVec<REAL> &x1, int numl = 1, REAL rot = 0.5);
43 
45  virtual ~TPZGenGrid();
46 
50  void SetData(TPZVec<int> &nx, TPZVec<REAL> &x0, TPZVec<REAL> &x1, MElementType eltype = EQuadrilateral, int numl = 1, REAL rot = 0.5);
51 
54  {
55  fZigZag = true;
56  }
57 
58  void SetDistortion(REAL distortion)
59  {
60  if (distortion) {
61  fTrapeze = true;
62  fDistortion = distortion;
63  }
64  else
65  {
66  fTrapeze = false;
67  fDistortion = 0.;
68  }
69  }
75  virtual short Read(TPZGeoMesh *mesh,int matid = 1);
80  short Read(TPZAutoPointer<TPZGeoMesh> &mesh, int matid = 1);
81 
83  static REAL GeometricProgression(REAL minsize, REAL size, int numdiv);
84 
86  void ComputeGeometricProgression(TPZVec<REAL> &minsizes, TPZVec<REAL> &progression);
87 
89  void SetGeometricProgression(TPZVec<REAL> &progression);
90 
98  virtual void SetBC(TPZGeoMesh *gr, int side, int bc);
99 
108  virtual void SetBC(TPZGeoMesh *gr, TPZVec<REAL> &start, TPZVec<REAL> &end, int bc);
109 
117  void SetBC(TPZAutoPointer<TPZGeoMesh> gr, int side, int bc)
118  {
119  SetBC(gr.operator->(), side, bc);
120  }
121 
130  {
131  SetBC(gr.operator->(), start, end, bc);
132  }
133 
140  void SetPointBC(TPZGeoMesh *gr, TPZVec<REAL> &x, int bc);
141 
149  {
150  SetPointBC(gr.operator->(), x, bc);
151  }
152 
158  virtual void Print( char *name = NULL, std::ostream &out = std::cout );
159 
165  virtual void SetElementType(MElementType type);
166 
173  int64_t ElemId(int64_t iel,int64_t jel, int layer);
174 
180  static REAL Distance(TPZVec<REAL> &x1,TPZVec<REAL> &x2);
181 
187  bool ReadAndMergeGeoMesh(TPZGeoMesh * grid,TPZGeoMesh * grid2);
193  bool ReadAndMergeGeoMesh(TPZGeoMesh* grid,TPZGeoMesh* grid2,int matid);
199  bool MergeGeoMesh(TPZGeoMesh* grid,TPZGeoMesh* grid2,int matid = 1);
200 
202  void SetRefpatternElements(bool refpat)
203  {
204  fRefPattern = refpat;
205  }
206 
207 protected:
213  virtual void Coord(int i, TPZVec<REAL> &coord);
214 
221  virtual int GlobalI(int ix, int iy, int layer);
222 
224  void ElementConnectivity(int64_t iel, TPZVec<int64_t> &nodes);
225 
227  void ElementConnectivityZigZag(int64_t iel, TPZVec<int64_t> &nodes);
228 
233  virtual bool GenerateNodes(TPZGeoMesh *grid);
234 
240  virtual bool GenerateElements(TPZGeoMesh *grid,int matid);
241 
247  virtual bool GenerateElementsZigZag(TPZGeoMesh *grid,int matid);
248 
260  int64_t fNumNodes;
266 
270  REAL fRotAngle;
271 
273  bool fZigZag;
274 
275  bool fTrapeze;
276 
278 
281 
282 };
283 
284 #endif // _TGENGRIDHH_
void ComputeGeometricProgression(TPZVec< REAL > &minsizes, TPZVec< REAL > &progression)
Compute the geometric progression such that the first elements have this size.
Definition: pzgengrid.cpp:878
void SetPointBC(TPZGeoMesh *gr, TPZVec< REAL > &x, int bc)
Generate a boundary geometric element at the indicated node.
Definition: pzgengrid.cpp:942
void ElementConnectivityZigZag(int64_t iel, TPZVec< int64_t > &nodes)
compute the nodes of the ith Element
Definition: pzgengrid.cpp:651
REAL fDistortion
Definition: pzgengrid.h:277
TPZManVector< REAL > fGeometricProgression
Geometric progression coeficients in the x and y direction.
Definition: pzgengrid.h:258
void SetPointBC(TPZAutoPointer< TPZGeoMesh > gr, TPZVec< REAL > &x, int bc)
Generate a boundary geometric element at the indicated node.
Definition: pzgengrid.h:148
virtual bool GenerateElements(TPZGeoMesh *grid, int matid)
Creates the geometric element: triangles or quadrilaterals.
Definition: pzgengrid.cpp:457
REAL fRotAngle
Rotation angle between the layers.
Definition: pzgengrid.h:270
bool fRefPattern
Uniform or refpattern elements.
Definition: pzgengrid.h:280
clarg::argBool bc("-bc", "binary checkpoints", false)
TPZManVector< REAL > fDelx
Size of the lower left element.
Definition: pzgengrid.h:256
bool MergeGeoMesh(TPZGeoMesh *grid, TPZGeoMesh *grid2, int matid=1)
Merges two geometrical mesh created for TPZGenGrid as separated, both meshes must to exist...
Definition: pzgengrid.cpp:282
Templated vector implementation.
static REAL Distance(TPZVec< REAL > &x1, TPZVec< REAL > &x2)
Computes the euclidean distance between two points, or the measure of the interval between two points...
Definition: pzgengrid.cpp:804
Implements the generation of a multilayered bi-dimensional geometric grid. Getting Data...
Definition: pzgengrid.h:29
virtual void SetElementType(MElementType type)
Set the element type.
Definition: pzgengrid.cpp:812
virtual bool GenerateElementsZigZag(TPZGeoMesh *grid, int matid)
Creates the geometric element: triangles or quadrilaterals.
Definition: pzgengrid.cpp:505
TPZManVector< REAL > fX0
Coordinate of the lower left point.
Definition: pzgengrid.h:252
void SetBC(TPZAutoPointer< TPZGeoMesh > gr, TPZVec< REAL > &start, TPZVec< REAL > &end, int bc)
Generate boundary geometric elements between node start and end going counter clockwise.
Definition: pzgengrid.h:129
void SetDistortion(REAL distortion)
Definition: pzgengrid.h:58
Defines enum MElementType and contains the implementation of MElementType_NNodes(...) functions.
virtual void Print(char *name=NULL, std::ostream &out=std::cout)
Prints the data structure of the class.
Definition: pzgengrid.cpp:698
void SetZigZagPattern()
Indicate whether the elements are generated in a zigzag pattern.
Definition: pzgengrid.h:53
virtual int GlobalI(int ix, int iy, int layer)
Returns the geometric node id for the element addressed by the parameters.
Definition: pzgengrid.cpp:783
TPZManVector< int > fNx
Number of elements in both directions.
Definition: pzgengrid.h:250
static REAL GeometricProgression(REAL minsize, REAL size, int numdiv)
Compute the geometric progression such that the first elements have this size.
Definition: pzgengrid.cpp:831
int fNumLayers
Number of meshes which will be generated hinging along an axis.
Definition: pzgengrid.h:268
TPZManVector< REAL > fX1
coordinate of the upper right point
Definition: pzgengrid.h:254
MElementType fElementType
Variable which indicates the type of element that should be generated Only EQuadrilateral or ETriangl...
Definition: pzgengrid.h:265
virtual void SetBC(TPZGeoMesh *gr, int side, int bc)
Generate boundary geometric elements associated with the side of the rectangular domain.
Definition: pzgengrid.cpp:706
void SetGeometricProgression(TPZVec< REAL > &progression)
Sets the geometric progression of the mesh to be generated.
Definition: pzgengrid.cpp:927
Free store vector implementation.
TPZGenGrid(TPZVec< int > &nx, TPZVec< REAL > &x0, TPZVec< REAL > &x1, int numl=1, REAL rot=0.5)
Constructor of the rectangular domain.
Definition: pzgengrid.cpp:33
Contains declaration of the TPZAutoPointer class which has Increment and Decrement actions are mutexe...
virtual void Coord(int i, TPZVec< REAL > &coord)
Computes the coordinates of the ith geometric node generated.
Definition: pzgengrid.cpp:545
int64_t fNumNodes
Number of nodes of the mesh.
Definition: pzgengrid.h:260
void SetData(TPZVec< int > &nx, TPZVec< REAL > &x0, TPZVec< REAL > &x1, MElementType eltype=EQuadrilateral, int numl=1, REAL rot=0.5)
Change points and all data to generate geometric mesh.
Definition: pzgengrid.cpp:44
bool ReadAndMergeGeoMesh(TPZGeoMesh *grid, TPZGeoMesh *grid2)
Merges two geometrical mesh created for TPZGenGrid as separated.
Definition: pzgengrid.cpp:99
bool fZigZag
variable to generate a zigzag grid
Definition: pzgengrid.h:273
int64_t ElemId(int64_t iel, int64_t jel, int layer)
Returns the element id for the element addressed by the parameters.
Definition: pzgengrid.cpp:800
virtual ~TPZGenGrid()
Default destructor.
Definition: pzgengrid.cpp:41
virtual bool GenerateNodes(TPZGeoMesh *grid)
Creates the geometric nodes, it depends on fElementType, layer and fRotAngle.
Definition: pzgengrid.cpp:434
This class implements a geometric mesh for the pz environment. Geometry.
Definition: pzgmesh.h:48
MElementType
Define the element types.
Definition: pzeltype.h:52
Implements computational mesh. Computational Mesh.
Definition: pzcmesh.h:47
Contains the declaration of TPZFlopCounter class and TPZCounter struct.
void SetBC(TPZAutoPointer< TPZGeoMesh > gr, int side, int bc)
Generate boundary geometric elements associated with the side of the rectangular domain.
Definition: pzgengrid.h:117
bool fTrapeze
Definition: pzgengrid.h:275
void SetRefpatternElements(bool refpat)
Generate element of type refpattern or uniform refinement.
Definition: pzgengrid.h:202
void ElementConnectivity(int64_t iel, TPZVec< int64_t > &nodes)
compute the nodes of the ith Element
Definition: pzgengrid.cpp:625
virtual short Read(TPZGeoMesh *mesh, int matid=1)
Add nodes and elements to the object mesh.
Definition: pzgengrid.cpp:64