24 std::string
const& path)
38 auto scriptPath = std::filesystem::path(
40 script_config.getConfigParameter<std::string>(
"name"));
41 if (scriptPath.is_relative())
43 scriptPath = std::filesystem::path(path) / scriptPath;
45 if (!std::filesystem::exists(scriptPath))
47 ERR(
"In-situ script {:s} does not exist!", scriptPath.string());
49 INFO(
"Initializing in-situ script: {:s}", scriptPath.string());
50 vtkNew<vtkCPPythonScriptPipeline> pipeline;
51 pipeline->Initialize(scriptPath.c_str());
52 Processor->AddPipeline(pipeline.GetPointer());
64 unsigned int const timeStep,
bool const lastTimeStep,
65 std::string output_directory)
70 vtkNew<vtkCPDataDescription> dataDescription;
71 dataDescription->AddInput(
"input");
72 dataDescription->SetTimeData(time, timeStep);
73 if (lastTimeStep ==
true)
77 dataDescription->ForceOutputOn();
79 if (
Processor->RequestDataDescription(dataDescription.GetPointer()) != 0)
81 INFO(
"Start InSitu process: timestep #{:d} (t={:g}, last={:d})",
82 timeStep, time, lastTimeStep);
83 vtkNew<MeshLib::VtkMappedMeshSource> vtkSource;
84 vtkSource->SetMesh(&mesh);
86 dataDescription->GetInputDescriptionByName(
"input")->SetGrid(
87 vtkSource->GetOutput());
88 auto const cwd = std::filesystem::current_path();
89 std::filesystem::current_path(std::move(output_directory));
90 Processor->CoProcess(dataDescription.GetPointer());
91 std::filesystem::current_path(cwd);
92 INFO(
"End InSitu process.");