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