LifeV
ExpressionCubicRoot.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_CUBICROOT_HPP
37 #define EXPRESSION_CUBICROOT_HPP
38 
39 #include <lifev/core/LifeV.hpp>
40 
41 #include <lifev/eta/expression/ExpressionBase.hpp>
42 
43 namespace LifeV
44 {
45 
46 namespace ExpressionAssembly
47 {
48 
49 //! class ExpressionCubicRoot Class for representing a product between two expressions.
50 /*!
51  @author Samuel Quinodoz <samuel.quinodoz@epfl.ch>
52 
53  This class represents the product in the expression tree.
54 
55  <b> Template parameters </b>
56 
57  <i>LExpressionType</i>: The expression on the left side of the product operation.
58 
59  <i>RExpressionType</i>: The expression on the right side of the product operation.
60 
61  <b> Template requirements </b>
62 
63  <i>LExpressionType</i>: Copiable, static display method
64 
65  <i>RExpressionType</i>: Copiable, static display method
66 
67 */
68 template <typename BaseExpressionType>
69 class ExpressionCubicRoot : public ExpressionBase< ExpressionCubicRoot<BaseExpressionType> >
70 {
71 public:
72 
73  //! @name Public Types
74  //@{
75 
76  // No direct use, just ease of coding
77  typedef ExpressionBase< ExpressionCubicRoot <BaseExpressionType> > base_Type;
78 
79  //@}
80 
81  //! @name Constructors & Destructor
82  //@{
83 
84  //! Full constructor using the two expressions
85  ExpressionCubicRoot (const BaseExpressionType& l)
86  : base_Type(), M_l (l) {}
87 
88  //! Copy constructor
89  ExpressionCubicRoot (const ExpressionCubicRoot<BaseExpressionType>& expression)
90  : base_Type(), M_l (expression.M_l) {}
91 
92  //! Destructor
93  ~ExpressionCubicRoot() {}
94 
95  //@}
96 
97 
98  //! @name Methods
99  //@{
100 
101  //! Display method
102  static void display (std::ostream& out = std::cout)
103  {
104  BaseExpressionType::display (out);
105  out << " ^ ";
106  }
107 
108  //@}
109 
110 
111  //! @name Private Methods
112  //@{
113 
114  //! Getter for the left hand side
115  const BaseExpressionType& base() const
116  {
117  return M_l;
118  }
119 
120  //@}
121 
122 private:
123 
124  //! @name Private Methods
125  //@{
126 
127  ExpressionCubicRoot();
128 
129  //@}
130 
131 
132  // Left hand side
133  BaseExpressionType M_l;
134 };
135 
136 
137 //! operator* The generic operator for the product between expressions.
138 /*!
139  @author Samuel Quinodoz <samuel.quinodoz@epfl.ch>
140 
141  Operator used in construction of the expression tree. To avoid shadowing
142  other operator*, it uses the ExpressionBase type to distinguish expressions
143  from other types.
144 
145  <b> Template parameters </b>
146 
147  <i>LExpressionType</i>: The expression on the left side of the product operation.
148 
149  <i>RExpressionType</i>: The expression on the right side of the product operation.
150 
151  <b> Template requirements </b>
152 
153  <i>LExpressionType</i>: Same as in LifeV::ExpressionProduct
154 
155  <i>RExpressionType</i>: Same as in LifeV::ExpressionProduct
156 
157 */
158 
159 template< typename ExpressionType>
160 ExpressionCubicRoot<ExpressionType>
161 cubicroot (const ExpressionBase<ExpressionType>& l)
162 {
163  return ExpressionCubicRoot<ExpressionType> ( l.cast() );
164 }
165 
166 
167  /*
168  This expression is a specialization of the cubic root expression
169  for the structure module to have a fast computation of the isochoric
170  change of variable used in the structure module for the constitutive models
171  */
172 template <typename BaseExpressionType>
173 class ExpressionIsochoricChangeOfVariable :
174  public ExpressionBase< ExpressionIsochoricChangeOfVariable< BaseExpressionType> >
175 {
176 public:
177 
178  //! @name Public Types
179  //@{
180 
181  // No direct use, just ease of coding
182  typedef ExpressionBase< ExpressionIsochoricChangeOfVariable <BaseExpressionType> > base_Type;
183 
184  //@}
185 
186  //! @name Constructors & Destructor
187  //@{
188 
189  //! Full constructor using the two expressions
190  ExpressionIsochoricChangeOfVariable (const BaseExpressionType& l)
191  : base_Type(), M_l (l) {}
192 
193  //! Copy constructor
194  ExpressionIsochoricChangeOfVariable (const ExpressionIsochoricChangeOfVariable<BaseExpressionType>& expression)
195  : base_Type(), M_l (expression.M_l) {}
196 
197  //! Destructor
198  ~ExpressionIsochoricChangeOfVariable() {}
199 
200  //@}
201 
202 
203  //! @name Methods
204  //@{
205 
206  //! Display method
207  static void display (std::ostream& out = std::cout)
208  {
209  BaseExpressionType::display (out);
210  out << " ^ ";
211  }
212 
213  //@}
214 
215 
216  //! @name Private Methods
217  //@{
218 
219  //! Getter for the left hand side
220  const BaseExpressionType& base() const
221  {
222  return M_l;
223  }
224 
225  //@}
226 
227 private:
228 
229  //! @name Private Methods
230  //@{
231 
232  ExpressionIsochoricChangeOfVariable();
233 
234  //@}
235 
236 
237  // Left hand side
238  BaseExpressionType M_l;
239 };
240 
241 
242 //! operator* The generic operator for the product between expressions.
243 /*!
244  @author Samuel Quinodoz <samuel.quinodoz@epfl.ch>
245 
246  Operator used in construction of the expression tree. To avoid shadowing
247  other operator*, it uses the ExpressionBase type to distinguish expressions
248  from other types.
249 
250  <b> Template parameters </b>
251 
252  <i>LExpressionType</i>: The expression on the left side of the product operation.
253 
254  <i>RExpressionType</i>: The expression on the right side of the product operation.
255 
256  <b> Template requirements </b>
257 
258  <i>LExpressionType</i>: Same as in LifeV::ExpressionProduct
259 
260  <i>RExpressionType</i>: Same as in LifeV::ExpressionProduct
261 
262 */
263 
264 template< typename ExpressionType>
265 ExpressionIsochoricChangeOfVariable<ExpressionType>
266 isoCoV (const ExpressionBase<ExpressionType>& l)
267 {
268  return ExpressionIsochoricChangeOfVariable<ExpressionType> ( l.cast() );
269 }
270 
271 
272 } // Namespace ExpressionAssembly
273 
274 } // Namespace LifeV
275 
276 #endif
void updateInverseJacobian(const UInt &iQuadPt)
class ExpressionBase Base class (static polymorphism, CRTP sense) for all the expressions used in ass...