NeoPZ
TPZAcademicGeoMesh.h
Go to the documentation of this file.
1 //
2 // TPZAcademicGeoMesh.hpp
3 // PZ
4 //
5 // Created by Philippe Devloo on 5/29/16.
6 //
7 //
8 
9 #ifndef TPZAcademicGeoMesh_hpp
10 #define TPZAcademicGeoMesh_hpp
11 
12 #include <stdio.h>
13 #include "pzmanvector.h"
14 #include "pzreal.h"
15 #include "pzgmesh.h"
16 #include <iostream>
17 
18 
20 {
21 public:
23 
25 
27 
28 protected:
29 
32 
35 
38 
40  int64_t fNumberElements;
41 
44 
46  void GenerateNodes(TPZGeoMesh *gmesh);
47 
49  void DeformGMesh(TPZGeoMesh &gmesh);
50 
54 
55  int AddBoundaryElements(TPZGeoMesh *gmesh);
56 
58 
59  void CheckConsistency(TPZGeoMesh *gmesh);
60 
61 
62 public:
63 
66 
68  TPZAcademicGeoMesh(int numelements, MMeshType meshtype, bool deform = false) : fMeshType(meshtype), fBCNumbers(6,-1), fShouldDeform(deform),
69  fNumberElements(numelements), fMaterialId(1)
70  {
71 
72  }
73 
75  void SetMeshType(MMeshType meshtype)
76  {
77  if (meshtype == ENone) {
78  DebugStop();
79  }
80  fMeshType = meshtype;
81  }
82 
84  void SetBoundaryIndices(TPZVec<int> &BCNumbers);
85 
87  void ShouldDeform(bool deform);
88 
90  void SetNumberElements(int64_t numelements)
91  {
92 #ifdef PZDEBUG
93  if(numelements < 0)
94  {
95  DebugStop();
96  }
97 #endif
98  fNumberElements = numelements;
99  }
101  void SetMaterialId(int id)
102  {
103 #ifdef PZDEBUG
104  if(id == 0)
105  {
106  DebugStop();
107  }
108 #endif
109  fMaterialId = id;
110  }
111 
114  {
115  switch (fMeshType) {
116  case EHexa:
117  return HexahedralMesh();
118  break;
119  case ETetrahedra:
120  return TetrahedralMesh();
121  break;
122  case EPyramid:
124  break;
125  case EPrism:
126  std::cout << "Not implemented\n";
127 
128  default:
129  DebugStop();
130  break;
131  }
132  return 0;
133  }
134 
136 
138 
140 
152  void SetBCIDVector(TPZVec<int> &BCNumbers){
153  if(fBCNumbers.size() != BCNumbers.size()){
154  DebugStop();
155  }
156  for (int i = 0; i < BCNumbers.size(); i++) {
157  fBCNumbers[i] = BCNumbers[i];
158  }
159  }
160 
161 
162 };
163 
164 #endif /* TPZAcademicGeoMesh_hpp */
static TPZManVector< REAL, 3 > fX0
TPZAcademicGeoMesh()
sets up parameters to create de hexahedral regular mesh
TPZGeoMesh * RedBlackPyramidalAndHexagonalMesh()
void SetNumberElements(int64_t numelements)
set the number of elements in any direction
TPZGeoMesh * TetrahedralMeshUsingRefinement()
MMeshType fMeshType
type of mesh that should be generated
void SetMeshType(MMeshType meshtype)
set the meshtype acording to the enumerate values
TPZManVector< int, 6 > fBCNumbers
indices of the boundary conditions
bool fShouldDeform
whether the mesh should be deformed or not
TPZGeoMesh * HexahedralMesh()
TPZAcademicGeoMesh(int numelements, MMeshType meshtype, bool deform=false)
sets up parameters to create de hexahedral regular mesh
int64_t size() const
Returns the number of elements of the vector.
Definition: pzvec.h:196
void SetBCIDVector(TPZVec< int > &BCNumbers)
Contains declaration of TPZMesh class which defines a geometrical mesh and contains a corresponding l...
#define DebugStop()
Returns a message to user put a breakpoint in.
Definition: pzerror.h:20
Free store vector implementation.
int fMaterialId
material index for volume elements
void ShouldDeform(bool deform)
toggle between regular or deformed mesh
int64_t fNumberElements
number of elements in any direction
TPZGeoMesh * PyramidalAndTetrahedralMesh()
static TPZManVector< REAL, 3 > fEps
int AddBoundaryElementsByCoord(TPZGeoMesh *gmesh)
This class implements a geometric mesh for the pz environment. Geometry.
Definition: pzgmesh.h:48
void SetMaterialId(int id)
set the material id to be used
Contains the declaration of TPZFlopCounter class and TPZCounter struct.
TPZGeoMesh * CreateGeoMesh()
create a geometric mesh acording to the parameters of the object
void GenerateNodes(TPZGeoMesh *gmesh)
put the geometric nodes in the geometric mesh
void DeformGMesh(TPZGeoMesh &gmesh)
Deform the geometric mesh according to the coordinates of fDeformed.
TPZGeoMesh * TetrahedralMesh()
int AddBoundaryElements(TPZGeoMesh *gmesh)
void CheckConsistency(TPZGeoMesh *gmesh)
verify if the faces without neighbour should be orthogonal to the main planes
void SetBoundaryIndices(TPZVec< int > &BCNumbers)
set the boundary numbers on the sides of the cube