GemaCoreLib
The GeMA Core library
Loading...
Searching...
No Matches
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
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{
109public:
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 bool localAxis(const GmMatrix&X, GmMatrix& R) const { Q_UNUSED(X); R = arma::eye(3, 3); return false; }
123
125 virtual void centroidCartesian(const GmMatrix& X, GmVector& coord) const
126 {
127 GmGeometryUtils::pyramidCentroid(X.col(0), X.col(1), X.col(2), X.col(3), X.col(4), coord);
128 }
129
130 // --------- Capabilities API ---------
131
132 virtual int isValid(const GmMatrix& X, double tol) const
133 {
134 int ret = GM_GEOMETRY_STATE_VALID;
135 if (!GmGeometryUtils::isCoplanar3D(X.col(0), X.col(1), X.col(2), X.col(3), tol)) ret |= GM_GEOMETRY_STATE_NON_PLANAR;
136 if (!GmGeometryUtils::pyra5IsWellDefined(X, tol)) ret |= GM_GEOMETRY_STATE_BAD_ORIENTATION;
137 return ret;
138 }
139
140private:
146};
147
148//---------------------------------------------------------
149// GmPyra13CellGeometryInfo
150//---------------------------------------------------------
151
154 : public GmCellGeometryInfoSolidElement<GmPyraIntegrationRuleSet, GmQuadraticPyraIntegrationRuleSetDefaults,
155 GmPyraEdgeIntegrationRuleSet, GmQuadraticPyraEdgeIntegrationRuleSetDefaults,
156 GmPyraFaceIntegrationRuleSet, GmQuadraticPyraFaceIntegrationRuleSetDefaults>
157{
158public:
159 static const GmPyra13CellGeometryInfo* instance();
160
161 // Shape factory. See comments on the base class.
162 virtual GmShape* shapeInstance(int P, int Q) const { Q_UNUSED(P); Q_UNUSED(Q); return new GmPyra13Shape; }
163
165 virtual double dimension(const GmMatrix& X) const { return dimensionByIntegration(X); }
166
168 virtual void centroidCartesian(const GmMatrix& X, GmVector& coord) const { centroidByIntegration(X, coord); }
169
171 virtual bool localAxis(const GmMatrix&X, GmMatrix& R) const {Q_UNUSED(X); R = arma::eye(3, 3); return false; }
172
173 // --------- Capabilities API ---------
174
175 virtual int isValid(const GmMatrix& X, double tol) const
176 {
177 int ret = GM_GEOMETRY_STATE_VALID;
178 if (!GmGeometryUtils::pyra13ValidEdges(X)) ret |= GM_GEOMETRY_STATE_BAD_EDGE;
179 if (!GmGeometryUtils::pyra5IsWellDefined(X, tol)) ret |= GM_GEOMETRY_STATE_BAD_ORIENTATION;
180 if (!GmGeometryUtils::isCoplanar3D(X.col(0), X.col(1), X.col(2), X.col(3), tol)) ret |= GM_GEOMETRY_STATE_NON_PLANAR;
181 return ret;
182 }
183
184private:
190};
191
192#endif
193
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
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
An auxiliary class that can be used as base for solid elements. Implements the needed integration rul...
Definition gmCellGeometryInfo.h:440
A helper class used to store the default rules for each rule type. Template parameters are the defaul...
Definition gmCellGeometryIntegrationRuleSet.h:44
A helper class used to store the class types for each rule type. Template parameters are the implemen...
Definition gmCellGeometryIntegrationRuleSet.h:197
A helper class used to store the default rules for elements with more than one face type (like wedges...
Definition gmCellGeometryIntegrationRuleSet.h:118
A type used to represent a 'unexistant" integration rule. Should be used as template parameter for Gm...
Definition gmCellGeometryIntegrationRuleSet.h:35
The Pyra13 implementation.
Definition gmPyraCellGeometryInfo.h:157
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:162
GmPyra13CellGeometryInfo(GmCellGeometryMetadata &&metadata)
Protected constructor. Only a single Hex20 geometry info object is ever necessary,...
Definition gmPyraCellGeometryInfo.h:186
virtual bool localAxis(const GmMatrix &X, GmMatrix &R) const
Local axis for Pyra == Identity.
Definition gmPyraCellGeometryInfo.h:171
virtual int 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:175
virtual void centroidCartesian(const GmMatrix &X, GmVector &coord) const
Returns the Tet10 centroid by numeric integration.
Definition gmPyraCellGeometryInfo.h:168
virtual double dimension(const GmMatrix &X) const
Returns the Tet10 volume by numeric integration.
Definition gmPyraCellGeometryInfo.h:165
GmShape specialization for a Tetrahedron with 4 nodes object.
Definition gmPyraShape.h:133
The Pyra5 implementation.
Definition gmPyraCellGeometryInfo.h:108
virtual double dimension(const GmMatrix &X) const
Returns the Pyra5 volume.
Definition gmPyraCellGeometryInfo.h:116
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:125
virtual bool localAxis(const GmMatrix &X, GmMatrix &R) const
Local axis for Pyra == Identity.
Definition gmPyraCellGeometryInfo.h:122
virtual int 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:132
GmPyra5CellGeometryInfo(GmCellGeometryMetadata &&metadata)
Protected constructor. Only a single Hex8 geometry info object is ever necessary, created by GmTetCel...
Definition gmPyraCellGeometryInfo.h:142
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
GmShape specialization for a Pyramid with 5 nodes object.
Definition gmPyraShape.h:108
Gauss integration rule for Tet element borders (edges)
Definition gmPyraIntegrationRule.h:86
Newton Integration rule for pyramid elements. Should be included.
Definition gmPyraIntegrationRule.h:71
3D integration rules for Pyramid elements
Definition gmPyraIntegrationRule.h:41
Shape function handling base classe.
Definition gmShape.h:38
Declaration of the GmCellGeometryInfo base class.
Declaration of the GmCellGeometryIntegrationRuleSet class & friends.
#define GMC_API_EXPORT
Macro for controlling if the class is being exported (GEMA_CORE_LIB defined) or imported (GEMA_CORE_L...
Definition gmCoreConfig.h:35
Utilitary functions for working with geometry.
@ GM_GAUSS_RULE_TYPE
Gauss rules.
Definition gmIntegrationRule.h:75
arma::mat GmMatrix
The basic type for a GeMA matrix object. Currently based on an Armadillo matrix.
Definition gmMatrix.h:38
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
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
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
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
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
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
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
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
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
Declaration of the GmPyraXxxxIntegrationRule family of classes, including border rules....
Declaration of the 3D Pyra shapes inheriting from GmShape class.
arma::vec GmVector
The basic type for a GeMA vector object. Currently based on an Armadillo vector.
Definition gmVector.h:34
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:240
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:388
Plane structure storing the full set of geometric metadata for a cell type.
Definition gmCellGeometryInfo.h:69