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