PFASST++
pfasst::encap::EncapSweeper< time > Class Template Reference

Host based encapsulated base sweeper. More...

#include <encap_sweeper.hpp>

+ Inheritance diagram for pfasst::encap::EncapSweeper< time >:
+ Collaboration diagram for pfasst::encap::EncapSweeper< time >:

Public Member Functions

 EncapSweeper ()
 
virtual shared_ptr< Encapsulation< time > > get_state (size_t m) const
 Retrieve solution values of current iteration at time node index m. More...
 
virtual shared_ptr< Encapsulation< time > > get_tau (size_t m) const
 Retrieve FAS correction of current iteration at time node index m. More...
 
virtual shared_ptr< Encapsulation< time > > get_saved_state (size_t m) const
 Retrieve solution values of previous iteration at time node index m. More...
 
virtual void set_options () override
 Set options from command line etc. More...
 
virtual void setup (bool coarse) override
 Setup (allocate etc) the sweeper. More...
 
virtual void spread () override
 Initialize solution values at all time nodes with meaningful values. More...
 
virtual void save (bool initial_only) override
 Save states (and/or function values) at all nodes. More...
 
virtual void set_quadrature (shared_ptr< IQuadrature< time >> quadrature)
 
virtual shared_ptr< const IQuadrature< time > > get_quadrature () const
 
virtual const vector< time > get_nodes () const
 
virtual void set_factory (shared_ptr< EncapFactory< time >> factory)
 
virtual shared_ptr< EncapFactory< time > > get_factory () const
 
virtual shared_ptr< Encapsulation< time > > get_start_state () const
 
virtual shared_ptr< Encapsulation< time > > get_end_state ()
 
virtual void advance () override
 Advance from one time step to the next. More...
 
virtual void reevaluate (bool initial_only=false)
 Re-evaluate function values. More...
 
virtual void integrate (time dt, vector< shared_ptr< Encapsulation< time >>> dst) const
 Integrates values of right hand side at all time nodes \( t \in [0,M-1] \) simultaneously. More...
 
void set_residual_tolerances (time abs_residual_tol, time rel_residual_tol, int order=0)
 Set residual tolerances for convergence checking. More...
 
virtual void residual (time dt, vector< shared_ptr< Encapsulation< time >>> dst) const
 Compute residual at each SDC node (including FAS corrections). More...
 
virtual bool converged () override
 Return convergence status. More...
 
virtual void post (ICommunicator *comm, int tag) override
 
virtual void send (ICommunicator *comm, int tag, bool blocking) override
 
virtual void recv (ICommunicator *comm, int tag, bool blocking) override
 
virtual void broadcast (ICommunicator *comm) override
 
- Public Member Functions inherited from pfasst::ISweeper< time >
 ISweeper ()
 
virtual ~ISweeper ()
 
virtual void set_controller (Controller< time > *ctrl)
 Set the sweepers controller. More...
 
virtual Controller< time > * get_controller ()
 Accessor to the controller managing this sweeper. More...
 
virtual void predict (bool initial)=0
 Perform a predictor sweep. More...
 
virtual void sweep ()=0
 Perform one SDC sweep/iteration. More...
 
virtual void post_sweep ()
 Hook automatically run after each completed sweep. More...
 
virtual void post_predict ()
 Hook automatically run after each completed predict. More...
 
virtual void post_step ()
 Hook automatically run after each completed time step. More...
 

Protected Attributes

string FORMAT_STR
 
shared_ptr< IQuadrature< time > > quadrature
 
shared_ptr< EncapFactory< time > > factory
 Encapsulation data structure factory. More...
 
shared_ptr< Encapsulation< time > > start_state
 Separate start state, i.e. initial condition for the sweeper's current time step. More...
 
shared_ptr< Encapsulation< time > > end_state
 Current solution at \( T_{end} \). More...
 
vector< shared_ptr< Encapsulation< time > > > residuals
 Place for the residuals at the different time nodes. More...
 
vector< shared_ptr< Encapsulation< time > > > state
 Solution values \( U \) at all time nodes of the current iteration. More...
 
vector< shared_ptr< Encapsulation< time > > > saved_state
 Solution values \( U \) at all time nodes of the previous iteration. More...
 
vector< shared_ptr< Encapsulation< time > > > fas_corrections
 FAS corrections \( \tau \) at all time nodes of the current iteration. More...
 
int residual_norm_order
 
time abs_residual_tol
 Tolerance for absolute residual. More...
 
time rel_residual_tol
 Tolerance for relative residual. More...
 
- Protected Attributes inherited from pfasst::ISweeper< time >
Controller< time > * controller
 Backreference to the controller managing the sweeper instance. More...
 

Detailed Description

template<typename time = time_precision>
class pfasst::encap::EncapSweeper< time >

Host based encapsulated base sweeper.

Template Parameters
timetime precision; defaults to pfasst::time_precision

Definition at line 30 of file encap_sweeper.hpp.

Constructor & Destructor Documentation

template<typename time >
pfasst::encap::EncapSweeper< time >::EncapSweeper ( )

Definition at line 16 of file encap_sweeper_impl.hpp.

Member Function Documentation

template<typename time >
void pfasst::encap::EncapSweeper< time >::advance ( )
overridevirtual

Advance from one time step to the next.

Exceptions
NotImplementedYetThis function is required by EncapSweeper

Implements pfasst::ISweeper< time >.

Reimplemented in pfasst::examples::boris::BorisSweeper< scalar, time >, pfasst::encap::IMEXSweeper< time >, and pfasst::encap::ImplicitSweeper< time >.

Definition at line 161 of file encap_sweeper_impl.hpp.

template<typename time >
void pfasst::encap::EncapSweeper< time >::broadcast ( ICommunicator comm)
overridevirtual

Reimplemented from pfasst::ISweeper< time >.

Reimplemented in pfasst::examples::boris::BorisSweeper< scalar, time >.

Definition at line 263 of file encap_sweeper_impl.hpp.

References pfasst::ICommunicator::rank(), and pfasst::ICommunicator::size().

+ Here is the call graph for this function:

template<typename time >
bool pfasst::encap::EncapSweeper< time >::converged ( )
overridevirtual

Return convergence status.

Reimplemented from pfasst::ISweeper< time >.

Definition at line 218 of file encap_sweeper_impl.hpp.

References pfasst::examples::boris::norm0(), and pfasst::encap::solution.

+ Here is the call graph for this function:

template<typename time >
shared_ptr< Encapsulation< time > > pfasst::encap::EncapSweeper< time >::get_end_state ( )
virtual

Definition at line 152 of file encap_sweeper_impl.hpp.

template<typename time >
shared_ptr< EncapFactory< time > > pfasst::encap::EncapSweeper< time >::get_factory ( ) const
virtual

Definition at line 146 of file encap_sweeper_impl.hpp.

template<typename time >
const vector< time > pfasst::encap::EncapSweeper< time >::get_nodes ( ) const
virtual

Definition at line 134 of file encap_sweeper_impl.hpp.

Referenced by pfasst::encap::IMEXSweeper< time >::sweep_with_left(), and pfasst::encap::IMEXSweeper< time >::sweep_without_left().

+ Here is the caller graph for this function:

template<typename time >
shared_ptr< const IQuadrature< time > > pfasst::encap::EncapSweeper< time >::get_quadrature ( ) const
virtual

Definition at line 122 of file encap_sweeper_impl.hpp.

template<typename time >
shared_ptr< Encapsulation< time > > pfasst::encap::EncapSweeper< time >::get_saved_state ( size_t  m) const
virtual

Retrieve solution values of previous iteration at time node index m.

Parameters
[in]m0-based index of time node

Reimplemented in pfasst::examples::boris::BorisSweeper< scalar, time >.

Definition at line 35 of file encap_sweeper_impl.hpp.

template<typename time >
shared_ptr< Encapsulation< time > > pfasst::encap::EncapSweeper< time >::get_start_state ( ) const
virtual

Reimplemented in pfasst::examples::boris::BorisSweeper< scalar, time >.

Definition at line 128 of file encap_sweeper_impl.hpp.

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

+ Here is the caller graph for this function:

template<typename time >
shared_ptr< Encapsulation< time > > pfasst::encap::EncapSweeper< time >::get_state ( size_t  m) const
virtual

Retrieve solution values of current iteration at time node index m.

Parameters
[in]m0-based index of time node

Reimplemented in pfasst::examples::boris::BorisSweeper< scalar, time >.

Definition at line 23 of file encap_sweeper_impl.hpp.

template<typename time >
shared_ptr< Encapsulation< time > > pfasst::encap::EncapSweeper< time >::get_tau ( size_t  m) const
virtual

Retrieve FAS correction of current iteration at time node index m.

Parameters
[in]m0-based index of time node

Definition at line 29 of file encap_sweeper_impl.hpp.

template<typename time >
void pfasst::encap::EncapSweeper< time >::integrate ( time  dt,
vector< shared_ptr< Encapsulation< time >>>  dst 
) const
virtual

Integrates values of right hand side at all time nodes \( t \in [0,M-1] \) simultaneously.

Parameters
[in]dtwidth of the time interval to integrate
[in,out]dstintegrated values
Exceptions
NotImplementedYetThis function is required by EncapSweeper

Reimplemented in pfasst::examples::boris::BorisSweeper< scalar, time >, pfasst::encap::IMEXSweeper< time >, and pfasst::encap::ImplicitSweeper< time >.

Definition at line 180 of file encap_sweeper_impl.hpp.

References UNUSED.

template<typename time >
void pfasst::encap::EncapSweeper< time >::post ( ICommunicator comm,
int  tag 
)
overridevirtual

Reimplemented from pfasst::ISweeper< time >.

Reimplemented in pfasst::examples::boris::BorisSweeper< scalar, time >.

Definition at line 242 of file encap_sweeper_impl.hpp.

template<typename time >
void pfasst::encap::EncapSweeper< time >::recv ( ICommunicator comm,
int  tag,
bool  blocking 
)
overridevirtual

Reimplemented from pfasst::ISweeper< time >.

Reimplemented in pfasst::examples::boris::BorisSweeper< scalar, time >.

Definition at line 254 of file encap_sweeper_impl.hpp.

template<typename time >
void pfasst::encap::EncapSweeper< time >::reevaluate ( bool  initial_only = false)
virtual

Re-evaluate function values.

Parameters
[in]initial_onlywhether the right hand side should only be evaluated at the initial time point
Exceptions
NotImplementedYetThis function is required by EncapSweeper

Reimplemented in pfasst::encap::IMEXSweeper< time >, and pfasst::encap::ImplicitSweeper< time >.

Definition at line 170 of file encap_sweeper_impl.hpp.

References UNUSED.

template<typename time >
void pfasst::encap::EncapSweeper< time >::residual ( time  dt,
vector< shared_ptr< Encapsulation< time >>>  dst 
) const
virtual

Compute residual at each SDC node (including FAS corrections).

Parameters
[in]dtwidth of the time interval to compute the residual for
[in,out]dstplace to store the residuals at time nodes
Exceptions
NotImplementedYetThis function is required by EncapSweeper for residual computation

Reimplemented in pfasst::examples::boris::BorisSweeper< scalar, time >, and pfasst::encap::IMEXSweeper< time >.

Definition at line 199 of file encap_sweeper_impl.hpp.

References UNUSED.

template<typename time >
void pfasst::encap::EncapSweeper< time >::save ( bool  initial_only)
overridevirtual

Save states (and/or function values) at all nodes.

Reimplemented from pfasst::ISweeper< time >.

Reimplemented in pfasst::examples::boris::BorisSweeper< scalar, time >.

Definition at line 103 of file encap_sweeper_impl.hpp.

template<typename time >
void pfasst::encap::EncapSweeper< time >::send ( ICommunicator comm,
int  tag,
bool  blocking 
)
overridevirtual

Reimplemented from pfasst::ISweeper< time >.

Reimplemented in pfasst::examples::boris::BorisSweeper< scalar, time >.

Definition at line 248 of file encap_sweeper_impl.hpp.

template<typename time >
void pfasst::encap::EncapSweeper< time >::set_factory ( shared_ptr< EncapFactory< time >>  factory)
virtual

Definition at line 140 of file encap_sweeper_impl.hpp.

template<typename time >
void pfasst::encap::EncapSweeper< time >::set_options ( )
overridevirtual

Set options from command line etc.

Reimplemented from pfasst::ISweeper< time >.

Definition at line 53 of file encap_sweeper_impl.hpp.

template<typename time >
void pfasst::encap::EncapSweeper< time >::set_quadrature ( shared_ptr< IQuadrature< time >>  quadrature)
virtual

Definition at line 116 of file encap_sweeper_impl.hpp.

template<typename time >
void pfasst::encap::EncapSweeper< time >::set_residual_tolerances ( time  abs_residual_tol,
time  rel_residual_tol,
int  order = 0 
)

Set residual tolerances for convergence checking.

Parameters
[in]abs_residual_toltolerance for the absolute residual
[in]rel_residual_toltolerance for the relative residual
[in]order

Definition at line 187 of file encap_sweeper_impl.hpp.

template<typename time >
void pfasst::encap::EncapSweeper< time >::setup ( bool  coarse)
overridevirtual

Setup (allocate etc) the sweeper.

Reimplemented from pfasst::ISweeper< time >.

Reimplemented in pfasst::examples::boris::BorisSweeper< scalar, time >, pfasst::encap::IMEXSweeper< time >, and pfasst::encap::ImplicitSweeper< time >.

Definition at line 68 of file encap_sweeper_impl.hpp.

References pfasst::encap::solution.

Referenced by pfasst::encap::ImplicitSweeper< time >::setup(), pfasst::encap::IMEXSweeper< time >::setup(), and pfasst::examples::boris::BorisSweeper< scalar, time >::setup().

+ Here is the caller graph for this function:

template<typename time >
void pfasst::encap::EncapSweeper< time >::spread ( )
overridevirtual

Initialize solution values at all time nodes with meaningful values.

This implementation simply copies the initial value (see EncapSweeper::get_start_state()) to all time nodes.

Reimplemented from pfasst::ISweeper< time >.

Reimplemented in pfasst::examples::boris::BorisSweeper< scalar, time >.

Definition at line 95 of file encap_sweeper_impl.hpp.

Member Data Documentation

template<typename time = time_precision>
time pfasst::encap::EncapSweeper< time >::abs_residual_tol
protected

Tolerance for absolute residual.

The absolute residual is the residual between the very first iteration and the current state.

Definition at line 92 of file encap_sweeper.hpp.

template<typename time = time_precision>
shared_ptr<Encapsulation<time> > pfasst::encap::EncapSweeper< time >::end_state
protected

Current solution at \( T_{end} \).

Definition at line 45 of file encap_sweeper.hpp.

template<typename time = time_precision>
shared_ptr<EncapFactory<time> > pfasst::encap::EncapSweeper< time >::factory
protected

Encapsulation data structure factory.

Definition at line 39 of file encap_sweeper.hpp.

template<typename time = time_precision>
vector<shared_ptr<Encapsulation<time> > > pfasst::encap::EncapSweeper< time >::fas_corrections
protected

FAS corrections \( \tau \) at all time nodes of the current iteration.

The index of the vector corresponds to the index of the quadrature nodes, i.e. fas_corrections.size() == quadrature->get_num_nodes().

Definition at line 79 of file encap_sweeper.hpp.

template<typename time = time_precision>
string pfasst::encap::EncapSweeper< time >::FORMAT_STR
protected

Definition at line 102 of file encap_sweeper.hpp.

template<typename time = time_precision>
shared_ptr<IQuadrature<time> > pfasst::encap::EncapSweeper< time >::quadrature
protected

Quadrature rule used by this sweeper.

Definition at line 36 of file encap_sweeper.hpp.

template<typename time = time_precision>
time pfasst::encap::EncapSweeper< time >::rel_residual_tol
protected

Tolerance for relative residual.

The relative residual is the residual between the previous iteration and current state.

Definition at line 99 of file encap_sweeper.hpp.

template<typename time = time_precision>
int pfasst::encap::EncapSweeper< time >::residual_norm_order
protected
Todo:
Write documentation for this member.

Definition at line 84 of file encap_sweeper.hpp.

template<typename time = time_precision>
vector<shared_ptr<Encapsulation<time> > > pfasst::encap::EncapSweeper< time >::residuals
protected

Place for the residuals at the different time nodes.

The index of the vector corresponds to the index of the quadrature nodes, i.e. residuals.size() == quadrature->get_num_nodes().

Definition at line 53 of file encap_sweeper.hpp.

template<typename time = time_precision>
vector<shared_ptr<Encapsulation<time> > > pfasst::encap::EncapSweeper< time >::saved_state
protected

Solution values \( U \) at all time nodes of the previous iteration.

The index of the vector corresponds to the index of the quadrature nodes, i.e. saved_state.size() == quadrature->get_num_nodes().

Definition at line 71 of file encap_sweeper.hpp.

template<typename time = time_precision>
shared_ptr<Encapsulation<time> > pfasst::encap::EncapSweeper< time >::start_state
protected

Separate start state, i.e. initial condition for the sweeper's current time step.

Definition at line 42 of file encap_sweeper.hpp.

template<typename time = time_precision>
vector<shared_ptr<Encapsulation<time> > > pfasst::encap::EncapSweeper< time >::state
protected

Solution values \( U \) at all time nodes of the current iteration.

The index of the vector corresponds to the index of the quadrature nodes, i.e. state.size() == quadrature->get_num_nodes().

Definition at line 63 of file encap_sweeper.hpp.


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