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