LifeV
ExpressionInverse.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 where the structures for the element-wise multiplication between expressions are defined.
30 
31  @author Samuel Quinodoz <samuel.quinodoz@epfl.ch>
32 
33  @date 08-2012
34  */
35 
36 #ifndef EXPRESSION_INVERSE_HPP
37 #define EXPRESSION_INVERSE_HPP
38 
39 #include <lifev/core/LifeV.hpp>
40 
41 #include <lifev/eta/expression/ExpressionBase.hpp>
42 #include <lifev/eta/expression/ExpressionMatrix.hpp>
43 
44 namespace LifeV
45 {
46 
47 namespace ExpressionAssembly
48 {
49 
50 //! class ExpressionEmult Class for representing the transpose operation of an expression
51 /*!
52  @author Samuel Quinodoz <samuel.quinodoz@epfl.ch>
53 
54  This class represents the transpose operation in the expression tree.
55 
56  <b> Template parameters </b>
57 
58  <i>ExpressionType</i>: The expression to be transposed.
59 
60  <b> Template requirements </b>
61 
62  <i>ExpressionType</i>: Copiable, static display method
63 
64 
65 */
66 template <typename ExpressionType>
67 class ExpressionInverse : public ExpressionBase< ExpressionInverse<ExpressionType> >
68 {
69 public:
70 
71  //! @name Public Types
72  //@{
73 
74  // No real need, just for ease of coding
75  typedef ExpressionBase< ExpressionInverse <ExpressionType> > base_Type;
76 
77  //@}
78 
79 
80  //! @name Constructors & Destructor
81  //@{
82 
83  //! Full constructor
84  ExpressionInverse (const ExpressionType& expr)
85  : base_Type(), M_expr (expr) {}
86 
87  //! Copy constructor
88  ExpressionInverse (const ExpressionInverse<ExpressionType>& expression)
89  : base_Type(), M_expr (expression.M_expr) {}
90 
91  //! Destructor
92  ~ExpressionInverse() {}
93 
94  //@}
95 
96 
97  //! @name Methods
98  //@{
99 
100  //! Display method
101  static void display (std::ostream& out = std::cout)
102  {
103  out << " transpose ";
104  ExpressionType::display (out);
105  }
106 
107  //@}
108 
109 
110  //! @name Get Methods
111  //@{
112 
113  //! Getter for the expression that we transpose
114  const ExpressionType& exprEx() const
115  {
116  return M_expr;
117  }
118 
119 
120  //@}
121 
122 private:
123 
124  //! @name Private Methods
125  //@{
126 
127  //! No default constructor
128  ExpressionInverse();
129 
130  //@}
131 
132  // Expression that we transpose
133  ExpressionType M_expr;
134 
135 };
136 
137 
138 // transpose The generic function for the transpose of an expression.
139 /*!
140  @author Samuel Quinodoz <samuel.quinodoz@epfl.ch>
141 
142  Function used in construction of the expression tree. To avoid shadowing
143  other functions, it uses the ExpressionBase type to distinguish expressions
144  from other types.
145 
146  <b> Template parameters </b>
147 
148  <i>ExpressionType</i>: The expression to be transposed.
149 
150  <b> Template requirements </b>
151 
152  <i>ExpressionType</i>: Same as in LifeV::ExpressionInverse
153 
154 */
155 template< typename ExpressionType >
156 ExpressionInverse<ExpressionType>
157 inv (const ExpressionBase<ExpressionType>& expr)
158 {
159  return ExpressionInverse<ExpressionType> (expr.cast() );
160 }
161 
162 
163 // Specialization for the matricial constants
164 template< UInt Dim1, UInt Dim2>
165 ExpressionInverse<ExpressionMatrix<Dim1, Dim2> >
166 inv (const MatrixSmall<Dim1, Dim2>& m)
167 {
168  return ExpressionInverse<ExpressionMatrix<Dim1, Dim2> > (ExpressionMatrix<Dim1, Dim2> (m) );
169 }
170 
171 
172 } // Namespace ExpressionAssembly
173 
174 } // Namespace LifeV
175 #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