TimeStepBase Class Reference

Inheritance diagram for TimeStepBase:

Inheritance graph
[legend]

List of all members.

Classes

class  ExcCantComputeTimestep

Public Types

enum  SolutionState { primal_problem = 0x0, dual_problem = 0x1, postprocess = 0x2 }

Public Member Functions

 TimeStepBase (const double time)
virtual ~TimeStepBase ()
virtual void wake_up (const unsigned int)
virtual void sleep (const unsigned int)
virtual void start_sweep ()
virtual void end_sweep ()
virtual void init_for_primal_problem ()
virtual void init_for_dual_problem ()
virtual void init_for_postprocessing ()
virtual void solve_primal_problem ()=0
virtual void solve_dual_problem ()
virtual void postprocess_timestep ()
double get_time () const
unsigned int get_timestep_no () const
double get_backward_timestep () const
double get_forward_timestep () const
virtual unsigned int memory_consumption () const

Protected Attributes

const TimeStepBaseprevious_timestep
const TimeStepBasenext_timestep
unsigned int sweep_no
unsigned int timestep_no
const double time
unsigned int next_action

Private Member Functions

void set_previous_timestep (const TimeStepBase *previous)
void set_next_timestep (const TimeStepBase *next)
void set_timestep_no (const unsigned int step_no)
void set_sweep_no (const unsigned int sweep_no)
 TimeStepBase (const TimeStepBase &)
TimeStepBaseoperator= (const TimeStepBase &)

Friends

class TimeDependent


Detailed Description

Base class for a time step in time dependent problems. This class provides barely more than the basic framework, defining the necessary virtual functions (namely sleep and wake_up), the interface to previous and following grids, and some functions to be called before a new loop over all time steps is started.

Author:
Wolfgang Bangerth, 1999

Member Enumeration Documentation

Enum denoting the type of problem which will have to be solved next.

Enumerator:
primal_problem 
dual_problem 
postprocess 

Reimplemented in TimeStepBase_Tria< dim >.


Constructor & Destructor Documentation

TimeStepBase::TimeStepBase ( const double  time  ) 

Constructor. Does nothing here apart from setting the time.

virtual TimeStepBase::~TimeStepBase (  )  [virtual]

Destructor. At present, this does nothing.

TimeStepBase::TimeStepBase ( const TimeStepBase  )  [private]

Copy constructor. I can see no reason why someone might want to use it, so I don't provide it. Since this class has pointer members, making it private prevents the compiler to provide it's own, incorrect one if anyone chose to copy such an object.


Member Function Documentation

virtual void TimeStepBase::wake_up ( const unsigned  int  )  [virtual]

Reconstruct all the data that is needed for this time level to work. This function serves to reget all the variables and data structures to work again after they have been send to sleep some time before, or at the first time we visit this time level. In particular, it is used to reconstruct the triangulation, degree of freedom handlers, to reload data vectors in case they have been stored to disk, etc.

The actual implementation of this function does nothing.

Since this is an important task, you should call this function from your own function, should you choose to overload it in your own class (which likely is the case), preferably at the beginning so that your function can take effect of the triangulation already existing.

Reimplemented in TimeStepBase_Tria< dim >.

virtual void TimeStepBase::sleep ( const unsigned  int  )  [virtual]

This is the opposite function to wake_up. It is used to delete data or save it to disk after they are no more needed for the present sweep. Typical kinds of data for this are data vectors, degree of freedom handlers, triangulation objects, etc. which occupy large amounts of memory and may therefore be externalized.

By default, this function does nothing.

Reimplemented in TimeStepBase_Tria< dim >.

virtual void TimeStepBase::start_sweep (  )  [virtual]

This function is called each time before a new sweep is started. You may want to set up some fields needed in the course of the computations, and so on. You should take good care, however, not to install large objects, which should be deferred until the wake_up function is called.

A typical action of this function would be sorting out names of temporary files needed in the process of solving, etc.

At the time this function is called, the values of timestep_no, sweep_no and the pointer to the previous and next time step object already have their correct value.

The default implementation of this function does nothing.

virtual void TimeStepBase::end_sweep (  )  [virtual]

This is the analogon to the above function, but it is called at the end of a sweep. You will usually want to do clean-ups in this function, such as deleting temporary files and the like.

virtual void TimeStepBase::init_for_primal_problem (  )  [virtual]

Before the primal problem is solved on each time level, this function is called (i.e. before the solution takes place on the first time level). By default, this function sets the next_action variable of this class. You may overload this function, but you should call this function within your own one.

virtual void TimeStepBase::init_for_dual_problem (  )  [virtual]

Same as above, but called before a round of dual problem solves.

virtual void TimeStepBase::init_for_postprocessing (  )  [virtual]

Same as above, but called before a round of postprocessing steps.

virtual void TimeStepBase::solve_primal_problem (  )  [pure virtual]

This function is called by the manager object when solving the primal problem on this time level is needed. It is called after the wake_up function was called and before the sleep function will be called. There is no default implementation for obvious reasons, so you have to overload this function.

virtual void TimeStepBase::solve_dual_problem (  )  [virtual]

This function is called by the manager object when solving the dual problem on this time level is needed. It is called after the wake_up function was called and before the sleep function will be called. There is a default implementation doing plain nothing since some problems may not need solving a dual problem. However, it will abort the program when being called anyway, since then you should really overload the function.

virtual void TimeStepBase::postprocess_timestep (  )  [virtual]

This function is called by the manager object when postprocessing this time level is needed. It is called after the wake_up function was called and before the sleep function will be called. There is a default implementation doing plain nothing since some problems may not need doing a postprocess step, e.g. if everything was already done when solving the primal problem. However, it will abort the program when being called anyway, since then you should really overload the function.

double TimeStepBase::get_time (  )  const

Return the time value of this time step.

unsigned int TimeStepBase::get_timestep_no (  )  const

Return the number of this time step. Note that this number may vary between different sweeps, if timesteps are added or deleted.

double TimeStepBase::get_backward_timestep (  )  const

Compute the time difference to the last time step. If this timestep is the first one, this function will result in an exception. Though this behaviour seems a bit drastic, it is appropriate in most cases since if there is no previous time step you will need special treatment anyway and this way no invalid value is returned which could lead to wrong but unnoticed results of your computation. (The only sensible value to return in that case would not be zero, since valid computation can be done with that, but would be a denormalized value such as NaN. However, there is not much difference in finding that the results of a computation are all denormalized values or in getting an exception; in the latter case you at least get the exact place where your problem lies.)

double TimeStepBase::get_forward_timestep (  )  const

Return the time difference to the next time step. With regard to the case that there is no next time step, the same applies as for the function above.

virtual unsigned int TimeStepBase::memory_consumption (  )  const [virtual]

Determine an estimate for the memory consumption (in bytes) of this object.

You will want to overload this function in derived classes to compute the amount memory used by the derived class, and add the result of this function to your result.

Reimplemented in TimeStepBase_Tria< dim >.

void TimeStepBase::set_previous_timestep ( const TimeStepBase previous  )  [private]

Reset the pointer to the previous time step; shall only be called by the time level manager object.

This function is called at the set-up of the manager object and whenever a timestep is inserted or deleted.

void TimeStepBase::set_next_timestep ( const TimeStepBase next  )  [private]

Reset the pointer to the next time step; shall only be called by the time level manager object.

This function is called at the set-up of the manager object and whenever a timestep is inserted or deleted.

void TimeStepBase::set_timestep_no ( const unsigned int  step_no  )  [private]

Set the number this time step has in the list of timesteps. This function is called by the time step management object at the beginning of each sweep, to update information which may have changed due to addition or deleltion of time levels.

void TimeStepBase::set_sweep_no ( const unsigned int  sweep_no  )  [private]

Set the number of the sweep we are presently in. This function is called by the time level management object at start-up time of each sweep.

TimeStepBase& TimeStepBase::operator= ( const TimeStepBase  )  [private]

Copy operator. I can see no reason why someone might want to use it, so I don't provide it. Since this class has pointer members, making it private prevents the compiler to provide it's own, incorrect one if anyone chose to copy such an object.


Friends And Related Function Documentation

friend class TimeDependent [friend]


Member Data Documentation

Pointer to the previous time step object in the list.

Pointer to the next time step object in the list.

Number of the sweep we are presently in. This number is reset by the time level manager before a sweep is started.

Number of the time step, counted from zero onwards. This number is reset at the start of each sweep by the time level manager, since some time steps may have been inserted or deleted after the previous sweep.

const double TimeStepBase::time [protected]

Discrete time this level operates on.

Variable storing whether the solution of a primal or a dual problem is actual, or any of the other actions specified. This variable is set by the init_for_* functions.


The documentation for this class was generated from the following file:

deal.II documentation generated on Sat Aug 15 16:52:28 2009 by doxygen 1.5.9