16 #ifndef dealii_time_dependent_h 17 # define dealii_time_dependent_h 23 # include <deal.II/base/config.h> 25 # include <deal.II/base/exceptions.h> 26 # include <deal.II/base/smartpointer.h> 27 # include <deal.II/base/subscriptor.h> 32 DEAL_II_NAMESPACE_OPEN
36 template <
typename number>
38 template <
int dim,
int spacedim>
435 const TimeSteppingData &data_dual,
436 const TimeSteppingData &data_postprocess);
555 template <
typename InitFunctionObject,
typename LoopFunctionObject>
557 do_loop(InitFunctionObject init_function,
558 LoopFunctionObject loop_function,
559 const TimeSteppingData ×tepping_data,
610 "You cannot insert a time step at the specified position.");
618 std::vector<SmartPointer<TimeStepBase, TimeDependent>>
timesteps;
650 end_sweep(
const unsigned int begin_timestep,
const unsigned int end_timestep);
737 sleep(
const unsigned int);
1140 std::vector<std::vector<std::pair<unsigned int, double>>>;
1201 const std::vector<std::vector<std::pair<unsigned int, double>>>
1239 <<
"The value " << arg1
1240 <<
" for the cell number corridor does not fulfill " 1241 "its natural requirements.");
1280 <<
"The value " << arg1
1281 <<
" for the cell refinement thresholds does not fulfill " 1282 "its natural requirements.");
1316 using RefinementFlags =
1389 wake_up(
const unsigned int wakeup_level)
override;
1405 sleep(
const unsigned int)
override;
1464 "When calling restore_grid(), you must have previously " 1465 "deleted the triangulation.");
1522 template <
typename InitFunctionObject,
typename LoopFunctionObject>
1525 LoopFunctionObject loop_function,
1540 const unsigned int n_timesteps =
timesteps.size();
1544 for (
unsigned int step = 0; step < n_timesteps; ++step)
1551 init_function((&*
timesteps[n_timesteps - step - 1]));
1557 for (
int step = -static_cast<int>(timestepping_data.
look_ahead); step < 0;
1559 for (
int look_ahead = 0;
1560 look_ahead <= static_cast<int>(timestepping_data.
look_ahead);
1565 if (step + look_ahead >= 0)
1566 timesteps[step + look_ahead]->wake_up(look_ahead);
1569 if (n_timesteps - (step + look_ahead) < n_timesteps)
1570 timesteps[n_timesteps - (step + look_ahead)]->wake_up(look_ahead);
1575 for (
unsigned int step = 0; step < n_timesteps; ++step)
1579 for (
unsigned int look_ahead = 0;
1585 if (step + look_ahead < n_timesteps)
1586 timesteps[step + look_ahead]->wake_up(look_ahead);
1589 if (n_timesteps > (step + look_ahead))
1590 timesteps[n_timesteps - (step + look_ahead) - 1]->wake_up(
1603 loop_function((&*
timesteps[n_timesteps - step - 1]));
1608 for (
unsigned int look_back = 0; look_back <= timestepping_data.
look_back;
1613 if (step >= look_back)
1614 timesteps[step - look_back]->sleep(look_back);
1617 if (n_timesteps - (step - look_back) <= n_timesteps)
1618 timesteps[n_timesteps - (step - look_back) - 1]->sleep(
1625 for (
int step = n_timesteps;
1626 step < static_cast<int>(n_timesteps + timestepping_data.
look_back);
1628 for (
int look_back = 0;
1629 look_back <= static_cast<int>(timestepping_data.
look_back);
1634 if ((step - look_back >= 0) &&
1635 (step - look_back < static_cast<int>(n_timesteps)))
1636 timesteps[step - look_back]->sleep(look_back);
1639 if ((step - look_back >= 0) &&
1640 (step - look_back < static_cast<int>(n_timesteps)))
1641 timesteps[n_timesteps - (step - look_back) - 1]->sleep(look_back);
1646 DEAL_II_NAMESPACE_CLOSE
void set_sweep_no(const unsigned int sweep_no)
virtual std::size_t memory_consumption() const
virtual void solve_primal_problem()=0
const unsigned int look_back
virtual void sleep(const unsigned int)
virtual void start_sweep()
void refine_grid(const RefinementData data)
static ::ExceptionBase & ExcInvalidValue(double arg1)
const std::vector< std::vector< std::pair< unsigned int, double > > > correction_relaxations
TimeDependent(const TimeSteppingData &data_primal, const TimeSteppingData &data_dual, const TimeSteppingData &data_postprocess)
virtual void solve_dual_problem()
void set_timestep_no(const unsigned int step_no)
void solve_primal_problem()
void add_timestep(TimeStepBase *new_timestep)
void solve_dual_problem()
const TimeStepBase * next_timestep
const TimeSteppingData timestepping_data_postprocess
const unsigned int wakeup_level_to_build_grid
virtual void wake_up(const unsigned int wakeup_level) override
double get_forward_timestep() const
void set_next_timestep(const TimeStepBase *next)
const TimeStepBase * previous_timestep
virtual ~TimeStepBase() override=default
const TimeSteppingData timestepping_data_dual
const unsigned int cell_number_correction_steps
const unsigned int max_refinement_level
LinearAlgebra::distributed::Vector< Number > Vector
SmartPointer< const Triangulation< dim, dim >, TimeStepBase_Tria< dim > > coarse_grid
const double cell_number_corridor_top
virtual std::size_t memory_consumption() const override
void set_previous_timestep(const TimeStepBase *previous)
unsigned int get_timestep_no() const
void do_loop(InitFunctionObject init_function, LoopFunctionObject loop_function, const TimeSteppingData ×tepping_data, const Direction direction)
const RefinementFlags refinement_flags
std::vector< std::vector< std::pair< unsigned int, double > >> CorrectionRelaxations
#define DeclException1(Exception1, type1, outsequence)
std::size_t memory_consumption() const
virtual void init_for_refinement()
RefinementData(const double refinement_threshold, const double coarsening_threshold=0)
std::vector< SmartPointer< TimeStepBase, TimeDependent > > timesteps
virtual void get_tria_refinement_criteria(Vector< float > &criteria) const =0
#define DeclExceptionMsg(Exception, defaulttext)
const TimeSteppingData timestepping_data_primal
static ::ExceptionBase & ExcInvalidPosition()
virtual void start_sweep(const unsigned int sweep_no)
virtual void init_for_postprocessing()
static ::ExceptionBase & ExcGridNotDeleted()
static CorrectionRelaxations default_correction_relaxations
static ::ExceptionBase & ExcInvalidValue(double arg1)
const unsigned int first_sweep_with_correction
double get_backward_timestep() const
const unsigned int sleep_level_to_delete_grid
const double coarsening_threshold
void delete_timestep(const unsigned int position)
virtual void wake_up(const unsigned int)
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)
TimeStepBase & operator=(const TimeStepBase &)=delete
typename TimeStepBase_Tria_Flags::Flags< dim > Flags
virtual void init_for_dual_problem()
const double cell_number_corridor_bottom
const unsigned int look_ahead
virtual void init_for_primal_problem()
const bool mirror_flags_to_previous_grid
const unsigned int min_cells_for_correction
void insert_timestep(const TimeStepBase *position, TimeStepBase *new_timestep)
std::vector< std::vector< bool > > refine_flags
const double refinement_threshold
SmartPointer< Triangulation< dim, dim >, TimeStepBase_Tria< dim > > tria
std::vector< std::vector< bool > > coarsen_flags
virtual void postprocess_timestep()
const bool delete_and_rebuild_tria
virtual ~TimeStepBase_Tria() override
virtual void sleep(const unsigned int) override
TimeStepBase(const double time)
TimeSteppingData(const unsigned int look_ahead, const unsigned int look_back)