LifeV
ReferenceFE.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 Base structure for a reference finite element
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 
38 #ifndef _REFFE_H
39 #define _REFFE_H
40 
41 #include <lifev/core/LifeV.hpp>
42 #include <lifev/core/fem/ReferenceElement.hpp>
43 #include <lifev/core/fem/DOFLocalPattern.hpp>
44 
45 namespace LifeV
46 {
47 /*!
48  \class ReferenceFE
49  \brief The class for a reference Lagrangian finite element
50  \author J.-F. Gerbeau
51  \date 04/2002
52 
53  \par How to add a new finite element ?
54 
55  (1) in refEle.h : you declare the functions you need (fct1_Pipo_2D,
56  derfct1_1_Pipo_2D, etc...), the static arrays containing these functions
57  and the coordinates of the nodes on the reference element.
58 
59  \par
60  (2) in defQuadRuleFE.cc : you define these functions (fct1_Pipo_2D, etc...)
61 
62  \par
63  (3) in refFE.h, you declare your finite element:
64  \code
65  extern const ReferenceFE fePipo;
66  \endcode
67 
68  \par
69  (4) in defQuadRuleFE.cc: you define your new element with a command like:
70  \code
71  const ReferenceFE feTriaPipo("Pipo element on a triangle",TRIANGLE,1,0,0,0,3,2,
72  fct_Pipo_2D,derfct_Pipo_2D,der2fct_Pipo_2D,refcoor_Pipo_2D,allQuadRuleTria,STANDARD_PATTERN,&feSegP1);
73  \endcode
74  See documentation of ReferenceFE::ReferenceFE(...) for a precise description of all arguments
75 
76 */
77 /* Unique FE identifier*/
78 enum FE_TYPE
79 {
80  FE_P0_0D = 1,
84 
89 
93 
96 
102 
106 
107  FE_RT0_HEXA_3D, //!< Vectorial space for Mixed FE
109  FE_RT0_HYB_HEXA_3D, //!< for hybrid Mixed FE.
112 };
113 
114 
116  public ReferenceElement,
117  public DOFLocalPattern
118 {
119 
120 public:
121 
122  //! @name Public Types
123  //@{
124 
125  typedef ReferenceElement::function_Type function_Type;
126 
127  //@}
128 
129 
130  //! @name Constructor & Destructor
131  //@{
132 
133  //! Constructor of a reference Lagrangian finite element.
134  /*!
135  Constructor of a reference finite element. The arguments are:
136  @param name the name of the f.e.
137  @param type the type of the f.e. (FE_P1_2D,... see the #define at the
138  begining of refFE.h)
139  @param shape the geometry belongs to enum ReferenceShapes {NONE, POINT,
140  LINE, TRIANGLE, QUAD, HEXA, PRISM, TETRA}; (see ElementShapes.h)
141  @param nbDofPerVertex the number of degrees of freedom per vertex
142  @param nbDofPerEdge the number of degrees of freedom per edge
143  @param nbDofPerFace the number of degrees of freedom per face
144  @param nbDofPerVolume the number of degrees of freedom per volume
145  @param nbDof the total number of d.o.f ( = nbDofPerVertex * nb vertex +
146  nbDofPerEdge * nb edges + etc...)
147  @param nbLocalCoor number of local coordinates
148  @param phi the static array containing the basis functions (defined in
149  refEle.h)
150  @param dPhi the static array containing the derivatives of the basis
151  functions (defined in refEle.h)
152  @param d2Phi the static array containing the second derivatives of the
153  basis functions (defined in refEle.h)
154  @param divPhi the static array containing the divergence of the basis function
155  @param refCoor the static array containing the coordinates of the nodes on
156  the reference element (defined in refEle.h)
157  @param patternType in most of cases STANDARD_PATTERN, except for elements
158  like P1isoP2 (to define a new pattern, add a new #define in refFE.h and
159  code it in refFE.cc following the example of P1ISOP2_TRIA_PATTERN)
160  @param bdRefFE a pointer on the associated reference finite element on the boundary
161  */
162  ReferenceFE ( std::string name,
163  FE_TYPE type,
164  ReferenceShapes shape,
165  Int nbDofPerVertex,
166  Int nbDofPerEdge,
167  Int nbDofPerFace,
168  Int nbDofPerVolume,
169  Int nbDof,
170  Int nbLocalCoor,
171  Int FEDim,
172  const function_Type* phi,
173  const function_Type* dPhi,
174  const function_Type* d2Phi,
175  const function_Type* divPhi,
176  const Real* refCoor,
177  DofPatternType patternType,
178  const ReferenceFE* bdRefFE );
179 
180  //! Destructor
181  virtual ~ReferenceFE();
182 
183  //@}
184 
185 
186  //! @name Get Methods
187  //@{
188 
189  //! Check if the reference element has boundary elements
190  bool hasBoundaryFE() const
191  {
192  return M_boundaryFE != NULL;
193  }
194 
195  //! Getter for the boundary finite element
196  /*
197  The boundary of a finite element has to be understood in the sense of the trace. For example, the boundary finite element of the P0 finite element on a triangle is a P0 finite element on a segment, even if there is no degree of freedom located on the edges of the triangle for P0 finite element.
198  */
199  const ReferenceFE& boundaryFE() const
200  {
201  ASSERT ( M_boundaryFE , "No boundary FE defined" );
202  return *M_boundaryFE;
203  }
204 
205  //! Getter for the type of the finite element
206  const FE_TYPE& type() const
207  {
208  return M_type;
209  }
210 
211  //@}
212 
213 private:
214 
215  //! @name Private Methods
216  //@{
217 
218  //! No empty constructor
219  ReferenceFE();
220 
221  //! No copy constructor
222  ReferenceFE (const ReferenceFE&);
223 
224  //@}
225 
226 
227  //! Reference to the boundary finite element
229 
230  //! Type of finite element (FE_P1_2D, ..., see the #define at the beginning of refFE.h
232 };
233 
234 
235 
236 }
237 #endif
const ReferenceFE & boundaryFE() const
Getter for the boundary finite element.
virtual ~ReferenceFE()
Destructor.
Definition: ReferenceFE.cpp:58
ReferenceElement - The basis class for the geometric mapping and the reference finite elements...
DofPatternType
Local pattern type.
int32_type Int
Generic integer data.
Definition: LifeV.hpp:188
const FE_TYPE & type() const
Getter for the type of the finite element.
bool hasBoundaryFE() const
Check if the reference element has boundary elements.
void updateInverseJacobian(const UInt &iQuadPt)
#define ASSERT(X, A)
Definition: LifeAssert.hpp:90
const FE_TYPE M_type
Type of finite element (FE_P1_2D, ..., see the #define at the beginning of refFE.h.
Vectorial space for Mixed FE.
ReferenceFE()
No empty constructor.
ReferenceFE(const ReferenceFE &)
No copy constructor.
DOFLocalPattern - A class to store the "couplings" between the basis functions.
const ReferenceFE * M_boundaryFE
Reference to the boundary finite element.
double Real
Generic real data.
Definition: LifeV.hpp:175
The class for a reference Lagrangian finite element.
ReferenceFE(std::string name, FE_TYPE type, ReferenceShapes shape, Int nbDofPerVertex, Int nbDofPerEdge, Int nbDofPerFace, Int nbDofPerVolume, Int nbDof, Int nbLocalCoor, Int FEDim, const function_Type *phi, const function_Type *dPhi, const function_Type *d2Phi, const function_Type *divPhi, const Real *refCoor, DofPatternType patternType, const ReferenceFE *bdRefFE)
Constructor of a reference Lagrangian finite element.
Definition: ReferenceFE.cpp:47
for hybrid Mixed FE.