GemaCoreLib
The GeMA Core library
Loading...
Searching...
No Matches
gmTetCellGeometryInfo.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_TET_CELL_GEOMETRY_INFO_H_
25#define _GEMA_TET_CELL_GEOMETRY_INFO_H_
26
27#include "gmCellGeometryInfo.h"
29
30#include "gmGeometryUtils.h"
31
33#include "gmTetShape.h"
34
35//---------------------------------------------------------
36// Tet integration rules
37//---------------------------------------------------------
38
42
46
50
51//---------------------------------------------------------
52// Tet4 rule defaults
53//---------------------------------------------------------
54
59
64
69
70//---------------------------------------------------------
71// Tet10 rule defaults
72//---------------------------------------------------------
73
78
83
88
89
90//---------------------------------------------------------
91// GmTet4CellGeometryInfo
92//---------------------------------------------------------
93
96 : public GmCellGeometryInfoSolidElement<GmTetIntegrationRuleSet, GmLinearTetIntegrationRuleSetDefaults,
97 GmTetEdgeIntegrationRuleSet, GmLinearTetEdgeIntegrationRuleSetDefaults,
98 GmTetFaceIntegrationRuleSet, GmLinearTetFaceIntegrationRuleSetDefaults>
99{
100public:
101 static const GmTet4CellGeometryInfo* instance();
102
103 // Shape factory. See comments on the base class.
104 virtual GmShape* shapeInstance(int P, int Q) const { Q_UNUSED(P); Q_UNUSED(Q); return new GmTet4Shape; }
105
107 virtual double dimension(const GmMatrix& X) const
108 {
109 return GmGeometryUtils::tetrahedronVolume(X.col(0), X.col(1), X.col(2), X.col(3));
110 }
111
113 virtual void centroidCartesian(const GmMatrix& X, GmVector& coord) const
114 {
115 GmGeometryUtils::tetrahedronCentroid(X.col(0), X.col(1), X.col(2), X.col(3), coord);
116 }
117
119 virtual bool localAxis(const GmMatrix&X, GmMatrix& R) const { Q_UNUSED(X); R = arma::eye(3, 3); return false; }
120
121 // --------- Capabilities API ---------
122
123 // See comments on the base class
124 virtual int isValid(const GmMatrix& X, double tol) const
125 {
126 Q_UNUSED(tol);
127 int ret = GM_GEOMETRY_STATE_VALID;
128 if (!GmGeometryUtils::tet4IsWellDefined(X.col(0), X.col(1), X.col(2), X.col(3))) ret |= GM_GEOMETRY_STATE_BAD_ORIENTATION;
129 return ret;
130 }
131
132 // See comments on the base class
133 virtual bool contains(const GmMatrix& X, const GmVector& coord) const { return GmGeometryUtils::pointInTetrahedron(X, coord); }
134
135private:
141};
142
143//---------------------------------------------------------
144// GmTet10CellGeometryInfo
145//---------------------------------------------------------
146
149 : public GmCellGeometryInfoSolidElement<GmTetIntegrationRuleSet, GmQuadraticTetIntegrationRuleSetDefaults,
150 GmTetEdgeIntegrationRuleSet, GmQuadraticTetEdgeIntegrationRuleSetDefaults,
151 GmTetFaceIntegrationRuleSet, GmQuadraticTetFaceIntegrationRuleSetDefaults>
152{
153public:
154 static const GmTet10CellGeometryInfo* instance();
155
156 // Shape factory. See comments on the base class.
157 virtual GmShape* shapeInstance(int P, int Q) const { Q_UNUSED(P); Q_UNUSED(Q); return new GmTet10Shape; }
158
160 virtual double dimension(const GmMatrix& X) const { return dimensionByIntegration(X); }
161
163 virtual void centroidCartesian(const GmMatrix& X, GmVector& coord) const { centroidByIntegration(X, coord); }
164
166 virtual bool localAxis(const GmMatrix&X, GmMatrix& R) const {Q_UNUSED(X); R = arma::eye(3, 3); return false; }
167
168 // --------- Capabilities API ---------
169 //For now same check as Tet4
170 virtual int isValid(const GmMatrix& X, double tol) const
171 {
172 Q_UNUSED(tol);
173 int ret = GM_GEOMETRY_STATE_VALID;
174 if (!GmGeometryUtils::tet10ValidEdges(X)) ret |= GM_GEOMETRY_STATE_BAD_EDGE;
175 if (!GmGeometryUtils::tet4IsWellDefined(X.col(0), X.col(1), X.col(2), X.col(3))) ret |= GM_GEOMETRY_STATE_BAD_ORIENTATION;
176 return ret;
177 }
178
179private:
185};
186
187#endif
188
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 type used to represent a 'unexistant" integration rule. Should be used as template parameter for Gm...
Definition gmCellGeometryIntegrationRuleSet.h:35
Shape function handling base classe.
Definition gmShape.h:38
The Tet10 implementation.
Definition gmTetCellGeometryInfo.h:152
virtual bool localAxis(const GmMatrix &X, GmMatrix &R) const
Local axis for Tet == Identity.
Definition gmTetCellGeometryInfo.h:166
virtual double dimension(const GmMatrix &X) const
Returns the Tet10 volume by numeric integration.
Definition gmTetCellGeometryInfo.h:160
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 gmTetCellGeometryInfo.h:170
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 gmTetCellGeometryInfo.h:157
GmTet10CellGeometryInfo(GmCellGeometryMetadata &&metadata)
Protected constructor. Only a single Hex20 geometry info object is ever necessary,...
Definition gmTetCellGeometryInfo.h:181
virtual void centroidCartesian(const GmMatrix &X, GmVector &coord) const
Returns the Tet10 centroid by numeric integration.
Definition gmTetCellGeometryInfo.h:163
GmShape specialization for a Tetrahedron with 4 nodes object.
Definition gmTetShape.h:143
The Tet4 implementation.
Definition gmTetCellGeometryInfo.h:99
virtual bool contains(const GmMatrix &X, const GmVector &coord) const
Virtual method that should be implemented if this geometry info supports the GM_CELL_GEOMETRY_CONTAIN...
Definition gmTetCellGeometryInfo.h:133
virtual double dimension(const GmMatrix &X) const
Returns the Tet4 volume.
Definition gmTetCellGeometryInfo.h:107
virtual void centroidCartesian(const GmMatrix &X, GmVector &coord) const
Returns the Tet4 centroid by calculating the mean of the vertices (simplex centroid)
Definition gmTetCellGeometryInfo.h:113
GmTet4CellGeometryInfo(GmCellGeometryMetadata &&metadata)
Protected constructor. Only a single Hex8 geometry info object is ever necessary, created by GmTetCel...
Definition gmTetCellGeometryInfo.h:137
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 gmTetCellGeometryInfo.h:104
virtual bool localAxis(const GmMatrix &X, GmMatrix &R) const
Local axis for Tet == Identity.
Definition gmTetCellGeometryInfo.h:119
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 gmTetCellGeometryInfo.h:124
GmShape specialization for a Tetrahedron with 4 nodes object.
Definition gmTetShape.h:109
Gauss integration rule for Tet element borders (edges)
Definition gmTetIntegrationRule.h:109
Gauss integration rule for Tet element faces.
Definition gmTetIntegrationRule.h:96
3D integration rules for Tet elements
Definition gmTetIntegrationRule.h:44
Newton Integration rule for tetrahedron elements. Accepts both open and closed rules.
Definition gmTetIntegrationRule.h:67
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, 3, -1, -1, -1 > GmLinearTetFaceIntegrationRuleSetDefaults
The set of default rules for an Tet4 FACE. Template parameters 2 to 5 are the default rule numbers fo...
Definition gmTetCellGeometryInfo.h:63
GmCellGeometryIntegrationRuleSetDefaultRules< GM_GAUSS_RULE_TYPE, 3, -1, -1, -1 > GmQuadraticTetFaceIntegrationRuleSetDefaults
The set of default rules for an Tet10 FACE. Template parameters 2 to 5 are the default rule numbers f...
Definition gmTetCellGeometryInfo.h:82
GmCellGeometryIntegrationRuleSetDefaultRules< GM_GAUSS_RULE_TYPE, 4, -1, 1, 1 > GmLinearTetIntegrationRuleSetDefaults
The set of default rules for an Tet4 ELEMENT. Template parameters 2 to 5 are the default rule numbers...
Definition gmTetCellGeometryInfo.h:58
GmCellGeometryIntegrationRuleSetDefaultRules< GM_GAUSS_RULE_TYPE, 4, -1, 2, 2 > GmQuadraticTetIntegrationRuleSetDefaults
The set of default rules for an Tet10 ELEMENT. Template parameters 2 to 5 are the default rule number...
Definition gmTetCellGeometryInfo.h:77
GmCellGeometryIntegrationRuleSetDefaultRules< GM_GAUSS_RULE_TYPE, 2, -1, -1, -1 > GmQuadraticTetEdgeIntegrationRuleSetDefaults
The set of default rules for an Tet10 EDGE. Template parameters 2 to 5 are the default rule numbers f...
Definition gmTetCellGeometryInfo.h:87
GmCellGeometryIntegrationRuleSet< GmTetGaussFaceIntegrationRule, GmCellGeometryNullIntegrationRule, GmCellGeometryNullIntegrationRule, GmCellGeometryNullIntegrationRule > GmTetFaceIntegrationRuleSet
The set of possible FACE integration rules, per integration rule type, for the family of Tet elements...
Definition gmTetCellGeometryInfo.h:45
GmCellGeometryIntegrationRuleSetDefaultRules< GM_GAUSS_RULE_TYPE, 2, -1, -1, -1 > GmLinearTetEdgeIntegrationRuleSetDefaults
The set of default rules for an Tet4 EDGE. Template parameters 2 to 5 are the default rule numbers fo...
Definition gmTetCellGeometryInfo.h:68
GmCellGeometryIntegrationRuleSet< GmTetGaussEdgeIntegrationRule, GmCellGeometryNullIntegrationRule, GmCellGeometryNullIntegrationRule, GmCellGeometryNullIntegrationRule > GmTetEdgeIntegrationRuleSet
The set of possible EDGE integration rules, per integration rule type, for the family of Tet elements...
Definition gmTetCellGeometryInfo.h:49
GmCellGeometryIntegrationRuleSet< GmTetGaussIntegrationRule, GmCellGeometryNullIntegrationRule, GmTetNewtonIntegrationRule, GmTetNewtonIntegrationRule > GmTetIntegrationRuleSet
The set of possible ELEMENT integration rules, per integration rule type, for the family of Tet eleme...
Definition gmTetCellGeometryInfo.h:41
Declaration of the GmTetXxxxIntegrationRule family of classes, including border rules....
Declaration of the 3D tet shapes inheriting from GmShape class Previosuly part of the gmShape3D....
arma::vec GmVector
The basic type for a GeMA vector object. Currently based on an Armadillo vector.
Definition gmVector.h:34
static bool pointInTetrahedron(const GmMatrix &X, const GmVector &p, QVector< bool > &ss)
Helper function for pointInTetrahedron(X, p) also returning the "same side" vector.
Definition gmGeometryUtils.cpp:753
void tetrahedronCentroid(const GmVector &p1, const GmVector &p2, const GmVector &p3, const GmVector &p4, GmVector &coord)
Returns the cartesian coordinate of the tetrahedron centroid.
Definition gmGeometryUtils.cpp:342
double tetrahedronVolume(const GmVector &p1, const GmVector &p2, const GmVector &p3, const GmVector &p4)
Calculates the volume of the given tetrahedron. Points follow the standard Tet cell definition.
Definition gmGeometryUtils.cpp:216
Plane structure storing the full set of geometric metadata for a cell type.
Definition gmCellGeometryInfo.h:69