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