GemaCoreLib
The GeMA Core library
gmPyraCellGeometryInfo.h
Go to the documentation of this file.
1 /************************************************************************
2 **
3 ** Copyright (C) 2014 by Carlos Augusto Teixera Mendes
4 ** All rights reserved.
5 **
6 ** This file is part of the "GeMA" software. It's use should respect
7 ** the terms in the license agreement that can be found together
8 ** with this source code.
9 ** It is provided AS IS, with NO WARRANTY OF ANY KIND,
10 ** INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR
11 ** A PARTICULAR PURPOSE.
12 **
13 ************************************************************************/
14 
24 #ifndef _GEMA_PYRA_CELL_GEOMETRY_INFO_H_
25 #define _GEMA_PYRA_CELL_GEOMETRY_INFO_H_
26 
27 #include "gmCellGeometryInfo.h"
29 
30 #include "gmGeometryUtils.h"
31 
32 #include "gmPyraIntegrationRule.h"
33 #include "gmPyraShape.h"
34 
35 //---------------------------------------------------------
36 // Tet integration rules
37 //---------------------------------------------------------
38 
42 
46 
50 
51 //---------------------------------------------------------
52 // Pyra5 rule defaults
53 //---------------------------------------------------------
54 
59 
65 
68 
73 
74 //---------------------------------------------------------
75 // Pyra13 rule defaults
76 //---------------------------------------------------------
77 
82 
89 
92 
97 
98 
99 //---------------------------------------------------------
100 // GmPyra5CellGeometryInfo
101 //---------------------------------------------------------
102 
105  : public GmCellGeometryInfoSolidElement<GmPyraIntegrationRuleSet, GmLinearPyraIntegrationRuleSetDefaults,
106  GmPyraEdgeIntegrationRuleSet, GmLinearPyraEdgeIntegrationRuleSetDefaults,
107  GmPyraFaceIntegrationRuleSet, GmLinearPyraFaceIntegrationRuleSetDefaults>
108 {
109 public:
110  static const GmPyra5CellGeometryInfo* instance();
111 
112  // Shape factory. See comments on the base class.
113  virtual GmShape* shapeInstance(int P, int Q) const { Q_UNUSED(P); Q_UNUSED(Q); return new GmPyra5Shape; }
114 
116  virtual double dimension(const GmMatrix& X) const
117  {
118  return GmGeometryUtils::pyramidVolume(X.col(0), X.col(1), X.col(2), X.col(3), X.col(4));
119  }
120 
122  virtual void centroidCartesian(const GmMatrix& X, GmVector& coord) const
123  {
124  GmGeometryUtils::pyramidCentroid(X.col(0), X.col(1), X.col(2), X.col(3), X.col(4), coord);
125  }
126 
127  // --------- Capabilities API ---------
128 
129  virtual bool isValid(const GmMatrix& X, double tol) const
130  {
131  return GmGeometryUtils::pyra5IsWellDefined(X, tol);
132  }
133 
134 private:
140 };
141 
142 //---------------------------------------------------------
143 // GmPyra13CellGeometryInfo
144 //---------------------------------------------------------
145 
148  : public GmCellGeometryInfoSolidElement<GmPyraIntegrationRuleSet, GmQuadraticPyraIntegrationRuleSetDefaults,
149  GmPyraEdgeIntegrationRuleSet, GmQuadraticPyraEdgeIntegrationRuleSetDefaults,
150  GmPyraFaceIntegrationRuleSet, GmQuadraticPyraFaceIntegrationRuleSetDefaults>
151 {
152 public:
153  static const GmPyra13CellGeometryInfo* instance();
154 
155  // Shape factory. See comments on the base class.
156  virtual GmShape* shapeInstance(int P, int Q) const { Q_UNUSED(P); Q_UNUSED(Q); return new GmPyra13Shape; }
157 
159  virtual double dimension(const GmMatrix& X) const { return dimensionByIntegration(X); }
160 
162  virtual void centroidCartesian(const GmMatrix& X, GmVector& coord) const { centroidByIntegration(X, coord); }
163 
164  // --------- Capabilities API ---------
165 
166  virtual bool isValid(const GmMatrix& X, double tol) const
167  {
168  return GmGeometryUtils::pyra13ValidEdges(X) &&
169  GmGeometryUtils::pyra5IsWellDefined(X, tol);
170  }
171 
172 private:
178 };
179 
180 #endif
181 
GmCellGeometryIntegrationRuleSetDefaultRules< GM_GAUSS_RULE_TYPE, 5, -1, -1, -1 > GmQuadraticPyraIntegrationRuleSetDefaults
The set of default rules for an Pyra13 ELEMENT. Template parameters 5 are the default rule numbers fo...
Definition: gmPyraCellGeometryInfo.h:81
double pyramidVolume(const GmVector &p1, const GmVector &p2, const GmVector &p3, const GmVector &p4, const GmVector &p5)
Calculates the volume of the given pyramid. Points follow the standard pyramid cell definition.
Definition: gmGeometryUtils.cpp:269
virtual GmShape * shapeInstance(int P, int Q) const
Shape function factory. Should return a NEW instance of the shape function object for this type....
Definition: gmPyraCellGeometryInfo.h:113
void centroidByIntegration(const GmMatrix &X, GmVector &coord, const GmIntegrationRule *ir=NULL) const
Given a cell geometry defined by matrix X (with node coordinates organized by column) performs a nume...
Definition: gmCellGeometryInfo.cpp:114
Gauss rules.
Definition: gmIntegrationRule.h:75
void pyramidCentroid(const GmVector &p1, const GmVector &p2, const GmVector &p3, const GmVector &p4, const GmVector &p5, GmVector &coord)
Returns the cartesian coordinate of the pyramid centroid.
Definition: gmGeometryUtils.cpp:419
An auxiliary class that can be used as base for solid elements. Implements the needed integration rul...
Definition: gmCellGeometryInfo.h:380
GmCellGeometryIntegrationRuleSet< GmPyraGaussFaceIntegrationRule, GmCellGeometryNullIntegrationRule, GmCellGeometryNullIntegrationRule, GmCellGeometryNullIntegrationRule > GmPyraFaceIntegrationRuleSet
The set of possible FACE integration rules, per integration rule type, for the family of Tet elements...
Definition: gmPyraCellGeometryInfo.h:45
A type used to represent a 'unexistant" integration rule. Should be used as template parameter for Gm...
Definition: gmCellGeometryIntegrationRuleSet.h:35
GmCellGeometryIntegrationRuleSet< GmPyraGaussEdgeIntegrationRule, GmCellGeometryNullIntegrationRule, GmCellGeometryNullIntegrationRule, GmCellGeometryNullIntegrationRule > GmPyraEdgeIntegrationRuleSet
The set of possible EDGE integration rules, per integration rule type, for the family of Tet elements...
Definition: gmPyraCellGeometryInfo.h:49
GmCellGeometryIntegrationRuleSetDefaultRules< GM_GAUSS_RULE_TYPE, 3, -1, -1, -1 > GmLinearPyraTriFaceIntegrationRuleSetDefaults
For the Pyra5 FACE rules, we define a rule for triangular faces and a rule for quad faces,...
Definition: gmPyraCellGeometryInfo.h:63
virtual double dimension(const GmMatrix &X) const
Returns the Pyra5 volume.
Definition: gmPyraCellGeometryInfo.h:116
A helper class used to store the default rules for each rule type. Template parameters are the defaul...
Definition: gmCellGeometryIntegrationRuleSet.h:43
Gauss integration rule for Tet element borders (edges)
Definition: gmPyraIntegrationRule.h:85
GmPyra13CellGeometryInfo(GmCellGeometryMetadata &&metadata)
Protected constructor. Only a single Hex20 geometry info object is ever necessary,...
Definition: gmPyraCellGeometryInfo.h:174
virtual GmShape * shapeInstance(int P, int Q) const
Shape function factory. Should return a NEW instance of the shape function object for this type....
Definition: gmPyraCellGeometryInfo.h:156
GmShape specialization for a Tetrahedron with 4 nodes object.
Definition: gmPyraShape.h:129
virtual bool isValid(const GmMatrix &X, double tol) const
Virtual method that should be implemented if this geometry info supports the GM_CELL_GEOMETRY_VALID c...
Definition: gmPyraCellGeometryInfo.h:129
Declaration of the 3D Pyra shapes inheriting from GmShape class.
Shape function handling base classe.
Definition: gmShape.h:37
GmCellGeometryIntegrationRuleSetDefaultRules< GM_GAUSS_RULE_TYPE, 2, -1, -1, -1 > GmQuadraticPyraEdgeIntegrationRuleSetDefaults
The set of default rules for an Pyra13 EDGE. Template parameters 2 to 5 are the default rule numbers ...
Definition: gmPyraCellGeometryInfo.h:96
Declaration of the GmCellGeometryIntegrationRuleSet class & friends.
GmCellGeometryIntegrationRuleSetDefaultRules< GM_GAUSS_RULE_TYPE, 3, -1, -1, -1 > GmQuadraticPyraTriFaceIntegrationRuleSetDefaults
The set of default rules for an Pyra13 FACE. we define a rule for triangular faces and a rule for qua...
Definition: gmPyraCellGeometryInfo.h:87
3D integration rules for Pyramid elements
Definition: gmPyraIntegrationRule.h:40
virtual void centroidCartesian(const GmMatrix &X, GmVector &coord) const
Returns the Tet10 centroid by numeric integration.
Definition: gmPyraCellGeometryInfo.h:162
A helper class used to store the class types for each rule type. Template parameters are the implemen...
Definition: gmCellGeometryIntegrationRuleSet.h:196
The Pyra13 implementation.
Definition: gmPyraCellGeometryInfo.h:147
GmCellGeometryIntegrationRuleSetDefaultRules< GM_GAUSS_RULE_TYPE, 5, -1, -1, -1 > GmLinearPyraIntegrationRuleSetDefaults
The set of default rules for an Pyra5 ELEMENT. Template parameters 5 are the default rule numbers for...
Definition: gmPyraCellGeometryInfo.h:58
Utilitary functions for working with geometry.
Newton Integration rule for pyramid elements. Should be included.
Definition: gmPyraIntegrationRule.h:70
double dimensionByIntegration(const GmMatrix &X, const GmIntegrationRule *ir=NULL) const
Given a cell geometry defined by matrix X (with node coordinates organized by column) performs a nume...
Definition: gmCellGeometryInfo.cpp:76
#define GMC_API_EXPORT
Macro for controling if the class is being exported (GEMA_CORE_LIB defined) or imported (GEMA_CORE_LI...
Definition: gmCoreConfig.h:35
GmPyra5CellGeometryInfo(GmCellGeometryMetadata &&metadata)
Protected constructor. Only a single Hex8 geometry info object is ever necessary, created by GmTetCel...
Definition: gmPyraCellGeometryInfo.h:136
virtual double dimension(const GmMatrix &X) const
Returns the Tet10 volume by numeric integration.
Definition: gmPyraCellGeometryInfo.h:159
GmShape specialization for a Pyramid with 5 nodes object.
Definition: gmPyraShape.h:104
virtual bool isValid(const GmMatrix &X, double tol) const
Virtual method that should be implemented if this geometry info supports the GM_CELL_GEOMETRY_VALID c...
Definition: gmPyraCellGeometryInfo.h:166
A helper class used to store the default rules for elements with more than one face type (like wedges...
Definition: gmCellGeometryIntegrationRuleSet.h:117
Declaration of the GmCellGeometryInfo base class.
GmCellGeometryIntegrationRuleSetDefaultRules< GM_GAUSS_RULE_TYPE, 2, -1, -1, -1 > GmLinearPyraEdgeIntegrationRuleSetDefaults
The set of default rules for an Pyra5 EDGE. Template parameters 2 to 5 are the default rule numbers f...
Definition: gmPyraCellGeometryInfo.h:72
Declaration of the GmPyraXxxxIntegrationRule family of classes, including border rules....
arma::vec GmVector
The basic type for a GeMA vector object. Currently based on an Armadillo vector.
Definition: gmVector.h:34
The Pyra5 implementation.
Definition: gmPyraCellGeometryInfo.h:104
arma::mat GmMatrix
The basic type for a GeMA matrix object. Currently based on an Armadillo matrix.
Definition: gmMatrix.h:38
GmCellGeometryIntegrationRuleSet< GmPyraGaussIntegrationRule, GmCellGeometryNullIntegrationRule, GmCellGeometryNullIntegrationRule, GmCellGeometryNullIntegrationRule > GmPyraIntegrationRuleSet
The set of possible ELEMENT integration rules, per integration rule type, for the family of Tet eleme...
Definition: gmPyraCellGeometryInfo.h:41
virtual void centroidCartesian(const GmMatrix &X, GmVector &coord) const
Returns the Tet4 centroid by calculating the mean of the vertices (simplex centroid)
Definition: gmPyraCellGeometryInfo.h:122
Plane structure storing the full set of geometric metadata for a cell type.
Definition: gmCellGeometryInfo.h:57