GemaCoreLib
The GeMA Core library
gmBarCellGeometryInfo.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_BAR_CELL_GEOMETRY_INFO_H_
25 #define _GEMA_BAR_CELL_GEOMETRY_INFO_H_
26 
27 #include "gmCellGeometryInfo.h"
29 
30 #include "gmGeometryUtils.h"
31 
32 #include "gmBarIntegrationRule.h"
33 #include "gmBarShape.h"
34 
35 //---------------------------------------------------------
36 // Bar integration rules
37 //---------------------------------------------------------
38 
42 
43 
44 //---------------------------------------------------------
45 // Bar2 & Bar3D2 rule defaults
46 //---------------------------------------------------------
47 
52 
53 
54 //---------------------------------------------------------
55 // Bar3 & Bar3D3 rule defaults
56 //---------------------------------------------------------
57 
62 
63 
64 //---------------------------------------------------------
65 // GmBar2CellGeometryInfo
66 //---------------------------------------------------------
67 
70  : public GmCellGeometryInfoLineElement<GmBarIntegrationRuleSet, GmLinearBarIntegrationRuleSetDefaults>
71 {
72 public:
73  static const GmBar2CellGeometryInfo* instance();
74 
75  // Shape factory. See comments on the base class.
76  virtual GmShape* shapeInstance(int P, int Q) const { Q_UNUSED(P); Q_UNUSED(Q); return new GmBar2Shape; }
77 
79  virtual double dimension(const GmMatrix& X) const { return GmGeometryUtils::edgeLength(X.col(0), X.col(1)); }
80 
82  virtual void centroidCartesian(const GmMatrix& X, GmVector& coord) const { GmGeometryUtils::edgeCentroid(X.col(0), X.col(1), coord); }
83 
84  // --------- Capabilities API ---------
85 
86 protected:
90 };
91 
92 //---------------------------------------------------------
93 // GmBar3D2CellGeometryInfo
94 //---------------------------------------------------------
95 
98 {
99 public:
100  static const GmBar3D2CellGeometryInfo* instance();
101 
102  // Shape factory. See comments on the base class.
103  virtual GmShape* shapeInstance(int P, int Q) const { Q_UNUSED(P); Q_UNUSED(Q); return new GmBar3D2Shape; }
104 
105 private:
108 };
109 
110 
111 //---------------------------------------------------------
112 // GmBar3CellGeometryInfo
113 //---------------------------------------------------------
114 
117  : public GmCellGeometryInfoLineElement<GmBarIntegrationRuleSet, GmQuadraticBarIntegrationRuleSetDefaults>
118 {
119 public:
120  static const GmBar3CellGeometryInfo* instance();
121 
122  // Shape factory. See comments on the base class.
123  virtual GmShape* shapeInstance(int P, int Q) const { Q_UNUSED(P); Q_UNUSED(Q); return new GmBar3Shape; }
124 
126  virtual double dimension(const GmMatrix& X) const { return dimensionByIntegration(X); }
127 
131  virtual void centroidCartesian(const GmMatrix& X, GmVector& coord) const { centroidByIntegration(X, coord); }
132 
133  // --------- Capabilities API ---------
134 
135 protected:
139 };
140 
141 //---------------------------------------------------------
142 // GmBar3D3CellGeometryInfo
143 //---------------------------------------------------------
144 
147 {
148 public:
149  static const GmBar3D3CellGeometryInfo* instance();
150 
151  // Shape factory. See comments on the base class.
152  virtual GmShape* shapeInstance(int P, int Q) const { Q_UNUSED(P); Q_UNUSED(Q); return new GmBar3D3Shape; }
153 
154 private:
157 };
158 
159 
160 #endif
161 
virtual void centroidCartesian(const GmMatrix &X, GmVector &coord) const
Returns the Bar2 centroid by calculating the mean of the vertices (simplex centroid)
Definition: gmBarCellGeometryInfo.h:82
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: gmBarCellGeometryInfo.h:152
GmShape specialization for a 3D Bar with 2 nodes object.
Definition: gmBarShape.h:176
1D Lobatto Integration rules (for bar elements)
Definition: gmBarIntegrationRule.h:83
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
1D Newton cotes Integration rules (for bar elements)
Definition: gmBarIntegrationRule.h:59
GmBar3D2CellGeometryInfo(const GmBar2CellGeometryInfo &bar2)
Private constructor. Only a single Bar3D2 geometry info object is ever necessary, created by GmBarCel...
Definition: gmBarCellGeometryInfo.h:107
An auxiliary class that can be used as base for line (bar) elements. Implements the needed integratio...
Definition: gmCellGeometryInfo.h:315
GmBar2CellGeometryInfo(GmCellGeometryMetadata &&metadata)
Protected constructor. Only a single Bar2 geometry info object is ever necessary, created by GmBarCel...
Definition: gmBarCellGeometryInfo.h:88
GmShape specialization for a 2D Bar with 3 nodes object.
Definition: gmBarShape.h:152
virtual void centroidCartesian(const GmMatrix &X, GmVector &coord) const
Returns the Bar3 centroid by returning the mid edge cell node coordinate. Is this correct?...
Definition: gmBarCellGeometryInfo.h:131
A helper class used to store the default rules for each rule type. Template parameters are the defaul...
Definition: gmCellGeometryIntegrationRuleSet.h:43
The Bar2 implementation.
Definition: gmBarCellGeometryInfo.h:69
void edgeCentroid(const GmVector &p1, const GmVector &p2, GmVector &coord)
Returns the cartesian coordinate of the edge centroid.
Definition: gmGeometryUtils.cpp:283
virtual double dimension(const GmMatrix &X) const
Returns the Bar2 length.
Definition: gmBarCellGeometryInfo.h:79
Shape function handling base classe.
Definition: gmShape.h:37
GmShape specialization for a 3D Bar with 3 nodes object.
Definition: gmBarShape.h:202
Declaration of the GmCellGeometryIntegrationRuleSet class & friends.
GmCellGeometryIntegrationRuleSetDefaultRules< GM_GAUSS_RULE_TYPE, 3, 3, 3, 3 > GmQuadraticBarIntegrationRuleSetDefaults
The set of default rules for a quadratic Bar ELEMENT. Template parameters 2 to 5 are the default rule...
Definition: gmBarCellGeometryInfo.h:61
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: gmBarCellGeometryInfo.h:76
A helper class used to store the class types for each rule type. Template parameters are the implemen...
Definition: gmCellGeometryIntegrationRuleSet.h:196
static const GmBar3CellGeometryInfo * instance()
Instance function for the Bar3 single geometry object.
Definition: gmBarCellGeometryInfo.cpp:96
The Bar3D3 implementation.
Definition: gmBarCellGeometryInfo.h:146
Utilitary functions for working with geometry.
GmCellGeometryIntegrationRuleSetDefaultRules< GM_GAUSS_RULE_TYPE, 2, 2, 2, 2 > GmLinearBarIntegrationRuleSetDefaults
The set of default rules for a linear Bar ELEMENT. Template parameters 2 to 5 are the default rule nu...
Definition: gmBarCellGeometryInfo.h:51
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
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: gmBarCellGeometryInfo.h:103
#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
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: gmBarCellGeometryInfo.h:123
static const GmBar2CellGeometryInfo * instance()
Instance function for the Bar2 single geometry object.
Definition: gmBarCellGeometryInfo.cpp:33
GmBar3D3CellGeometryInfo(const GmBar3CellGeometryInfo &bar3)
Private constructor. Only a single Bar3D2 geometry info object is ever necessary, created by GmBarCel...
Definition: gmBarCellGeometryInfo.h:156
double edgeLength(const GmVector &p1, const GmVector &p2)
Calculates the length of the edge determined by points p1 and p2.
Definition: gmGeometryUtils.cpp:157
GmBar3CellGeometryInfo(GmCellGeometryMetadata &&metadata)
Protected constructor. Only a single Bar3 geometry info object is ever necessary, created by GmBarCel...
Definition: gmBarCellGeometryInfo.h:137
The Bar3D2 implementation.
Definition: gmBarCellGeometryInfo.h:97
Declaration of the GmCellGeometryInfo base class.
arma::vec GmVector
The basic type for a GeMA vector object. Currently based on an Armadillo vector.
Definition: gmVector.h:34
virtual double dimension(const GmMatrix &X) const
Returns the Bar3 length by numeric integration.
Definition: gmBarCellGeometryInfo.h:126
arma::mat GmMatrix
The basic type for a GeMA matrix object. Currently based on an Armadillo matrix.
Definition: gmMatrix.h:38
1D Gauss Integration rules (for bar elements)
Definition: gmBarIntegrationRule.h:36
The Bar3 implementation.
Definition: gmBarCellGeometryInfo.h:116
Declaration of the GmLineXxxxIntegrationRule family of classes Content previously in gmIntegrationRul...
Declaration of the 1D Bar shapes inheriting from GmShape class Previosuly part of the gmShape1D....
Plane structure storing the full set of geometric metadata for a cell type.
Definition: gmCellGeometryInfo.h:57
GmShape specialization for a 2D Bar with 2 nodes object.
Definition: gmBarShape.h:119
GmCellGeometryIntegrationRuleSet< GmLineGaussIntegrationRule, GmLineLobattoIntegrationRule, GmLineNewtonIntegrationRule, GmLineNewtonIntegrationRule > GmBarIntegrationRuleSet
The set of possible ELEMENT integration rules, per integration rule type, for the family of Bar eleme...
Definition: gmBarCellGeometryInfo.h:41