LifeV
OneDFSIFunction.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 containing the interface class for the boundary function of 1D model.
30  *
31  * @version 1.0
32  * @date 01-08-2006
33  * @author Lucia Mirabella <lucia.mirabella@gmail.com>
34  * @author Tiziano Passerini <tiziano.passerini@gmail.com>
35  *
36  * @version 2.0
37  * @date 20-04-2010
38  * @author Cristiano Malossi <cristiano.malossi@epfl.ch>
39  *
40  * @maintainer Cristiano Malossi <cristiano.malossi@epfl.ch>
41  */
42 
43 #ifndef OneDFSIBCFunction_H
44 #define OneDFSIBCFunction_H
45 
46 #include <lifev/one_d_fsi/solver/OneDFSIDefinitions.hpp>
47 
48 namespace LifeV
49 {
50 
51 //! OneDFSIFunction - Base class for 1D BC Functions.
52 /*!
53  * @author Lucia Mirabella, Tiziano Passerini, Cristiano Malossi
54  * @see Equations and networks of 1-D models \cite FormaggiaLamponi2003
55  * @see Geometrical multiscale coupling of 1-D models \cite Malossi2011Algorithms \cite Malossi2011Algorithms1D
56  *
57  * The 1D boundary condition function is evaluated as a function of the current time and of the time step.
58  */
60 {
61 public:
62 
63  //! @name Type definitions and Enumerators
64  //@{
65 
66  /*! @typedef function_Type */
67  //! Type definition for the 1D boundary function
68  typedef std::function<Real ( const Real&, const Real& ) > function_Type;
69 
70  //@}
71 
72 
73  //! @name Constructors & Destructor
74  //@{
75 
76  //! Empty Constructor
77  explicit OneDFSIFunction() : M_function() {}
78 
79  //! Constructor by function
80  /*!
81  * @param function the user defined function
82  */
83  explicit OneDFSIFunction ( const function_Type& function ) : M_function ( function ) {}
84 
85  //! Copy constructor
86  /*!
87  * @param bcFunction OneDFSIFunction
88  */
89  OneDFSIFunction ( const OneDFSIFunction& bcFunction ) : M_function ( bcFunction.M_function ) {}
90 
91  //! Destructor
92  virtual ~OneDFSIFunction() {}
93 
94  //@}
95 
96 
97  //! @name Operators
98  //@{
99 
100  //! Operator=
101  /*!
102  * @param bcFunction OneDFSIFunction
103  * @return reference to a copy of the class
104  */
105  OneDFSIFunction& operator= ( const OneDFSIFunction& bcFunction )
106  {
107  if ( this != &bcFunction )
108  {
109  M_function = bcFunction.M_function;
110  }
111 
112  return *this;
113  }
114 
115  //! Operator()
116  /*!
117  * Evaluate the function.
118  *
119  * @param time the current time.
120  * @param timeStep the time step.
121  * @return the value of the function.
122  */
123  Real operator() ( const Real& time, const Real& timeStep = 0. ) const
124  {
125  return M_function ( time, timeStep );
126  }
127 
128  //@}
129 
130 
131  //! @name Set Methods
132  //@{
133 
134  //! Set the function
135  /*!
136  @param function the user defined function
137  */
138  void setFunction ( const function_Type& function )
139  {
140  M_function = function;
141  }
142 
143  //@}
144 
145 
146  //! @name Get Methods
147  //@{
148 
149  //! Get the function
150  /*!
151  @return the user defined function
152  */
153  const function_Type& function() const
154  {
155  return M_function;
156  }
157 
158  //@}
159 
160 private:
161 
163 };
164 
165 /*
166 //! Factory create function
167 inline OneDFSIFunction*
168 Create_OneDFSIModel_BCFunction( const OneDFSIFunction* bcFunction )
169 {
170  return new OneDFSIFunction( (const OneDFSIFunction&)* bcFunction );
171 }
172 
173 namespace
174 {
175  static bool registerOneD_BCFunction = FactoryClone_OneDFSIModel_BCFunction::instance().registerProduct( typeid(OneDFSIFunction), &Create_OneDFSIModel_BCFunction );
176 }
177 */
178 
179 }
180 
181 #endif // OneDFSIBCFunction_H
const function_Type & function() const
Get the function.
std::function< Real(const Real &, const Real &) > function_Type
Type definition for the 1D boundary function.
OneDFSIFunction()
Empty Constructor.
OneDFSIFunction(const function_Type &function)
Constructor by function.
OneDFSIFunction & operator=(const OneDFSIFunction &bcFunction)
Operator=.
void updateInverseJacobian(const UInt &iQuadPt)
OneDFSIFunction - Base class for 1D BC Functions.
void setFunction(const function_Type &function)
Set the function.
virtual ~OneDFSIFunction()
Destructor.
double Real
Generic real data.
Definition: LifeV.hpp:175
OneDFSIFunction(const OneDFSIFunction &bcFunction)
Copy constructor.
Real operator()(const Real &time, const Real &timeStep=0.) const
Operator()