Gitlab.kitware.com will be offline between 8am and midnight (EST/UTC-0500) on Saturday, December 15th.

Commit fc3ba8c8 authored by Andrew Bauer's avatar Andrew Bauer

Merge branch 'catalyst_python_pipeline_adaptor' into 'master'

Catalyst python pipeline adaptor

See merge request !37
parents e93947ba 6e56d34a
......@@ -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
......
......@@ -7,34 +7,34 @@ routines.
Repository Organization
----------------------
- CMake/
This contains CMake files e.g. mpi.cmake, FindADIOS.cmake, etc.
- sensei/
This contains the source code for the all files under the 'sensei' namespace
including the core components, DataAdaptor.[h,cxx], AnalysisAdaptor.[h,cxx],
as well as example analysis adaptor implementations such as Histogram.[h,cxx],
Autocorrelation.[h,cxx].
All classes within this directory are under the 'sensei' namespace and application
code can include these header using fully qualified paths e.g.
#include <sensei/DataAdaptor.h> // for sensei::DataAdaptor declaration.
#include <sensei/AnalysisAdaptor.h> // for sensei::AnalysisAdaptor declaration.
Adaptor implementations that depend on insitu frameworks are contained within
directories specific for that framework under this directory.
- sensei/adios/
Contains source code for all files under the 'sensei::adios' namespace.
This houses sensei::DataAdaptor and sensei::AnalysisAdaptor implementations that read and write
data using ADIOS APIs, namely, 'sensei::adios::DataAdaptor' and
'sensei::adios::AnalysisAdaptor'.
- sensei/catalyst/
Contains source code for all files under the 'sensei::catalyst' namespace.
This houses sensei::catalyst::AnalysisAdaptor which implements 'sensei::AnalysisAdaptor'
interface to use Catalyst for the analysis. Since in Catalyst, analysis is performed
......@@ -44,37 +44,37 @@ Repository Organization
Contains source code for all files under the 'sensei::libsim' namespace.
This houses the Libsim analysis adaptor for making slice images, etc.
- miniapps/
All miniapps generated for various bechmarks and testing is included in this directory.
Each miniapp includes both the expository implementation
independent of Sensei infrastructure as well as a version that uses Sensei.
- miniapps/parallel3d/
Code for miniapp from year I.
Code for miniapp from year I.
- miniapps/oscillators/
Core for miniapp from year II.
- endpoints/
Code for executables that act as analysis endpoints for frameworks like ADIOS (ADIOSAnalysisEndPoint.cxx)
and GLEAN. These executables (will) use the sensei::adios::DataAdaptor and sensei::glean::DataAdaptor
to ingest data from these frameworks back to Sensei for further analysis.
- utils/
- diy/
- grid/
- opts/
- pugixml/
Various utility code used by the various analysis implementations.
- configs/
Sample configuration XML files demonstrating how a configurable analysis pipeline
can be setup.
......@@ -142,7 +142,7 @@ Typical build usage:
cd build
ccmake .. # set cmake options as needed
make
All executables will be generated under `bin`.
Miniapps/Executables
......@@ -201,5 +201,3 @@ Details on each of the miniapps are as follows:
Usage (ENABLE_SENSEI=OFF):
<NOT AVAILABLE>
......@@ -47,7 +47,13 @@ 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 +63,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
......
......@@ -3,12 +3,17 @@
#include <sensei/DataAdaptor.h>
#include <timer/Timer.h>
#include <vtkCommunicator.h>
#include <vtkCPAdaptorAPI.h>
#include <vtkCPDataDescription.h>
#include <vtkCPInputDataDescription.h>
#include <vtkCPProcessor.h>
#include <vtkDataObject.h>
#include <vtkImageData.h>
#include <vtkMultiProcessController.h>
#include <vtkObjectFactory.h>
#include <vtkRectilinearGrid.h>
#include <vtkStructuredGrid.h>
namespace sensei
{
......@@ -90,7 +95,6 @@ bool AnalysisAdaptor::FillDataDescriptionWithMetaData(
desc->AddCellField(dA->GetArrayName(vtkDataObject::CELL, cc).c_str());
}
// XXX(todo): Add whole extent, if available.
return true;
}
......@@ -112,7 +116,37 @@ bool AnalysisAdaptor::FillDataDescriptionWithData(
}
}
}
desc->SetGrid(mesh);
if (mesh->IsA("vtkImageData") || mesh->IsA("vtkRectilinearGrid") ||
mesh->IsA("vtkStructuredGrid") )
{
int wholeExtent[6], localExtent[6];
if (vtkImageData* id = vtkImageData::SafeDownCast(mesh))
{
id->GetExtent(localExtent);
}
else if(vtkRectilinearGrid* rg = vtkRectilinearGrid::SafeDownCast(mesh))
{
rg->GetExtent(localExtent);
}
else if(vtkStructuredGrid* sg = vtkStructuredGrid::SafeDownCast(mesh))
{
sg->GetExtent(localExtent);
}
vtkMultiProcessController* c =
vtkMultiProcessController::GetGlobalController();
localExtent[0] = -localExtent[0];
localExtent[2] = -localExtent[2];
localExtent[4] = -localExtent[4];
c->AllReduce(localExtent, wholeExtent, 6, vtkCommunicator::MAX_OP);
wholeExtent[0] = -wholeExtent[0];
wholeExtent[2] = -wholeExtent[2];
wholeExtent[4] = -wholeExtent[4];
desc->SetWholeExtent(wholeExtent);
}
return true;
}
......
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