diff --git a/opm/simulators/SimulatorIncompTwophase.cpp b/opm/simulators/SimulatorIncompTwophase.cpp index 5005c586d..0c55c8838 100644 --- a/opm/simulators/SimulatorIncompTwophase.cpp +++ b/opm/simulators/SimulatorIncompTwophase.cpp @@ -136,6 +136,11 @@ namespace Opm return pimpl_->timestep_completed_; } + // empty default implementation, but provided in module; it is dangerous ta have + // this inlined in clients from the header, because then it can't be updated! + void SimulatorIncompTwophase::sync () { + } + static void reportVolumes(std::ostream &os, double satvol[2], double tot_porevol_init, double tot_injected[2], double tot_produced[2], double injected[2], double produced[2], diff --git a/opm/simulators/SimulatorIncompTwophase.hpp b/opm/simulators/SimulatorIncompTwophase.hpp index 09ea2b93a..cba56a286 100644 --- a/opm/simulators/SimulatorIncompTwophase.hpp +++ b/opm/simulators/SimulatorIncompTwophase.hpp @@ -110,8 +110,28 @@ namespace Opm /// sim.timestep_completed ().add (f); /// sim.run (...); /// \endcode + /// + /// \note + /// Registered callbacks should call the sync() method before + /// accessing the state that was passed into the run() method. + /// + /// \see Opm::SimulatorIncompTwophase::sync Event& timestep_completed (); + /// Notify the simulator that a callback has an interest in reading + /// for reporting purposes the contents of the state argument that + /// was passed to the run() method. The simulator will then flush + /// any internal state which is currently not reflected in it. + /// + /// \note + /// This should only be called from within a notification which has + /// been setup with timestep_completed(). Avoid calling this method + /// outside of run(). + /// + /// \see Opm::SimulatorIncompTwophase::run, + /// Opm::SimulatorIncompTwophase::timestep_completed + void sync (); + private: struct Impl; // Using shared_ptr instead of unique_ptr since unique_ptr requires complete type for Impl.