LifeV
EvaluationVectorFromNonConstantMatrix.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 EvaluationVector class.
31 
32  @date 06/2011
33  @author Samuel Quinodoz <samuel.quinodoz@epfl.ch>
34  */
35 #ifndef EVALUATION_VECTORFROMNONCONSTANTMATRIX_HPP
36 #define EVALUATION_VECTORFROMNONCONSTANTMATRIX_HPP
37 
38 #include <lifev/core/LifeV.hpp>
39 
40 #include <lifev/core/array/VectorSmall.hpp>
41 #include <lifev/core/array/MatrixSmall.hpp>
42 
43 #include <lifev/eta/expression/ExpressionVectorFromNonConstantMatrix.hpp>
44 
45 namespace LifeV
46 {
47 
48 namespace ExpressionAssembly
49 {
50 
51 //! Evaluation for a vectorial constant
52 /*!
53  @author Samuel Quinodoz <samuel.quinodoz@epfl.ch>
54 
55  This class aims at representing a vectorial constant in the assembly
56 
57  This class is an Evaluation class, and therefore, has all the methods
58  required to work within the Evaluation trees.
59  */
60 template <typename EvaluationType, UInt SpaceDim, UInt FieldDim>
61 class EvaluationVectorFromNonConstantMatrix
62 {
63 public:
64 
65  //! @name Public Types
66  //@{
67 
68  //! Type of the value returned by this class
69  typedef VectorSmall<FieldDim> return_Type;
70  typedef MatrixSmall<FieldDim, SpaceDim> matrix_Type;
71 
72  //@}
73 
74 
75  //! @name Static constants
76  //@{
77 
78  //! Flag for the global current FE
79  const static flag_Type S_globalUpdateFlag;
80 
81  //! Flag for the test current FE
82  const static flag_Type S_testUpdateFlag;
83 
84  //! Flag for the solution current FE
85  const static flag_Type S_solutionUpdateFlag;
86 
87  //@}
88 
89 
90  //! @name Constructors, destructor
91  //@{
92 
93  //! Copy constructor
94  EvaluationVectorFromNonConstantMatrix (const EvaluationVectorFromNonConstantMatrix<EvaluationType, SpaceDim, FieldDim >& evaluation)
95  : M_evaluation( evaluation.M_evaluation ), M_column( evaluation.M_column)
96  { }
97 
98  //! Expression-based constructor
99  template< typename Expression>
100  explicit EvaluationVectorFromNonConstantMatrix (const ExpressionVectorFromNonConstantMatrix<Expression, SpaceDim, FieldDim>& expression)
101  : M_evaluation( expression.expr() ), M_column( expression.column() )
102  {}
103 
104  //! Destructor
105  ~EvaluationVectorFromNonConstantMatrix()
106  {}
107 
108  //@}
109 
110 
111  //! @name Methods
112  //@{
113 
114  //! Do nothing internal update
115  void update (const UInt& iElement)
116  {
117  M_evaluation.update ( iElement );
118  }
119 
120  //! Display method
121  static void display (std::ostream& out = std::cout)
122  {
123  out << "vector from a non constant matrix[" << FieldDim << "]";
124  }
125 
126  //@}
127 
128 
129  //! @name Set Methods
130  //@{
131 
132  //! Do nothing setter for the global current FE
133  template< typename CFEType >
134  void setGlobalCFE (const CFEType* globalCFE)
135  {
136  M_evaluation.setGlobalCFE (globalCFE);
137  }
138 
139  //! Do nothing setter for the test current FE
140  template< typename CFEType >
141  void setTestCFE (const CFEType* testCFE)
142  {
143  M_evaluation.setTestCFE (testCFE);
144  }
145 
146  //! Do nothing setter for the solution current FE
147  template< typename CFEType >
148  void setSolutionCFE (const CFEType* solutionCFE)
149  {
150  M_evaluation.setSolutionCFE (solutionCFE);
151  }
152 
153  //! Setter for the quadrature rule
154  void setQuadrature (const QuadratureRule& qr)
155  {
156  M_evaluation.setQuadrature (qr);
157  }
158 
159  //@}
160 
161 
162  //! @name Get Methods
163  //@{
164 
165  //! Getter for a value
166  return_Type value_q (const UInt& q) const
167  {
168  return M_evaluation.value_q( q ).extractColumn( M_column );
169  }
170 
171  //! Getter for the value for a vector
172  return_Type value_qi (const UInt& q, const UInt& i) const
173  {
174  return M_evaluation.value_qi( q,i ).extractColumn( M_column );
175  }
176 
177  //! Getter for the value for a matrix
178  return_Type value_qij (const UInt& q, const UInt& i, const UInt& j) const
179  {
180  return M_evaluation.value_qij( q,i,j ).extractColumn( M_column );
181  }
182 
183  //@}
184 
185 private:
186 
187  // Storage
188  EvaluationType M_evaluation;
189  UInt M_column;
190 };
191 
192 
193 template<typename EvaluationType,UInt SpaceDim , UInt FieldDim>
194 const flag_Type EvaluationVectorFromNonConstantMatrix<EvaluationType,SpaceDim, FieldDim>::S_globalUpdateFlag = EvaluationType::S_globalUpdateFlag;
195 
196 template<typename EvaluationType,UInt SpaceDim , UInt FieldDim>
197 const flag_Type EvaluationVectorFromNonConstantMatrix<EvaluationType,SpaceDim, FieldDim>::S_testUpdateFlag = EvaluationType::S_testUpdateFlag;
198 
199 template<typename EvaluationType,UInt SpaceDim , UInt FieldDim>
200 const flag_Type EvaluationVectorFromNonConstantMatrix<EvaluationType,SpaceDim, FieldDim>::S_solutionUpdateFlag = EvaluationType::S_solutionUpdateFlag;
201 
202 
203 } // Namespace ExpressionAssembly
204 
205 } // Namespace LifeV
206 #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