LifeV
EvaluationProduct.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_PRODUCT_HPP
37 #define EVALUTATION_PRODUCT_HPP
38 
39 #include <lifev/core/LifeV.hpp>
40 
41 #include <lifev/eta/array/OperationSmallProduct.hpp>
42 
43 #include <lifev/eta/expression/ExpressionProduct.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 EvaluationLType, typename EvaluationRType>
63 class EvaluationProduct
64 {
65 public:
66 
67  //! @name Public Types
68  //@{
69 
70  //! Type of the value returned by the left operand
71  typedef typename EvaluationLType::return_Type Lreturn_Type;
72 
73  //! Type of the value returned by the right operand
74  typedef typename EvaluationRType::return_Type Rreturn_Type;
75 
76  //! Type of the value returned by this class
77  typedef typename OperationSmallProduct<Lreturn_Type, Rreturn_Type>::result_Type return_Type;
78 
79  //@}
80 
81 
82  //! @name Static constants
83  //@{
84 
85  //! Flag for the global current FE
86  const static flag_Type S_globalUpdateFlag;
87 
88  //! Flag for the test current FE
89  const static flag_Type S_testUpdateFlag;
90 
91  //! Flag for the solution current FE
92  const static flag_Type S_solutionUpdateFlag;
93 
94  //@}
95 
96 
97  //! @name Constructors, destructor
98  //@{
99 
100  //! Copy constructor
101  EvaluationProduct (const EvaluationProduct& eval)
102  : M_evaluationL (eval.M_evaluationL),
103  M_evaluationR (eval.M_evaluationR)
104  {}
105 
106  //! Constructor from the corresponding expression
107  template <typename L, typename R>
108  explicit EvaluationProduct (const ExpressionProduct<L, R>& expression)
109  : M_evaluationL (expression.left() ),
110  M_evaluationR (expression.right() )
111  {}
112 
113  //! Destructor
114  ~EvaluationProduct() {}
115 
116  //@}
117 
118 
119  //! @name Methods
120  //@{
121 
122  //! Internal update method
123  void update (const UInt& iElement)
124  {
125  M_evaluationL.update (iElement);
126  M_evaluationR.update (iElement);
127  }
128 
129  //! Display method
130  static void display (std::ostream& out = std::cout )
131  {
132  EvaluationLType::display (out);
133  out << " * ";
134  EvaluationRType::display (out);
135  }
136 
137  //@}
138 
139 
140  //! @name Set Methods
141  //@{
142 
143  //! Setter for the global current FE
144  template< typename CFEType >
145  void setGlobalCFE (const CFEType* globalCFE)
146  {
147  M_evaluationL.setGlobalCFE (globalCFE);
148  M_evaluationR.setGlobalCFE (globalCFE);
149  }
150 
151  //! Setter for the test current FE
152  template< typename CFEType >
153  void setTestCFE (const CFEType* testCFE)
154  {
155  M_evaluationL.setTestCFE (testCFE);
156  M_evaluationR.setTestCFE (testCFE);
157  }
158 
159  //! Setter for the solution current FE
160  template< typename CFEType >
161  void setSolutionCFE (const CFEType* solutionCFE)
162  {
163  M_evaluationL.setSolutionCFE (solutionCFE);
164  M_evaluationR.setSolutionCFE (solutionCFE);
165  }
166 
167  //! Setter for the quadrature rule
168  void setQuadrature (const QuadratureRule& qr)
169  {
170  M_evaluationL.setQuadrature (qr);
171  M_evaluationR.setQuadrature (qr);
172  }
173 
174  //@}
175 
176 
177  //! @name Get Methods
178  //@{
179 
180  //! Getter a value
181  return_Type value_q (const UInt& q) const
182  {
183  return M_evaluationL.value_q (q) * M_evaluationR.value_q (q);
184  }
185 
186  //! Getter for the value for a vector
187  return_Type value_qi (const UInt& q, const UInt& i) const
188  {
189  return M_evaluationL.value_qi (q, i) * M_evaluationR.value_qi (q, i);
190  }
191 
192  //! Getter for the value for a matrix
193  return_Type value_qij (const UInt& q, const UInt& i, const UInt& j) const
194  {
195  return M_evaluationL.value_qij (q, i, j) * M_evaluationR.value_qij (q, i, j);
196  }
197 
198  //@}
199 
200 private:
201 
202  //! @name Private Methods
203  //@{
204 
205  //! No empty constructor
206  EvaluationProduct();
207 
208  //@}
209 
210  //! Internal storage
211  EvaluationLType M_evaluationL;
212  EvaluationRType M_evaluationR;
213 };
214 
215 template< typename EvaluationLType, typename EvaluationRType>
216 const flag_Type EvaluationProduct<EvaluationLType, EvaluationRType>::S_globalUpdateFlag
217  = EvaluationLType::S_globalUpdateFlag | EvaluationRType::S_globalUpdateFlag;
218 
219 template< typename EvaluationLType, typename EvaluationRType>
220 const flag_Type EvaluationProduct<EvaluationLType, EvaluationRType>::S_testUpdateFlag
221  = EvaluationLType::S_testUpdateFlag | EvaluationRType::S_testUpdateFlag;
222 
223 template< typename EvaluationLType, typename EvaluationRType>
224 const flag_Type EvaluationProduct<EvaluationLType, EvaluationRType>::S_solutionUpdateFlag
225  = EvaluationLType::S_solutionUpdateFlag | EvaluationRType::S_solutionUpdateFlag;
226 
227 } // Namespace ExpressionAssembly
228 
229 } // Namespace LifeV
230 #endif
uint32_type flag_Type
bit-flag with up to 32 different flags
Definition: LifeV.hpp:197
void updateInverseJacobian(const UInt &iQuadPt)
class OperationSmallProduct Class containing information about the product operation between *Small c...
QuadratureRule - The basis class for storing and accessing quadrature rules.
uint32_type UInt
generic unsigned integer (used mainly for addressing)
Definition: LifeV.hpp:191