LifeV
ExpressionLogarithm.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 product between expressions are defined.
30 
31  @author Samuel Quinodoz <samuel.quinodoz@epfl.ch>
32 
33  @date 07-2011
34  */
35 
36 #ifndef EXPRESSION_LOGARITHM_HPP
37 #define EXPRESSION_LOGARITHM_HPP
38 
39 #include <lifev/core/LifeV.hpp>
40 
41 #include <lifev/eta/expression/ExpressionBase.hpp>
42 #include <lifev/eta/expression/ExpressionDeterminant.hpp>
43 #include <lifev/eta/expression/ExpressionTrace.hpp>
44 
45 namespace LifeV
46 {
47 
48 namespace ExpressionAssembly
49 {
50 
51 //! class ExpressionLogarithm Class for representing a product between two expressions.
52 /*!
53  @author Samuel Quinodoz <samuel.quinodoz@epfl.ch>
54 
55  This class represents the product in the expression tree.
56 
57  <b> Template parameters </b>
58 
59  <i>LExpressionType</i>: The expression on the left side of the product operation.
60 
61  <i>RExpressionType</i>: The expression on the right side of the product operation.
62 
63  <b> Template requirements </b>
64 
65  <i>LExpressionType</i>: Copiable, static display method
66 
67  <i>RExpressionType</i>: Copiable, static display method
68 
69 */
70 template <typename BaseExpressionType>
71 class ExpressionLogarithm : public ExpressionBase< ExpressionLogarithm<BaseExpressionType> >
72 {
73 public:
74 
75  //! @name Public Types
76  //@{
77 
78  // No direct use, just ease of coding
79  typedef ExpressionBase< ExpressionLogarithm <BaseExpressionType> > base_Type;
80 
81  //@}
82 
83  //! @name Constructors & Destructor
84  //@{
85 
86  //! Full constructor using the two expressions
87  ExpressionLogarithm (const BaseExpressionType& l)
88  : base_Type(), M_l (l) {}
89 
90  //! Copy constructor
91  ExpressionLogarithm (const ExpressionLogarithm<BaseExpressionType>& expression)
92  : base_Type(), M_l (expression.M_l) {}
93 
94  //! Destructor
95  ~ExpressionLogarithm() {}
96 
97  //@}
98 
99 
100  //! @name Methods
101  //@{
102 
103  //! Display method
104  static void display (std::ostream& out = std::cout)
105  {
106  out << "Expression Logarithm of: ";
107  BaseExpressionType::display (out);
108  }
109 
110  //@}
111 
112 
113  //! @name Private Methods
114  //@{
115 
116  //! Getter for the left hand side
117  const BaseExpressionType& base() const
118  {
119  return M_l;
120  }
121  //@}
122 
123 private:
124 
125  //! @name Private Methods
126  //@{
127 
128  ExpressionLogarithm();
129 
130  //@}
131 
132 
133  // Left hand side
134  BaseExpressionType M_l;
135 };
136 
137 
138 //! operator* The generic operator for the product between expressions.
139 /*!
140  @author Samuel Quinodoz <samuel.quinodoz@epfl.ch>
141 
142  Operator used in construction of the expression tree. To avoid shadowing
143  other operator*, it uses the ExpressionBase type to distinguish expressions
144  from other types.
145 
146  <b> Template parameters </b>
147 
148  <i>LExpressionType</i>: The expression on the left side of the product operation.
149 
150  <i>RExpressionType</i>: The expression on the right side of the product operation.
151 
152  <b> Template requirements </b>
153 
154  <i>LExpressionType</i>: Same as in LifeV::ExpressionProduct
155 
156  <i>RExpressionType</i>: Same as in LifeV::ExpressionProduct
157 
158 */
159 
160 // "Specialization" for the case of a scalar
161 template< typename ExpressionType>
162 ExpressionLogarithm<ExpressionType>
163 log (const ExpressionBase<ExpressionType>& l)
164 {
165  return ExpressionLogarithm<ExpressionType> (l.cast() );
166 }
167 
168 } // Namespace ExpressionAssembly
169 
170 } // Namespace LifeV
171 
172 #endif
void updateInverseJacobian(const UInt &iQuadPt)
class ExpressionBase Base class (static polymorphism, CRTP sense) for all the expressions used in ass...