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