LifeV
ExpressionSquareRoot.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_SQUAREROOT_HPP
37 #define EXPRESSION_SQUAREROOT_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 ExpressionSquareRoot 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 ExpressionSquareRoot : public ExpressionBase< ExpressionSquareRoot<BaseExpressionType> >
70 {
71 public:
72 
73  //! @name Public Types
74  //@{
75 
76  // No direct use, just ease of coding
77  typedef ExpressionBase< ExpressionSquareRoot <BaseExpressionType> > base_Type;
78 
79  //@}
80 
81  //! @name Constructors & Destructor
82  //@{
83 
84  //! Full constructor using the two expressions
85  ExpressionSquareRoot (const BaseExpressionType& l)
86  : base_Type(), M_l (l) {}
87 
88  //! Copy constructor
89  ExpressionSquareRoot (const ExpressionSquareRoot<BaseExpressionType>& expression)
90  : base_Type(), M_l (expression.M_l) {}
91 
92  //! Destructor
93  ~ExpressionSquareRoot() {}
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  ExpressionSquareRoot();
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 ExpressionSquareRoot<ExpressionType>
161 sqrt (const ExpressionBase<ExpressionType>& l)
162 {
163  return ExpressionSquareRoot<ExpressionType> ( l.cast() );
164 }
165 
166 
167 } // Namespace ExpressionAssembly
168 
169 } // Namespace LifeV
170 
171 #endif
void updateInverseJacobian(const UInt &iQuadPt)
class ExpressionBase Base class (static polymorphism, CRTP sense) for all the expressions used in ass...