LifeV
EvaluationLaplacianJ.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 EvaluationLaplacianJ class.
31 
32  @date 11/2014
33  @author Davide Forti <davide.forti@epfl.ch>
34  */
35 
36 #ifndef EVALUATION_LAPLACIAN_J_HPP
37 #define EVALUATION_LAPLACIAN_J_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/ExpressionLaplacianJ.hpp>
48 
49 
50 namespace LifeV
51 {
52 
53 namespace ExpressionAssembly
54 {
55 
56 //! Evaluation of the laplacian of the basis function phi_i in the case of a vectorial FE.
57 /*!
58  @author Davide Forti <davide.forti@epfl.ch>
59 
60  This class aims at representing the laplacian 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>
67 {
68 public:
69 
70  //! @name Public Types
71  //@{
72 
73  //! Type of the values returned by this class
74  typedef VectorSmall<fieldDim> 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  EvaluationLaplacianJ() {}
99 
100  //! Copy constructor
101  EvaluationLaplacianJ (const EvaluationLaplacianJ& provider) : M_valuesPtr (provider.M_valuesPtr) {}
102 
103  //! Expression-based constructor
104  explicit EvaluationLaplacianJ (const ExpressionLaplacianJ& /*expression*/) {}
105 
106  //! Destructor
107  ~EvaluationLaplacianJ() {}
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 << "laplacian(phi_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 
139  //! Do nothing 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 testCFE cannot be set");
144  M_valuesPtr = & (solutionCFE->M_laplacian);
145  }
146 
147  //! Do nothing setter for the quadrature rule
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  return (*M_valuesPtr) [q][j];
160  }
161 
162  //@}
163 
164 private:
165 
166  //! Storage of the pointer to the data
167  std::vector< std::vector < VectorSmall<fieldDim> > > const* M_valuesPtr;
168 
169 };
170 
171 
172 template<UInt fieldDim, UInt spaceDim>
173 const flag_Type EvaluationLaplacianJ<fieldDim, spaceDim>::S_globalUpdateFlag = ET_UPDATE_NONE;
174 
175 template<UInt fieldDim, UInt spaceDim>
176 const flag_Type EvaluationLaplacianJ<fieldDim, spaceDim>::S_testUpdateFlag = ET_UPDATE_NONE;
177 
178 template<UInt fieldDim, UInt spaceDim>
179 const flag_Type EvaluationLaplacianJ<fieldDim, spaceDim>::S_solutionUpdateFlag = ET_UPDATE_LAPLACIAN;
180 
181 //! Evaluation of the basis function dphi_i in the case of a scalar FE.
182 /*!
183  @author Samuel Quinodoz <samuel.quinodoz@epfl.ch>
184 
185  This class aims at representing the gradient of a test function in the assembly.
186 
187  This class is an Evaluation class, and therefore, has all the methods
188  required to work within the Evaluation trees.
189  */
190 template <UInt spaceDim>
191 class EvaluationLaplacianJ<1, spaceDim>
192 {
193 public:
194 
195  //! @name Public Types
196  //@{
197 
198  //! Type of the values returned by this class
199  typedef Real return_Type;
200 
201  //@}
202 
203 
204  //! @name Static constants
205  //@{
206 
207  //! Flag for the global current FE
208  const static flag_Type S_globalUpdateFlag;
209 
210  //! Flag for the test current FE
211  const static flag_Type S_testUpdateFlag;
212 
213  //! Flag for the solution current FE
214  const static flag_Type S_solutionUpdateFlag;
215 
216  //@}
217 
218 
219  //! @name Constructors, destructor
220  //@{
221 
222  //! Empty constructor
223  EvaluationLaplacianJ() {}
224 
225  //! Copy constructor
226  EvaluationLaplacianJ (const EvaluationLaplacianJ& provider) : M_valuesPtr (provider.M_valuesPtr) {}
227 
228  //! Expression-based constructor
229  explicit EvaluationLaplacianJ (const ExpressionLaplacianJ& /*expression*/) {}
230 
231  //! Destructor
232  ~EvaluationLaplacianJ() {}
233 
234  //@}
235 
236 
237  //! @name Methods
238  //@{
239 
240  //! Do nothing internal update
241  void update (const UInt& /*iElement*/) {}
242 
243  //! Display method
244  static void display (std::ostream& out = std::cout)
245  {
246  out << "dphi_i[" << spaceDim << "]";
247  }
248 
249  //@}
250 
251 
252  //! @name Set Methods
253  //@{
254 
255  //! Do nothing setter for the global current FE
256  template< typename CFEType >
257  void setGlobalCFE (const CFEType* /*globalCFE*/) {}
258 
259  //! Setter for the test current FE
260  template< typename CFEType >
261  void setTestCFE (const CFEType* testCFE)
262  {
263  ASSERT (testCFE != 0, "Nul pointer to the testCFE cannot be set");
264  M_valuesPtr = & (testCFE->M_laplacian);
265  }
266 
267  //! Do nothing setter for the solution current FE
268  template< typename CFEType >
269  void setSolutionCFE (const CFEType* /*solutionCFE*/) {}
270 
271  //! Do nothing setter for the quadrature rule
272  void setQuadrature (const QuadratureRule&) {}
273 
274  //@}
275 
276 
277  //! @name Get Methods
278  //@{
279 
280  //! Getter for the value for a matrix
281  const return_Type& value_qij (const UInt& q, const UInt& /*i*/, const UInt& j) const
282  {
283  return (*M_valuesPtr) [q][j];
284  }
285 
286  //@}
287 
288 private:
289 
290  //! Storage of the pointer to the data
291  std::vector< std::vector < Real > > const* M_valuesPtr;
292 
293 };
294 
295 
296 template<UInt spaceDim>
297 const flag_Type EvaluationLaplacianJ<1, spaceDim>::S_globalUpdateFlag = ET_UPDATE_NONE;
298 
299 template<UInt spaceDim>
300 const flag_Type EvaluationLaplacianJ<1, spaceDim>::S_testUpdateFlag = ET_UPDATE_NONE;
301 
302 template<UInt spaceDim>
303 const flag_Type EvaluationLaplacianJ<1, spaceDim>::S_solutionUpdateFlag = ET_UPDATE_LAPLACIAN;
304 
305 } // Namespace ExpressionAssembly
306 
307 } // Namespace LifeV
308 #endif
friend class ExpressionAssembly::EvaluationLaplacianJ
Friend to allow direct access to the raw data.
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.
uint32_type UInt
generic unsigned integer (used mainly for addressing)
Definition: LifeV.hpp:191