LifeV
ExpressionReturnAtQuadraturePoints.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 LifeV.
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 License
21  along with LifeV. If not, see <http://www.gnu.org/licenses/>.
22 
23 *******************************************************************************
24 */
25 //@HEADER
26 
27 /*!
28  @file
29  @brief File for the definition of the expression used to interpolate FE functions.
30 
31  @author Samuel Quinodoz <samuel.quinodoz@epfl.ch>
32 
33  @date 07-2011
34  */
35 
36 #ifndef EXPRESSION_RETURN_AT_QUAD_PTS_HPP
37 #define EXPRESSION_RETURN_AT_QUAD_PTS_HPP
38 
39 #include <lifev/core/LifeV.hpp>
40 
41 #include <lifev/core/array/VectorEpetra.hpp>
42 
43 #include <lifev/eta/expression/ExpressionBase.hpp>
44 
45 #include <lifev/eta/fem/ETFESpace.hpp>
46 
47 #include <iostream>
48 
49 namespace LifeV
50 {
51 
52 namespace ExpressionAssembly
53 {
54 
55 //! class ExpressionInterpolateValue Class representing an interpolation in an expression.
56 /*!
57  @author Samuel Quinodoz <samuel.quinodoz@epfl.ch>
58 
59  This class is meant to be used only in the expression tree, it does not perform
60  any computation.
61 
62  <b> Template parameters </b>
63 
64  <i>MeshType</i>: The type of the mesh
65 
66  <i>MapType</i>: The type of the algebraic map (for parallel computations)
67 
68  <i>SpaceDim</i>: The ambiant space (for the finite element space)
69 
70  <i>FieldDim</i>: The dimension of the field to interpolate (scalar vs vectorial)
71 
72  <b> Template requirements </b>
73 
74  <i>MeshType</i>: Same as in LifeV::ETFESpace
75 
76  <i>MapType</i>: Same as in LifeV::ETFESpace
77 
78 */
79 template<typename MeshType, typename MapType, UInt SpaceDim, UInt FieldDim>
80 class ExpressionReturnAtQuadraturePoints
81  : public ExpressionBase<ExpressionReturnAtQuadraturePoints < MeshType, MapType, SpaceDim, FieldDim > >
82 {
83 public:
84 
85  //! @name Public Types
86  //@{
87 
88  // Base class, used only to make the code cleaner
89  typedef ExpressionBase<ExpressionReturnAtQuadraturePoints < MeshType, MapType, SpaceDim, FieldDim > > base_Type;
90 
91  //! Type of the finite element space
92  typedef ETFESpace<MeshType, MapType, SpaceDim, FieldDim> fespace_Type;
93 
94  //! Type for the pointer on the finite element space
95  typedef std::shared_ptr<fespace_Type> fespacePtr_Type;
96 
97  //! Data vector type - vectorial case
98  typedef std::vector<std::vector<VectorSmall<FieldDim>>> vector_Type;
99 
100  //@}
101 
102 
103  //! @name Constructors & Destructor
104  //@{
105 
106  //! Constructor using the finite element space and the data vector
107  ExpressionReturnAtQuadraturePoints (fespacePtr_Type fespace, const vector_Type& vector)
108  : base_Type(), M_fespace (fespace), M_vector (vector) {}
109 
110  //! Copy constructor
111  ExpressionReturnAtQuadraturePoints (const ExpressionReturnAtQuadraturePoints<MeshType, MapType, SpaceDim, FieldDim>& expr)
112  : base_Type(), M_fespace (expr.M_fespace), M_vector (expr.M_vector) {}
113 
114  //! Destructor
115  ~ExpressionReturnAtQuadraturePoints() {}
116 
117  //@}
118 
119 
120  //! @name Methods
121  //@{
122 
123  //! Display method
124  static void display (std::ostream& out = std::cout)
125  {
126  out << "returned[" << FieldDim << "] ";
127  }
128 
129  //@}
130 
131 
132  //! @name Get Methods
133  //@{
134 
135  //! Getter for the finite element space
136  fespacePtr_Type fespace() const
137  {
138  return M_fespace;
139  }
140 
141  //! Getter for the data vector
142  const vector_Type vector() const
143  {
144  return M_vector;
145  }
146 
147  // @}
148 
149 private:
150 
151  //! @name Private Methods
152  //@{
153 
154  //! No default constructor
155  ExpressionReturnAtQuadraturePoints();
156 
157  //@}
158 
159  // Storage for the finite element space
160  fespacePtr_Type M_fespace;
161 
162  // Storage for the data vector
163  vector_Type M_vector;
164 };
165 
166 //! Simple function to be used in the construction of an expression
167 /*!
168  @author Samuel Quinodoz <samuel.quinodoz@epfl.ch>
169 
170  <b> Template parameters </b>
171 
172  <i>MeshType</i>: The type of the mesh stored in the finite element space
173 
174  <i>MapType</i>: The type of map used in the finite element space
175 
176  <i>SpaceDim</i>: The dimension of the ambient space.
177 
178  <i>FieldDim</i>: The dimension of the finite element space (scalar vs vectorial)
179 
180  <b> Template requirements </b>
181 
182  <i>MeshType</i>: Same as in LifeV::ETFESpace
183 
184  <i>MapType</i>: Same as in LifeV::ETFESpace
185 
186 */
187 template<typename MeshType, typename MapType, UInt SpaceDim, UInt FieldDim>
188 inline ExpressionReturnAtQuadraturePoints<MeshType, MapType, SpaceDim, FieldDim>
189 quadpts (
190  std::shared_ptr< ETFESpace<MeshType, MapType, SpaceDim, FieldDim> > fespace,
191  const std::vector<std::vector<VectorSmall<FieldDim>>>& vector
192 )
193 {
194  return ExpressionReturnAtQuadraturePoints<MeshType, MapType, SpaceDim, FieldDim> (fespace, vector);
195 }
196 
197 
198 } // Namespace ExpressionAssembly
199 
200 } // Namespace LifeV
201 
202 #endif
void updateInverseJacobian(const UInt &iQuadPt)
class ExpressionBase Base class (static polymorphism, CRTP sense) for all the expressions used in ass...
uint32_type UInt
generic unsigned integer (used mainly for addressing)
Definition: LifeV.hpp:191