LifeV
EvaluationDivI.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 the definition of the EvaluationDivI class.
31 
32  @date 06/2011
33  @author Samuel Quinodoz <samuel.quinodoz@epfl.ch>
34  */
35 
36 #ifndef EVALUATION_DIV_I_HPP
37 #define EVALUATION_DIV_I_HPP
38 
39 #include <lifev/core/LifeV.hpp>
40 
41 #include <lifev/eta/fem/ETCurrentFE.hpp>
42 #include <lifev/eta/fem/ETCurrentFlag.hpp>
43 #include <lifev/core/fem/QuadratureRule.hpp>
44 
45 #include <lifev/core/array/VectorSmall.hpp>
46 
47 #include <lifev/eta/expression/ExpressionDivI.hpp>
48 
49 
50 namespace LifeV
51 {
52 
53 namespace ExpressionAssembly
54 {
55 
56 template <UInt fieldDim, UInt spaceDim>
57 class EvaluationDivI
58 {
59 private:
60 
61  //! @name Constructors, destructor
62  //@{
63 
64  //! Empty constructor
65  EvaluationDivI();
66 
67  //! Copy constructor
68  EvaluationDivI (const EvaluationDivI& provider);
69 
70  //! Destructor
71  ~EvaluationDivI();
72 
73  //@}
74 };
75 
76 
77 //! Evaluation of the basis function divergence in the case of a vectorial FE.
78 /*!
79  @author Samuel Quinodoz <samuel.quinodoz@epfl.ch>
80 
81  This class aims at representing the divergence of a test function in the assembly.
82 
83  This class is an Evaluation class, and therefore, has all the methods
84  required to work within the Evaluation trees.
85  */
86 template <UInt spaceDim>
87 class EvaluationDivI<3, spaceDim>
88 {
89 public:
90 
91  //! @name Public Types
92  //@{
93 
94  //! Type of the values returned by this class
95  typedef Real return_Type;
96 
97  //@}
98 
99 
100  //! @name Static constants
101  //@{
102 
103  //! Flag for the global current FE
104  const static flag_Type S_globalUpdateFlag;
105 
106  //! Flag for the test current FE
107  const static flag_Type S_testUpdateFlag;
108 
109  //! Flag for the solution current FE
110  const static flag_Type S_solutionUpdateFlag;
111 
112  //@}
113 
114 
115  //! @name Constructors, destructor
116  //@{
117 
118  //! Empty constructor
119  EvaluationDivI() {}
120 
121  //! Copy constructor
122  EvaluationDivI (const EvaluationDivI<3, spaceDim>& provider) : M_valuesPtr (provider.M_valuesPtr) {}
123 
124  //! Expression-based constructor
125  explicit EvaluationDivI (const ExpressionDivI& /*expression*/) {}
126 
127  //! Destructor
128  ~EvaluationDivI() {}
129 
130  //@}
131 
132 
133  //! @name Methods
134  //@{
135 
136  //! Do nothing internal update
137  void update (const UInt& /*iElement*/) {}
138 
139  //! Display method
140  static void display (std::ostream& out = std::cout)
141  {
142  out << "div_i";
143  }
144 
145  //@}
146 
147 
148  //! @name Set Methods
149  //@{
150 
151  //! Do nothing setter for the global current FE
152  template< typename CFEType >
153  void setGlobalCFE (const CFEType* /*globalCFE*/) {}
154 
155  //! Setter for the test current FE
156  template< typename CFEType >
157  void setTestCFE (const CFEType* testCFE)
158  {
159  ASSERT (testCFE != 0, "Nul pointer to the testCFE cannot be set");
160  M_valuesPtr = & (testCFE->M_divergence);
161  }
162 
163  //! Do nothing setter for the solution current FE
164  template< typename CFEType >
165  void setSolutionCFE (const CFEType* /*solutionCFE*/) {}
166 
167  //! Do nothing setter for the quadrature rule
168  void setQuadrature (const QuadratureRule&) {}
169 
170  //@}
171 
172 
173  //! @name Get Methods
174  //@{
175 
176  //! Getter for the value for a vector
177  const return_Type& value_qi (const UInt& q, const UInt& i) const
178  {
179  ASSERT ( q < M_valuesPtr->size(), "Quadrature point index invalid");
180  ASSERT ( i < (*M_valuesPtr) [q].size(), "Dof index invalid");
181  return (*M_valuesPtr) [q][i];
182  }
183 
184  //! Getter for the value for a matrix
185  const return_Type& value_qij (const UInt& q, const UInt& i, const UInt& /*j*/) const
186  {
187  ASSERT ( q < M_valuesPtr->size(), "Quadrature point index invalid");
188  ASSERT ( i < (*M_valuesPtr) [q].size(), "Dof index invalid");
189  return (*M_valuesPtr) [q][i];
190  }
191 
192  //@}
193 
194 private:
195 
196  //! Storage of the pointer to the data
197  std::vector< std::vector < return_Type > > const* M_valuesPtr;
198 
199 };
200 
201 
202 template<UInt spaceDim>
203 const flag_Type EvaluationDivI<3, spaceDim>::S_globalUpdateFlag = ET_UPDATE_NONE;
204 
205 template<UInt spaceDim>
206 const flag_Type EvaluationDivI<3, spaceDim>::S_testUpdateFlag = ET_UPDATE_DIVERGENCE;
207 
208 template<UInt spaceDim>
209 const flag_Type EvaluationDivI<3, spaceDim>::S_solutionUpdateFlag = ET_UPDATE_NONE;
210 
211 
212 //! Evaluation of the basis function divergence in the case of a 2D vectorial FE.
213 /*!
214  @author Samuel Quinodoz <samuel.quinodoz@epfl.ch>
215 
216  This class aims at representing the divergence of a test function in the assembly.
217 
218  This class is an Evaluation class, and therefore, has all the methods
219  required to work within the Evaluation trees.
220  */
221 template <UInt spaceDim>
222 class EvaluationDivI<2, spaceDim>
223 {
224 public:
225 
226  //! @name Public Types
227  //@{
228 
229  //! Type of the values returned by this class
230  typedef Real return_Type;
231 
232  //@}
233 
234 
235  //! @name Static constants
236  //@{
237 
238  //! Flag for the global current FE
239  const static flag_Type S_globalUpdateFlag;
240 
241  //! Flag for the test current FE
242  const static flag_Type S_testUpdateFlag;
243 
244  //! Flag for the solution current FE
245  const static flag_Type S_solutionUpdateFlag;
246 
247  //@}
248 
249 
250  //! @name Constructors, destructor
251  //@{
252 
253  //! Empty constructor
254  EvaluationDivI() {}
255 
256  //! Copy constructor
257  EvaluationDivI (const EvaluationDivI<2, spaceDim>& provider) : M_valuesPtr (provider.M_valuesPtr) {}
258 
259  //! Expression-based constructor
260  explicit EvaluationDivI (const ExpressionDivI& /*expression*/) {}
261 
262  //! Destructor
263  ~EvaluationDivI() {}
264 
265  //@}
266 
267 
268  //! @name Methods
269  //@{
270 
271  //! Do nothing internal update
272  void update (const UInt& /*iElement*/) {}
273 
274  //! Display method
275  static void display (std::ostream& out = std::cout)
276  {
277  out << "div_i";
278  }
279 
280  //@}
281 
282 
283  //! @name Set Methods
284  //@{
285 
286  //! Do nothing setter for the global current FE
287  template< typename CFEType >
288  void setGlobalCFE (const CFEType* /*globalCFE*/) {}
289 
290  //! Setter for the test current FE
291  template< typename CFEType >
292  void setTestCFE (const CFEType* testCFE)
293  {
294  ASSERT (testCFE != 0, "Nul pointer to the testCFE cannot be set");
295  M_valuesPtr = & (testCFE->M_divergence);
296  }
297 
298  //! Do nothing setter for the solution current FE
299  template< typename CFEType >
300  void setSolutionCFE (const CFEType* /*solutionCFE*/) {}
301 
302  //! Do nothing setter for the quadrature rule
303  void setQuadrature (const QuadratureRule&) {}
304 
305  //@}
306 
307 
308  //! @name Get Methods
309  //@{
310 
311  //! Getter for the value for a vector
312  const return_Type& value_qi (const UInt& q, const UInt& i) const
313  {
314  ASSERT ( q < M_valuesPtr->size(), "Quadrature point index invalid");
315  ASSERT ( i < (*M_valuesPtr) [q].size(), "Dof index invalid");
316  return (*M_valuesPtr) [q][i];
317  }
318 
319  //! Getter for the value for a matrix
320  const return_Type& value_qij (const UInt& q, const UInt& i, const UInt& /*j*/) const
321  {
322  ASSERT ( q < M_valuesPtr->size(), "Quadrature point index invalid");
323  ASSERT ( i < (*M_valuesPtr) [q].size(), "Dof index invalid");
324  return (*M_valuesPtr) [q][i];
325  }
326 
327  //@}
328 
329 private:
330 
331  //! Storage of the pointer to the data
332  std::vector< std::vector < return_Type > > const* M_valuesPtr;
333 
334 };
335 
336 
337 template<UInt spaceDim>
338 const flag_Type EvaluationDivI<2, spaceDim>::S_globalUpdateFlag = ET_UPDATE_NONE;
339 
340 template<UInt spaceDim>
341 const flag_Type EvaluationDivI<2, spaceDim>::S_testUpdateFlag = ET_UPDATE_DIVERGENCE;
342 
343 template<UInt spaceDim>
344 const flag_Type EvaluationDivI<2, spaceDim>::S_solutionUpdateFlag = ET_UPDATE_NONE;
345 
346 
347 } // Namespace ExpressionAssembly
348 
349 } // Namespace LifeV
350 
351 #endif
uint32_type flag_Type
bit-flag with up to 32 different flags
Definition: LifeV.hpp:197
void updateInverseJacobian(const UInt &iQuadPt)
#define ASSERT(X, A)
Definition: LifeAssert.hpp:90
double Real
Generic real data.
Definition: LifeV.hpp:175
QuadratureRule - The basis class for storing and accessing quadrature rules.
uint32_type UInt
generic unsigned integer (used mainly for addressing)
Definition: LifeV.hpp:191