LifeV
ExpressionVector.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 containing the expression to represent a vectorial constant
30 
31  @author Samuel Quinodoz <samuel.quinodoz@epfl.ch>
32 
33  @date 07-2011
34  */
35 
36 #ifndef EXPRESSION_VECTOR_HPP
37 #define EXPRESSION_VECTOR_HPP
38 
39 #include <lifev/core/LifeV.hpp>
40 
41 #include <lifev/core/array/VectorSmall.hpp>
42 
43 #include <lifev/eta/expression/ExpressionBase.hpp>
44 
45 #include <iostream>
46 
47 namespace LifeV
48 {
49 
50 namespace ExpressionAssembly
51 {
52 
53 //! class ExpressionVector Class representing a constant vectorial value in an expression
54 /*!
55  @author Samuel Quinodoz <samuel.quinodoz@epfl.ch>
56 
57  <b> Template parameters </b>
58 
59  <i>VectorDim</i>: The dimension (size) of the vector to be represented.
60 
61 */
62 template < UInt VectorDim >
63 class ExpressionVector : public ExpressionBase<ExpressionVector<VectorDim> >
64 {
65 public:
66 
67  //! @name Public Types
68  //@{
69 
70  typedef ExpressionBase<ExpressionVector<VectorDim> > base_Type;
71 
72  //@}
73 
74 
75  //! @name Constructors & Destructor
76  //@{
77 
78  //! Constructor using the vector of values
79  ExpressionVector (const VectorSmall<VectorDim>& myValue)
80  : base_Type(), M_value (myValue) {}
81 
82  //! Copy constructor
83  ExpressionVector (const ExpressionVector<VectorDim>& expr)
84  : base_Type(), M_value (expr.M_value) {}
85 
86  //! Destructor
87  ~ExpressionVector() {}
88 
89  //@}
90 
91 
92  //! @name Methods
93  //@{
94 
95  //! Display method
96  static void display (std::ostream& out = std::cout)
97  {
98  out << "vector[" << VectorDim << "] ";
99  }
100 
101  //@}
102 
103 
104  //! @name Get Methods
105  //@{
106 
107  //! Getter for the vector of values
108  const VectorSmall<VectorDim>& value() const
109  {
110  return M_value;
111  }
112 
113  //@}
114 
115 private:
116 
117  //! @name Private Methods
118  //@{
119 
120  ExpressionVector();
121 
122  //@}
123 
124  VectorSmall<VectorDim> M_value;
125 };
126 
127 //! Simple function to be used in the construction of an expression
128 /*!
129  @author Samuel Quinodoz <samuel.quinodoz@epfl.ch>
130 
131  <b> Template parameters </b>
132 
133  <i>VectorDim</i>: The dimension (size) of the vector to be represented.
134 */
135 template<UInt VectorDim>
136 inline ExpressionVector<VectorDim>
137 value (const VectorSmall<VectorDim>& myValue)
138 {
139  return ExpressionVector<VectorDim> (myValue);
140 }
141 
142 
143 } // Namespace ExpressionAssembly
144 
145 } // Namespace LifeV
146 
147 #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