LifeV
EvaluationSquareRoot.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_SQUAREROOT_HPP
37 #define EVALUTATION_SQUAREROOT_HPP
38 
39 #include <lifev/core/LifeV.hpp>
40 
41 #include <lifev/eta/array/OperationSmallSquareRoot.hpp>
42 
43 #include <lifev/eta/expression/ExpressionSquareRoot.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 EvaluationSquareRoot
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  //! Type of the value returned by this class
74  typedef typename OperationSmallSquareRoot<BaseReturn_Type>::result_Type return_Type;
75  //@}
76 
77 
78  //! @name Static constants
79  //@{
80 
81  //! Flag for the global current FE
82  const static flag_Type S_globalUpdateFlag;
83 
84  //! Flag for the test current FE
85  const static flag_Type S_testUpdateFlag;
86 
87  //! Flag for the solution current FE
88  const static flag_Type S_solutionUpdateFlag;
89 
90  //@}
91 
92 
93  //! @name Constructors, destructor
94  //@{
95 
96  //! Copy constructor
97  EvaluationSquareRoot (const EvaluationSquareRoot& eval)
98  : M_evaluationBase (eval.M_evaluationBase)
99  {}
100 
101  //! Constructor from the corresponding expression
102  template <typename BaseExpressionType>
103  explicit EvaluationSquareRoot (const ExpressionSquareRoot<BaseExpressionType>& expression)
104  : M_evaluationBase (expression.base() )
105  {}
106 
107  //! Destructor
108  ~EvaluationSquareRoot() {}
109 
110  //@}
111 
112 
113  //! @name Methods
114  //@{
115 
116  //! Internal update method
117  void update (const UInt& iElement)
118  {
119  M_evaluationBase.update (iElement);
120  }
121 
122  //! Display method
123  static void display (std::ostream& out = std::cout )
124  {
125  out << " sqrt( " ;
126  EvaluationBaseType::display (out);
127  out << ")";
128  }
129 
130  //@}
131 
132 
133  //! @name Set Methods
134  //@{
135 
136  //! Setter for the global current FE
137  template< typename CFEType >
138  void setGlobalCFE (const CFEType* globalCFE)
139  {
140  M_evaluationBase.setGlobalCFE (globalCFE);
141  }
142 
143  //! Setter for the test current FE
144  template< typename CFEType >
145  void setTestCFE (const CFEType* testCFE)
146  {
147  M_evaluationBase.setTestCFE (testCFE);
148  }
149 
150  //! Setter for the solution current FE
151  template< typename CFEType >
152  void setSolutionCFE (const CFEType* solutionCFE)
153  {
154  M_evaluationBase.setSolutionCFE (solutionCFE);
155  }
156 
157  //! Setter for the quadrature rule
158  void setQuadrature (const QuadratureRule& qr)
159  {
160  M_evaluationBase.setQuadrature (qr);
161  }
162 
163  //@}
164 
165 
166  //! @name Get Methods
167  //@{
168 
169  //! Getter a value
170  return_Type value_q (const UInt& q) const
171  {
172  return std::sqrt (M_evaluationBase.value_q (q));
173  }
174 
175  //! Getter for the value for a vector
176  return_Type value_qi (const UInt& q, const UInt& i) const
177  {
178  return std::sqrt (M_evaluationBase.value_qi (q, i));
179  }
180 
181  //! Getter for the value for a matrix
182  return_Type value_qij (const UInt& q, const UInt& i, const UInt& j) const
183  {
184  return std::sqrt (M_evaluationBase.value_qij (q, i, j) );
185  }
186 
187  //@}
188 
189 private:
190 
191  //! @name Private Methods
192  //@{
193 
194  //! No empty constructor
195  EvaluationSquareRoot();
196 
197  //@}
198 
199  //! Internal storage
200  EvaluationBaseType M_evaluationBase;
201 };
202 
203 template< typename EvaluationBaseType>
204 const flag_Type EvaluationSquareRoot<EvaluationBaseType>::S_globalUpdateFlag
205  = EvaluationBaseType::S_globalUpdateFlag;
206 
207 template< typename EvaluationBaseType>
208 const flag_Type EvaluationSquareRoot<EvaluationBaseType>::S_testUpdateFlag
209  = EvaluationBaseType::S_testUpdateFlag;
210 
211 template< typename EvaluationBaseType>
212 const flag_Type EvaluationSquareRoot<EvaluationBaseType>::S_solutionUpdateFlag
213  = EvaluationBaseType::S_solutionUpdateFlag;
214 
215 } // Namespace ExpressionAssembly
216 
217 } // Namespace LifeV
218 #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