PFASST++
pfasst::Controller< time > Class Template Reference

Base SDC/MLSDC/PFASST controller. More...

#include <interface.hpp>

+ Inheritance diagram for pfasst::Controller< time >:
+ Collaboration diagram for pfasst::Controller< time >:

Classes

class  LevelIter
 Level (MLSDC/PFASST) iterator. More...
 

Public Member Functions

 Controller ()
 
virtual ~Controller ()
 
virtual void set_options (bool all_sweepers=true)
 Set options from command line etc. More...
 
virtual void setup ()
 Basic setup routine for this controller. More...
 
virtual void set_duration (time t0, time tend, time dt, size_t niters)
 Set basic time scope of the Controller. More...
 
virtual void add_level (shared_ptr< ISweeper< time >> sweeper, shared_ptr< ITransfer< time >> transfer=shared_ptr< ITransfer< time >>(nullptr), bool coarse=true)
 Adding a level to the controller. More...
 
virtual size_t nlevels ()
 Total number of levels controlled by this Controller. More...
 
template<typename R = ISweeper<time>>
shared_ptr< R > get_level (size_t level)
 Get sweeper for level with index level. More...
 
template<typename R = ISweeper<time>>
shared_ptr< R > get_finest ()
 Get coarsest level. More...
 
template<typename R = ISweeper<time>>
shared_ptr< R > get_coarsest ()
 Get coarsest level. More...
 
template<typename R = ITransfer<time>>
shared_ptr< R > get_transfer (size_t level)
 Retreive transfer operator for level level. More...
 
virtual size_t get_step ()
 Get current time step index. More...
 
virtual void set_step (size_t n)
 Set current time step index. More...
 
virtual time get_step_size ()
 Get width of current time step. More...
 
time get_dt ()
 Get width of current time step (alias for get_step_size). More...
 
virtual time get_time ()
 Get start time point of current time step. More...
 
time get_t ()
 Get start time point of current time step (alias for get_time). More...
 
virtual void advance_time (size_t nsteps=1)
 Advance to a following time step. More...
 
virtual time get_end_time ()
 Get end time point of last time step. More...
 
virtual size_t get_iteration ()
 Get current iteration index of current time step. More...
 
virtual void set_iteration (size_t iter)
 Set current iteration of current time step. More...
 
virtual void advance_iteration ()
 Advance to the next iteration. More...
 
virtual size_t get_max_iterations ()
 Get maximum number of allowed iterations per time step. More...
 
virtual LevelIter finest ()
 Convenience accessor to the finest level. More...
 
virtual LevelIter coarsest ()
 Convenience accessor to the coarsest level. More...
 

Protected Attributes

deque< shared_ptr< ISweeper< time > > > levels
 Ordered list of all levels. More...
 
deque< shared_ptr< ITransfer< time > > > transfer
 Ordered list of transfer operators for levels. More...
 
size_t step
 Current time step index. More...
 
size_t iteration
 Current iteration index on current time step. More...
 
size_t max_iterations
 Maximum iterations per time step. More...
 
time t
 \( t_0 \) of current time step. More...
 
time dt
 Width of current time step (\( \Delta t \)). More...
 
time tend
 \( T_{end} \) of last time step. More...
 

Detailed Description

template<typename time = time_precision>
class pfasst::Controller< time >

Base SDC/MLSDC/PFASST controller.

Base controller (see also SDC, MLSDC, and PFASST controllers).

Template Parameters
timetime precision; defaults to pfasst::time_precision
Since
v0.1.0

Definition at line 31 of file interface.hpp.

Constructor & Destructor Documentation

template<typename time >
pfasst::Controller< time >::Controller ( )

Definition at line 9 of file interface_impl.hpp.

template<typename time >
pfasst::Controller< time >::~Controller ( )
virtual

Definition at line 19 of file interface_impl.hpp.

Member Function Documentation

template<typename time >
void pfasst::Controller< time >::add_level ( shared_ptr< ISweeper< time >>  sweeper,
shared_ptr< ITransfer< time >>  transfer = shared_ptr<ITransfer<time>>(nullptr),
bool  coarse = true 
)
virtual

Adding a level to the controller.

Parameters
[in]sweepersweeper representing the level
[in]transfercorresponding transfer operator for the level
[in]coarsewhether to add this level as a coarser one to the list of existing

Definition at line 72 of file interface_impl.hpp.

Referenced by pfasst::examples::boris::run_boris_pfasst(), pfasst::examples::boris::run_boris_sdc(), pfasst::examples::advection_diffusion::run_mpi_pfasst(), pfasst::examples::scalar::run_scalar_sdc(), pfasst::examples::advection_diffusion::run_serial_mlsdc(), pfasst::examples::advection_diffusion::run_vanilla_sdc(), and pfasst::examples::vdp::run_vdp_sdc().

+ Here is the caller graph for this function:

template<typename time >
void pfasst::Controller< time >::advance_iteration ( )
virtual

Advance to the next iteration.

This method may or may not trigger additional post-iteration procedures.

Definition at line 147 of file interface_impl.hpp.

template<typename time >
void pfasst::Controller< time >::advance_time ( size_t  nsteps = 1)
virtual

Advance to a following time step.

Parameters
[in]nstepsnumber of time steps to advance; 1 meaning the next step

Definition at line 117 of file interface_impl.hpp.

References plot::dt, and plot::t.

template<typename time >
Controller< time >::LevelIter pfasst::Controller< time >::coarsest ( )
virtual

Convenience accessor to the coarsest level.

Returns
iterator to the coarsest level.

Definition at line 165 of file interface_impl.hpp.

Referenced by pfasst::examples::advection_diffusion::run_serial_mlsdc().

+ Here is the caller graph for this function:

template<typename time >
Controller< time >::LevelIter pfasst::Controller< time >::finest ( )
virtual

Convenience accessor to the finest level.

Returns
iterator to the finest level.

Definition at line 159 of file interface_impl.hpp.

Referenced by pfasst::examples::advection_diffusion::run_serial_mlsdc().

+ Here is the caller graph for this function:

template<typename time = time_precision>
template<typename R = ISweeper<time>>
shared_ptr<R> pfasst::Controller< time >::get_coarsest ( )
inline

Get coarsest level.

Template Parameters
Rtype of the level sweeper
See also
Controller::get_level() with level=0

Definition at line 175 of file interface.hpp.

template<typename time = time_precision>
time pfasst::Controller< time >::get_dt ( )
inline

Get width of current time step (alias for get_step_size).

Returns
\( \Delta t \) of current time step

Definition at line 230 of file interface.hpp.

template<typename time >
time pfasst::Controller< time >::get_end_time ( )
virtual

Get end time point of last time step.

Returns
\( T_{end} \) of last time step.

Definition at line 124 of file interface_impl.hpp.

template<typename time = time_precision>
template<typename R = ISweeper<time>>
shared_ptr<R> pfasst::Controller< time >::get_finest ( )
inline

Get coarsest level.

Template Parameters
Rtype of the level sweeper
See also
Controller::get_level() with level=(Controller::nlevels() - 1)

Definition at line 163 of file interface.hpp.

Referenced by pfasst::examples::boris::run_boris_pfasst(), pfasst::examples::boris::run_boris_sdc(), pfasst::examples::advection_diffusion::run_mpi_pfasst(), and pfasst::examples::advection_diffusion::run_serial_mlsdc().

+ Here is the caller graph for this function:

template<typename time >
size_t pfasst::Controller< time >::get_iteration ( )
virtual

Get current iteration index of current time step.

Returns
current iteration index of current time step.

Definition at line 130 of file interface_impl.hpp.

template<typename time = time_precision>
template<typename R = ISweeper<time>>
shared_ptr<R> pfasst::Controller< time >::get_level ( size_t  level)
inline

Get sweeper for level with index level.

Template Parameters
Rtype of the level sweeper
Returns
sweeper of type R for requested level

Definition at line 149 of file interface.hpp.

template<typename time >
size_t pfasst::Controller< time >::get_max_iterations ( )
virtual

Get maximum number of allowed iterations per time step.

Returns
maximum allowed iterations per time step.

Definition at line 153 of file interface_impl.hpp.

template<typename time >
size_t pfasst::Controller< time >::get_step ( )
virtual

Get current time step index.

The time step number is zero-based, i.e. the first time step has index 0.

Returns
current time step index

Definition at line 92 of file interface_impl.hpp.

template<typename time >
time pfasst::Controller< time >::get_step_size ( )
virtual

Get width of current time step.

Returns
\( \Delta t \) of current time step

Definition at line 105 of file interface_impl.hpp.

References plot::dt.

template<typename time = time_precision>
time pfasst::Controller< time >::get_t ( )
inline

Get start time point of current time step (alias for get_time).

Returns
\( t_0 \) of current time step

Definition at line 244 of file interface.hpp.

template<typename time >
time pfasst::Controller< time >::get_time ( )
virtual

Get start time point of current time step.

Returns
\( t_0 \) of current time step

Definition at line 111 of file interface_impl.hpp.

References plot::t.

template<typename time = time_precision>
template<typename R = ITransfer<time>>
shared_ptr<R> pfasst::Controller< time >::get_transfer ( size_t  level)
inline

Retreive transfer operator for level level.

Template Parameters
Rtype of the requested transfer operator
Parameters
[in]levellevel index to retreive transfer operator for
Returns
transfer operator of requested type R for desired level

Definition at line 193 of file interface.hpp.

template<typename time >
size_t pfasst::Controller< time >::nlevels ( )
virtual

Total number of levels controlled by this Controller.

Definition at line 86 of file interface_impl.hpp.

template<typename time >
void pfasst::Controller< time >::set_duration ( time  t0,
time  tend,
time  dt,
size_t  niters 
)
virtual

Set basic time scope of the Controller.

Parameters
[in]t0time start point of the first time step
[in]tendtime end point of the last time step
[in]dtwidth of one time step
[in]nitersmaximum number of iterations per time step The total number of time steps will get computed internally if required.

Definition at line 61 of file interface_impl.hpp.

References plot::dt, and plot::t.

Referenced by pfasst::examples::boris::run_boris_pfasst(), pfasst::examples::boris::run_boris_sdc(), pfasst::examples::advection_diffusion::run_mpi_pfasst(), pfasst::examples::scalar::run_scalar_sdc(), pfasst::examples::advection_diffusion::run_serial_mlsdc(), pfasst::examples::advection_diffusion::run_vanilla_sdc(), and pfasst::examples::vdp::run_vdp_sdc().

+ Here is the caller graph for this function:

template<typename time >
void pfasst::Controller< time >::set_iteration ( size_t  iter)
virtual

Set current iteration of current time step.

Parameters
[in]iteriteration index to set

Definition at line 136 of file interface_impl.hpp.

template<typename time >
void pfasst::Controller< time >::set_options ( bool  all_sweepers = true)
virtual

Set options from command line etc.

Parameters
[in]all_sweepersif given also calls ISweeper::set_options for all already added levels

Definition at line 30 of file interface_impl.hpp.

References plot::dt.

Referenced by pfasst::examples::boris::run_boris_pfasst(), pfasst::examples::advection_diffusion::run_mpi_pfasst(), pfasst::examples::advection_diffusion::run_serial_mlsdc(), and pfasst::examples::advection_diffusion::run_vanilla_sdc().

+ Here is the caller graph for this function:

template<typename time >
void pfasst::Controller< time >::set_step ( size_t  n)
virtual

Set current time step index.

Parameters
[in]nindex of new time step

Definition at line 98 of file interface_impl.hpp.

References plot::dt, and plot::t.

template<typename time >
void pfasst::Controller< time >::setup ( )
virtual

Basic setup routine for this controller.

Precondition
It is expected (i.e. the user has to make that sure) that all levels and transfer operators have been instantiated and added to this controller before calling Controller::setup().

Reimplemented in pfasst::MLSDC< time >.

Definition at line 52 of file interface_impl.hpp.

Referenced by pfasst::examples::scalar::run_scalar_sdc(), pfasst::examples::advection_diffusion::run_vanilla_sdc(), and pfasst::examples::vdp::run_vdp_sdc().

+ Here is the caller graph for this function:

Member Data Documentation

template<typename time = time_precision>
time pfasst::Controller< time >::dt
protected

Width of current time step (\( \Delta t \)).

Definition at line 76 of file interface.hpp.

template<typename time = time_precision>
size_t pfasst::Controller< time >::iteration
protected

Current iteration index on current time step.

Definition at line 61 of file interface.hpp.

template<typename time = time_precision>
deque<shared_ptr<ISweeper<time> > > pfasst::Controller< time >::levels
protected

Ordered list of all levels.

A level is represented by a sweeper implementing the ISweeper interface.

Note
The levels are ordered from coarsest (index 0) to finest.

Definition at line 42 of file interface.hpp.

template<typename time = time_precision>
size_t pfasst::Controller< time >::max_iterations
protected

Maximum iterations per time step.

Definition at line 66 of file interface.hpp.

template<typename time = time_precision>
size_t pfasst::Controller< time >::step
protected

Current time step index.

Definition at line 56 of file interface.hpp.

template<typename time = time_precision>
time pfasst::Controller< time >::t
protected

\( t_0 \) of current time step.

Definition at line 71 of file interface.hpp.

template<typename time = time_precision>
time pfasst::Controller< time >::tend
protected

\( T_{end} \) of last time step.

Definition at line 81 of file interface.hpp.

template<typename time = time_precision>
deque<shared_ptr<ITransfer<time> > > pfasst::Controller< time >::transfer
protected

Ordered list of transfer operators for levels.

A transfer operator for a level must implement the ITransfer interface.

Definition at line 49 of file interface.hpp.


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