Skip to content

Commit

Permalink
[insitu] Corrected CoProcess-calls to be indep. of OGS output config.
Browse files Browse the repository at this point in the history
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
  • Loading branch information
bilke committed Mar 23, 2017
1 parent 97cdec4 commit ab10a64
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
3 changes: 2 additions & 1 deletion Applications/InSituLib/Adaptor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
13 changes: 8 additions & 5 deletions ProcessLib/Output.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand Down

0 comments on commit ab10a64

Please sign in to comment.