31 std::string
const& path)
45 auto scriptPath = std::filesystem::path(
47 script_config.getConfigParameter<std::string>(
"name"));
48 if (scriptPath.is_relative())
50 scriptPath = std::filesystem::path(path) / scriptPath;
52 if (!std::filesystem::exists(scriptPath))
54 ERR(
"In-situ script {:s} does not exist!", scriptPath.string());
56 INFO(
"Initializing in-situ script: {:s}", scriptPath.string());
57 vtkNew<vtkCPPythonScriptPipeline> pipeline;
58 pipeline->Initialize(scriptPath.c_str());
59 Processor->AddPipeline(pipeline.GetPointer());
71 unsigned int const timeStep,
bool const lastTimeStep,
72 std::string output_directory)
77 vtkNew<vtkCPDataDescription> dataDescription;
78 dataDescription->AddInput(
"input");
79 dataDescription->SetTimeData(time, timeStep);
80 if (lastTimeStep ==
true)
84 dataDescription->ForceOutputOn();
86 if (
Processor->RequestDataDescription(dataDescription.GetPointer()) != 0)
88 INFO(
"Start InSitu process: timestep #{:d} (t={:g}, last={:d})",
89 timeStep, time, lastTimeStep);
90 vtkNew<MeshLib::VtkMappedMeshSource> vtkSource;
91 vtkSource->SetMesh(&mesh);
93 dataDescription->GetInputDescriptionByName(
"input")->SetGrid(
94 vtkSource->GetOutput());
95 auto const cwd = std::filesystem::current_path();
96 std::filesystem::current_path(std::move(output_directory));
97 Processor->CoProcess(dataDescription.GetPointer());
98 std::filesystem::current_path(cwd);
99 INFO(
"End InSitu process.");