NeoPZ
TPZTopologyUtils.cpp
Go to the documentation of this file.
1 #include "TPZTopologyUtils.h"
2 
3 #include "tpzpoint.h"
4 #include "tpzline.h"
5 #include "tpztriangle.h"
6 #include "tpzquadrilateral.h"
7 #include "tpztetrahedron.h"
8 #include "tpzcube.h"
9 #include "tpzpyramid.h"
10 #include "tpzprism.h"
11 
12 namespace pztopology{
13  REAL GetTolerance(){return gTolerance;}
14 
15  void SetTolerance(const REAL &tol){
16  if(tol > 0) gTolerance = tol;
17  else {
18  typedef std::numeric_limits< REAL > dbl;
19 
20  std::cout.precision(dbl::max_digits10);
21  std::cout<<"Invalid tolerance parameter for topologies. Trying to set: "<<tol<<std::endl;
22  std::cout<<"This value will be ignored. Tolerance is set at: "<<gTolerance<<std::endl;
23  }
24  }
25 
26  template<class Topology>
27  void GetPermutation(const int permutationIndex, TPZVec<int> &permutation){
28  #ifdef PZDEBUG
29  if(permutationIndex < 0 || permutationIndex >= Topology::NPermutations){
30  PZError<<"GetPermutation: invalid parameter: permutationIndex = "<<permutationIndex<<std::endl;
31  PZError<<"Aborting..."<<std::endl;
32  DebugStop();
33  }
34  #endif
35  if(permutation.size() != Topology::NSides) permutation.Resize(Topology::NSides,-1);
36  for(int i = 0; i < Topology::NSides; i++) permutation[i] = Topology::fPermutations[permutationIndex][i];
37  }
38 
39 }
40 
41 template void pztopology::GetPermutation<pztopology::TPZPoint>(const int permutationIndex, TPZVec<int> &permutation);
42 template void pztopology::GetPermutation<pztopology::TPZLine>(const int permutationIndex, TPZVec<int> &permutation);
43 template void pztopology::GetPermutation<pztopology::TPZTriangle>(const int permutationIndex, TPZVec<int> &permutation);
44 template void pztopology::GetPermutation<pztopology::TPZQuadrilateral>(const int permutationIndex, TPZVec<int> &permutation);
45 template void pztopology::GetPermutation<pztopology::TPZTetrahedron>(const int permutationIndex, TPZVec<int> &permutation);
46 template void pztopology::GetPermutation<pztopology::TPZCube>(const int permutationIndex, TPZVec<int> &permutation);
47 template void pztopology::GetPermutation<pztopology::TPZPrism>(const int permutationIndex, TPZVec<int> &permutation);
48 template void pztopology::GetPermutation<pztopology::TPZPyramid>(const int permutationIndex, TPZVec<int> &permutation);
49 
50 
51 
Contains the TPZPoint class which defines the topology of a point.
Contains the TPZTriangle class which defines the topology of a triangle.
Contains the TPZTetrahedron class which defines the topology of the tetrahedron element.
static REAL gTolerance
int64_t size() const
Returns the number of elements of the vector.
Definition: pzvec.h:196
virtual void Resize(const int64_t newsize, const T &object)
Resizes the vector object reallocating the necessary storage, copying the existing objects to the new...
Definition: pzvec.h:373
static const double tol
Definition: pzgeoprism.cpp:23
Groups all classes defining the structure of the master element.
Definition: PrismExtend.cpp:15
void SetTolerance(const REAL &tol)
#define DebugStop()
Returns a message to user put a breakpoint in.
Definition: pzerror.h:20
Contains the TPZQuadrilateral class which defines the topology of a quadrilateral element...
std::numeric_limits< REAL > dbl
Contains the TPZPyramid class which defines the topology of a pyramid element.
Contains the TPZCube class which defines the topology of the hexahedron element.
Contains the TPZLine class which defines the topology of a line element.
Contains the TPZPrism class which defines the topology of a Prism.
void GetPermutation(const int permutationIndex, TPZVec< int > &permutation)
#define PZError
Defines the output device to error messages and the DebugStop() function.
Definition: pzerror.h:15