LifeV
EvaluationExtract2.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 EvaluationExtract2 class.
31 
32  @date 06/2011
33  @author Samuel Quinodoz <samuel.quinodoz@epfl.ch>
34  */
35 
36 #ifndef EVALUTATION_EXTRACT2_HPP
37 #define EVALUTATION_EXTRACT2_HPP
38 
39 
40 #include <lifev/core/LifeV.hpp>
41 
42 #include <lifev/eta/expression/ExpressionExtract2.hpp>
43 #include <lifev/eta/expression/EvaluationMatrix.hpp>
44 
45 #include <lifev/eta/array/OperationSmallExtract.hpp>
46 
47 #include <lifev/core/fem/QuadratureRule.hpp>
48 
49 
50 namespace LifeV
51 {
52 
53 namespace ExpressionAssembly
54 {
55 
56 //! Evaluation for the extraction of a component from a matrix.
57 /*!
58  @author Samuel Quinodoz <samuel.quinodoz@epfl.ch>
59 
60  This class aims at representing the extraction of a component from a matrix 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  <b> Template requirement </b>
66 
67  There is one template argument for this class: The EvaluationType.
68 
69  <i> EvaluationType </i> It has to be an Evaluation class.
70  */
71 template <typename EvaluationType>
72 class EvaluationExtract2
73 {
74 public:
75 
76  //! @name Public Types
77  //@{
78 
79  //! Type of the values returned by this class
80  typedef typename OperationSmallExtract2< typename EvaluationType::return_Type >::result_Type return_Type;
81 
82  //@}
83 
84 
85  //! @name Static constants
86  //@{
87 
88  //! Flag for the global current FE
89  const static flag_Type S_globalUpdateFlag;
90 
91  //! Flag for the test current FE
92  const static flag_Type S_testUpdateFlag;
93 
94  //! Flag for the solution current FE
95  const static flag_Type S_solutionUpdateFlag;
96 
97  //@}
98 
99 
100  //! @name Constructors, destructor
101  //@{
102 
103  //! Copy constructor
104  EvaluationExtract2 (const EvaluationExtract2< EvaluationType >& eval)
105  : M_i (eval.M_i),
106  M_j (eval.M_j),
107  M_evaluation (eval.M_evaluation)
108  {}
109 
110  //! Constructor from the corresponding expression
111  template<typename Expression>
112  explicit EvaluationExtract2 (const ExpressionExtract2< Expression >& expression)
113  : M_i (expression.indexI() ),
114  M_j (expression.indexJ() ),
115  M_evaluation (expression.exprEx() )
116  {}
117 
118  //! Destructor
119  ~EvaluationExtract2()
120  {}
121 
122  //@}
123 
124 
125  //! @name Methods
126  //@{
127 
128  //! Internal update
129  void update (const UInt& iElement)
130  {
131  M_evaluation.update (iElement);
132  }
133 
134  //! Display method
135  static void display (std::ostream& out = std::cout)
136  {
137  out << "Extraction from ";
138  EvaluationType::display (out);
139  }
140 
141  //@}
142 
143 
144  //! @name Set Methods
145  //@{
146 
147  //! Setter for the global current FE
148  template< typename CFEType >
149  void setGlobalCFE (const CFEType* globalCFE)
150  {
151  M_evaluation.setGlobalCFE (globalCFE);
152  }
153 
154  //! Setter for the test current FE
155  template< typename CFEType >
156  void setTestCFE (const CFEType* testCFE)
157  {
158  M_evaluation.setTestCFE (testCFE);
159  }
160 
161  //! Setter for the solution current FE
162  template< typename CFEType >
163  void setSolutionCFE (const CFEType* solutionCFE)
164  {
165  M_evaluation.setSolutionCFE (solutionCFE);
166  }
167 
168  //! Setter for the quadrature rule
169  void setQuadrature (const QuadratureRule& qr)
170  {
171  M_evaluation.setQuadrature (qr);
172  }
173 
174  //@}
175 
176 
177  //! @name Get Methods
178  //@{
179 
180  //! Getter for a value
181  return_Type value_q (const UInt& q) const
182  {
183  return M_evaluation.value_q (q).extract (M_i, M_j);
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_evaluation.value_qi (q, i).extract (M_i, M_j);
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_evaluation.value_qij (q, i, j).extract (M_i, M_j);
196  }
197 
198  //@}
199 
200 private:
201 
202  //! @name Private Methods
203  //@{
204 
205  //! No empty constructor
206  EvaluationExtract2();
207 
208  //@}
209 
210  // Internal storage
211  UInt M_i;
212  UInt M_j;
213 
214  EvaluationType M_evaluation;
215 };
216 
217 
218 template<typename EvaluationType>
219 const flag_Type EvaluationExtract2<EvaluationType>::S_globalUpdateFlag
220  = EvaluationType::S_globalUpdateFlag;
221 
222 template<typename EvaluationType>
223 const flag_Type EvaluationExtract2<EvaluationType>::S_testUpdateFlag
224  = EvaluationType::S_testUpdateFlag;
225 
226 template<typename EvaluationType>
227 const flag_Type EvaluationExtract2<EvaluationType>::S_solutionUpdateFlag
228  = EvaluationType::S_solutionUpdateFlag;
229 
230 
231 } // Namespace ExpressionAssembly
232 
233 } // Namespace LifeV
234 #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