Public Member Functions | |
FunctionTime (const double initial_time=0.0) | |
virtual | ~FunctionTime () |
double | get_time () const |
virtual void | set_time (const double new_time) |
virtual void | advance_time (const double delta_t) |
Private Attributes | |
double | time |
ZeroFunction
, ConstantFunction
etc also work for time dependent problems.Access to the time goes through the following functions:
* <li> <tt>get_time</tt>: return the present value of the time variable. * <li> <tt>set_time</tt>: set the time value to a specific value. * <li> <tt>advance_time</tt>: increase the time by a certain time step. *
sin(t)
, then it may be a reasonable choice to calculate this factor in a derived version of set_time
, store it in a member variable and use that one rather than computing it every time operator()
, value_list
or one of the other functions is called.
By default, the advance_time
function calls the set_time
function with the new time, so it is sufficient in most cases to overload only set_time
for computations as sketched out above.
The constructor of this class takes an initial value for the time variable, which defaults to zero. Because a default value is given, none of the derived classes needs to take an initial value for the time variable if not needed.
Once again the warning: do not use the time
variable for any other purpose than the intended one! This will inevitably lead to confusion.
FunctionTime::FunctionTime | ( | const double | initial_time = 0.0 |
) |
Constructor. May take an initial vakue for the time variable, which defaults to zero.
virtual FunctionTime::~FunctionTime | ( | ) | [virtual] |
Virtual destructor.
double FunctionTime::get_time | ( | ) | const |
Return the value of the time variable/
virtual void FunctionTime::set_time | ( | const double | new_time | ) | [virtual] |
Set the time to new_time
, overwriting the old value.
Reimplemented in Functions::ParsedFunction< dim >.
virtual void FunctionTime::advance_time | ( | const double | delta_t | ) | [virtual] |
Advance the time by the given time step delta_t
.
double FunctionTime::time [private] |
Store the present time.