LifeV
ExpressionArcTan.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_ARCTAN_HPP
37 #define EXPRESSION_ARCTAN_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 ExpressionPower 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 ExpressionArcTan : public ExpressionBase< ExpressionArcTan<BaseExpressionType> >
70 {
71 public:
72 
73  //! @name Public Types
74  //@{
75 
76  // No direct use, just ease of coding
77  typedef ExpressionBase< ExpressionArcTan <BaseExpressionType> > base_Type;
78 
79  //@}
80 
81  //! @name Constructors & Destructor
82  //@{
83 
84  //! Full constructor using the two expressions
85  ExpressionArcTan (const BaseExpressionType& l, const Real epsilon, const Real K, const Real delta)
86  : base_Type(), M_l (l), M_epsilon (epsilon), M_K(K), M_delta(delta) {}
87 
88  //! Copy constructor
89  ExpressionArcTan (const ExpressionArcTan<BaseExpressionType>& expression)
90  :
91  base_Type(),
92  M_l (expression.M_l),
93  M_epsilon (expression.M_epsilon),
94  M_K (expression.M_K),
95  M_delta (expression.M_delta)
96  {}
97 
98  //! Destructor
99  ~ExpressionArcTan() {}
100 
101  //@}
102 
103 
104  //! @name Methods
105  //@{
106 
107  //! Display method
108  static void display (std::ostream& out = std::cout)
109  {
110  out << " atan ( ";
111  BaseExpressionType::display (out);
112  out << " ) ";
113  }
114 
115  //@}
116 
117 
118  //! @name Private Methods
119  //@{
120 
121  //! Getter for the left hand side
122  const BaseExpressionType& base() const
123  {
124  return M_l;
125  }
126 
127  //! Getter for the right hand side
128  const Real& epsilon() const
129  {
130  return M_epsilon;
131  }
132 
133  //! Getter for the right hand side
134  const Real& K() const
135  {
136  return M_K;
137  }
138 
139  //! Getter for the right hand side
140  const Real& delta() const
141  {
142  return M_delta;
143  }
144 
145  //@}
146 
147 private:
148 
149  //! @name Private Methods
150  //@{
151 
152  ExpressionArcTan();
153 
154  //@}
155 
156 
157  // Left hand side
158  BaseExpressionType M_l;
159 
160  Real M_epsilon;
161 
162  Real M_K;
163 
164  Real M_delta;
165 
166 };
167 
168 
169 //! operator* The generic operator for the product between expressions.
170 /*!
171  @author Samuel Quinodoz <samuel.quinodoz@epfl.ch>
172 
173  Operator used in construction of the expression tree. To avoid shadowing
174  other operator*, it uses the ExpressionBase type to distinguish expressions
175  from other types.
176 
177  <b> Template parameters </b>
178 
179  <i>LExpressionType</i>: The expression on the left side of the product operation.
180 
181  <i>RExpressionType</i>: The expression on the right side of the product operation.
182 
183  <b> Template requirements </b>
184 
185  <i>LExpressionType</i>: Same as in LifeV::ExpressionProduct
186 
187  <i>RExpressionType</i>: Same as in LifeV::ExpressionProduct
188 
189  The expression that is built is:
190 
191  K * atan( \epsilon * ( ExpressionBase ) ) + delta
192 
193 */
194 
195 template< typename ExpressionType>
196 ExpressionArcTan<ExpressionType>
197 atan (const ExpressionBase<ExpressionType>& l, const Real& epsilon,
198  const Real& K, const Real& delta)
199 {
200  return ExpressionArcTan<ExpressionType> (l.cast(), epsilon, K, delta);
201 }
202 
203 
204 } // Namespace ExpressionAssembly
205 
206 } // Namespace LifeV
207 
208 #endif
void updateInverseJacobian(const UInt &iQuadPt)
double Real
Generic real data.
Definition: LifeV.hpp:175
class ExpressionBase Base class (static polymorphism, CRTP sense) for all the expressions used in ass...