15#ifndef dealii_time_dependent_h
16#define dealii_time_dependent_h
34template <
typename number>
36template <
int dim,
int spacedim>
432 const TimeSteppingData &data_dual,
433 const TimeSteppingData &data_postprocess);
556 template <
typename InitFunctionObject,
typename LoopFunctionObject>
558 do_loop(InitFunctionObject init_function,
559 LoopFunctionObject loop_function,
560 const TimeSteppingData ×tepping_data,
611 "You cannot insert a time step at the specified position.");
619 std::vector<SmartPointer<TimeStepBase, TimeDependent>>
timesteps;
651 end_sweep(
const unsigned int begin_timestep,
const unsigned int end_timestep);
736 sleep(
const unsigned int);
1137 std::vector<std::vector<std::pair<unsigned int, double>>>;
1198 const std::vector<std::vector<std::pair<unsigned int, double>>>
1236 <<
"The value " << arg1
1237 <<
" for the cell number corridor does not fulfill "
1238 "its natural requirements.");
1277 <<
"The value " << arg1
1278 <<
" for the cell refinement thresholds does not fulfill "
1279 "its natural requirements.");
1383 wake_up(
const unsigned int wakeup_level)
override;
1399 sleep(
const unsigned int)
override;
1458 "When calling restore_grid(), you must have previously "
1459 "deleted the triangulation.");
1516template <
typename InitFunctionObject,
typename LoopFunctionObject>
1519 LoopFunctionObject loop_function,
1534 const unsigned int n_timesteps =
timesteps.size();
1538 for (
unsigned int step = 0; step < n_timesteps; ++step)
1545 init_function((&*
timesteps[n_timesteps - step - 1]));
1551 for (
int step = -
static_cast<int>(timestepping_data.
look_ahead); step < 0;
1553 for (
int look_ahead = 0;
1554 look_ahead <= static_cast<int>(timestepping_data.
look_ahead);
1559 if (step + look_ahead >= 0)
1560 timesteps[step + look_ahead]->wake_up(look_ahead);
1563 if (n_timesteps - (step + look_ahead) < n_timesteps)
1564 timesteps[n_timesteps - (step + look_ahead)]->wake_up(look_ahead);
1569 for (
unsigned int step = 0; step < n_timesteps; ++step)
1573 for (
unsigned int look_ahead = 0;
1579 if (step + look_ahead < n_timesteps)
1580 timesteps[step + look_ahead]->wake_up(look_ahead);
1583 if (n_timesteps > (step + look_ahead))
1584 timesteps[n_timesteps - (step + look_ahead) - 1]->wake_up(
1597 loop_function((&*
timesteps[n_timesteps - step - 1]));
1602 for (
unsigned int look_back = 0; look_back <= timestepping_data.
look_back;
1607 if (step >= look_back)
1608 timesteps[step - look_back]->sleep(look_back);
1611 if (n_timesteps - (step - look_back) <= n_timesteps)
1612 timesteps[n_timesteps - (step - look_back) - 1]->sleep(
1619 for (
int step = n_timesteps;
1620 step < static_cast<int>(n_timesteps + timestepping_data.
look_back);
1622 for (
int look_back = 0;
1623 look_back <= static_cast<int>(timestepping_data.
look_back);
1628 if ((step - look_back >= 0) &&
1629 (step - look_back < static_cast<int>(n_timesteps)))
1630 timesteps[step - look_back]->sleep(look_back);
1633 if ((step - look_back >= 0) &&
1634 (step - look_back < static_cast<int>(n_timesteps)))
1635 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()
typename TimeStepBase_Tria_Flags::RefinementFlags< dim > RefinementFlags
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
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_CXX20_REQUIRES(condition)
#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)
std::vector< std::vector< std::pair< unsigned int, double > > > CorrectionRelaxations
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
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