LifeV
MeshGeometricMap.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 the LifeV library
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
21  License along with this library; if not, see <http://www.gnu.org/licenses/>
22 
23 
24 *******************************************************************************
25 */
26 //@HEADER
27 
28 /*!
29  * @file
30  @brief This file contains an helper function to get a geometric map adapted to a mesh
31 
32  @date 07/2011
33  @author Samuel Quinodoz <samuel.quinodoz@epfl.ch>
34  */
35 
36 #ifndef MESH_GEOMETRIC_MAP_HPP
37 #define MESH_GEOMETRIC_MAP_HPP
38 
39 #include <lifev/core/LifeV.hpp>
40 
41 #include <lifev/core/fem/GeometricMap.hpp>
42 
43 #include <lifev/core/mesh/ElementShapes.hpp>
44 
45 #include <boost/shared_ptr.hpp>
46 
47 
48 // LifeV namespace.
49 namespace LifeV
50 {
51 
52 
53 //! Generic implementation of the GeometricMapFromElementShape.
54 /*
55 This generic implementation should never be implemented. In case one asks
56 for a mapping that does not exist, an error will appear at compile time.
57 
58 The specializations can be used to get the geometric mapping that goes
59 with the Shape given as template argument.
60 */
61 template <typename Shape>
63 
64 //! \cond
65 
66 template<>
67 inline const GeometricMap& geometricMapFromElementShape<GeoPoint>()
68 {
69  return geoLinearNode;
70 }
71 
72 template<>
73 inline const GeometricMap& geometricMapFromElementShape<LinearLine>()
74 {
75  return geoLinearSeg;
76 }
77 
78 template<>
79 inline const GeometricMap& geometricMapFromElementShape<LinearTriangle>()
80 {
81  return geoLinearTria;
82 }
83 
84 template<>
85 inline const GeometricMap& geometricMapFromElementShape<LinearQuad>()
86 {
87  return geoBilinearQuad;
88 }
89 
90 template<>
91 inline const GeometricMap& geometricMapFromElementShape<LinearTetra>()
92 {
93  return geoLinearTetra;
94 }
95 
96 template<>
97 inline const GeometricMap& geometricMapFromElementShape<LinearHexa>()
98 {
99  return geoBilinearHexa;
100 }
101 
102 
103 //! \endcond
104 
105 //! Function to get the map that goes with a mesh (version with template argument only)
106 /*!
107  Given a type of mesh, this method returns an instance of geometric mapping
108  that corresponds with the mesh.
109 */
110 template <typename MeshType>
112 {
113  return geometricMapFromElementShape<typename MeshType::elementShape_Type>();
114 }
115 
116 
117 //! Function to get the map that goes with a mesh (version with mesh in argument)
118 /*!
119  Given a type of mesh, this method returns an instance of geometric mapping
120  that corresponds with the mesh.
121 */
122 template <typename MeshType>
123 inline const GeometricMap& geometricMapFromMesh (const std::shared_ptr<MeshType>& /*mesh*/ )
124 {
125  return geometricMapFromElementShape<typename MeshType::elementShape_Type>();
126 }
127 
128 } // namespace LifeV
129 
130 
131 #endif
GeometricMap - Structure for the geometrical mapping.
const GeometricMap & geometricMapFromElementShape()
Generic implementation of the GeometricMapFromElementShape.
const GeometricMap geoLinearTetra("Linear mapping on a tetraedra", TETRA, 4, 3, fct_P1_3D, derfct_P1_3D, der2fct_P1_3D, refcoor_P1_3D, &geoLinearTria)
const GeometricMap geoLinearTria("Linear mapping on a triangle", TRIANGLE, 3, 2, fct_P1_2D, derfct_P1_2D, der2fct_P1_2D, refcoor_P1_2D, &geoLinearSeg)
void updateInverseJacobian(const UInt &iQuadPt)
const GeometricMap & geometricMapFromMesh(const std::shared_ptr< MeshType > &)
Function to get the map that goes with a mesh (version with mesh in argument)
const GeometricMap geoLinearNode("Mapping of a point", POINT, 1, 1, fct_P0_0D, derfct_P0_0D, der2fct_P0_0D, refcoor_P0_0D,(GeometricMap *) NULL)
const GeometricMap geoLinearSeg("Linear mapping on a segment", LINE, 2, 1, fct_P1_1D, derfct_P1_1D, der2fct_P1_1D, refcoor_P1_1D, &geoLinearNode)
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)
const GeometricMap & geometricMapFromMesh()
Function to get the map that goes with a mesh (version with template argument only) ...