From: wolf Date: Mon, 1 Mar 1999 02:35:19 +0000 (+0000) Subject: Implement a previously forgotten function and fix several bugs. X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=aa2e3694aee1750d23d69215f1751a24f9d77aeb;p=dealii-svn.git Implement a previously forgotten function and fix several bugs. git-svn-id: https://svn.dealii.org/trunk@932 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/deal.II/source/numerics/time_dependent.cc b/deal.II/deal.II/source/numerics/time_dependent.cc index 179b05f93a..d59a679690 100644 --- a/deal.II/deal.II/source/numerics/time_dependent.cc +++ b/deal.II/deal.II/source/numerics/time_dependent.cc @@ -8,6 +8,16 @@ +TimeDependent::TimeSteppingData::TimeSteppingData (const unsigned int look_ahead, + const unsigned int look_back) + : + look_ahead (look_ahead), + look_back (look_back) +{}; + + + + TimeDependent::TimeDependent (const TimeSteppingData &data_primal): sweep_no (static_cast(-1)), timestepping_data_primal (data_primal) @@ -32,26 +42,43 @@ TimeDependent::insert_timestep (TimeStepBase *new_timestep, ExcInvalidPosition(position, timesteps.size())); // lock this timestep from deletion - timesteps.back()->subscribe(); + new_timestep->subscribe(); // first insert the new time step // into the doubly linked list // of timesteps - if (position != 0) + if (position == timesteps.size()) { - timesteps[position]->set_next_timestep (new_timestep); - new_timestep->set_previous_timestep (timesteps[position]); - } - else - new_timestep->set_previous_timestep (0); - - if (position+1 < timesteps.size()) - { - timesteps[position+1]->set_previous_timestep (new_timestep); - new_timestep->set_next_timestep (timesteps[position+1]); + // at the end + new_timestep->set_next_timestep (0); + if (timesteps.size() > 0) + { + timesteps.back()->set_next_timestep (new_timestep); + new_timestep->set_previous_timestep (timesteps.back()); + } + else + new_timestep->set_previous_timestep (0); } else - new_timestep->set_next_timestep (0); + if (position == 0) + { + // at the beginning + new_timestep->set_previous_timestep (0); + if (timesteps.size() > 0) + { + timesteps[0]->set_previous_timestep (new_timestep); + new_timestep->set_next_timestep (timesteps[0]); + } + else + new_timestep->set_next_timestep (0); + } + else + { + // inner time step + timesteps[position-1]->set_next_timestep (new_timestep); + new_timestep->set_next_timestep (timesteps[position]); + timesteps[position]->set_previous_timestep (new_timestep); + }; // finally enter it into the // array @@ -299,10 +326,10 @@ TimeStepBase_Tria::Flags::Flags (const unsigned int max_refinement_level, wakeup_level_to_build_grid (wakeup_level_to_build_grid), sleep_level_to_delete_grid (sleep_level_to_delete_grid) { - Assert (!delete_and_rebuild_tria || (wakeup_level_to_build_grid>=1), - ExcInvalidParameter(wakeup_level_to_build_grid)); - Assert (!delete_and_rebuild_tria || (sleep_level_to_delete_grid>=1), - ExcInvalidParameter(sleep_level_to_delete_grid)); +// Assert (!delete_and_rebuild_tria || (wakeup_level_to_build_grid>=1), +// ExcInvalidParameter(wakeup_level_to_build_grid)); +// Assert (!delete_and_rebuild_tria || (sleep_level_to_delete_grid>=1), +// ExcInvalidParameter(sleep_level_to_delete_grid)); }; @@ -348,7 +375,7 @@ TimeStepBase_Tria::wake_up (const unsigned wakeup_level) { TimeStepBase::wake_up (wakeup_level); if (wakeup_level == flags.wakeup_level_to_build_grid) - if (flags.delete_and_rebuild_tria) + if (flags.delete_and_rebuild_tria || !tria) restore_grid (); };