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;
532 template <
typename InitFunctionObject,
typename LoopFunctionObject>
533 void do_loop (InitFunctionObject init_function,
534 LoopFunctionObject loop_function,
583 "You cannot insert a time step at the specified position.");
591 std::vector<SmartPointer<TimeStepBase,TimeDependent> >
timesteps;
623 void end_sweep (
const unsigned int begin_timestep,
624 const unsigned int end_timestep);
646 primal_problem = 0x0,
676 virtual void wake_up (
const unsigned int);
687 virtual void sleep (
const unsigned int);
720 virtual void init_for_primal_problem ();
725 virtual void init_for_dual_problem ();
730 virtual void init_for_postprocessing ();
761 virtual void postprocess_timestep ();
766 double get_time ()
const;
772 unsigned int get_timestep_no ()
const;
787 double get_backward_timestep ()
const;
794 double get_forward_timestep ()
const;
850 void set_previous_timestep (
const TimeStepBase *previous);
867 void set_timestep_no (
const unsigned int step_no);
873 void set_sweep_no (
const unsigned int sweep_no);
928 Flags (
const bool delete_and_rebuild_tria,
929 const unsigned int wakeup_level_to_build_grid,
930 const unsigned int sleep_level_to_delete_grid);
1102 const unsigned int first_sweep_with_correction = 0,
1103 const unsigned int min_cells_for_correction = 0,
1104 const double cell_number_corridor_top = (1<<dim),
1105 const double cell_number_corridor_bottom = 1,
1106 const CorrectionRelaxations &correction_relaxations = CorrectionRelaxations(),
1107 const unsigned int cell_number_correction_steps = 0,
1108 const bool mirror_flags_to_previous_grid =
false,
1109 const bool adapt_grids =
false);
1187 <<
"The value " << arg1
1188 <<
" for the cell number corridor does not fulfill " 1189 "its natural requirements.");
1207 const double coarsening_threshold=0);
1228 <<
"The value " << arg1
1229 <<
" for the cell refinement thresholds does not fulfill " 1230 "its natural requirements.");
1275 grid_refinement = 0x1000
1304 const RefinementFlags &refinement_flags = RefinementFlags());
1332 virtual void wake_up (
const unsigned int wakeup_level);
1347 virtual void sleep (
const unsigned int);
1363 void refine_grid (
const RefinementData data);
1370 virtual void init_for_refinement ();
1379 virtual void get_tria_refinement_criteria (
Vector<float> &criteria)
const = 0;
1385 void save_refine_flags ();
1401 "When calling restore_grid(), you must have previously " 1402 "deleted the triangulation.");
1451 void restore_grid ();
1460 template <
typename InitFunctionObject,
typename LoopFunctionObject>
1462 LoopFunctionObject loop_function,
1477 const unsigned int n_timesteps =
timesteps.size();
1481 for (
unsigned int step=0; step<n_timesteps; ++step)
1485 init_function (static_cast<typename InitFunctionObject::argument_type>
1489 init_function (static_cast<typename InitFunctionObject::argument_type>
1490 (&*
timesteps[n_timesteps-@ref step_1
"step-1"]));
1496 for (
int step=-timestepping_data.
look_ahead; step<0; ++step)
1506 if (n_timesteps-(step+
look_ahead) < n_timesteps)
1512 for (
unsigned int step=0; step<n_timesteps; ++step)
1535 loop_function (static_cast<typename LoopFunctionObject::argument_type>
1539 loop_function (static_cast<typename LoopFunctionObject::argument_type>
1540 (&*
timesteps[n_timesteps-@ref step_1
"step-1"]));
1554 if (n_timesteps-(step-
look_back) <= n_timesteps)
1561 for (
int step=n_timesteps;
1562 step<static_cast<int>(n_timesteps+timestepping_data.
look_back); ++step)
1570 (step-look_back < static_cast<int>(n_timesteps)))
1576 (step-look_back < static_cast<int>(n_timesteps)))
1582 DEAL_II_NAMESPACE_CLOSE
const unsigned int look_back
TimeDependent(const TimeSteppingData &data_primal, const TimeSteppingData &data_dual, const TimeSteppingData &data_postprocess)
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
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 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
const TimeSteppingData timestepping_data_primal
virtual void start_sweep(const unsigned int sweep_no)
static CorrectionRelaxations default_correction_relaxations
const unsigned int first_sweep_with_correction
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
DeclExceptionMsg(ExcInvalidPosition, "You cannot insert a time step at the specified position.")
std::vector< SmartPointer< TimeStepBase, TimeDependent > > timesteps
const double cell_number_corridor_bottom
const unsigned int look_ahead
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
std::vector< std::vector< std::pair< unsigned int, double > > > CorrectionRelaxations
const bool delete_and_rebuild_tria
TimeSteppingData(const unsigned int look_ahead, const unsigned int look_back)
SmartPointer< Triangulation< dim, dim >, TimeStepBase_Tria< dim > > tria