LifeV
ZeroDimensionalFunction.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 zero dimensional bc function
30  *
31  * @date 13-03-2013
32  * @author Cristiano Malossi <cristiano.malossi@epfl.ch>
33  *
34  * @maintainer Cristiano Malossi <cristiano.malossi@epfl.ch>
35  */
36 
37 #ifndef ZeroDimensionalFunction_H
38 #define ZeroDimensionalFunction_H
39 
40 #include <lifev/zero_dimensional/solver/ZeroDimensionalDefinitions.hpp>
41 
42 namespace LifeV
43 {
44 
45 //! ZeroDimensionalFunction - A boundary conditions function for zero-dimensional models.
46 /*!
47  * @author Cristiano Malossi
48  *
49  * This simple class handles the boundary condition functions for zero-dimensional models.
50  */
52 {
53 public:
54 
55  //! @name Type definitions and Enumerators
56  //@{
57 
58  /*! @typedef function_Type */
59  //! Type definition for the 0D boundary function
60  typedef std::function<Real ( const Real& ) > function_Type;
61 
62  //@}
63 
64 
65  //! @name Constructors & Destructor
66  //@{
67 
68  //! Empty Constructor
70 
71  //! Constructor by function
72  /*!
73  * @param function the user defined function
74  */
75  explicit ZeroDimensionalFunction ( const function_Type& function ) : M_function ( function ) {}
76 
77  //! Copy constructor
78  /*!
79  * @param bcFunction ZeroDimensionalFunction
80  */
81  ZeroDimensionalFunction ( const ZeroDimensionalFunction& bcFunction ) : M_function ( bcFunction.M_function ) {}
82 
83  //! Destructor
85 
86  //@}
87 
88 
89  //! @name Operators
90  //@{
91 
92  //! Operator=
93  /*!
94  * @param bcFunction ZeroDimensionalFunction
95  * @return reference to a copy of the class
96  */
98  {
99  if ( this != &bcFunction )
100  {
101  M_function = bcFunction.M_function;
102  }
103 
104  return *this;
105  }
106 
107  //! Operator()
108  /*!
109  * Evaluate the function.
110  *
111  * @param time the current time.
112  * @param timeStep the time step.
113  * @return the value of the function.
114  */
115  Real operator() ( const Real& time ) const
116  {
117  return M_function ( time );
118  }
119 
120  //@}
121 
122 
123  //! @name Set Methods
124  //@{
125 
126  //! Set the function
127  /*!
128  @param function the user defined function
129  */
130  void setFunction ( const function_Type& function )
131  {
132  M_function = function;
133  }
134 
135  //@}
136 
137 
138  //! @name Get Methods
139  //@{
140 
141  //! Get the function
142  /*!
143  @return the user defined function
144  */
145  const function_Type& function() const
146  {
147  return M_function;
148  }
149 
150  //@}
151 
152 private:
153 
155 };
156 
157 }
158 
159 #endif // ZeroDimensionalFunction_H
ZeroDimensionalFunction & operator=(const ZeroDimensionalFunction &bcFunction)
Operator=.
void setFunction(const function_Type &function)
Set the function.
Real operator()(const Real &time) const
Operator()
void updateInverseJacobian(const UInt &iQuadPt)
ZeroDimensionalFunction(const ZeroDimensionalFunction &bcFunction)
Copy constructor.
std::function< Real(const Real &) > function_Type
Type definition for the 0D boundary function.
const function_Type & function() const
Get the function.
double Real
Generic real data.
Definition: LifeV.hpp:175
virtual ~ZeroDimensionalFunction()
Destructor.
ZeroDimensionalFunction(const function_Type &function)
Constructor by function.
ZeroDimensionalFunction - A boundary conditions function for zero-dimensional models.