NeoPZ
tpztetrahedron.h
Go to the documentation of this file.
1 
6 #ifndef PZTOPOLOGYTPZTETRAHEDRON_H
7 #define PZTOPOLOGYTPZTETRAHEDRON_H
8 
9 
10 #include "pzfmatrix.h"
11 #include "pzstack.h"
12 #include "pztrnsform.h"
13 #include "pzeltype.h"
14 #include "pzaxestools.h"
15 #include "TPZTopologyUtils.h"
16 class TPZIntPoints;
17 class TPZIntTetra3D;
18 class TPZGraphElT3d;
19 
20 class TPZCompEl;
21 class TPZGeoEl;
22 class TPZCompMesh;
23 
25 namespace pztopology {
33  class TPZTetrahedron : public TPZSavable {
34  public:
35 
36  friend void pztopology::GetPermutation<TPZTetrahedron>(const int permute, TPZVec<int> &permutation);
38  enum {NSides = 15, NCornerNodes = 4, Dimension = 3, NFaces = 4, NPermutations = 24};
39 
40  int ClassId() const override;
41  void Read(TPZStream &buf, void *context) override;
42  void Write(TPZStream &buf, int withclassid) const override;
43 
46  }
47 
49  virtual ~TPZTetrahedron() {
50  }
51 
56  static int SideDimension(int side);
57 
59  static void LowerDimensionSides(int side,TPZStack<int> &smallsides);
61  static void LowerDimensionSides(int side,TPZStack<int> &smallsides, int DimTarget);
62 
68  static void HigherDimensionSides(int side, TPZStack<int> &high);
69 
71  static int NSideNodes(int side);
73  static int SideNodeLocId(int side, int node);
74 
76  static int NumSides();
78  static int NumSides(int dimension);
79 
81  static int NContainedSides(int side);
83  static int ContainedSideLocId(int side, int c);
84 
85 
87  static void Shape(TPZVec<REAL> &loc,TPZFMatrix<REAL> &phi,TPZFMatrix<REAL> &dphi){
88  TShape(loc, phi, dphi);
89  }
91  template<class T>
92  static void TShape(const TPZVec<T> &loc,TPZFMatrix<T> &phi,TPZFMatrix<T> &dphi);
101  template<class T>
102  static void BlendFactorForSide(const int &side, const TPZVec<T> &xi, T &blendFactor,
103  TPZVec<T> &corrFactorDxi);
110  static void CenterPoint(int side, TPZVec<REAL> &center);
111 
113  static bool IsInParametricDomain(const TPZVec<REAL> &pt, REAL tol = pztopology::gTolerance);
114 
115  #ifdef _AUTODIFF
116 
117  static bool IsInParametricDomain(const TPZVec<Fad<REAL>> &pt, REAL tol = pztopology::gTolerance){
118  TPZVec<REAL> xi(pt.size());
119  for(int i = 0; i < pt.size(); i++) xi[i]= pt[i].val();
120  return IsInParametricDomain(xi,tol);
121  }
122  #endif
123  #ifdef _AUTODIFF
124  template<typename T,
125  typename std::enable_if<std::is_same<T,Fad<REAL>>::value>::type* = nullptr>
126  static bool IsInParametricDomain(const TPZVec<T> &pt, REAL tol){
127  TPZVec<REAL> qsiReal(pt.size(),-1);
128  for(int i = 0; i < qsiReal.size(); i++) qsiReal[i] = pt[i].val();
129  return IsInParametricDomain(qsiReal,tol);
130  }
131  #endif
132 
134  static void RandomPoint(TPZVec<REAL> &pt);
135 
143  template<class T>
144  static bool CheckProjectionForSingularity(const int &side, const TPZVec<T> &xiInterior);
145 
146  template<class T>
147  static void MapToSide(int side, TPZVec<T> &InternalPar, TPZVec<T> &SidePar, TPZFMatrix<T> &JacToSide);
148 
149  static void ParametricDomainNodeCoord(int node, TPZVec<REAL> &nodeCoord);
150 
157  static MElementType Type();
158 
160  static MElementType Type(int side) ;
161 
173  static TPZTransform<> SideToSideTransform(int sidefrom, int sideto);
174 
180  static TPZTransform<> TransformSideToElement(int side);
186  static TPZTransform<> TransformElementToSide(int side);
187 
193  static int GetTransformId(TPZVec<int64_t> &id);
194 
201  static int GetTransformId(int side, TPZVec<int64_t> &id);
202 
213  static TPZIntPoints * CreateSideIntegrationRule(int side, int order);
214 
219 
229  static void GetSideHDivPermutation(int transformationid, TPZVec<int> &permgather);
230 
232  static constexpr REAL RefElVolume() {
233  return (1.0L/6.0L);
234  }
235 
236  /* Given side and gradx the method returns directions needed for Hdiv space */
237  static void ComputeDirections(int side, TPZFMatrix<REAL> &gradx, TPZFMatrix<REAL> &directions, TPZVec<int> &sidevectors);
239  static void GetSideHDivDirections(TPZVec<int> &sides, TPZVec<int> &dir, TPZVec<int> &bilinearounao, TPZVec<int> &sidevectors);
240 
242  template <class TVar>
243  static void ComputeHDivDirections(TPZFMatrix<TVar> &gradx, TPZFMatrix<TVar> &directions);
244 
260  template <class TVar>
261  static void ComputeHCurlDirections(TPZFMatrix<TVar> &gradx, TPZFMatrix<TVar> &directions, const TPZVec<int> &transformationIds);
265  static int NBilinearSides();
266 
267  protected:
272  static int FaceNodes[4][3];
273 
275  static int SideNodes[6][2];
276 
278  static int ShapeFaceId[4][3];
279 
281  static int fPermutations[24][15];
284  };
285 
286 }
287 
288 #endif
static int bilinearounao[81]
Definition: tpzcube.cpp:405
static constexpr REAL RefElVolume()
Volume of the master element (measure)
static void CenterPoint(int side, TPZVec< REAL > &center)
Returns the barycentric coordinates in the master element space of the original element.
void Write(TPZStream &buf, int withclassid) const override
Writes this object to the TPZStream buffer. Include the classid if withclassid = true.
static int FaceNodes[4][3]
Nodes over quadrilateral sides (2d - faces).
static TPZIntPoints * CreateSideIntegrationRule(int side, int order)
Create an integration rule over side.
static bool CheckProjectionForSingularity(const int &side, const TPZVec< T > &xiInterior)
static int fPermutations[24][15]
Valid permutations between nodes.
static TPZTransform TransformElementToSide(int side)
Returns the transformation which projects a point from the interior of the element to the side...
static int SideDimension(int side)
Returns the dimension of the side.
clarg::argInt dimension("-d", "Matrices dimension M x M", 1000)
static int SideNodes[6][2]
Nodes over lines sides (1d)
static void ComputeHCurlDirections(TPZFMatrix< TVar > &gradx, TPZFMatrix< TVar > &directions, const TPZVec< int > &transformationIds)
TPZGraphElT3d GraphElType
Typedef to graphical element type.
Definition: fad.h:54
Defines enum MElementType and contains the implementation of MElementType_NNodes(...) functions.
REAL val(STATE &number)
Returns value of the variable.
Definition: pzartdiff.h:23
static int ShapeFaceId[4][3]
Ids of the shape face.
static int NContainedSides(int side)
Returns the number of nodes (not connectivities) associated with a side.
static void TShape(const TPZVec< T > &loc, TPZFMatrix< T > &phi, TPZFMatrix< T > &dphi)
Compute the shape being used to construct the x mapping from local parametric coordinates.
static int NumSides()
Number of connects of the element (27)
static REAL gTolerance
Abstract class defining integration rules. Numerical Integration.
Definition: tpzintpoints.h:19
static void ComputeHDivDirections(TPZFMatrix< TVar > &gradx, TPZFMatrix< TVar > &directions)
Compute the directions of the HDiv vectors.
static MElementType Type()
Returns the type of the element as specified in file pzeltype.h.
static void BlendFactorForSide(const int &side, const TPZVec< T > &xi, T &blendFactor, TPZVec< T > &corrFactorDxi)
int64_t size() const
Returns the number of elements of the vector.
Definition: pzvec.h:196
static TPZTransform SideToSideTransform(int sidefrom, int sideto)
Returns the transformation which takes a point from the side sidefrom to the side sideto...
static const double tol
Definition: pzgeoprism.cpp:23
Groups all classes defining the structure of the master element.
Definition: PrismExtend.cpp:15
static int NSideNodes(int side)
Returns the number of nodes (not connectivities) associated with a side.
Defines the behaviour of all geometric elements. GeometryTPZGeoEl is the common denominator for all g...
Definition: pzgeoel.h:43
Implements the graphical representation of a tetrahedra element. Post processing. ...
Definition: tpzgraphelt3d.h:16
static void ComputeDirections(int side, TPZFMatrix< REAL > &gradx, TPZFMatrix< REAL > &directions, TPZVec< int > &sidevectors)
Contains TPZMatrixclass which implements full matrix (using column major representation).
virtual ~TPZTetrahedron()
Default destructor.
static TPZTransform TransformSideToElement(int side)
Returns the transformation which transform a point from the side to the interior of the element...
int ClassId() const override
Define the class id associated with the class.
static void MapToSide(int side, TPZVec< T > &InternalPar, TPZVec< T > &SidePar, TPZFMatrix< T > &JacToSide)
A simple stack.
TPZIntTetra3D IntruleType
Typedef to numerical integration rule.
static void RandomPoint(TPZVec< REAL > &pt)
Generates a random point in the master domain.
Defines the topology of the tetrahedron element. Topology Sides 0 to 3 are vertices, sides 4 to 9 are lines, sides 10 to 13 are triangles and side 14 is the tetrahedra.
MElementType
Define the element types.
Definition: pzeltype.h:52
Implements computational mesh. Computational Mesh.
Definition: pzcmesh.h:47
static void GetSideHDivDirections(TPZVec< int > &sides, TPZVec< int > &dir, TPZVec< int > &bilinearounao)
static void Shape(TPZVec< REAL > &loc, TPZFMatrix< REAL > &phi, TPZFMatrix< REAL > &dphi)
Compute the shape being used to construct the x mapping from local parametric coordinates.
static int ContainedSideLocId(int side, int c)
Returns the local connect number of the connect "c" along side "side".
Contains declaration of the TPZAxesTools class which implements verifications over axes...
static bool IsInParametricDomain(const TPZVec< REAL > &pt, REAL tol=pztopology::gTolerance)
Verifies if the parametric point pt is in the element parametric domain.
static int GetTransformId(TPZVec< int64_t > &id)
Method which identifies the transformation based on the IDs of the corner nodes.
Contains the TPZTransform<> class which implements an affine transformation between points in paramet...
Defines the interface for saving and reading data. Persistency.
Definition: TPZStream.h:50
Implements an affine transformation between points in parameter space. Topology Utility.
Definition: pzmganalysis.h:14
static int SideNodeLocId(int side, int node)
Returns the local node number of the node "node" along side "side".
Handles the numerical integration for three-dimensional problems using tetraedra elements. Numerical Integration.
Definition: pzquad.h:322
This class defines the interface to save and restore objects from TPZStream objects. Persistency.
Definition: TPZSavable.h:67
Defines the interface of a computational element. Computational Element.
Definition: pzcompel.h:59
static void LowerDimensionSides(int side, TPZStack< int > &smallsides)
Get all sides with lower dimension on side.
TPZTetrahedron()
Default constructor.
static void GetSideHDivPermutation(int transformationid, TPZVec< int > &permgather)
Identifies the permutation of the nodes needed to make neighbouring elements compatible in terms of o...
void Read(TPZStream &buf, void *context) override
read objects from the stream
static void ParametricDomainNodeCoord(int node, TPZVec< REAL > &nodeCoord)
static void HigherDimensionSides(int side, TPZStack< int > &high)
Returns all sides whose closure contains side.