LifeV
GeometricMap.hpp
Go to the documentation of this file.
1 //@HEADER
2 /*
3 *******************************************************************************
4 
5  Copyright (C) 2004, 2005, 2007 EPFL, Politecnico di Milano, INRIA
6  Copyright (C) 2010 EPFL, Politecnico di Milano, Emory University
7 
8  This file is part of LifeV.
9 
10  LifeV is free software; you can redistribute it and/or modify
11  it under the terms of the GNU Lesser General Public License as published by
12  the Free Software Foundation, either version 3 of the License, or
13  (at your option) any later version.
14 
15  LifeV is distributed in the hope that it will be useful,
16  but WITHOUT ANY WARRANTY; without even the implied warranty of
17  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18  Lesser General Public License for more details.
19 
20  You should have received a copy of the GNU Lesser General Public License
21  along with LifeV. If not, see <http://www.gnu.org/licenses/>.
22 
23 *******************************************************************************
24 */
25 //@HEADER
26 
27 /*!
28  @file
29  @brief This file contains the definition of the GeometricMap class (and an helper function)
30 
31  @author Jean-Frederic Gerbeau
32  @date 00-04-2002
33 
34  @contributor Samuel Quinodoz <samuel.quinodoz@epfl.ch>
35  @mantainer Samuel Quinodoz <samuel.quinodoz@epfl.ch>
36 
37  This class contains the geometrical transformation that maps the reference
38  element on the current element.
39  */
40 
41 #ifndef GEOMAP_H
42 #define GEOMAP_H 1
43 
44 #include <lifev/core/LifeV.hpp>
45 
46 #include <lifev/core/fem/ReferenceElement.hpp>
47 
48 namespace LifeV
49 {
50 
51 //! GeometricMap - Structure for the geometrical mapping
52 /*!
53  @author J.-F. Gerbeau
54  @date 04/2002
55 
56 
57  Modified by S. Quinodoz (samuel.quinodoz@epfl.ch, 04.2010)
58 */
60  public ReferenceElement
61 {
62 public:
63 
64  //! @name Public Types
65  //@{
66 
67  typedef ReferenceElement::function_Type function_Type;
68 
69  //@}
70 
71 
72  //! @name Constructor & Destructor
73  //@{
74 
75  //! Full Constructor of a geo map
76  /*!
77  @param name : the name of the f.e.
78  @param shape : the geometry belongs to enum ReferenceShapes {NONE, POINT, LINE, TRIANGLE, QUAD, HEXA, PRISM, TETRA}; (see ElementShapes.h)
79  @param nbDof : the total number of d.o.f.
80  @param nbLocalCoor : number of local coordinates
81  @param phi : the static array containing the basis functions (defined in refEle.h)
82  @param dPhi : the static array containing the derivatives of the basis functions (defined in refEle.h)
83  @param d2Phi : the static array containing the second derivatives of the basis functions (defined in refEle.h)
84  @param refCoor : the static array containing the coordinates of the nodes on the reference element (defined in refEle.h)
85  @param bdMap : a pointer on the natural associated mapping for the boundary of the element
86  */
87  GeometricMap ( std::string name,
88  ReferenceShapes shape,
89  UInt nbDof,
90  UInt nbLocalCoor,
91  const function_Type* phi,
92  const function_Type* dPhi,
93  const function_Type* d2Phi,
94  const Real* refCoor,
95  const GeometricMap* bdMap );
96 
97  //! Destructor
98  ~GeometricMap();
99 
100  //@}
101 
102 
103  //! @name Get Methods
104  //@{
105 
106  //! return the natural mapping for the boundary of the element
107  const GeometricMap& boundaryMap() const
108  {
109  ASSERT ( M_boundaryMap != 0 , "No boundary map defined" );
110  return *M_boundaryMap;
111  }
112 
113  //@}
114 
115 private:
116 
117  //! @name Private Methods
118  //@{
119 
120  //! No empty constructor
121  GeometricMap();
122 
123  //! No copy constructor
124  GeometricMap (const GeometricMap&);
125 
126  //@}
127 
129 };
130 
131 
132 
133 //---- Predeclaration of the map (defined in FEDefinitions.cpp) ----
134 
135 extern const GeometricMap geoLinearNode;
136 extern const GeometricMap geoLinearSeg;
137 extern const GeometricMap geoQuadraticSeg;
138 extern const GeometricMap geoLinearTria;
139 extern const GeometricMap geoBilinearQuad;
140 extern const GeometricMap geoBiquadraticQuad;
141 extern const GeometricMap geoLinearTetra;
142 extern const GeometricMap geoBilinearHexa;
143 extern const GeometricMap geoBiquadraticHexa;
144 
145 // ----
146 
147 /*! Helper function that returns the geomap associated to a mesh */
148 template <typename MeshType>
149 const GeometricMap& getGeometricMap ( MeshType& /*mesh*/ )
150 {
151 
152  typedef typename MeshType::elementShape_Type elementShape_Type;
153 
154  switch ( elementShape_Type::S_shape )
155  {
156  case POINT:
157  if ( elementShape_Type::S_numPoints == 1 )
158  {
159  return geoLinearNode;
160  }
161  else
162  {
163  ERROR_MSG ( "Geomap type not yet implemented" );
164  }
165  break;
166  case LINE:
167  if ( elementShape_Type::S_numPoints == 2 )
168  {
169  return geoLinearSeg;
170  }
171  else
172  {
173  ERROR_MSG ( "Geomap type not yet implemented" );
174  }
175  break;
176  case HEXA:
177  if ( elementShape_Type::S_numPoints == 8 )
178  {
179  return geoBilinearHexa;
180  }
181  else
182  {
183  ERROR_MSG ( "Geomap type not yet implemented" );
184  }
185  break;
186  case TETRA:
187  if ( elementShape_Type::S_numPoints == 4 )
188  {
189  return geoLinearTetra;
190  }
191  else
192  {
193  ERROR_MSG ( "Geomap type not yet implemented" );
194  }
195  break;
196  case TRIANGLE:
197  if ( elementShape_Type::S_numPoints == 3 )
198  {
199  return geoLinearTria;
200  }
201  else
202  {
203  ERROR_MSG ( "Geomap type not yet implemented" );
204  }
205  break;
206  case QUAD:
207  if ( elementShape_Type::S_numPoints == 4 )
208  {
209  return geoBilinearQuad;
210  }
211  else
212  {
213  ERROR_MSG ( "Geomap type not yet implemented" );
214  }
215  break;
216  default:
217  ERROR_MSG ( "Geomap type not yet implemented" );
218  }
219  return geoLinearNode;
220 }
221 }
222 #endif
GeometricMap - Structure for the geometrical mapping.
ReferenceElement - The basis class for the geometric mapping and the reference finite elements...
const GeometricMap geoLinearTetra("Linear mapping on a tetraedra", TETRA, 4, 3, fct_P1_3D, derfct_P1_3D, der2fct_P1_3D, refcoor_P1_3D, &geoLinearTria)
~GeometricMap()
Destructor.
const GeometricMap geoLinearTria("Linear mapping on a triangle", TRIANGLE, 3, 2, fct_P1_2D, derfct_P1_2D, der2fct_P1_2D, refcoor_P1_2D, &geoLinearSeg)
const GeometricMap geoQuadraticSeg("Quadratic mapping on a segment", LINE, 3, 1, fct_P2_1D, derfct_P2_1D, der2fct_P2_1D, refcoor_P2_1D, &geoLinearNode)
void updateInverseJacobian(const UInt &iQuadPt)
const GeometricMap & getGeometricMap(MeshType &)
const GeometricMap geoLinearNode("Mapping of a point", POINT, 1, 1, fct_P0_0D, derfct_P0_0D, der2fct_P0_0D, refcoor_P0_0D,(GeometricMap *) NULL)
#define ERROR_MSG(A)
Definition: LifeAssert.hpp:69
const GeometricMap geoLinearSeg("Linear mapping on a segment", LINE, 2, 1, fct_P1_1D, derfct_P1_1D, der2fct_P1_1D, refcoor_P1_1D, &geoLinearNode)
#define ASSERT(X, A)
Definition: LifeAssert.hpp:90
const GeometricMap * M_boundaryMap
GeometricMap()
No empty constructor.
const GeometricMap geoBiquadraticHexa
GeometricMap(std::string name, ReferenceShapes shape, UInt nbDof, UInt nbLocalCoor, const function_Type *phi, const function_Type *dPhi, const function_Type *d2Phi, const Real *refCoor, const GeometricMap *bdMap)
Full Constructor of a geo map.
double Real
Generic real data.
Definition: LifeV.hpp:175
const GeometricMap geoBiquadraticQuad("Biquadratic mapping on a quadrangle", QUAD, 9, 2, fct_Q2_2D, derfct_Q2_2D, der2fct_Q2_2D, refcoor_Q2_2D, &geoQuadraticSeg)
const GeometricMap geoBilinearHexa("Bilinear mapping on an hexaedra", HEXA, 8, 3, fct_Q1_3D, derfct_Q1_3D, der2fct_Q1_3D, refcoor_Q1_3D, &geoBilinearQuad)
const GeometricMap geoBilinearQuad("Bilinear mapping on a quadrangle", QUAD, 4, 2, fct_Q1_2D, derfct_Q1_2D, der2fct_Q1_2D, refcoor_Q1_2D, &geoLinearSeg)
GeometricMap(const GeometricMap &)
No copy constructor.
const GeometricMap & boundaryMap() const
return the natural mapping for the boundary of the element
uint32_type UInt
generic unsigned integer (used mainly for addressing)
Definition: LifeV.hpp:191