From a2fe1ad2acf744c39a93cefeb0bfed34c3d04c3d Mon Sep 17 00:00:00 2001 From: Lars Bilke <lars.bilke@ufz.de> Date: Tue, 21 Mar 2017 09:04:17 +0100 Subject: [PATCH] [insitu] Corrected CoProcess-calls to be indep. of OGS output config. Note: The last time is always outputted and may be outputted two times if the config marks it to output. E.g. - num timesteps: 10 - output every second time step --> last time step is outputted twice --- Applications/InSituLib/Adaptor.cpp | 3 ++- ProcessLib/Output.cpp | 13 ++++++++----- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/Applications/InSituLib/Adaptor.cpp b/Applications/InSituLib/Adaptor.cpp index 7c4eb32a8ba..81ddffacfc8 100644 --- a/Applications/InSituLib/Adaptor.cpp +++ b/Applications/InSituLib/Adaptor.cpp @@ -71,7 +71,8 @@ void CoProcess(MeshLib::Mesh const& mesh, double const time, } if (Processor->RequestDataDescription(dataDescription.GetPointer()) != 0) { - INFO("Start InSitu process."); + INFO("Start InSitu process: timestep #%d (t=%g, last=%d)", timeStep, + time, lastTimeStep); vtkNew<MeshLib::VtkMappedMeshSource> vtkSource; vtkSource->SetMesh(&mesh); vtkSource->Update(); diff --git a/ProcessLib/Output.cpp b/ProcessLib/Output.cpp index 3036cea5566..8e89340b73b 100644 --- a/ProcessLib/Output.cpp +++ b/ProcessLib/Output.cpp @@ -125,11 +125,6 @@ void Output::doOutputAlways(Process const& process, INFO("[time] Output of timestep %d took %g s.", timestep, time_output.elapsed()); - -#ifdef USE_INSITU - // TODO: get number of timesteps - InSituLib::CoProcess(process.getMesh(), t, timestep, false); -#endif } void Output::doOutput(Process const& process, @@ -140,6 +135,11 @@ void Output::doOutput(Process const& process, { if (shallDoOutput(timestep, _repeats_each_steps)) doOutputAlways(process, process_output, timestep, t, x); +#ifdef USE_INSITU + // Note: last time step may be output twice: here and in + // doOutputLastTimestep() which throws a warning. + InSituLib::CoProcess(process.getMesh(), t, timestep, false); +#endif } void Output::doOutputLastTimestep(Process const& process, @@ -150,6 +150,9 @@ void Output::doOutputLastTimestep(Process const& process, { if (!shallDoOutput(timestep, _repeats_each_steps)) doOutputAlways(process, process_output, timestep, t, x); +#ifdef USE_INSITU + InSituLib::CoProcess(process.getMesh(), t, timestep, true); +#endif } void Output::doOutputNonlinearIteration(Process const& process, -- GitLab