LifeV
EvaluationVectorFromNonConstantScalar.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 EvaluationTranspose class.
31 
32  @date 08/2012
33  @author Samuel Quinodoz <samuel.quinodoz@epfl.ch>
34  */
35 
36 #ifndef EVALUTATION_VECTORFROMNONCONSTANTSCALAR_HPP
37 #define EVALUTATION_VECTORFROMNONCONSTANTSCALAR_HPP
38 
39 
40 #include <lifev/core/LifeV.hpp>
41 
42 #include <lifev/core/array/VectorSmall.hpp>
43 
44 #include <lifev/eta/expression/ExpressionVectorFromNonConstantScalar.hpp>
45 
46 #include <lifev/core/fem/QuadratureRule.hpp>
47 
48 namespace LifeV
49 {
50 
51 namespace ExpressionAssembly
52 {
53 
54 //! Evaluation for the transpose of another Evaluation
55 /*!
56  @author Samuel Quinodoz <samuel.quinodoz@epfl.ch>
57 
58  This class aims at representing the transpose operation during the assembly
59 
60  This class is an Evaluation class, and therefore, has all the methods
61  required to work within the Evaluation trees.
62  */
63 template <typename EvaluationType, UInt FieldDim>
64 class EvaluationVectorFromNonConstantScalar
65 {
66 public:
67 
68 
69  //! @name Public Types
70  //@{
71 
72  //! Type of the value returned by the 'operand' to be transposed
73  // typedef typename EvaluationType::return_Type return_Type;
74 
75  //! Type of the value returned by this class
76  // NOTE: specialized for 3d problems
77  typedef VectorSmall<FieldDim> 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  EvaluationVectorFromNonConstantScalar (const EvaluationVectorFromNonConstantScalar& eval)
102  : M_evaluation (eval.M_evaluation)
103  {}
104 
105  //! Constructor from the corresponding expression
106  template< typename Expression>
107  explicit EvaluationVectorFromNonConstantScalar (const ExpressionVectorFromNonConstantScalar<Expression, FieldDim>& expression)
108  : M_evaluation (expression.exprEx() )
109  {}
110 
111  //! Destructor
112  ~EvaluationVectorFromNonConstantScalar()
113  {}
114 
115  //@}
116 
117 
118  //! @name Methods
119  //@{
120 
121  //! Internal update method
122  void update (const UInt& iElement)
123  {
124  M_evaluation.update (iElement);
125  }
126 
127  //! Display method
128  static void display (std::ostream& out = std::cout)
129  {
130  out << " vector from scalar expression ";
131  EvaluationType::display (out);
132  }
133 
134  //@}
135 
136 
137  //! @name Set Methods
138  //@{
139 
140  //! Setter for the global current FE
141  template< typename CFEType >
142  void setGlobalCFE (const CFEType* globalCFE)
143  {
144  M_evaluation.setGlobalCFE (globalCFE);
145  }
146 
147  //! Setter for the test current FE
148  template< typename CFEType >
149  void setTestCFE (const CFEType* testCFE)
150  {
151  M_evaluation.setTestCFE (testCFE);
152  }
153 
154  //! Setter for the solution FE
155  template< typename CFEType >
156  void setSolutionCFE (const CFEType* solutionCFE)
157  {
158  M_evaluation.setSolutionCFE (solutionCFE);
159  }
160 
161  //! Setter for the quadrature rule
162  void setQuadrature (const QuadratureRule& qr)
163  {
164  M_evaluation.setQuadrature (qr);
165  }
166 
167  //@}
168 
169 
170  //! @name Get Methods
171  //@{
172 
173  //! Getter for a value
174  return_Type value_q (const UInt& q) const
175  {
176  return VectorSmall<FieldDim> ( M_evaluation.value_q( q ) );
177  }
178 
179  //! Getter for the value for a vector
180  return_Type value_qi (const UInt& q, const UInt& i) const
181  {
182  return VectorSmall<FieldDim> ( M_evaluation.value_qi( q,i ) );
183  }
184 
185  //! Getter for the value for a matrix
186  return_Type value_qij (const UInt& q, const UInt& i, const UInt& j) const
187  {
188  return VectorSmall<FieldDim> ( M_evaluation.value_qij( q,i,j ) );
189  }
190 
191  //@}
192 
193 private:
194 
195  //! @name Private Methods
196  //@{
197 
198  //! No default
199  EvaluationVectorFromNonConstantScalar();
200 
201  //@}
202 
203  // Internal storage
204  EvaluationType M_evaluation;
205 };
206 
207 
208 template< typename EvaluationType, UInt FieldDim >
209 const flag_Type EvaluationVectorFromNonConstantScalar<EvaluationType, FieldDim>::S_globalUpdateFlag
210  = EvaluationType::S_globalUpdateFlag;
211 
212 template< typename EvaluationType, UInt FieldDim >
213 const flag_Type EvaluationVectorFromNonConstantScalar<EvaluationType, FieldDim>::S_testUpdateFlag
214  = EvaluationType::S_testUpdateFlag;
215 
216 template< typename EvaluationType, UInt FieldDim >
217 const flag_Type EvaluationVectorFromNonConstantScalar<EvaluationType, FieldDim>::S_solutionUpdateFlag
218  = EvaluationType::S_solutionUpdateFlag;
219 
220 } // Namespace ExpressionAssembly
221 
222 } // Namespace LifeV
223 #endif
uint32_type flag_Type
bit-flag with up to 32 different flags
Definition: LifeV.hpp:197
void updateInverseJacobian(const UInt &iQuadPt)
QuadratureRule - The basis class for storing and accessing quadrature rules.
uint32_type UInt
generic unsigned integer (used mainly for addressing)
Definition: LifeV.hpp:191