Skip to content
Snippets Groups Projects
Verified Commit dcf34b01 authored by Lars Bilke's avatar Lars Bilke
Browse files

[insitu] Fix cwd in Adaptor.

parent e2fbc057
No related branches found
No related tags found
No related merge requests found
# .git # .git
Tests/Data Tests/Data
_out/images
...@@ -18,8 +18,7 @@ ...@@ -18,8 +18,7 @@
#include "MeshLib/Mesh.h" #include "MeshLib/Mesh.h"
#include "MeshLib/Vtk/VtkMappedMeshSource.h" #include "MeshLib/Vtk/VtkMappedMeshSource.h"
#include "filesystem.h"
#include <filesystem>
namespace InSituLib namespace InSituLib
{ {
...@@ -41,12 +40,19 @@ void Initialize(BaseLib::ConfigTree const& scripts_config, ...@@ -41,12 +40,19 @@ void Initialize(BaseLib::ConfigTree const& scripts_config,
for (auto script_config : scripts_config.getConfigSubtreeList("script")) for (auto script_config : scripts_config.getConfigSubtreeList("script"))
{ {
//! \ogs_file_param{prj__insitu__scripts__script__name} //! \ogs_file_param{prj__insitu__scripts__script__name}
auto scriptName = script_config.getConfigParameter<std::string>("name"); auto scriptPath =
INFO("Initializing in-situ script: {:s}", scriptName); fs::path(script_config.getConfigParameter<std::string>("name"));
std::stringstream ss; if (scriptPath.is_relative())
ss << path << scriptName; {
scriptPath = fs::path(path) / scriptPath;
}
if (!fs::exists(scriptPath))
{
ERR("In-situ script {:s} does not exist!", scriptPath.string());
}
INFO("Initializing in-situ script: {:s}", scriptPath.string());
vtkNew<vtkCPPythonScriptPipeline> pipeline; vtkNew<vtkCPPythonScriptPipeline> pipeline;
pipeline->Initialize(ss.str().c_str()); pipeline->Initialize(scriptPath.c_str());
Processor->AddPipeline(pipeline.GetPointer()); Processor->AddPipeline(pipeline.GetPointer());
} }
} }
...@@ -83,11 +89,11 @@ void CoProcess(MeshLib::Mesh const& mesh, double const time, ...@@ -83,11 +89,11 @@ void CoProcess(MeshLib::Mesh const& mesh, double const time,
vtkSource->Update(); vtkSource->Update();
dataDescription->GetInputDescriptionByName("input")->SetGrid( dataDescription->GetInputDescriptionByName("input")->SetGrid(
vtkSource->GetOutput()); vtkSource->GetOutput());
auto cwd = std::filesystem::current_path(); auto cwd = fs::current_path();
std::filesystem::current_path(output_directory); fs::current_path(output_directory);
Processor->CoProcess(dataDescription.GetPointer()); Processor->CoProcess(dataDescription.GetPointer());
std::filesystem::current_path(cwd); fs::current_path(cwd);
INFO("End InSitu process."); INFO("End InSitu process.");
} }
} }
} // namespace } // namespace InSituLib
...@@ -72,7 +72,7 @@ compiler: ...@@ -72,7 +72,7 @@ compiler:
libcxx: [libstdc++, libstdc++11, libc++, c++_shared, c++_static] libcxx: [libstdc++, libstdc++11, libc++, c++_shared, c++_static]
cppstd: [None, 98, gnu98, 11, gnu11, 14, gnu14, 17, gnu17, 20, gnu20] cppstd: [None, 98, gnu98, 11, gnu11, 14, gnu14, 17, gnu17, 20, gnu20]
apple-clang: apple-clang:
version: ["5.0", "5.1", "6.0", "6.1", "7.0", "7.3", "8.0", "8.1", "9.0", "9.1", "10.0", "11.0"] version: ["5.0", "5.1", "6.0", "6.1", "7.0", "7.3", "8.0", "8.1", "9.0", "9.1", "10.0", "11.0", "12.0"]
libcxx: [libstdc++, libc++] libcxx: [libstdc++, libc++]
cppstd: [None, 98, gnu98, 11, gnu11, 14, gnu14, 17, gnu17, 20, gnu20] cppstd: [None, 98, gnu98, 11, gnu11, 14, gnu14, 17, gnu17, 20, gnu20]
intel: intel:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment