LifeV
ExpressionScalarToVector.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 This expression will collect three expressions that return a scalar into a vector. Used for computing the laplacian of a vector field.
30 
31  @author Davide Forti <davide.forti@epfl.ch>
32 
33  @date 02-2014
34  */
35 
36 #ifndef EXPRESSION_SCALARTOVECTOR_HPP
37 #define EXPRESSION_SCALARTOVECTOR_HPP
38 
39 #include <lifev/core/LifeV.hpp>
40 
41 #include <lifev/eta/expression/ExpressionBase.hpp>
42 
43 namespace LifeV
44 {
45 
46 namespace ExpressionAssembly
47 {
48 
49 template <typename ExpressionType, UInt FieldDim>
50 class ExpressionScalarToVector : public ExpressionBase<ExpressionScalarToVector<ExpressionType, FieldDim> >
51 {
52 public:
53 
54  //! @name Public Types
55  //@{
56 
57  // No real need, just for ease of coding
58  typedef ExpressionBase< ExpressionScalarToVector <ExpressionType, FieldDim> > base_Type;
59 
60  //@}
61 
62 
63  //! @name Constructors & Destructor
64  //@{
65 
66  //! Full constructor
67  ExpressionScalarToVector(const ExpressionType& expr1, const ExpressionType& expr2, const ExpressionType& expr3)
68  : base_Type(), M_expr1 (expr1), M_expr2 (expr2), M_expr3 (expr3) {}
69 
70  //! Copy constructor
71  ExpressionScalarToVector (const ExpressionScalarToVector<ExpressionType, FieldDim>& expression)
72  : base_Type(), M_expr1 (expression.M_expr1), M_expr2 (expression.M_expr2), M_expr3 (expression.M_expr3) {}
73 
74  //! Destructor
75  ~ExpressionScalarToVector() {}
76 
77  //@}
78 
79 
80  //! @name Methods
81  //@{
82 
83  //! Display method
84  static void display (std::ostream& out = std::cout)
85  {
86  out << " vector small from expression ";
87  ExpressionType::display (out);
88  }
89 
90  //@}
91 
92 
93  //! @name Get Methods
94  //@{
95 
96  //! Getter for the expression that we transpose
97  const ExpressionType& exprEx1() const
98  {
99  return M_expr1;
100  }
101 
102  const ExpressionType& exprEx2() const
103  {
104  return M_expr2;
105  }
106 
107  const ExpressionType& exprEx3() const
108  {
109  return M_expr3;
110  }
111 
112  //@}
113 
114 private:
115 
116  //! @name Private Methods
117  //@{
118 
119  //! No default constructor
120  ExpressionScalarToVector();
121 
122  //@}
123 
124  // Expression that we want to collect into the VectorSmall
125  ExpressionType M_expr1;
126  ExpressionType M_expr2;
127  ExpressionType M_expr3;
128 
129 
130 };
131 
132 template< typename ExpressionType, UInt FieldDim >
133 ExpressionScalarToVector<ExpressionType, FieldDim>
134 scalarToVector(const ExpressionBase<ExpressionType>& expr1,
135  const ExpressionBase<ExpressionType>& expr2,
136  const ExpressionBase<ExpressionType>& expr3)
137 {
138  return ExpressionScalarToVector<ExpressionType, FieldDim> (expr1.cast(), expr2.cast(), expr3.cast());
139 }
140 
141 
142 } // Namespace ExpressionAssembly
143 
144 } // Namespace LifeV
145 #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