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