LifeV
EvaluationCubicRoot.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 EvaluationAddition class.
31 
32  @date 06/2011
33  @author Samuel Quinodoz <samuel.quinodoz@epfl.ch>
34  */
35 
36 #ifndef EVALUTATION_CUBICROOT_HPP
37 #define EVALUTATION_CUBICROOT_HPP
38 
39 #include <lifev/core/LifeV.hpp>
40 #include <cmath>
41 #include <lifev/eta/array/OperationSmallCubicRoot.hpp>
42 
43 #include <lifev/eta/expression/ExpressionCubicRoot.hpp>
44 
45 #include <lifev/core/fem/QuadratureRule.hpp>
46 
47 namespace LifeV
48 {
49 
50 namespace ExpressionAssembly
51 {
52 
53 //! Evaluation for the product of two other Evaluations
54 /*!
55  @author Samuel Quinodoz <samuel.quinodoz@epfl.ch>
56 
57  This class aims at representing a product operation during the assembly
58 
59  This class is an Evaluation class, and therefore, has all the methods
60  required to work within the Evaluation trees.
61  */
62 template <typename EvaluationBaseType>
63 class EvaluationCubicRoot
64 {
65 public:
66 
67  //! @name Public Types
68  //@{
69 
70  //! Type of the value returned by the left operand
71  typedef typename EvaluationBaseType::return_Type BaseReturn_Type;
72 
73 
74  //! Type of the value returned by this class
75  typedef typename OperationSmallCubicRoot<BaseReturn_Type>::result_Type return_Type;
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  //! Copy constructor
98  EvaluationCubicRoot (const EvaluationCubicRoot& eval)
99  : M_evaluationBase (eval.M_evaluationBase)
100  {}
101 
102  //! Constructor from the corresponding expression
103  template <typename BaseExpressionType>
104  explicit EvaluationCubicRoot (const ExpressionCubicRoot<BaseExpressionType>& expression)
105  : M_evaluationBase (expression.base() )
106  {}
107 
108  //! Destructor
109  ~EvaluationCubicRoot() {}
110 
111  //@}
112 
113 
114  //! @name Methods
115  //@{
116 
117  //! Internal update method
118  void update (const UInt& iElement)
119  {
120  M_evaluationBase.update (iElement);
121  }
122 
123  //! Display method
124  static void display (std::ostream& out = std::cout )
125  {
126  out << " cbrt( " ;
127  EvaluationBaseType::display (out);
128  out << ")";
129  }
130 
131  //@}
132 
133 
134  //! @name Set Methods
135  //@{
136 
137  //! Setter for the global current FE
138  template< typename CFEType >
139  void setGlobalCFE (const CFEType* globalCFE)
140  {
141  M_evaluationBase.setGlobalCFE (globalCFE);
142  }
143 
144  //! Setter for the test current FE
145  template< typename CFEType >
146  void setTestCFE (const CFEType* testCFE)
147  {
148  M_evaluationBase.setTestCFE (testCFE);
149  }
150 
151  //! Setter for the solution current FE
152  template< typename CFEType >
153  void setSolutionCFE (const CFEType* solutionCFE)
154  {
155  M_evaluationBase.setSolutionCFE (solutionCFE);
156  }
157 
158  //! Setter for the quadrature rule
159  void setQuadrature (const QuadratureRule& qr)
160  {
161  M_evaluationBase.setQuadrature (qr);
162  }
163 
164  //@}
165 
166 
167  //! @name Get Methods
168  //@{
169 
170  //! Getter a value
171  return_Type value_q (const UInt& q) const
172  {
173  return cbrt (M_evaluationBase.value_q (q));
174  }
175 
176  //! Getter for the value for a vector
177  return_Type value_qi (const UInt& q, const UInt& i) const
178  {
179  return cbrt (M_evaluationBase.value_qi (q, i));
180  }
181 
182  //! Getter for the value for a matrix
183  return_Type value_qij (const UInt& q, const UInt& i, const UInt& j) const
184  {
185  return cbrt (M_evaluationBase.value_qij (q, i, j) );
186  }
187 
188  //@}
189 
190 private:
191 
192  //! @name Private Methods
193  //@{
194 
195  //! No empty constructor
196  EvaluationCubicRoot();
197 
198  //@}
199 
200  //! Internal storage
201  EvaluationBaseType M_evaluationBase;
202 };
203 
204 template< typename EvaluationBaseType>
205 const flag_Type EvaluationCubicRoot<EvaluationBaseType>::S_globalUpdateFlag
206  = EvaluationBaseType::S_globalUpdateFlag;
207 
208 template< typename EvaluationBaseType>
209 const flag_Type EvaluationCubicRoot<EvaluationBaseType>::S_testUpdateFlag
210  = EvaluationBaseType::S_testUpdateFlag;
211 
212 template< typename EvaluationBaseType>
213 const flag_Type EvaluationCubicRoot<EvaluationBaseType>::S_solutionUpdateFlag
214  = EvaluationBaseType::S_solutionUpdateFlag;
215 
216 
217 /*
218  This expression is a specialization of the cubic root expression
219  for the structure module to have a fast computation of the isochoric
220  change of variable used in the structure module for the constitutive models
221 */
222 template <typename EvaluationBaseType>
223 class EvaluationIsochoricChangeOfVariable
224 {
225 public:
226 
227  //! @name Public Types
228  //@{
229 
230  //! Type of the value returned by the left operand
231  typedef typename EvaluationBaseType::return_Type BaseReturn_Type;
232 
233 
234  //! Type of the value returned by this class
235  typedef typename OperationSmallIsochoricChangeOfVariable<BaseReturn_Type>::result_Type return_Type;
236  //@}
237 
238 
239  //! @name Static constants
240  //@{
241 
242  //! Flag for the global current FE
243  const static flag_Type S_globalUpdateFlag;
244 
245  //! Flag for the test current FE
246  const static flag_Type S_testUpdateFlag;
247 
248  //! Flag for the solution current FE
249  const static flag_Type S_solutionUpdateFlag;
250 
251  //@}
252 
253 
254  //! @name Constructors, destructor
255  //@{
256 
257  //! Copy constructor
258  EvaluationIsochoricChangeOfVariable (const EvaluationIsochoricChangeOfVariable& eval)
259  : M_evaluationBase (eval.M_evaluationBase)
260  {}
261 
262  //! Constructor from the corresponding expression
263  template <typename BaseExpressionType>
264  explicit EvaluationIsochoricChangeOfVariable (const ExpressionIsochoricChangeOfVariable<BaseExpressionType>& expression)
265  : M_evaluationBase (expression.base() )
266  {}
267 
268  //! Destructor
269  ~EvaluationIsochoricChangeOfVariable() {}
270 
271  //@}
272 
273 
274  //! @name Methods
275  //@{
276 
277  //! Internal update method
278  void update (const UInt& iElement)
279  {
280  M_evaluationBase.update (iElement);
281  }
282 
283  //! Display method
284  static void display ( std::ostream& out = std::cout )
285  {
286  out << " IsoCoV( " ;
287  EvaluationBaseType::display (out);
288  out << ")";
289  }
290 
291  //@}
292 
293 
294  //! @name Set Methods
295  //@{
296 
297  //! Setter for the global current FE
298  template< typename CFEType >
299  void setGlobalCFE (const CFEType* globalCFE)
300  {
301  M_evaluationBase.setGlobalCFE (globalCFE);
302  }
303 
304  //! Setter for the test current FE
305  template< typename CFEType >
306  void setTestCFE (const CFEType* testCFE)
307  {
308  M_evaluationBase.setTestCFE (testCFE);
309  }
310 
311  //! Setter for the solution current FE
312  template< typename CFEType >
313  void setSolutionCFE (const CFEType* solutionCFE)
314  {
315  M_evaluationBase.setSolutionCFE (solutionCFE);
316  }
317 
318  //! Setter for the quadrature rule
319  void setQuadrature (const QuadratureRule& qr)
320  {
321  M_evaluationBase.setQuadrature (qr);
322  }
323 
324  //@}
325 
326 
327  //! @name Get Methods
328  //@{
329 
330  //! Getter a value
331  return_Type value_q (const UInt& q) const
332  {
333  return ( 1.0 / cbrt (M_evaluationBase.value_q (q)) ) * ( 1.0 / cbrt (M_evaluationBase.value_q (q)) );
334  }
335 
336  //! Getter for the value for a vector
337  return_Type value_qi (const UInt& q, const UInt& i) const
338  {
339  return ( 1.0 / cbrt (M_evaluationBase.value_qi (q, i) ) ) * ( 1.0 / cbrt (M_evaluationBase.value_qi (q, i) ) );
340  }
341 
342  //! Getter for the value for a matrix
343  return_Type value_qij (const UInt& q, const UInt& i, const UInt& j) const
344  {
345  return ( 1.0 / cbrt (M_evaluationBase.value_qij (q, i, j) ) ) * ( 1.0 / cbrt (M_evaluationBase.value_qij (q, i, j) ) );
346  }
347 
348  //@}
349 
350 private:
351 
352  //! @name Private Methods
353  //@{
354 
355  //! No empty constructor
356  EvaluationIsochoricChangeOfVariable();
357 
358  //@}
359 
360  //! Internal storage
361  EvaluationBaseType M_evaluationBase;
362 };
363 
364 template< typename EvaluationBaseType>
365 const flag_Type EvaluationIsochoricChangeOfVariable<EvaluationBaseType>::S_globalUpdateFlag
366  = EvaluationBaseType::S_globalUpdateFlag;
367 
368 template< typename EvaluationBaseType>
369 const flag_Type EvaluationIsochoricChangeOfVariable<EvaluationBaseType>::S_testUpdateFlag
370  = EvaluationBaseType::S_testUpdateFlag;
371 
372 template< typename EvaluationBaseType>
373 const flag_Type EvaluationIsochoricChangeOfVariable<EvaluationBaseType>::S_solutionUpdateFlag
374  = EvaluationBaseType::S_solutionUpdateFlag;
375 
376 } // Namespace ExpressionAssembly
377 
378 } // Namespace LifeV
379 #endif
uint32_type flag_Type
bit-flag with up to 32 different flags
Definition: LifeV.hpp:197
void updateInverseJacobian(const UInt &iQuadPt)
class OperationSmallAddition Class containing information about the power operation between the *Smal...
QuadratureRule - The basis class for storing and accessing quadrature rules.
uint32_type UInt
generic unsigned integer (used mainly for addressing)
Definition: LifeV.hpp:191