NeoPZ
tpzquadrilateral.h
Go to the documentation of this file.
1 
6 #ifndef PZTOPOLOGYTPZQUADRILATERAL_H
7 #define PZTOPOLOGYTPZQUADRILATERAL_H
8 
9 #include "pzfmatrix.h"
10 #include "pzstack.h"
11 #include "pztrnsform.h"
12 #include "pzquad.h"
13 #include "pzeltype.h"
14 #include "pzaxestools.h"
15 #include "TPZTopologyUtils.h"
16 
17 #ifdef _AUTODIFF
18 #include "fadType.h"
19 #endif
20 
21 class TPZIntPoints;
22 class TPZIntQuad;
23 class TPZGraphElQ2dd;
24 
25 class TPZCompEl;
26 class TPZGeoEl;
27 class TPZCompMesh;
28 
30 namespace pztopology {
37  class TPZQuadrilateral : public TPZSavable {
38  public:
39 
40  friend void pztopology::GetPermutation<TPZQuadrilateral>(const int permute, TPZVec<int> &permutation);
42  enum {NSides = 9, NCornerNodes = 4, Dimension = 2, NFaces = 4, NPermutations = 8};
43  int ClassId() const override;
44  void Read(TPZStream &buf, void *context) override;
45  void Write(TPZStream &buf, int withclassid) const override;
46 
47 
50  }
51 
53  virtual ~TPZQuadrilateral() {
54  }
55 
60  static int SideDimension(int side);
61 
63  static void LowerDimensionSides(int side,TPZStack<int> &smallsides);
65  static void LowerDimensionSides(int side,TPZStack<int> &smallsides, int DimTarget);
66 
72  static void HigherDimensionSides(int side, TPZStack<int> &high);
73 
75  static int NSideNodes(int side);
77  static int SideNodeLocId(int side, int node);
78 
80  static int NumSides() {
81  return NSides;
82  }
84  static int NumSides(int dimension);
85 
87  static int NContainedSides(int side);
88 
90  static int ContainedSideLocId(int side, int c);
91 
92 
94  static void Shape(TPZVec<REAL> &loc,TPZFMatrix<REAL> &phi,TPZFMatrix<REAL> &dphi){
95  TShape(loc, phi, dphi);
96  }
98  template<class T>
99  static void TShape(const TPZVec<T> &loc,TPZFMatrix<T> &phi,TPZFMatrix<T> &dphi);
108  template<class T>
109  static void BlendFactorForSide(const int &side, const TPZVec<T> &xi, T &blendFactor,
110  TPZVec<T> &corrFactorDxi);
117  static void CenterPoint(int side, TPZVec<REAL> &center);
118 
120  static bool IsInParametricDomain(const TPZVec<REAL> &pt, REAL tol = pztopology::gTolerance);
121 
122  #ifdef _AUTODIFF
123 
124  static bool IsInParametricDomain(const TPZVec<Fad<REAL>> &pt, REAL tol = pztopology::gTolerance){
125  TPZVec<REAL> xi(pt.size());
126  for(int i = 0; i < pt.size(); i++) xi[i]= pt[i].val();
127  return IsInParametricDomain(xi,tol);
128  }
129  #endif
130  #ifdef _AUTODIFF
131  template<typename T,
132  typename std::enable_if<std::is_same<T,Fad<REAL>>::value>::type* = nullptr>
133  static bool IsInParametricDomain(const TPZVec<T> &pt, REAL tol){
134  TPZVec<REAL> qsiReal(pt.size(),-1);
135  for(int i = 0; i < qsiReal.size(); i++) qsiReal[i] = pt[i].val();
136  return IsInParametricDomain(qsiReal,tol);
137  }
138  #endif
139 
141  static void RandomPoint(TPZVec<REAL> &pt);
142 
150  template<class T>
151  static bool CheckProjectionForSingularity(const int &side, const TPZVec<T> &xiInterior);
152 
153  template<class T>
154  static void MapToSide(int side, TPZVec<T> &InternalPar, TPZVec<T> &SidePar, TPZFMatrix<T> &JacToSide);
155 
156  static void ParametricDomainNodeCoord(int node, TPZVec<REAL> &nodeCoord);
157 
164  static MElementType Type();
165 
167  static MElementType Type(int side);
168 
180  static TPZTransform<> SideToSideTransform(int sidefrom, int sideto);
181 
187  static TPZTransform<> TransformSideToElement(int side);
193  static TPZTransform<> TransformElementToSide(int side);
194 
200  static int GetTransformId(TPZVec<int64_t> &id);
201 
209  static int GetTransformId(int side, TPZVec<int64_t> &id);
210 
214  static void GetGatherPermute(int transformid, TPZVec<int> &permute);
215 
226  static TPZIntPoints * CreateSideIntegrationRule(int side, int order);
227 
232 
242  static void GetSideHDivPermutation(int transformid, TPZVec<int> &permgather);
243 
245  static constexpr REAL RefElVolume() { return 4.0L; }
246 
247  /* Given gradx the method returns directions needed for Hdiv space */
248  static void ComputeDirections(int is, TPZFMatrix<REAL> &gradx, TPZFMatrix<REAL> &directions, TPZVec<int> &sidevectors);
250  static void GetSideHDivDirections(TPZVec<int> &sides, TPZVec<int> &dir, TPZVec<int> &bilinearounao, TPZVec<int> &sidevectors);
251 
252 
254  template <class TVar>
255  static void ComputeHDivDirections(TPZFMatrix<TVar> &gradx, TPZFMatrix<TVar> &directions);
256 
272  template <class TVar>
273  static void ComputeHCurlDirections(TPZFMatrix<TVar> &gradx, TPZFMatrix<TVar> &directions, const TPZVec<int> &transformationIds);
274 
282  template <class TVar>
283  static void ComputeHCurlFaceDirections(TPZVec<TVar> &v1, TPZVec<TVar> &v2, int transformationId);
287  static int NBilinearSides();
288 
289 
291 
292  static void SetHdivType(EHdivType val);
293  protected:
295  static int fPermutations [8][9];
296  static REAL fTangentVectors [16][2];
297  static int FaceNodes[1][4]; // Denise e Jose: dim =2
298  static int SideNodes[4][2]; // Denise e Jose: dim = 1
299  };
300 
301 }
302 
303 #endif
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 bilinearounao[81]
Definition: tpzcube.cpp:405
static void BlendFactorForSide(const int &side, const TPZVec< T > &xi, T &blendFactor, TPZVec< T > &corrFactorDxi)
Contains the TPZInt1d, TPZIntTriang, TPZIntQuad, TPZIntCube3D, TPZIntTetra3D, TPZIntPyram3D and TPZIn...
TPZGraphElQ2dd GraphElType
Typedef to graphical element type.
static void CenterPoint(int side, TPZVec< REAL > &center)
returns the barycentric coordinates in the master element space of the original element ...
static void GetGatherPermute(int transformid, TPZVec< int > &permute)
return the vector which permutes the connects according to the transformation id
static REAL fTangentVectors[16][2]
clarg::argInt dimension("-d", "Matrices dimension M x M", 1000)
TPZIntQuad IntruleType
Typedef to numerical integration rule.
To export a graphical two-dimensional discontinuous element. Post processing.
Definition: pzgraphelq2dd.h:16
static void GetSideHDivPermutation(int transformid, TPZVec< int > &permgather)
Identifies the permutation of the nodes needed to make neighbouring elements compatible in terms of o...
static TPZTransform TransformElementToSide(int side)
Returns the transformation which transform a point from the interior of the element to the side...
static void ComputeDirections(int is, TPZFMatrix< REAL > &gradx, TPZFMatrix< REAL > &directions, TPZVec< int > &sidevectors)
Definition: fad.h:54
static int NSideNodes(int side)
return the number of vertices (not connectivities) associated with a side
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 fPermutations[8][9]
Valid permutations between nodes.
static TPZTransform SideToSideTransform(int sidefrom, int sideto)
returns the transformation which takes a point from the side sidefrom to the side sideto ...
virtual ~TPZQuadrilateral()
Default destructor.
static REAL gTolerance
Abstract class defining integration rules. Numerical Integration.
Definition: tpzintpoints.h:19
static void GetSideHDivDirections(TPZVec< int > &sides, TPZVec< int > &dir, TPZVec< int > &bilinearounao)
int ClassId() const override
Define the class id associated with the class.
int64_t size() const
Returns the number of elements of the vector.
Definition: pzvec.h:196
Handles the numerical integration for two-dimensional problems using quadrilateral elements...
Definition: pzquad.h:156
static const double tol
Definition: pzgeoprism.cpp:23
Groups all classes defining the structure of the master element.
Definition: PrismExtend.cpp:15
static void ComputeHDivDirections(TPZFMatrix< TVar > &gradx, TPZFMatrix< TVar > &directions)
Compute the directions of the HDiv vectors.
Defines the behaviour of all geometric elements. GeometryTPZGeoEl is the common denominator for all g...
Definition: pzgeoel.h:43
void Read(TPZStream &buf, void *context) override
read objects from the stream
Contains TPZMatrixclass which implements full matrix (using column major representation).
static void ComputeHCurlFaceDirections(TPZVec< TVar > &v1, TPZVec< TVar > &v2, int transformationId)
static void LowerDimensionSides(int side, TPZStack< int > &smallsides)
Get all sides with lower dimension on side.
static void ParametricDomainNodeCoord(int node, TPZVec< REAL > &nodeCoord)
static bool CheckProjectionForSingularity(const int &side, const TPZVec< T > &xiInterior)
static constexpr REAL RefElVolume()
Volume of the master element (measure)
static void RandomPoint(TPZVec< REAL > &pt)
Generates a random point in the master domain.
static void MapToSide(int side, TPZVec< T > &InternalPar, TPZVec< T > &SidePar, TPZFMatrix< T > &JacToSide)
static TPZTransform TransformSideToElement(int side)
Returns the transformation which transform a point from the side to the interior of the element...
A simple stack.
static MElementType Type()
Returns the type of the element as specified in file pzeltype.h.
void Write(TPZStream &buf, int withclassid) const override
Writes this object to the TPZStream buffer. Include the classid if withclassid = true.
static int NContainedSides(int side)
return the number of sides contained in the closure of a side
static int NumSides()
Returns number of sides of the element (9)
static int ContainedSideLocId(int side, int c)
returns the local side number of the side "c" contained in the closure of side "side" ...
MElementType
Define the element types.
Definition: pzeltype.h:52
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 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.
Implements computational mesh. Computational Mesh.
Definition: pzcmesh.h:47
Defines the topology of a quadrilateral element. Topology Sides 0 to 3 are vertices, sides 4 to 7 are lines, side 8 is the quadrilateral.
static void SetHdivType(EHdivType val)
Contains declaration of the TPZAxesTools class which implements verifications over axes...
static int GetTransformId(TPZVec< int64_t > &id)
Method which identifies the transformation based on the IDs of the corner nodes.
static int SideDimension(int side)
returns the dimension of the side
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
This class defines the interface to save and restore objects from TPZStream objects. Persistency.
Definition: TPZSavable.h:67
static int SideNodeLocId(int side, int node)
returns the local node number of the node "node" along side "side"
TPZQuadrilateral()
Default constructor.
Defines the interface of a computational element. Computational Element.
Definition: pzcompel.h:59
static void ComputeHCurlDirections(TPZFMatrix< TVar > &gradx, TPZFMatrix< TVar > &directions, const TPZVec< int > &transformationIds)
static TPZIntPoints * CreateSideIntegrationRule(int side, int order)
Create an integration rule over side.
static void HigherDimensionSides(int side, TPZStack< int > &high)
returns all sides whose closure contains side