LifeV
ExpressionIfCrossed.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_IF_CROSSED_HPP
37 #define EXPRESSION_IF_CROSSED_HPP
38 
39 #include <lifev/core/array/VectorEpetra.hpp>
40 
41 #include <lifev/core/LifeV.hpp>
42 
43 #include <lifev/eta/expression/ExpressionBase.hpp>
44 
45 #include <lifev/eta/fem/ETFESpace.hpp>
46 
47 #include <boost/shared_ptr.hpp>
48 
49 #include <iostream>
50 
51 namespace LifeV
52 {
53 
54 namespace ExpressionAssembly
55 {
56 
57 //! class ExpressionInterpolateValue Class representing an interpolation in an expression.
58 /*!
59  @author Samuel Quinodoz <samuel.quinodoz@epfl.ch>
60 
61 */
62 template<typename MeshType, typename MapType, UInt SpaceDim>
63 class ExpressionIfCrossed
64  : public ExpressionBase<ExpressionIfCrossed < MeshType, MapType, SpaceDim > >
65 {
66 public:
67 
68  //! @name Public Types
69  //@{
70 
71  // Base class, used only to make the code cleaner
72  typedef ExpressionBase<ExpressionIfCrossed < MeshType, MapType, SpaceDim > > base_Type;
73 
74  //! Type of the finite element space
75  typedef ETFESpace<MeshType, MapType, SpaceDim, 1> fespace_Type;
76 
77  //! Type for the pointer on the finite element space
78  typedef std::shared_ptr<fespace_Type> fespacePtr_Type;
79 
80  //! Data vector type
81  typedef VectorEpetra vector_Type;
82 
83  //@}
84 
85 
86  //! @name Constructors & Destructor
87  //@{
88 
89  //! Constructor using the finite element space and the data vector
90  ExpressionIfCrossed (fespacePtr_Type fespace, const vector_Type& vector)
91  : base_Type(), M_fespace (fespace), M_vector (vector) {}
92 
93  //! Copy constructor
94  ExpressionIfCrossed (const ExpressionIfCrossed<MeshType, MapType, SpaceDim>& expr)
95  : base_Type(), M_fespace (expr.M_fespace), M_vector (expr.M_vector) {}
96 
97  //! Destructor
98  ~ExpressionIfCrossed() {}
99 
100  //@}
101 
102 
103  //! @name Methods
104  //@{
105 
106  //! Display method
107  static void display (std::ostream& out = std::cout)
108  {
109  out << "ifCrossed";
110  }
111 
112  //@}
113 
114 
115  //! @name Get Methods
116  //@{
117 
118  //! Getter for the finite element space
119  fespacePtr_Type fespace() const
120  {
121  return M_fespace;
122  }
123 
124  //! Getter for the data vector
125  const vector_Type vector() const
126  {
127  return M_vector;
128  }
129 
130  // @}
131 
132 private:
133 
134  //! @name Private Methods
135  //@{
136 
137  //! No default constructor
138  ExpressionIfCrossed();
139 
140  //@}
141 
142  // Storage for the finite element space
143  fespacePtr_Type M_fespace;
144 
145  // Storage for the data vector
146  vector_Type M_vector;
147 };
148 
149 //! Simple function to be used in the construction of an expression
150 /*!
151  @author Samuel Quinodoz <samuel.quinodoz@epfl.ch>
152 
153  <b> Template parameters </b>
154 
155  <i>MeshType</i>: The type of the mesh stored in the finite element space
156 
157  <i>MapType</i>: The type of map used in the finite element space
158 
159  <i>SpaceDim</i>: The dimension of the ambient space.
160 
161  <b> Template requirements </b>
162 
163  <i>MeshType</i>: Same as in LifeV::ETFESpace
164 
165  <i>MapType</i>: Same as in LifeV::ETFESpace
166 
167 */
168 template<typename MeshType, typename MapType, UInt SpaceDim>
169 inline ExpressionIfCrossed<MeshType, MapType, SpaceDim>
170 ifCrossed (
171  std::shared_ptr< ETFESpace<MeshType, MapType, SpaceDim, 1> > fespace,
172  const VectorEpetra& vector
173 )
174 {
175  return ExpressionIfCrossed<MeshType, MapType, SpaceDim> (fespace, vector);
176 }
177 
178 
179 } // Namespace ExpressionAssembly
180 
181 } // Namespace LifeV
182 
183 #endif
VectorEpetra - The Epetra Vector format Wrapper.
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