Commit 81eff7b9 authored by Andrew Bauer's avatar Andrew Bauer
Browse files

Adding Catalyst Python script option to XML input

parent 4e783533
......@@ -43,6 +43,9 @@ cmake_dependent_option(VTK_HAS_GENERIC_ARRAYS "VTK build has Generic arrays" OFF
# Enable Catalyst and analysis using Catalyst.
cmake_dependent_option(
ENABLE_CATALYST "Enable analysis methods that use Catalyst" OFF "ENABLE_SENSEI" OFF)
cmake_dependent_option(
ENABLE_CATALYST_PYTHON "Enable analysis methods that use Catalyst Python scripts"
OFF "ENABLE_CATALYST" OFF)
#------------------------------------------------------------------------------
# Enable ADIOS and analysis using Adios
......
......@@ -47,7 +47,12 @@ add_library(sensei STATIC ${sources})
target_compile_definitions(sensei INTERFACE ENABLE_SENSEI)
if(ENABLE_CATALYST)
find_package(ParaView QUIET COMPONENTS vtkPVCatalyst vtkCommonDataModel vtkPVServerManagerRendering)
set(CATALYST_PYTHON_MODULE)
if(ENABLE_CATALYST_PYTHON)
set(CATALYST_PYTHON_MODULE "vtkPVPythonCatalyst")
endif()
find_package(ParaView QUIET COMPONENTS vtkPVCatalyst vtkCommonDataModel vtkPVServerManagerRendering ${CATALYST_PYTHON_MODULE})
if(NOT ParaView_FOUND)
message(FATAL_ERROR "Catalyst analysis components require Catalyst build (or "
"install directory. Please set ParaView_DIR to point to "
......@@ -57,6 +62,9 @@ if(ENABLE_CATALYST)
target_compile_definitions(sensei PUBLIC ${VTK_DEFINITIONS})
target_link_libraries(sensei PUBLIC ${VTK_LIBRARIES})
target_compile_definitions(sensei PUBLIC ENABLE_CATALYST)
if(ENABLE_CATALYST_PYTHON)
target_compile_definitions(sensei PUBLIC ENABLE_CATALYST_PYTHON)
endif()
else()
set(SENSEI_VTK_DEPS vtkCommonDataModel)
if (ENABLE_VTK_XMLP)
......
......@@ -14,6 +14,9 @@
#ifdef ENABLE_CATALYST
# include "catalyst/AnalysisAdaptor.h"
# include "catalyst/Slice.h"
#ifdef ENABLE_CATALYST_PYTHON
# include <vtkCPPythonScriptPipeline.h>
#endif
#endif
#ifdef ENABLE_LIBSIM
# include "libsim/AnalysisAdaptor.h"
......@@ -213,6 +216,21 @@ public:
}
this->CatalystAnalysisAdaptor->AddPipeline(slice.GetPointer());
}
if (strcmp(node.attribute("pipeline").value(), "pythonscript") == 0)
{
#ifdef ENABLE_CATALYST_PYTHON
if (node.attribute("filename"))
{
vtkNew<vtkCPPythonScriptPipeline> pythonPipeline;
std::string fileName = node.attribute("filename").value();
pythonPipeline->Initialize(fileName.c_str());
this->CatalystAnalysisAdaptor->AddPipeline(pythonPipeline.GetPointer());
}
#else
ConfigurableAnalysisError(
<< "Must configure SENSEI with ENABLE_CATALYST_PYTHON enabled in order to use Catalyst Python scripts");
#endif
}
return 0;
}
#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