LifeV
EvaluationExtract1.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 EvaluationExtract1 class.
31 
32  @date 06/2011
33  @author Samuel Quinodoz <samuel.quinodoz@epfl.ch>
34  */
35 
36 #ifndef EVALUTATION_EXTRACT1_HPP
37 #define EVALUTATION_EXTRACT1_HPP
38 
39 
40 #include <lifev/core/LifeV.hpp>
41 #include <lifev/core/array/MatrixSmall.hpp>
42 #include <lifev/eta/expression/ExpressionExtract1.hpp>
43 #include <lifev/eta/expression/EvaluationMatrix.hpp>
44 #include <lifev/eta/array/OperationSmallExtract.hpp>
45 
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 row resp. component from a matrix resp. a vector.
57 /*!
58  @author Samuel Quinodoz <samuel.quinodoz@epfl.ch>
59 
60  This class aims at representing the extraction of a row resp. component from a matrix resp. a vector 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 EvaluationExtract1
73 {
74 public:
75 
76  //! @name Public Types
77  //@{
78 
79  //! Type of the value returned by this class
80  typedef typename OperationSmallExtract1< 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  EvaluationExtract1 (const EvaluationExtract1< EvaluationType >& eval)
105  : M_i (eval.M_i),
106  M_evaluation (eval.M_evaluation)
107  {}
108 
109  //! Constructor from the corresponding expression
110  template< typename ExpressionType >
111  explicit EvaluationExtract1 (const ExpressionExtract1< ExpressionType >& expression)
112  : M_i (expression.indexI() ),
113  M_evaluation (expression.exprEx() )
114  {}
115 
116 
117  //! Destructor
118  ~EvaluationExtract1()
119  {}
120 
121  //@}
122 
123 
124  //! @name Methods
125  //@{
126 
127  //! Internal update
128  void update (const UInt& iElement)
129  {
130  M_evaluation.update (iElement);
131  }
132 
133  //! Display method
134  static void display (std::ostream& out = std::cout)
135  {
136  out << "Extraction from ";
137  EvaluationType::display (out);
138  }
139 
140  //@}
141 
142 
143  //! @name Set Methods
144  //@{
145 
146  //! Setter for the global current FE
147  template< typename CFEType >
148  void setGlobalCFE (const CFEType* globalCFE)
149  {
150  M_evaluation.setGlobalCFE (globalCFE);
151  }
152 
153  //! Setter for the test current FE
154  template< typename CFEType >
155  void setTestCFE (const CFEType* testCFE)
156  {
157  M_evaluation.setTestCFE (testCFE);
158  }
159 
160  //! Setter for the solution current FE
161  template< typename CFEType >
162  void setSolutionCFE (const CFEType* solutionCFE)
163  {
164  M_evaluation.setSolutionCFE (solutionCFE);
165  }
166 
167  //! Setter for the quadrature rule
168  void setQuadrature (const QuadratureRule& qr)
169  {
170  M_evaluation.setQuadrature (qr);
171  }
172 
173  //@}
174 
175 
176  //! @name Get Methods
177  //@{
178 
179  //! Getter for a value
180  return_Type value_q (const UInt& q) const
181  {
182  return M_evaluation.value_q (q).extract (M_i);;
183  }
184 
185  //! Getter for the value for a vector
186  return_Type value_qi (const UInt& q, const UInt& i) const
187  {
188  return M_evaluation.value_qi (q, i).extract (M_i);
189  }
190 
191  //! Getter for the value for a matrix
192  return_Type value_qij (const UInt& q, const UInt& i, const UInt& j) const
193  {
194  return M_evaluation.value_qij (q, i, j).extract (M_i);
195  }
196 
197  //@}
198 
199 private:
200 
201  //! @name Private Methods
202  //@{
203 
204  //! No empty constructor
205  EvaluationExtract1();
206 
207  //@}
208 
209  // Internal storage
210  UInt M_i;
211  EvaluationType M_evaluation;
212 };
213 
214 
215 
216 template<typename EvaluationType>
217 const flag_Type EvaluationExtract1<EvaluationType>::S_globalUpdateFlag
218  = EvaluationType::S_globalUpdateFlag;
219 
220 template<typename EvaluationType>
221 const flag_Type EvaluationExtract1<EvaluationType>::S_testUpdateFlag
222  = EvaluationType::S_testUpdateFlag;
223 
224 template<typename EvaluationType>
225 const flag_Type EvaluationExtract1<EvaluationType>::S_solutionUpdateFlag
226  = EvaluationType::S_solutionUpdateFlag;
227 
228 
229 } // Namespace ExpressionAssembly
230 
231 } // Namespace LifeV
232 
233 #endif
uint32_type flag_Type
bit-flag with up to 32 different flags
Definition: LifeV.hpp:197
void updateInverseJacobian(const UInt &iQuadPt)
class OperationSmallExtract Class containing information about the extraction of a row or component w...
QuadratureRule - The basis class for storing and accessing quadrature rules.
uint32_type UInt
generic unsigned integer (used mainly for addressing)
Definition: LifeV.hpp:191