Reference documentation for deal.II version Git 57495fa5ad 2019-09-23 17:04:23 +0200
\(\newcommand{\dealcoloneq}{\mathrel{\vcenter{:}}=}\)
Public Types | Public Member Functions | Static Public Member Functions | Protected Attributes | Private Member Functions | Private Attributes | List of all members
TimeStepBase_Tria< dim > Class Template Referenceabstract

#include <deal.II/numerics/time_dependent.h>

Inheritance diagram for TimeStepBase_Tria< dim >:
[legend]

Public Types

enum  SolutionState { grid_refinement = 0x1000 }
 
using Flags = typename TimeStepBase_Tria_Flags::Flags< dim >
 
- Public Types inherited from TimeStepBase
enum  SolutionState { primal_problem = 0x0, dual_problem = 0x1, postprocess = 0x2 }
 

Public Member Functions

 TimeStepBase_Tria ()
 
 TimeStepBase_Tria (const double time, const Triangulation< dim, dim > &coarse_grid, const Flags &flags, const RefinementFlags &refinement_flags=RefinementFlags())
 
virtual ~TimeStepBase_Tria () override
 
virtual void wake_up (const unsigned int wakeup_level) override
 
virtual void sleep (const unsigned int) override
 
void refine_grid (const RefinementData data)
 
virtual void init_for_refinement ()
 
virtual void get_tria_refinement_criteria (Vector< float > &criteria) const =0
 
void save_refine_flags ()
 
virtual std::size_t memory_consumption () const override
 
- Public Member Functions inherited from TimeStepBase
 TimeStepBase (const double time)
 
virtual ~TimeStepBase () override=default
 
 TimeStepBase (const TimeStepBase &)=delete
 
TimeStepBaseoperator= (const TimeStepBase &)=delete
 
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
 
- Public Member Functions inherited from Subscriptor
 Subscriptor ()
 
 Subscriptor (const Subscriptor &)
 
 Subscriptor (Subscriptor &&) noexcept
 
virtual ~Subscriptor ()
 
Subscriptoroperator= (const Subscriptor &)
 
Subscriptoroperator= (Subscriptor &&) noexcept
 
void subscribe (std::atomic< bool > *const validity, const std::string &identifier="") const
 
void unsubscribe (std::atomic< bool > *const validity, const std::string &identifier="") const
 
unsigned int n_subscriptions () const
 
template<typename StreamType >
void list_subscribers (StreamType &stream) const
 
void list_subscribers () const
 
template<class Archive >
void serialize (Archive &ar, const unsigned int version)
 

Static Public Member Functions

static ::ExceptionBaseExcGridNotDeleted ()
 
- Static Public Member Functions inherited from Subscriptor
static ::ExceptionBaseExcInUse (int arg1, std::string arg2, std::string arg3)
 
static ::ExceptionBaseExcNoSubscriber (std::string arg1, std::string arg2)
 

Protected Attributes

SmartPointer< Triangulation< dim, dim >, TimeStepBase_Tria< dim > > tria
 
SmartPointer< const Triangulation< dim, dim >, TimeStepBase_Tria< dim > > coarse_grid
 
const Flags flags
 
const RefinementFlags refinement_flags
 
- Protected Attributes inherited from TimeStepBase
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 restore_grid ()
 

Private Attributes

std::vector< std::vector< bool > > refine_flags
 
std::vector< std::vector< bool > > coarsen_flags
 

Detailed Description

template<int dim>
class TimeStepBase_Tria< dim >

Specialization of TimeStepBase which addresses some aspects of grid handling. In particular, this class is thought to make handling of grids available that are adaptively refined on each time step separately or with a loose coupling between time steps. It also takes care of deleting and rebuilding grids when memory resources are a point, through the sleep and wake_up functions declared in the base class.

In addition to that, it offers functions which do some rather hairy refinement rules for time dependent problems, trying to avoid too much change in the grids between subsequent time levels, while also trying to retain the freedom of refining each grid separately. There are lots of flags and numbers controlling this function, which might drastically change the behaviour of the function – see the description of the flags for further information.

Author
Wolfgang Bangerth, 1999; large parts taken from the wave program, by Wolfgang Bangerth 1998

Definition at line 1310 of file time_dependent.h.

Member Typedef Documentation

◆ Flags

template<int dim>
using TimeStepBase_Tria< dim >::Flags = typename TimeStepBase_Tria_Flags::Flags<dim>

Typedef the data types of the TimeStepBase_Tria_Flags() namespace into local scope.

Definition at line 1317 of file time_dependent.h.

Member Enumeration Documentation

◆ SolutionState

template<int dim>
enum TimeStepBase_Tria::SolutionState

Extension of the enum in the base class denoting the next action to be done.

Enumerator
grid_refinement 

Perform grid refinement next.

Definition at line 1327 of file time_dependent.h.

Constructor & Destructor Documentation

◆ TimeStepBase_Tria() [1/2]

template<int dim>
TimeStepBase_Tria< dim >::TimeStepBase_Tria ( )

Default constructor. Does nothing but throws an exception. We need to have such a constructor in order to satisfy the needs of derived classes, which take this class as a virtual base class and don't need to call this constructor of they are not terminal classes. The compiler would like to know a constructor to call anyway since it can't know that the class is not terminal.

Definition at line 424 of file time_dependent.cc.

◆ TimeStepBase_Tria() [2/2]

template<int dim>
TimeStepBase_Tria< dim >::TimeStepBase_Tria ( const double  time,
const Triangulation< dim, dim > &  coarse_grid,
const Flags flags,
const RefinementFlags &  refinement_flags = RefinementFlags() 
)

Constructor. Takes a coarse grid from which the grids on this time level will be derived and some flags steering the behaviour of this object.

The ownership of the coarse grid stays with the creator of this object. However, it is locked from destruction to guarantee the lifetime of the coarse grid is longer than it is needed by this object.

You need to give the general flags structure to this function since it is needed anyway; the refinement flags can be omitted if you do not intend to call the refinement function of this class.

◆ ~TimeStepBase_Tria()

template<int dim>
TimeStepBase_Tria< dim >::~TimeStepBase_Tria ( )
overridevirtual

Destructor. At present, this does not more than releasing the lock on the coarse grid triangulation given to the constructor.

Definition at line 452 of file time_dependent.cc.

Member Function Documentation

◆ wake_up()

template<int dim>
void TimeStepBase_Tria< dim >::wake_up ( const unsigned int  wakeup_level)
overridevirtual

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. By default, this function rebuilds the triangulation if the respective flag has been set to destroy it in the sleep function. It does so also the first time we hit this function and wakeup_level equals flags.wakeup_level_to_build_grid, independently of the value of the mentioned flag. (Actually, it does so whenever the triangulation pointer equals the Null pointer and the value of wakeup_level is right.)

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 from TimeStepBase.

Definition at line 470 of file time_dependent.cc.

◆ sleep()

template<int dim>
void TimeStepBase_Tria< dim >::sleep ( const unsigned int  sleep_level)
overridevirtual

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, if the user specified so in the flags for this object, the triangulation is deleted and the refinement history is saved such that the respective wake_up function can rebuild it. You should therefore call this function from your overloaded version, preferably at the end so that your function can use the triangulation as long as you need it.

Reimplemented from TimeStepBase.

Definition at line 483 of file time_dependent.cc.

◆ refine_grid()

template<int dim>
void TimeStepBase_Tria< dim >::refine_grid ( const RefinementData  data)

Do the refinement according to the flags passed to the constructor of this object and the data passed to this function. For a description of the working of this function refer to the general documentation of this class.

In fact, this function does not actually refine or coarsen the triangulation, but only sets the respective flags. This is done because usually you will not need the grid immediately afterwards but only in the next sweep, so it suffices to store the flags and rebuild it the next time we need it. Also, it may be that the next time step would like to add or delete some flags, so we have to wait anyway with the use of this grid.

Definition at line 738 of file time_dependent.cc.

◆ init_for_refinement()

template<int dim>
void TimeStepBase_Tria< dim >::init_for_refinement ( )
virtual

Respective init function for the refinement loop; does nothing in the default implementation, apart from setting next_action to grid_refinement but can be overloaded.

Definition at line 1142 of file time_dependent.cc.

◆ get_tria_refinement_criteria()

template<int dim>
virtual void TimeStepBase_Tria< dim >::get_tria_refinement_criteria ( Vector< float > &  criteria) const
pure virtual

Virtual function that should fill the vector with the refinement criteria for the present triangulation. It is used within the refine_grid function to get the criteria for the present time step, since they can't be passed through its argument when using the loop of the time step management object.

◆ save_refine_flags()

template<int dim>
void TimeStepBase_Tria< dim >::save_refine_flags ( )

The refinement flags of the triangulation are stored in a local variable thus allowing a restoration. The coarsening flags are also stored.

Definition at line 504 of file time_dependent.cc.

◆ memory_consumption()

template<int dim>
std::size_t TimeStepBase_Tria< dim >::memory_consumption ( ) const
overridevirtual

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 from TimeStepBase.

Definition at line 1151 of file time_dependent.cc.

◆ restore_grid()

template<int dim>
void TimeStepBase_Tria< dim >::restore_grid ( )
private

Restore the grid according to the saved data. For this, the coarse grid is copied and the grid is stepwise rebuilt using the saved flags.

Definition at line 518 of file time_dependent.cc.

Member Data Documentation

◆ tria

template<int dim>
SmartPointer<Triangulation<dim, dim>, TimeStepBase_Tria<dim> > TimeStepBase_Tria< dim >::tria
protected

Triangulation used at this time level. Since this is something that every time stepping scheme needs to have, we can safely put it into the base class. Note that the triangulation is frequently deleted and rebuilt by the functions sleep and wake_up to save memory, if such a behaviour is specified in the flags structure.

Definition at line 1477 of file time_dependent.h.

◆ coarse_grid

template<int dim>
SmartPointer<const Triangulation<dim, dim>, TimeStepBase_Tria<dim> > TimeStepBase_Tria< dim >::coarse_grid
protected

Pointer to a grid which is to be used as the coarse grid for this time level. This pointer is set through the constructor; ownership remains with the owner of this management object.

Definition at line 1485 of file time_dependent.h.

◆ flags

template<int dim>
const Flags TimeStepBase_Tria< dim >::flags
protected

Some flags about how this time level shall behave. See the documentation of this struct to find out more about that.

Definition at line 1491 of file time_dependent.h.

◆ refinement_flags

template<int dim>
const RefinementFlags TimeStepBase_Tria< dim >::refinement_flags
protected

Flags controlling the refinement process; see the documentation of the respective structure for more information.

Definition at line 1497 of file time_dependent.h.

◆ refine_flags

template<int dim>
std::vector<std::vector<bool> > TimeStepBase_Tria< dim >::refine_flags
private

Vectors holding the refinement and coarsening flags of the different sweeps on this time level. The vectors therefore hold the history of the grid.

Definition at line 1505 of file time_dependent.h.

◆ coarsen_flags

template<int dim>
std::vector<std::vector<bool> > TimeStepBase_Tria< dim >::coarsen_flags
private

refine_flags

Definition at line 1510 of file time_dependent.h.


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