Verified Commit 7cb134fd authored by Lars Bilke's avatar Lars Bilke
Browse files

[Insitu] Write files to output directory (ogs -o ...)

parent fbd6bdf2
......@@ -19,6 +19,8 @@
#include "MeshLib/Mesh.h"
#include "MeshLib/Vtk/VtkMappedMeshSource.h"
#include <filesystem>
namespace InSituLib
{
vtkCPProcessor* Processor = nullptr;
......@@ -57,7 +59,8 @@ void Finalize()
}
}
void CoProcess(MeshLib::Mesh const& mesh, double const time,
unsigned int const timeStep, bool const lastTimeStep)
unsigned int const timeStep, bool const lastTimeStep,
std::string output_directory)
{
if (Processor == nullptr)
return;
......@@ -80,7 +83,10 @@ void CoProcess(MeshLib::Mesh const& mesh, double const time,
vtkSource->Update();
dataDescription->GetInputDescriptionByName("input")->SetGrid(
vtkSource->GetOutput());
auto cwd = std::filesystem::current_path();
std::filesystem::current_path(output_directory);
Processor->CoProcess(dataDescription.GetPointer());
std::filesystem::current_path(cwd);
INFO("End InSitu process.");
}
}
......
......@@ -20,5 +20,6 @@ void Initialize(BaseLib::ConfigTree const& scripts_config,
std::string const& path);
void Finalize();
void CoProcess(MeshLib::Mesh const& mesh, double const time,
unsigned int const timeStep, bool const lastTimeStep);
unsigned int const timeStep, bool const lastTimeStep,
std::string output_directory);
}
......@@ -350,7 +350,7 @@ void Output::doOutput(Process const& process,
#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);
InSituLib::CoProcess(process.getMesh(), t, timestep, false, _output_directory);
#endif
}
......@@ -365,7 +365,7 @@ void Output::doOutputLastTimestep(Process const& process,
doOutputAlways(process, process_id, timestep, t, x);
}
#ifdef USE_INSITU
InSituLib::CoProcess(process.getMesh(), t, timestep, true);
InSituLib::CoProcess(process.getMesh(), t, timestep, true, _output_directory);
#endif
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment