16 #ifndef dealii__time_dependent_h 17 #define dealii__time_dependent_h 23 #include <deal.II/base/config.h> 24 #include <deal.II/base/exceptions.h> 25 #include <deal.II/base/subscriptor.h> 26 #include <deal.II/base/smartpointer.h> 31 DEAL_II_NAMESPACE_OPEN
35 template <
typename number>
class Vector;
425 const TimeSteppingData &data_dual,
426 const TimeSteppingData &data_postprocess);
539 template <
typename InitFunctionObject,
typename LoopFunctionObject>
540 void do_loop (InitFunctionObject init_function,
541 LoopFunctionObject loop_function,
542 const TimeSteppingData ×tepping_data,
590 "You cannot insert a time step at the specified position.");
598 std::vector<SmartPointer<TimeStepBase,TimeDependent> >
timesteps;
630 void end_sweep (
const unsigned int begin_timestep,
631 const unsigned int end_timestep);
692 virtual void wake_up (
const unsigned int);
703 virtual void sleep (
const unsigned int);
1203 <<
"The value " << arg1
1204 <<
" for the cell number corridor does not fulfill " 1205 "its natural requirements.");
1244 <<
"The value " << arg1
1245 <<
" for the cell refinement thresholds does not fulfill " 1246 "its natural requirements.");
1351 virtual void wake_up (
const unsigned int wakeup_level);
1366 virtual void sleep (
const unsigned int);
1420 "When calling restore_grid(), you must have previously " 1421 "deleted the triangulation.");
1479 template <
typename InitFunctionObject,
typename LoopFunctionObject>
1481 LoopFunctionObject loop_function,
1496 const unsigned int n_timesteps =
timesteps.size();
1500 for (
unsigned int step=0; step<n_timesteps; ++step)
1507 init_function ((&*
timesteps[n_timesteps-@ref step_1
"step-1"]));
1513 for (
int step=-timestepping_data.
look_ahead; step<0; ++step)
1514 for (
int look_ahead=0;
1515 look_ahead<=static_cast<int>(timestepping_data.
look_ahead); ++look_ahead)
1519 if (step+look_ahead >= 0)
1520 timesteps[step+look_ahead]->wake_up(look_ahead);
1523 if (n_timesteps-(step+look_ahead) < n_timesteps)
1524 timesteps[n_timesteps-(step+look_ahead)]->wake_up(look_ahead);
1529 for (
unsigned int step=0; step<n_timesteps; ++step)
1533 for (
unsigned int look_ahead=0;
1534 look_ahead<=timestepping_data.
look_ahead; ++look_ahead)
1538 if (step+look_ahead < n_timesteps)
1539 timesteps[step+look_ahead]->wake_up(look_ahead);
1542 if (n_timesteps > (step+look_ahead))
1543 timesteps[n_timesteps-(step+look_ahead)-1]->wake_up(look_ahead);
1555 loop_function ((&*
timesteps[n_timesteps-@ref step_1
"step-1"]));
1560 for (
unsigned int look_back=0;
1561 look_back<=timestepping_data.
look_back; ++look_back)
1565 if (step>=look_back)
1566 timesteps[step-look_back]->sleep(look_back);
1569 if (n_timesteps-(step-look_back) <= n_timesteps)
1570 timesteps[n_timesteps-(step-look_back)-1]->sleep(look_back);
1576 for (
int step=n_timesteps;
1577 step<static_cast<int>(n_timesteps+timestepping_data.
look_back); ++step)
1578 for (
int look_back=0;
1579 look_back<=static_cast<int>(timestepping_data.
look_back); ++look_back)
1583 if ((step-look_back >= 0)
1585 (step-look_back < static_cast<int>(n_timesteps)))
1586 timesteps[step-look_back]->sleep(look_back);
1589 if ((step-look_back >= 0)
1591 (step-look_back < static_cast<int>(n_timesteps)))
1592 timesteps[n_timesteps-(step-look_back)-1]->sleep(look_back);
1597 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)
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
double get_forward_timestep() const
void set_next_timestep(const TimeStepBase *next)
const TimeStepBase * previous_timestep
const TimeSteppingData timestepping_data_dual
const unsigned int cell_number_correction_steps
const unsigned int max_refinement_level
const double cell_number_corridor_top
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
const std::vector< std::vector< std::pair< unsigned int, double > > > correction_relaxations
#define DeclException1(Exception1, type1, outsequence)
SmartPointer< const Triangulation< dim, dim >, TimeStepBase_Tria< dim > > coarse_grid
std::size_t memory_consumption() const
virtual void init_for_refinement()
RefinementData(const double refinement_threshold, const double coarsening_threshold=0)
TimeStepBase & operator=(const TimeStepBase &)
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()
virtual ~TimeStepBase_Tria()
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)
TimeStepBase_Tria_Flags::Flags< dim > Flags
virtual std::size_t memory_consumption() const
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)
virtual void sleep(const unsigned int)
std::vector< SmartPointer< TimeStepBase, TimeDependent > > timesteps
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
std::vector< std::vector< bool > > coarsen_flags
virtual void postprocess_timestep()
std::vector< std::vector< std::pair< unsigned int, double > > > CorrectionRelaxations
const bool delete_and_rebuild_tria
virtual void wake_up(const unsigned int wakeup_level)
TimeStepBase(const double time)
TimeSteppingData(const unsigned int look_ahead, const unsigned int look_back)
SmartPointer< Triangulation< dim, dim >, TimeStepBase_Tria< dim > > tria