16#ifndef dealii_time_dependent_h
17# define dealii_time_dependent_h
37template <
typename number>
39template <
int dim,
int spacedim>
434 const TimeSteppingData &data_dual,
435 const TimeSteppingData &data_postprocess);
558 template <
typename InitFunctionObject,
typename LoopFunctionObject>
560 do_loop(InitFunctionObject init_function,
561 LoopFunctionObject loop_function,
562 const TimeSteppingData ×tepping_data,
613 "You cannot insert a time step at the specified position.");
621 std::vector<SmartPointer<TimeStepBase, TimeDependent>>
timesteps;
653 end_sweep(
const unsigned int begin_timestep,
const unsigned int end_timestep);
738 sleep(
const unsigned int);
1139 std::vector<std::vector<std::pair<unsigned int, double>>>;
1200 const std::vector<std::vector<std::pair<unsigned int, double>>>
1238 <<
"The value " << arg1
1239 <<
" for the cell number corridor does not fulfill "
1240 "its natural requirements.");
1279 <<
"The value " << arg1
1280 <<
" for the cell refinement thresholds does not fulfill "
1281 "its natural requirements.");
1385 wake_up(
const unsigned int wakeup_level)
override;
1401 sleep(
const unsigned int)
override;
1460 "When calling restore_grid(), you must have previously "
1461 "deleted the triangulation.");
1518template <
typename InitFunctionObject,
typename LoopFunctionObject>
1521 LoopFunctionObject loop_function,
1536 const unsigned int n_timesteps =
timesteps.size();
1540 for (
unsigned int step = 0; step < n_timesteps; ++step)
1547 init_function((&*
timesteps[n_timesteps - step - 1]));
1553 for (
int step = -
static_cast<int>(timestepping_data.
look_ahead); step < 0;
1555 for (
int look_ahead = 0;
1556 look_ahead <= static_cast<int>(timestepping_data.
look_ahead);
1561 if (step + look_ahead >= 0)
1562 timesteps[step + look_ahead]->wake_up(look_ahead);
1565 if (n_timesteps - (step + look_ahead) < n_timesteps)
1566 timesteps[n_timesteps - (step + look_ahead)]->wake_up(look_ahead);
1571 for (
unsigned int step = 0; step < n_timesteps; ++step)
1575 for (
unsigned int look_ahead = 0;
1581 if (step + look_ahead < n_timesteps)
1582 timesteps[step + look_ahead]->wake_up(look_ahead);
1585 if (n_timesteps > (step + look_ahead))
1586 timesteps[n_timesteps - (step + look_ahead) - 1]->wake_up(
1599 loop_function((&*
timesteps[n_timesteps - step - 1]));
1604 for (
unsigned int look_back = 0; look_back <= timestepping_data.
look_back;
1609 if (step >= look_back)
1610 timesteps[step - look_back]->sleep(look_back);
1613 if (n_timesteps - (step - look_back) <= n_timesteps)
1614 timesteps[n_timesteps - (step - look_back) - 1]->sleep(
1621 for (
int step = n_timesteps;
1622 step < static_cast<int>(n_timesteps + timestepping_data.
look_back);
1624 for (
int look_back = 0;
1625 look_back <= static_cast<int>(timestepping_data.
look_back);
1630 if ((step - look_back >= 0) &&
1631 (step - look_back < static_cast<int>(n_timesteps)))
1632 timesteps[step - look_back]->sleep(look_back);
1635 if ((step - look_back >= 0) &&
1636 (step - look_back < static_cast<int>(n_timesteps)))
1637 timesteps[n_timesteps - (step - look_back) - 1]->sleep(look_back);
void insert_timestep(const TimeStepBase *position, TimeStepBase *new_timestep)
virtual void start_sweep(const unsigned int sweep_no)
std::size_t memory_consumption() const
const TimeSteppingData timestepping_data_primal
std::vector< SmartPointer< TimeStepBase, TimeDependent > > timesteps
void solve_dual_problem()
void do_loop(InitFunctionObject init_function, LoopFunctionObject loop_function, const TimeSteppingData ×tepping_data, const Direction direction)
const TimeSteppingData timestepping_data_dual
void solve_primal_problem()
TimeDependent(const TimeSteppingData &data_primal, const TimeSteppingData &data_dual, const TimeSteppingData &data_postprocess)
void delete_timestep(const unsigned int position)
void add_timestep(TimeStepBase *new_timestep)
const TimeSteppingData timestepping_data_postprocess
virtual void wake_up(const unsigned int wakeup_level) override
typename TimeStepBase_Tria_Flags::Flags< dim > Flags
std::vector< std::vector< bool > > coarsen_flags
virtual void sleep(const unsigned int) override
TimeStepBase_Tria(const double time, const Triangulation< dim, dim > &coarse_grid, const Flags &flags, const RefinementFlags &refinement_flags=RefinementFlags())
virtual std::size_t memory_consumption() const override
void refine_grid(const RefinementData data)
virtual void init_for_refinement()
SmartPointer< const Triangulation< dim, dim >, TimeStepBase_Tria< dim > > coarse_grid
typename TimeStepBase_Tria_Flags::RefinementData< dim > RefinementData
virtual void get_tria_refinement_criteria(Vector< float > &criteria) const =0
const RefinementFlags refinement_flags
virtual ~TimeStepBase_Tria() override
SmartPointer< Triangulation< dim, dim >, TimeStepBase_Tria< dim > > tria
typename TimeStepBase_Tria_Flags::RefinementFlags< dim > RefinementFlags
std::vector< std::vector< bool > > refine_flags
virtual std::size_t memory_consumption() const
double get_forward_timestep() const
TimeStepBase(const double time)
virtual void wake_up(const unsigned int)
void set_timestep_no(const unsigned int step_no)
void set_previous_timestep(const TimeStepBase *previous)
const TimeStepBase * previous_timestep
TimeStepBase(const TimeStepBase &)=delete
virtual ~TimeStepBase() override=default
virtual void postprocess_timestep()
virtual void sleep(const unsigned int)
void set_next_timestep(const TimeStepBase *next)
unsigned int get_timestep_no() const
double get_backward_timestep() const
void set_sweep_no(const unsigned int sweep_no)
TimeStepBase & operator=(const TimeStepBase &)=delete
virtual void solve_primal_problem()=0
virtual void init_for_postprocessing()
virtual void start_sweep()
virtual void init_for_primal_problem()
virtual void solve_dual_problem()
virtual void init_for_dual_problem()
const TimeStepBase * next_timestep
#define DEAL_II_NAMESPACE_OPEN
#define DEAL_II_NAMESPACE_CLOSE
static ::ExceptionBase & ExcGridNotDeleted()
static ::ExceptionBase & ExcInvalidValue(double arg1)
#define DeclExceptionMsg(Exception, defaulttext)
#define DeclException1(Exception1, type1, outsequence)
static ::ExceptionBase & ExcInvalidValue(double arg1)
static ::ExceptionBase & ExcInvalidPosition()
const unsigned int look_ahead
const unsigned int look_back
TimeSteppingData(const unsigned int look_ahead, const unsigned int look_back)
const unsigned int wakeup_level_to_build_grid
const bool delete_and_rebuild_tria
const unsigned int sleep_level_to_delete_grid
const double refinement_threshold
const double coarsening_threshold
RefinementData(const double refinement_threshold, const double coarsening_threshold=0)
const unsigned int min_cells_for_correction
const double cell_number_corridor_top
RefinementFlags(const unsigned int max_refinement_level=0, const unsigned int first_sweep_with_correction=0, const unsigned int min_cells_for_correction=0, const double cell_number_corridor_top=(1<< dim), const double cell_number_corridor_bottom=1, const CorrectionRelaxations &correction_relaxations=CorrectionRelaxations(), const unsigned int cell_number_correction_steps=0, const bool mirror_flags_to_previous_grid=false, const bool adapt_grids=false)
const unsigned int first_sweep_with_correction
std::vector< std::vector< std::pair< unsigned int, double > > > CorrectionRelaxations
const std::vector< std::vector< std::pair< unsigned int, double > > > correction_relaxations
const unsigned int max_refinement_level
const bool mirror_flags_to_previous_grid
const unsigned int cell_number_correction_steps
static CorrectionRelaxations default_correction_relaxations
const double cell_number_corridor_bottom