LifeV
EvaluationPhiI.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 EvaluationPhiI class.
31 
32  @date 06/2011
33  @author Samuel Quinodoz <samuel.quinodoz@epfl.ch>
34  */
35 
36 #ifndef EVALUATION_PHI_I_HPP
37 #define EVALUATION_PHI_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/eta/expression/ExpressionPhiI.hpp>
46 
47 
48 namespace LifeV
49 {
50 
51 namespace ExpressionAssembly
52 {
53 
54 //! Evaluation of the basis function phi_i in the case of a vectorial FE.
55 /*!
56  @author Samuel Quinodoz <samuel.quinodoz@epfl.ch>
57 
58  This class aims at representing a test function in the assembly.
59 
60  This class is an Evaluation class, and therefore, has all the methods
61  required to work within the Evaluation trees.
62  */
63 template<UInt testDim>
64 class EvaluationPhiI
65 {
66 public:
67 
68  //! @name Public Types
69  //@{
70 
71  //! Type of the values returned by this class
72  typedef VectorSmall<testDim> return_Type;
73 
74  //@}
75 
76 
77  //! @name Static constants
78  //@{
79 
80  //! Flag for the global current FE
81  const static flag_Type S_globalUpdateFlag = ET_UPDATE_NONE;
82 
83  //! Flag for the test current FE
84  const static flag_Type S_testUpdateFlag = ET_UPDATE_NONE;
85 
86  //! Flag for the solution current FE
87  const static flag_Type S_solutionUpdateFlag = ET_UPDATE_NONE;
88 
89  //@}
90 
91 
92  //! @name Constructors, destructor
93  //@{
94 
95  //! Empty constructor
97 
98  //! Copy constructor
99  EvaluationPhiI (const EvaluationPhiI& evaluation)
101  {}
102 
103  //! Expression-based constructor
104  explicit EvaluationPhiI (const ExpressionPhiI& /*expression*/) {}
105 
106  //! Destructor
108 
109  //@}
110 
111 
112  //! @name Methods
113  //@{
114 
115  //! Do nothing update
116  void update (const UInt& /*iElement*/) {}
117 
118  //! Display method
119  static void display (std::ostream& out = std::cout)
120  {
121  out << "phi_i";
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, "Null pointer to the testCFE cannot be set");
139  M_valuesPtr = & (testCFE->M_phi);
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
177 
178 };
179 
180 
181 
182 //! Evaluation of the basis function phi_i in the case of a scalar FE.
183 /*!
184  @author Samuel Quinodoz <samuel.quinodoz@epfl.ch>
185 
186  This class aims at representing a test function in the assembly.
187 
188  This class is an Evaluation class, and therefore, has all the methods
189  required to work within the Evaluation trees.
190  */
191 template <>
193 {
194 public:
195 
196  //! @name Public Types
197  //@{
198 
199  //! Type of the values returned by this class
200  typedef Real return_Type;
201 
202  //@}
203 
204 
205  //! @name Static constants
206  //@{
207 
208  //! Flag for the global current FE
209  const static flag_Type S_globalUpdateFlag = ET_UPDATE_NONE;
210 
211  //! Flag for the test current FE
212  const static flag_Type S_testUpdateFlag = ET_UPDATE_NONE;
213 
214  //! Flag for the solution current FE
215  const static flag_Type S_solutionUpdateFlag = ET_UPDATE_NONE;
216 
217  //@}
218 
219 
220  //! @name Constructors, destructor
221  //@{
222 
223  //! Empty constructor
225 
226  //! Copy constructor
227  EvaluationPhiI (const EvaluationPhiI& evaluation)
229  {}
230 
231  //! Expression-based constructor
232  explicit EvaluationPhiI (const ExpressionPhiI& /*expression*/) {}
233 
234  //! Destructor
236 
237  //@}
238 
239 
240  //! @name Methods
241  //@{
242 
243  //! Do nothing update
244  void update (const UInt& /*iElement*/) {}
245 
246  //! Display method
247  static void display (std::ostream& out = std::cout)
248  {
249  out << "phi_i";
250  }
251 
252  //@}
253 
254 
255  //! @name Set Methods
256  //@{
257 
258  //! Do nothing setter for the global current FE
259  template< typename CFEType >
260  void setGlobalCFE (const CFEType* /*globalCFE*/) {}
261 
262  //! Setter for the test current FE
263  template< typename CFEType >
264  void setTestCFE (const CFEType* testCFE)
265  {
266  ASSERT (testCFE != 0, "Nul pointer to the testCFE cannot be set");
267  M_valuesPtr = & (testCFE->M_phi);
268  }
269 
270  //! Do nothing setter for the solution current FE
271  template< typename CFEType >
272  void setSolutionCFE (const CFEType* /*solutionCFE*/) {}
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 vector
284  const return_Type& value_qi (const UInt& q, const UInt& i) const
285  {
286  ASSERT ( q < M_valuesPtr->size(), "Quadrature point index invalid");
287  ASSERT ( i < (*M_valuesPtr) [q].size(), "Dof index invalid");
288  return (*M_valuesPtr) [q][i];
289  }
290 
291  //! Getter for the value for a matrix
292  const return_Type& value_qij (const UInt& q, const UInt& i, const UInt& /*j*/) const
293  {
294  ASSERT ( q < M_valuesPtr->size(), "Quadrature point index invalid");
295  ASSERT ( i < (*M_valuesPtr) [q].size(), "Dof index invalid");
296  return (*M_valuesPtr) [q][i];
297  }
298 
299  //@}
300 
301 private:
302 
303  //! Storage of the pointer to the data
304  std::vector< std::vector < Real > > const* M_valuesPtr;
305 
306 };
307 
308 
309 } // Namespace ExpressionAssembly
310 
311 } // Namespace LifeV
312 #endif
void setGlobalCFE(const CFEType *)
Do nothing setter for the global current FE.
const return_Type & value_qij(const UInt &q, const UInt &i, const UInt &) const
Getter for the value for a matrix.
uint32_type flag_Type
bit-flag with up to 32 different flags
Definition: LifeV.hpp:197
static const flag_Type S_testUpdateFlag
Flag for the test current FE.
void update(const UInt &)
Do nothing update.
friend class ExpressionAssembly::EvaluationPhiI
Friend to allow direct access to the raw data.
static const flag_Type S_globalUpdateFlag
Flag for the global current FE.
static const flag_Type S_solutionUpdateFlag
Flag for the solution current FE.
static void display(std::ostream &out=std::cout)
Display method.
static const flag_Type S_solutionUpdateFlag
Flag for the solution current FE.
static const flag_Type S_testUpdateFlag
Flag for the test current FE.
VectorSmall< testDim > return_Type
Type of the values returned by this class.
void updateInverseJacobian(const UInt &iQuadPt)
void update(const UInt &)
Do nothing update.
EvaluationPhiI(const ExpressionPhiI &)
Expression-based constructor.
void setTestCFE(const CFEType *testCFE)
Setter for the test current FE.
void setQuadrature(const QuadratureRule &)
Do nothing setter for the quadrature rule.
static const flag_Type S_globalUpdateFlag
Flag for the global current FE.
void setSolutionCFE(const CFEType *)
Do nothing setter for the solution current FE.
#define ASSERT(X, A)
Definition: LifeAssert.hpp:90
void setTestCFE(const CFEType *testCFE)
Setter for the test current FE.
static void display(std::ostream &out=std::cout)
Display method.
const return_Type & value_qij(const UInt &q, const UInt &i, const UInt &) const
Getter for the value for a matrix.
std::vector< std::vector< return_Type > > const * M_valuesPtr
Storage of the pointer to the data.
double Real
Generic real data.
Definition: LifeV.hpp:175
const return_Type & value_qi(const UInt &q, const UInt &i) const
Getter for the value for a vector.
std::vector< std::vector< Real > > const * M_valuesPtr
Storage of the pointer to the data.
void setGlobalCFE(const CFEType *)
Do nothing setter for the global current FE.
EvaluationPhiI(const EvaluationPhiI &evaluation)
Copy constructor.
const return_Type & value_qi(const UInt &q, const UInt &i) const
Getter for the value for a vector.
QuadratureRule - The basis class for storing and accessing quadrature rules.
EvaluationPhiI(const ExpressionPhiI &)
Expression-based constructor.
EvaluationPhiI(const EvaluationPhiI &evaluation)
Copy constructor.
uint32_type UInt
generic unsigned integer (used mainly for addressing)
Definition: LifeV.hpp:191
void setQuadrature(const QuadratureRule &)
Do nothing setter for the quadrature rule.
Real return_Type
Type of the values returned by this class.
void setSolutionCFE(const CFEType *)
Do nothing setter for the solution current FE.