diff --git a/CMake/adios.cmake b/CMake/adios.cmake new file mode 100644 index 0000000000000000000000000000000000000000..f25d7703a6e2261e63adee46cc44b52f08daeac4 --- /dev/null +++ b/CMake/adios.cmake @@ -0,0 +1,7 @@ +find_package(ADIOS 1.9 REQUIRED) +add_library(adios INTERFACE) +target_link_libraries(adios INTERFACE ${ADIOS_LIBRARIES}) +target_include_directories(adios SYSTEM INTERFACE ${ADIOS_INCLUDE_DIRS}) +if(ADIOS_DEFINITIONS) + target_compile_definitions(adios INTERFACE ${ADIOS_DEFINITIONS}) +endif() diff --git a/CMakeLists.txt b/CMakeLists.txt index b0fb191b82e5cd298c0865147ed824503d7ed0e2..802f1c54d8f0009b2cf1659eb5e2036254c66f2c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -42,50 +42,19 @@ cmake_dependent_option( #------------------------------------------------------------------------------ include(mpi) +if(ENABLE_ADIOS) + include(adios) +endif() add_subdirectory(utils) -# Process subdirectories. +include_directories(${CMAKE_CURRENT_SOURCE_DIR}) if(ENABLE_SENSEI) message(STATUS "Enabled: Sensei infrastructure.") - add_subdirectory(core) + add_subdirectory(sensei) else() message(STATUS "Disabled: Sensei infrastructure.") endif() - -if(ENABLE_SENSEI) - if(VTK_HAS_GENERIC_ARRAYS) - add_subdirectory(analysis/histogram) - endif() - add_subdirectory(analysis/configurable) - add_subdirectory(analysis/autocorrelation) -endif() - -if(ENABLE_PARALLEL3D) - message(STATUS "Enabled: Parallel3D miniapp.") - add_subdirectory(miniapps/parallel3d) -else() - message(STATUS "Disabled: Parallel3D miniapp.") -endif() - -if(ENABLE_OSCILLATORS) - message(STATUS "Enabled: Oscillators miniapp.") - add_subdirectory(miniapps/oscillators) -else() - message(STATUS "Disabled: Histogram miniapp.") -endif() - -if(ENABLE_CATALYST) - message(STATUS "Enabled: Catalyst") - add_subdirectory(infrastructures/catalyst) -else() - message(STATUS "Disabled: Catalyst") -endif() - -if(ENABLE_ADIOS) - message(STATUS "Enabled: ADIOS") - add_subdirectory(infrastructures/adios) -else() - message(STATUS "Disabled: ADIOS") -endif() +add_subdirectory(miniapps) +add_subdirectory(endpoints) diff --git a/analysis/autocorrelation/CMakeLists.txt b/analysis/autocorrelation/CMakeLists.txt deleted file mode 100644 index 7daeffdea14eb9eca6c3fd78493f9bb1f9949815..0000000000000000000000000000000000000000 --- a/analysis/autocorrelation/CMakeLists.txt +++ /dev/null @@ -1,14 +0,0 @@ -#------------------------------------------------------------------------------ -if(ENABLE_SENSEI) - set(sources AutocorrelationAnalysisAdaptor.cxx) -else() - set(sources analysis.cpp) -endif() - -add_library(autocorrelation STATIC ${sources}) -target_compile_options(autocorrelation PRIVATE "-std=c++11") -target_include_directories(autocorrelation INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}) -target_link_libraries(autocorrelation PUBLIC mpi PRIVATE diy grid) -if (ENABLE_SENSEI) - target_link_libraries(autocorrelation PUBLIC core) -endif() diff --git a/analysis/configurable/CMakeLists.txt b/analysis/configurable/CMakeLists.txt deleted file mode 100644 index 86eafe9546fd63aed4d4dbfcda925c8553026232..0000000000000000000000000000000000000000 --- a/analysis/configurable/CMakeLists.txt +++ /dev/null @@ -1,16 +0,0 @@ -add_library(configurable STATIC vtkConfigurableAnalysisAdaptor.cxx) -target_link_libraries(configurable PUBLIC mpi core PRIVATE pugixml) -target_include_directories(configurable INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}) - -if(VTK_HAS_GENERIC_ARRAYS) - target_link_libraries(configurable PRIVATE histogram) - target_compile_options(configurable PRIVATE ENABLE_HISTOGRAM) -endif() -target_link_libraries(configurable PRIVATE autocorrelation) - -if(ENABLE_CATALYST) - target_link_libraries(configurable PRIVATE catalyst) -endif() -if(ENABLE_ADIOS) - target_link_libraries(configurable PRIVATE adios) -endif() diff --git a/analysis/configurable/vtkConfigurableAnalysisAdaptor.h b/analysis/configurable/vtkConfigurableAnalysisAdaptor.h deleted file mode 100644 index 1b16adfdab7c327bdf3f62daa0b5cefb4db4f677..0000000000000000000000000000000000000000 --- a/analysis/configurable/vtkConfigurableAnalysisAdaptor.h +++ /dev/null @@ -1,36 +0,0 @@ -#ifndef vtkConfigurableAnalysisAdaptor_h -#define vtkConfigurableAnalysisAdaptor_h - -#include - -#include -#include - -/// @brief vtkConfigurableAnalysisAdaptor is all-in-one analysis adaptor that -/// can execute all available analysis adaptors. -class vtkConfigurableAnalysisAdaptor : public vtkInsituAnalysisAdaptor -{ -public: - static vtkConfigurableAnalysisAdaptor* New(); - vtkTypeMacro(vtkConfigurableAnalysisAdaptor, vtkInsituAnalysisAdaptor); - void PrintSelf(ostream& os, vtkIndent indent); - - /// @brief Initialize the adaptor using the configuration specified. - bool Initialize(MPI_Comm world, const std::string& filename); - - virtual bool Execute(vtkInsituDataAdaptor* data); -//BTX -protected: - vtkConfigurableAnalysisAdaptor(); - ~vtkConfigurableAnalysisAdaptor(); - -private: - vtkConfigurableAnalysisAdaptor(const vtkConfigurableAnalysisAdaptor&); // Not implemented. - void operator=(const vtkConfigurableAnalysisAdaptor&); // Not implemented. - - class vtkInternals; - vtkInternals* Internals; -//ETX -}; - -#endif diff --git a/analysis/histogram/CMakeLists.txt b/analysis/histogram/CMakeLists.txt deleted file mode 100644 index 55261f105c6ed04fe2dcf6426a27a4dbee3d480e..0000000000000000000000000000000000000000 --- a/analysis/histogram/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -#----------------------------------------------------------------------- -set(sources - HistogramAnalysisAdaptor.cxx - HistogramAnalysisAdaptor.h) - -#----------------------------------------------------------------------- -add_library(histogram STATIC ${sources}) -target_include_directories(histogram INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}) -target_link_libraries(histogram PUBLIC mpi core) diff --git a/analysis/histogram/HistogramAnalysisAdaptor.h b/analysis/histogram/HistogramAnalysisAdaptor.h deleted file mode 100644 index 8c63fa04399d7753b9281ef9fe5a484ea8ac2b2a..0000000000000000000000000000000000000000 --- a/analysis/histogram/HistogramAnalysisAdaptor.h +++ /dev/null @@ -1,39 +0,0 @@ -#ifndef HISTOGRAMANALYSISADAPTOR_H -#define HISTOGRAMANALYSISADAPTOR_H - - -#include "vtkInsituAnalysisAdaptor.h" -#include - -class vtkDataObject; -class vtkDataArray; -/// HistogramAnalysisAdaptor is a vtkInsituAnalysisAdaptor specialization for -/// histogram analysis. -class HistogramAnalysisAdaptor : public vtkInsituAnalysisAdaptor -{ -public: - static HistogramAnalysisAdaptor* New(); - vtkTypeMacro(HistogramAnalysisAdaptor, vtkInsituAnalysisAdaptor); - - void Initialize(MPI_Comm comm, int bins, - int association, const std::string& arrayname); - - virtual bool Execute(vtkInsituDataAdaptor* data); - -protected: - HistogramAnalysisAdaptor(); - virtual ~HistogramAnalysisAdaptor(); - - vtkDataArray* GetArray(vtkDataObject* dobj); - - - MPI_Comm Communicator; - int Bins; - std::string ArrayName; - int Association; -private: - HistogramAnalysisAdaptor(const HistogramAnalysisAdaptor&); - void operator=(const HistogramAnalysisAdaptor&); -}; - -#endif diff --git a/analysis/histogram/vtk_histogram.cxx b/analysis/histogram/vtk_histogram.cxx deleted file mode 100644 index 87b1ead1011d5938f5c2f6eeb050727a8fa63f16..0000000000000000000000000000000000000000 --- a/analysis/histogram/vtk_histogram.cxx +++ /dev/null @@ -1,94 +0,0 @@ -#include "vtk_histogram.h" - -#include -#include -#include - -namespace { -// Private worker for histogram method. Computes the local histogram on -// array (passed to operator()). To be used with vtkArrayDispatch. -// -// Inputs: -// range: Global range of data -// bins: Number of histogram bins -// array: Local data. -// -// Outputs: -// Histogram: The histogram of the local data. -struct HistogramWorker -{ - const double *Range; - int Bins; - std::vector Histogram; - HistogramWorker(const double *range, int bins) : Range(range), Bins(bins) {} - - template - void operator()(ArrayT *array) - { - assert(array); - assert(array->GetNumberOfComponents() == 1); - - typedef typename ArrayT::ValueType ValueType; - ValueType width = static_cast((this->Range[1] - this->Range[0]) / this->Bins); - ValueType min = static_cast(this->Range[0]); - vtkIdType numTuples = array->GetNumberOfTuples(); - - this->Histogram.clear(); - // + 1 to store val == max. These will be moved to this last bin before - // returning (Avoids having to branch in the loop below); - this->Histogram.resize(this->Bins + 1, 0); - for (vtkIdType tIdx = 0; tIdx < numTuples; ++tIdx) - { - int bin = static_cast((array->GetComponent(tIdx, 0) - min) / width); - ++this->Histogram[bin]; - } - - // Merge the last two bins (the last is only when val == max) - this->Histogram[this->Bins-1] += this->Histogram[this->Bins]; - this->Histogram.resize(this->Bins); - } -}; - -} // end anon namespace - -void vtk_histogram(MPI_Comm comm, vtkDataArray* array, int bins) -{ - int rank; - MPI_Comm_rank(comm, &rank); - - // find max and min. - double range[2]; - array->GetRange(range); - - double g_range[2]; - // Find the global max/min - MPI_Allreduce(&range[0], &g_range[0], 1, MPI_DOUBLE, MPI_MIN, comm); - MPI_Allreduce(&range[1], &g_range[1], 1, MPI_DOUBLE, MPI_MAX, comm); - - // Compute local histogram - HistogramWorker worker(g_range, bins); - // vtkArrayDispatch downcasts the array to a concrete typed implementation - // that provides faster access methods. - if (!vtkArrayDispatch::Dispatch::Execute(array, worker)) - { - // This happens if vtkArrayDispatch doesn't know about the array subclass - // in use. - std::cerr << "HistogramWorker dispatch failed on rank " << rank << "!\n"; - worker.Histogram.resize(bins, 0); - } - - // Global histogram: - std::vector gHist(bins, 0); - MPI_Reduce(&worker.Histogram[0], &gHist[0], bins, MPI_UNSIGNED, MPI_SUM, 0, comm); - if (rank == 0) - { - std::cout << "Histogram '" << array->GetName() << "' (VTK):\n"; - double width = (g_range[1] - g_range[0]) / bins; - for (int i = 0; i < bins; ++i) - { - printf(" %f-%f: %d\n", g_range[0] + i*width, g_range[0] + (i+1)*width, gHist[i]); - } - } -} - - diff --git a/analysis/histogram/vtk_histogram.h b/analysis/histogram/vtk_histogram.h deleted file mode 100644 index d12e3279f7af4b88125c02d760dc62d1a2a87796..0000000000000000000000000000000000000000 --- a/analysis/histogram/vtk_histogram.h +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef VTK_HISTOGRAM_H -#define VTK_HISTOGRAM_H - -#include - -class vtkDataArray; - -/// Parallel histogram implementation using array-layout independent -/// VTK's Generic Array infrastructure. -void vtk_histogram(MPI_Comm comm, vtkDataArray* array, int bins); - -#endif diff --git a/core/CMakeLists.txt b/core/CMakeLists.txt deleted file mode 100644 index 2119c546c1a8c5bb12cddcdc50b07ec81ffabd21..0000000000000000000000000000000000000000 --- a/core/CMakeLists.txt +++ /dev/null @@ -1,22 +0,0 @@ -#----------------------------------------------------------------------- -set (sources - vtkInsituAnalysisAdaptor.cxx - vtkInsituAnalysisAdaptor.h - vtkInsituDataAdaptor.cxx - vtkInsituDataAdaptor.h - ) - -#----------------------------------------------------------------------- -find_package(VTK QUIET COMPONENTS vtkCommonDataModel) -if(NOT VTK_FOUND) - message(FATAL_ERROR "VTK (vtkCommonDataModel) is required for Sensei core " - "even when not using any infrastructures. Please set VTK_DIR to point to a " - "directory containing `VTKConfig.cmake`.") -endif() - -add_library(core STATIC ${sources}) -target_include_directories(core SYSTEM PUBLIC ${VTK_INCLUDE_DIRS} - INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}) -target_compile_definitions(core PUBLIC ${VTK_DEFINITIONS} - INTERFACE ENABLE_SENSEI) -target_link_libraries(core PUBLIC ${VTK_LIBRARIES}) diff --git a/core/vtkInsituAnalysisAdaptor.cxx b/core/vtkInsituAnalysisAdaptor.cxx deleted file mode 100644 index 3a6827a6cbb2e4450d0dfff1e6c9885f6f80682d..0000000000000000000000000000000000000000 --- a/core/vtkInsituAnalysisAdaptor.cxx +++ /dev/null @@ -1,33 +0,0 @@ -/*========================================================================= - - Program: Visualization Toolkit - Module: vtkInsituAnalysisAdaptor.cxx - - Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen - All rights reserved. - See Copyright.txt or http://www.kitware.com/Copyright.htm for details. - - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notice for more information. - -=========================================================================*/ -#include "vtkInsituAnalysisAdaptor.h" - -#include "vtkObjectFactory.h" - -//---------------------------------------------------------------------------- -vtkInsituAnalysisAdaptor::vtkInsituAnalysisAdaptor() -{ -} - -//---------------------------------------------------------------------------- -vtkInsituAnalysisAdaptor::~vtkInsituAnalysisAdaptor() -{ -} - -//---------------------------------------------------------------------------- -void vtkInsituAnalysisAdaptor::PrintSelf(ostream& os, vtkIndent indent) -{ - this->Superclass::PrintSelf(os, indent); -} diff --git a/core/vtkInsituAnalysisAdaptor.h b/core/vtkInsituAnalysisAdaptor.h deleted file mode 100644 index 670f10b76474b5a03df7c2193ffd6f78da608158..0000000000000000000000000000000000000000 --- a/core/vtkInsituAnalysisAdaptor.h +++ /dev/null @@ -1,44 +0,0 @@ -/*========================================================================= - - Program: Visualization Toolkit - Module: vtkInsituAnalysisAdaptor.h - - Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen - All rights reserved. - See Copyright.txt or http://www.kitware.com/Copyright.htm for details. - - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notice for more information. - -=========================================================================*/ -// .NAME vtkInsituAnalysisAdaptor -// .SECTION Description -// vtkInsituAnalysisAdaptor is an adaptor for any insitu analysis framework or -// algorithm. Concrete subclasses use vtkInsituDataAdaptor instance passed to -// the Execute() method to access simulation data for further processing. -#ifndef vtkInsituAnalysisAdaptor_h -#define vtkInsituAnalysisAdaptor_h - -#include "vtkObjectBase.h" -#include "vtkSetGet.h" - -class vtkInsituDataAdaptor; -class vtkInsituAnalysisAdaptor : public vtkObjectBase -{ -public: - vtkTypeMacro(vtkInsituAnalysisAdaptor, vtkObjectBase); - void PrintSelf(ostream& os, vtkIndent indent); - - virtual bool Execute(vtkInsituDataAdaptor* data) = 0; - -protected: - vtkInsituAnalysisAdaptor(); - ~vtkInsituAnalysisAdaptor(); - -private: - vtkInsituAnalysisAdaptor(const vtkInsituAnalysisAdaptor&); // Not implemented. - void operator=(const vtkInsituAnalysisAdaptor&); // Not implemented. -}; - -#endif diff --git a/infrastructures/adios/ADIOSAnalysisEndPoint.cxx b/endpoints/ADIOSAnalysisEndPoint.cxx similarity index 89% rename from infrastructures/adios/ADIOSAnalysisEndPoint.cxx rename to endpoints/ADIOSAnalysisEndPoint.cxx index 50c97dfdf3bd0158e18e789cb4a291311bd98d39..65221c87efe2eb38a9d10d834fe169d8b03e19c5 100644 --- a/infrastructures/adios/ADIOSAnalysisEndPoint.cxx +++ b/endpoints/ADIOSAnalysisEndPoint.cxx @@ -9,10 +9,8 @@ #include #include #include -#include -#include -#include -#include +#include +#include #include #include @@ -55,10 +53,10 @@ int main(int argc, char** argv) readmethods["dimes"] = ADIOS_READ_METHOD_DIMES; readmethods["flexpath"] = ADIOS_READ_METHOD_FLEXPATH; - vtkNew analysis; + vtkNew analysis; analysis->Initialize(comm, config_file); - vtkNew dataAdaptor; + vtkNew dataAdaptor; dataAdaptor->Open(comm, readmethods[readmethod], input); do { diff --git a/endpoints/CMakeLists.txt b/endpoints/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..d0eace86f521a782830a6ac1c145b67b41c879df --- /dev/null +++ b/endpoints/CMakeLists.txt @@ -0,0 +1,5 @@ +if (ENABLE_ADIOS) + #------------------------------------------------------------------------------ + add_executable(ADIOSAnalysisEndPoint ADIOSAnalysisEndPoint.cxx) + target_link_libraries(ADIOSAnalysisEndPoint PRIVATE opts mpi adios sensei) +endif() diff --git a/infrastructures/catalyst/CMakeLists.txt b/infrastructures/catalyst/CMakeLists.txt deleted file mode 100644 index 33fde350143024793c267d809d8fa0416149a78c..0000000000000000000000000000000000000000 --- a/infrastructures/catalyst/CMakeLists.txt +++ /dev/null @@ -1,21 +0,0 @@ -set(sources - vtkCatalystAnalysisAdaptor.cxx - vtkCatalystSlicePipeline.cxx) - -#------------------------------------------------------------------------------ -find_package(ParaView QUIET COMPONENTS vtkPVCatalyst) -if(NOT ParaView_FOUND) - message(FATAL_ERROR "Catalyst analysis components require Catalyst build (or " - "install directory. Please set ParaView_DIR to point to " - "directory containing `ParaViewConfig.cmake`.") -endif() -add_library(catalyst STATIC ${sources}) -target_include_directories(catalyst - SYSTEM PUBLIC ${PARAVIEW_INCLUDE_DIRS} - INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}) -target_compile_definitions(catalyst - PUBLIC ${VTK_DEFINITIONS} - INTERFACE ENABLE_CATALYST) -target_link_libraries(catalyst - PUBLIC ${VTK_LIBRARIES} - PUBLIC core) diff --git a/miniapps/CMakeLists.txt b/miniapps/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..c0f644e13dc8c542d56385b222fa8684a4a332a3 --- /dev/null +++ b/miniapps/CMakeLists.txt @@ -0,0 +1,14 @@ +if(ENABLE_PARALLEL3D) + message(STATUS "Enabled: Parallel3D miniapp.") + add_subdirectory(parallel3d) +else() + message(STATUS "Disabled: Parallel3D miniapp.") +endif() + +if(ENABLE_OSCILLATORS) + message(STATUS "Enabled: Oscillators miniapp.") + add_subdirectory(oscillators) +else() + message(STATUS "Disabled: Oscillators miniapp.") +endif() + diff --git a/miniapps/oscillators/CMakeLists.txt b/miniapps/oscillators/CMakeLists.txt index 84387ad5fb64549ad098b48bdf9a6d7fb5f27957..294717996911c3fe0fb527082bd76d770523018a 100644 --- a/miniapps/oscillators/CMakeLists.txt +++ b/miniapps/oscillators/CMakeLists.txt @@ -26,5 +26,5 @@ find_package(Threads) target_link_libraries(oscillator PRIVATE util ${CMAKE_THREAD_LIBS_INIT}) if(ENABLE_SENSEI) - target_link_libraries(oscillator PRIVATE core configurable) + target_link_libraries(oscillator PRIVATE sensei) endif() diff --git a/miniapps/oscillators/bridge.cpp b/miniapps/oscillators/bridge.cpp index 2b92b7067e637e3eea25fee64df18bd7fbd997ab..04acf7af1fab0e56e24aefa555f4906bf7348299 100644 --- a/miniapps/oscillators/bridge.cpp +++ b/miniapps/oscillators/bridge.cpp @@ -3,16 +3,15 @@ #include "dataadaptor.h" #include -#include +#include #include -#include #include #include namespace bridge { static vtkSmartPointer GlobalDataAdaptor; -static vtkSmartPointer GlobalAnalysisAdaptor; +static vtkSmartPointer GlobalAnalysisAdaptor; //----------------------------------------------------------------------------- void initialize(MPI_Comm world, @@ -36,7 +35,7 @@ void initialize(MPI_Comm world, from_z[cc], to_z[cc]); } - GlobalAnalysisAdaptor = vtkSmartPointer::New(); + GlobalAnalysisAdaptor = vtkSmartPointer::New(); GlobalAnalysisAdaptor->Initialize(world, config_file); } diff --git a/miniapps/oscillators/dataadaptor.h b/miniapps/oscillators/dataadaptor.h index 6870e72837d73ba9465648cc3705219c5fc50b6a..0a624e514dcaa27ff6282c321909b42c03890210 100644 --- a/miniapps/oscillators/dataadaptor.h +++ b/miniapps/oscillators/dataadaptor.h @@ -1,15 +1,15 @@ #ifndef OSCILLATORS_DATAADAPTOR_H #define OSCILLATORS_DATAADAPTOR_H -#include +#include namespace oscillators { -class DataAdaptor : public vtkInsituDataAdaptor +class DataAdaptor : public sensei::DataAdaptor { public: static DataAdaptor* New(); - vtkTypeMacro(DataAdaptor, vtkInsituDataAdaptor); + vtkTypeMacro(DataAdaptor, sensei::DataAdaptor); /// @brief Initialize the data adaptor. /// diff --git a/miniapps/parallel3d/Bridge.cxx b/miniapps/parallel3d/Bridge.cxx index 6d126edf2271178f0dcb8b1c30de791f703be4e2..aeb318865a08b675973e343e56a346589a49d61b 100644 --- a/miniapps/parallel3d/Bridge.cxx +++ b/miniapps/parallel3d/Bridge.cxx @@ -1,16 +1,15 @@ #include "Bridge.h" - #include "DataAdaptor.h" -#include "vtkInsituAnalysisAdaptor.h" -#include "vtkNew.h" -#include "vtkDataObject.h" -#include "vtkConfigurableAnalysisAdaptor.h" +#include +#include +#include #include + namespace BridgeInternals { static vtkSmartPointer GlobalDataAdaptor; - static vtkSmartPointer GlobalAnalysisAdaptor; + static vtkSmartPointer GlobalAnalysisAdaptor; } //----------------------------------------------------------------------------- @@ -33,7 +32,7 @@ void bridge_initialize(MPI_Comm comm, tot_blocks_x, tot_blocks_y, tot_blocks_z, block_id_x, block_id_y, block_id_z); - BridgeInternals::GlobalAnalysisAdaptor = vtkSmartPointer::New(); + BridgeInternals::GlobalAnalysisAdaptor = vtkSmartPointer::New(); BridgeInternals::GlobalAnalysisAdaptor->Initialize(comm, config_file); } diff --git a/miniapps/parallel3d/CMakeLists.txt b/miniapps/parallel3d/CMakeLists.txt index b8ecb861812bb7e505dc458c540d0a42fe07d647..2851f833911486b547896d656d12eed4f21080b2 100644 --- a/miniapps/parallel3d/CMakeLists.txt +++ b/miniapps/parallel3d/CMakeLists.txt @@ -17,5 +17,5 @@ target_compile_definitions(3D_Grid PRIVATE _FILE_OFFSET_BITS=64 _LARGEFILE64_SOU target_link_libraries(3D_Grid PRIVATE m mpi) if(ENABLE_SENSEI) - target_link_libraries(3D_Grid PRIVATE core configurable) + target_link_libraries(3D_Grid PRIVATE sensei) endif() diff --git a/miniapps/parallel3d/DataAdaptor.h b/miniapps/parallel3d/DataAdaptor.h index 3672c89fa8f73b5c41afac9bb93b55daaff909fe..b4bd07220cb4b0a4bec431b4c4992183442c7958 100644 --- a/miniapps/parallel3d/DataAdaptor.h +++ b/miniapps/parallel3d/DataAdaptor.h @@ -1,7 +1,7 @@ #ifndef PARALLEL3D_DATAADAPTOR_H #define PARALLEL3D_DATAADAPTOR_H -#include "vtkInsituDataAdaptor.h" +#include #include "vtkSmartPointer.h" #include #include @@ -14,11 +14,11 @@ namespace parallel3d /// DataAdaptor is an adaptor for the parallel_3d simulation (miniapp). /// Its purpose is to map the simulation datastructures to VTK /// data model. -class DataAdaptor : public vtkInsituDataAdaptor +class DataAdaptor : public sensei::DataAdaptor { public: static DataAdaptor* New(); - vtkTypeMacro(DataAdaptor, vtkInsituDataAdaptor); + vtkTypeMacro(DataAdaptor, sensei::DataAdaptor); /// Initialize the data adaptor. void Initialize( diff --git a/sensei/AnalysisAdaptor.cxx b/sensei/AnalysisAdaptor.cxx new file mode 100644 index 0000000000000000000000000000000000000000..a2a61a586f1409759227327258b586b6424ac821 --- /dev/null +++ b/sensei/AnalysisAdaptor.cxx @@ -0,0 +1,24 @@ +#include "AnalysisAdaptor.h" + +#include "vtkObjectFactory.h" + +namespace sensei +{ + +//---------------------------------------------------------------------------- +AnalysisAdaptor::AnalysisAdaptor() +{ +} + +//---------------------------------------------------------------------------- +AnalysisAdaptor::~AnalysisAdaptor() +{ +} + +//---------------------------------------------------------------------------- +void AnalysisAdaptor::PrintSelf(ostream& os, vtkIndent indent) +{ + this->Superclass::PrintSelf(os, indent); +} + +} // end of namespace sensei diff --git a/sensei/AnalysisAdaptor.h b/sensei/AnalysisAdaptor.h new file mode 100644 index 0000000000000000000000000000000000000000..72e15c7d4de505a17ab85f78265d4ec025297240 --- /dev/null +++ b/sensei/AnalysisAdaptor.h @@ -0,0 +1,39 @@ +#ifndef sensei_AnalysisAdaptor_h +#define sensei_AnalysisAdaptor_h + +#include "vtkObjectBase.h" +#include "vtkSetGet.h" + +namespace sensei +{ +class DataAdaptor; + +/// @class AnalysisAdaptor +/// @brief AnalysisAdaptor is an abstract base class that defines the analysis interface. +/// +/// AnalysisAdaptor is an adaptor for any insitu analysis framework or +/// algorithm. Concrete subclasses use DataAdaptor instance passed to +/// the Execute() method to access simulation data for further processing. +class AnalysisAdaptor : public vtkObjectBase +{ +public: + vtkTypeMacro(AnalysisAdaptor, vtkObjectBase); + void PrintSelf(ostream& os, vtkIndent indent); + + /// @brief Execute the analysis routine. + /// + /// This method is called to execute the analysis routine per simulation + /// iteration. + virtual bool Execute(DataAdaptor* data) = 0; + +protected: + AnalysisAdaptor(); + ~AnalysisAdaptor(); + +private: + AnalysisAdaptor(const AnalysisAdaptor&); // Not implemented. + void operator=(const AnalysisAdaptor&); // Not implemented. +}; + +} +#endif diff --git a/analysis/autocorrelation/AutocorrelationAnalysisAdaptor.cxx b/sensei/Autocorrelation.cxx similarity index 87% rename from analysis/autocorrelation/AutocorrelationAnalysisAdaptor.cxx rename to sensei/Autocorrelation.cxx index d89b9e99d7092e2bf3f65393e1908332f58c2eeb..1bc21c366097d71d267f35121265557aaa4c8f7f 100644 --- a/analysis/autocorrelation/AutocorrelationAnalysisAdaptor.cxx +++ b/sensei/Autocorrelation.cxx @@ -1,10 +1,12 @@ -#include "AutocorrelationAnalysisAdaptor.h" +#include "Autocorrelation.h" +#include "DataAdaptor.h" + +// VTK includes #include #include #include #include -#include #include #include #include @@ -20,6 +22,7 @@ #include #include + // http://stackoverflow.com/a/12580468 template std::unique_ptr make_unique( Args&& ...args ) @@ -37,14 +40,17 @@ namespace diy { namespace mpi { namespace detail { template struct mpi_op< add_vectors > { static MPI_Op get() { return MPI_SUM; } }; } } } +namespace sensei +{ + using GridRef = grid::GridRef; using Vertex = GridRef::Vertex; using Vertex4D = Vertex::UPoint; -struct Autocorrelation +struct AutocorrelationImpl { using Grid = grid::Grid; - Autocorrelation(size_t window_, int gid_, Vertex from_, Vertex to_): + AutocorrelationImpl(size_t window_, int gid_, Vertex from_, Vertex to_): window(window_), gid(gid_), from(from_), to(to_), @@ -54,8 +60,8 @@ struct Autocorrelation corr(shape.lift(3, window)) {} - static void* create() { return new Autocorrelation; } - static void destroy(void* b) { delete static_cast(b); } + static void* create() { return new AutocorrelationImpl; } + static void destroy(void* b) { delete static_cast(b); } void process(float* data) { GridRef g(data, shape); @@ -94,11 +100,11 @@ struct Autocorrelation size_t count = 0; private: - Autocorrelation() {} // here just for create; to let Master manage the blocks (+ if we choose to add OOC later) + AutocorrelationImpl() {} // here just for create; to let Master manage the blocks (+ if we choose to add OOC later) }; //----------------------------------------------------------------------------- -class AutocorrelationAnalysisAdaptor::AInternals +class Autocorrelation::AInternals { public: std::unique_ptr Master; @@ -133,7 +139,7 @@ public: Vertex from { ext[0], ext[2], ext[4] }; Vertex to { ext[1], ext[3], ext[5] }; int bid = this->Master->communicator().rank(); - Autocorrelation* b = new Autocorrelation(this->Window, bid, from, to); + AutocorrelationImpl* b = new AutocorrelationImpl(this->Window, bid, from, to); this->Master->add(bid, b, new diy::Link); this->NumberOfBlocks = this->Master->communicator().size(); } @@ -158,7 +164,7 @@ public: Vertex from { ext[0], ext[2], ext[4] }; Vertex to { ext[1], ext[3], ext[5] }; - Autocorrelation* b = new Autocorrelation(this->Window, bid, from, to); + AutocorrelationImpl* b = new AutocorrelationImpl(this->Window, bid, from, to); this->Master->add(bid, b, new diy::Link); } } @@ -168,29 +174,29 @@ public: } }; -vtkStandardNewMacro(AutocorrelationAnalysisAdaptor); +vtkStandardNewMacro(Autocorrelation); //----------------------------------------------------------------------------- -AutocorrelationAnalysisAdaptor::AutocorrelationAnalysisAdaptor() - : Internals(new AutocorrelationAnalysisAdaptor::AInternals()) +Autocorrelation::Autocorrelation() + : Internals(new Autocorrelation::AInternals()) { } //----------------------------------------------------------------------------- -AutocorrelationAnalysisAdaptor::~AutocorrelationAnalysisAdaptor() +Autocorrelation::~Autocorrelation() { this->PrintResults(this->Internals->KMax); delete this->Internals; } //----------------------------------------------------------------------------- -void AutocorrelationAnalysisAdaptor::Initialize(MPI_Comm world, +void Autocorrelation::Initialize(MPI_Comm world, size_t window, int association, const char* arrayname, size_t kmax) { AInternals& internals = (*this->Internals); internals.Master = make_unique(world, -1, -1, - &Autocorrelation::create, - &Autocorrelation::destroy); + &AutocorrelationImpl::create, + &AutocorrelationImpl::destroy); internals.Association = association; internals.ArrayName = arrayname; internals.Window = window; @@ -198,7 +204,7 @@ void AutocorrelationAnalysisAdaptor::Initialize(MPI_Comm world, } //----------------------------------------------------------------------------- -bool AutocorrelationAnalysisAdaptor::Execute(vtkInsituDataAdaptor* data) +bool Autocorrelation::Execute(DataAdaptor* data) { AInternals& internals = (*this->Internals); const int association = internals.Association; @@ -225,7 +231,7 @@ bool AutocorrelationAnalysisAdaptor::Execute(vtkInsituDataAdaptor* data) if (vtkDataSet* dataObj = vtkDataSet::SafeDownCast(iter->GetCurrentDataObject())) { int lid = internals.Master->lid(static_cast(bid)); - Autocorrelation* corr = internals.Master->block(lid); + AutocorrelationImpl* corr = internals.Master->block(lid); vtkFloatArray* fa = vtkFloatArray::SafeDownCast( dataObj->GetAttributesAsFieldData(association)->GetArray(arrayname)); if (fa) @@ -244,7 +250,7 @@ bool AutocorrelationAnalysisAdaptor::Execute(vtkInsituDataAdaptor* data) { int bid = internals.Master->communicator().rank(); int lid = internals.Master->lid(static_cast(bid)); - Autocorrelation* corr = internals.Master->block(lid); + AutocorrelationImpl* corr = internals.Master->block(lid); vtkFloatArray* fa = vtkFloatArray::SafeDownCast( ds->GetAttributesAsFieldData(association)->GetArray(arrayname)); if (fa) @@ -261,13 +267,13 @@ bool AutocorrelationAnalysisAdaptor::Execute(vtkInsituDataAdaptor* data) } //----------------------------------------------------------------------------- -void AutocorrelationAnalysisAdaptor::PrintResults(size_t k_max) +void Autocorrelation::PrintResults(size_t k_max) { AInternals& internals = (*this->Internals); size_t nblocks = internals.NumberOfBlocks; // add up the autocorrellations - internals.Master->foreach([](Autocorrelation* b, const diy::Master::ProxyWithLink& cp, void*) + internals.Master->foreach([](AutocorrelationImpl* b, const diy::Master::ProxyWithLink& cp, void*) { std::vector sums(b->window, 0); grid::for_each(b->corr.shape(), [&](const Vertex4D& v) @@ -289,8 +295,8 @@ void AutocorrelationAnalysisAdaptor::PrintResults(size_t k_max) std::cout << std::endl; } - internals.Master->foreach( - [](Autocorrelation* b, const diy::Master::ProxyWithLink& cp, void*) + internals.Master->foreach( + [](AutocorrelationImpl* b, const diy::Master::ProxyWithLink& cp, void*) { cp.collectives()->clear(); }); @@ -301,7 +307,7 @@ void AutocorrelationAnalysisAdaptor::PrintResults(size_t k_max) diy::reduce(*internals.Master, assigner, partners, [k_max](void* b_, const diy::ReduceProxy& rp, const diy::RegularMergePartners& partners) { - Autocorrelation* b = static_cast(b_); + AutocorrelationImpl* b = static_cast(b_); unsigned round = rp.round(); // current round number using MaxHeapVector = std::vector>>; @@ -365,3 +371,5 @@ void AutocorrelationAnalysisAdaptor::PrintResults(size_t k_max) } }); } + +} diff --git a/analysis/autocorrelation/AutocorrelationAnalysisAdaptor.h b/sensei/Autocorrelation.h similarity index 54% rename from analysis/autocorrelation/AutocorrelationAnalysisAdaptor.h rename to sensei/Autocorrelation.h index 710a264236966c4ce9c9b1db717a6d36b75e5653..1e4c09909e8a22f158e4c1a9fc3f7b70a7877190 100644 --- a/analysis/autocorrelation/AutocorrelationAnalysisAdaptor.h +++ b/sensei/Autocorrelation.h @@ -1,18 +1,21 @@ -#ifndef AUTOCORRELATIONANALYSISADAPTOR_H -#define AUTOCORRELATIONANALYSISADAPTOR_H +#ifndef sensei_Autocorrelation_h +#define sensei_Autocorrelation_h -#include "vtkInsituAnalysisAdaptor.h" +#include "AnalysisAdaptor.h" #include -/// @brief vtkInsituAnalysisAdaptor subclass for autocorrelation. +namespace sensei +{ +/// @class autocorrelation::AnalysisAdaptor +/// @brief AnalysisAdaptor subclass for autocorrelation. /// -/// AutocorrelationAnalysisAdaptor is an analysis adaptor that performs +/// Autocorrelation is an analysis adaptor that performs /// autocorrelation on the dataset. -class AutocorrelationAnalysisAdaptor : public vtkInsituAnalysisAdaptor +class Autocorrelation : public AnalysisAdaptor { public: - static AutocorrelationAnalysisAdaptor* New(); - vtkTypeMacro(AutocorrelationAnalysisAdaptor, vtkInsituAnalysisAdaptor); + static Autocorrelation* New(); + vtkTypeMacro(Autocorrelation, AnalysisAdaptor); /// @brief Initialize the adaptor. /// @@ -29,17 +32,19 @@ public: void Initialize(MPI_Comm world, size_t window, int association, const char* arrayname, size_t k_max); - virtual bool Execute(vtkInsituDataAdaptor* data); + virtual bool Execute(DataAdaptor* data); protected: - AutocorrelationAnalysisAdaptor(); - ~AutocorrelationAnalysisAdaptor(); + Autocorrelation(); + ~Autocorrelation(); void PrintResults(size_t k_max); private: - AutocorrelationAnalysisAdaptor(const AutocorrelationAnalysisAdaptor&); // not implemented. - void operator=(const AutocorrelationAnalysisAdaptor&); + Autocorrelation(const Autocorrelation&); // not implemented. + void operator=(const Autocorrelation&); class AInternals; AInternals* Internals; }; + +} #endif diff --git a/sensei/CMakeLists.txt b/sensei/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..217db535c4e799245e6f2888e12ea7b7c663f430 --- /dev/null +++ b/sensei/CMakeLists.txt @@ -0,0 +1,77 @@ +#----------------------------------------------------------------------- +set (sources + AnalysisAdaptor.cxx + AnalysisAdaptor.h + Autocorrelation.cxx + Autocorrelation.h + ConfigurableAnalysis.cxx + ConfigurableAnalysis.h + DataAdaptor.cxx + DataAdaptor.h +) + +if(VTK_HAS_GENERIC_ARRAYS) + list(APPEND sources + Histogram.cxx + Histogram.h) +endif() + +if(ENABLE_CATALYST) + list(APPEND sources + catalyst/AnalysisAdaptor.cxx + catalyst/AnalysisAdaptor.h + catalyst/Slice.cxx + catalyst/Slice.h) +endif() +if(ENABLE_ADIOS) + list(APPEND sources + adios/AnalysisAdaptor.cxx + adios/AnalysisAdaptor.h + adios/DataAdaptor.cxx + adios/DataAdaptor.h) +endif() + +#----------------------------------------------------------------------- +add_library(sensei STATIC ${sources}) +target_compile_definitions(sensei INTERFACE ENABLE_SENSEI) + +if(ENABLE_CATALYST) + find_package(ParaView QUIET COMPONENTS vtkPVCatalyst vtkCommonDataModel) + if(NOT ParaView_FOUND) + message(FATAL_ERROR "Catalyst analysis components require Catalyst build (or " + "install directory. Please set ParaView_DIR to point to " + "directory containing `ParaViewConfig.cmake`.") + endif() + target_include_directories(sensei SYSTEM PUBLIC ${PARAVIEW_INCLUDE_DIRS}) + target_compile_definitions(sensei PUBLIC ${VTK_DEFINITIONS}) + target_link_libraries(sensei PUBLIC ${VTK_LIBRARIES}) + target_compile_definitions(sensei PUBLIC ENABLE_CATALYST) +else() + find_package(VTK QUIET COMPONENTS vtkCommonDataModel) + if(NOT VTK_FOUND) + message(FATAL_ERROR "VTK (vtkCommonDataModel) is required for Sensei core " + "even when not using any infrastructures. Please set VTK_DIR to point to a " + "directory containing `VTKConfig.cmake`.") + endif() + target_include_directories(sensei SYSTEM PUBLIC ${VTK_INCLUDE_DIRS}) + target_compile_definitions(sensei PUBLIC ${VTK_DEFINITIONS}) +endif() + +if(VTK_HAS_GENERIC_ARRAYS) + target_compile_definitions(sensei PRIVATE ENABLE_HISTOGRAM) +endif() + +if(ENABLE_ADIOS) + target_link_libraries(sensei PRIVATE adios) +endif() + +target_link_libraries(sensei + PUBLIC ${VTK_LIBRARIES} + mpi + PRIVATE diy + grid + pugixml + ) + +# Needed by Autocorrelation.cxx +target_compile_options(sensei PRIVATE "-std=c++11") diff --git a/analysis/configurable/vtkConfigurableAnalysisAdaptor.cxx b/sensei/ConfigurableAnalysis.cxx similarity index 70% rename from analysis/configurable/vtkConfigurableAnalysisAdaptor.cxx rename to sensei/ConfigurableAnalysis.cxx index e24376240ae244dea83fbe16f5e410d0533f6772..8bb983066871332684c2daa5b0ca844855d66506 100644 --- a/analysis/configurable/vtkConfigurableAnalysisAdaptor.cxx +++ b/sensei/ConfigurableAnalysis.cxx @@ -1,40 +1,28 @@ -/*========================================================================= - - Program: Visualization Toolkit - Module: vtkConfigurableAnalysisAdaptor.cxx - - Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen - All rights reserved. - See Copyright.txt or http://www.kitware.com/Copyright.htm for details. - - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notice for more information. - -=========================================================================*/ -#include "vtkConfigurableAnalysisAdaptor.h" +#include "ConfigurableAnalysis.h" #include #include #include #include +#include "Autocorrelation.h" #ifdef ENABLE_HISTOGRAM -# include +# include "Histogram.h" #endif #ifdef ENABLE_ADIOS -# include +# include "adios/AnalysisAdaptor.h" #endif #ifdef ENABLE_CATALYST -# include -# include +# include "catalyst/AnalysisAdaptor.h" +# include "catalyst/Slice.h" #endif -#include #include #include +namespace sensei +{ -class vtkConfigurableAnalysisAdaptor::vtkInternals +class ConfigurableAnalysis::vtkInternals { int GetAssociation(pugi::xml_attribute asscNode) { @@ -52,7 +40,7 @@ class vtkConfigurableAnalysisAdaptor::vtkInternals } public: - std::vector > Analyses; + std::vector > Analyses; #ifdef ENABLE_HISTOGRAM void AddHistogram(MPI_Comm comm, pugi::xml_node node) @@ -63,7 +51,7 @@ public: int association = GetAssociation(node.attribute("association")); int bins = node.attribute("bins")? node.attribute("bins").as_int() : 10; - vtkNew histogram; + vtkNew histogram; histogram->Initialize(comm, bins, association, array.value()); this->Analyses.push_back(histogram.GetPointer()); } @@ -77,7 +65,7 @@ public: #ifdef ENABLE_ADIOS void AddAdios(MPI_Comm comm, pugi::xml_node node) { - vtkNew adios; + vtkNew adios; pugi::xml_attribute filename = node.attribute("filename"); pugi::xml_attribute method = node.attribute("method"); if (filename) @@ -93,18 +81,18 @@ public: #endif #ifdef ENABLE_CATALYST - vtkSmartPointer CatalystAnalysisAdaptor; + vtkSmartPointer CatalystAnalysisAdaptor; void AddCatalyst(MPI_Comm comm, pugi::xml_node node) { if (!this->CatalystAnalysisAdaptor) { - this->CatalystAnalysisAdaptor = vtkSmartPointer::New(); + this->CatalystAnalysisAdaptor = vtkSmartPointer::New(); this->Analyses.push_back(this->CatalystAnalysisAdaptor); } if (strcmp(node.attribute("pipeline").value(), "slice") == 0) { - vtkNew slice; + vtkNew slice; // TODO: parse origin and normal. slice->SetSliceNormal(0, 0, 1); slice->SetSliceOrigin(0, 0, 0); @@ -117,7 +105,7 @@ public: void AddAutoCorrelation(MPI_Comm comm, pugi::xml_node node) { - vtkNew adaptor; + vtkNew adaptor; adaptor->Initialize(comm, node.attribute("window")? node.attribute("window").as_int() : 10, this->GetAssociation(node.attribute("association")), @@ -127,21 +115,21 @@ public: } }; -vtkStandardNewMacro(vtkConfigurableAnalysisAdaptor); +vtkStandardNewMacro(ConfigurableAnalysis); //---------------------------------------------------------------------------- -vtkConfigurableAnalysisAdaptor::vtkConfigurableAnalysisAdaptor() - : Internals(new vtkConfigurableAnalysisAdaptor::vtkInternals()) +ConfigurableAnalysis::ConfigurableAnalysis() + : Internals(new ConfigurableAnalysis::vtkInternals()) { } //---------------------------------------------------------------------------- -vtkConfigurableAnalysisAdaptor::~vtkConfigurableAnalysisAdaptor() +ConfigurableAnalysis::~ConfigurableAnalysis() { delete this->Internals; } //---------------------------------------------------------------------------- -bool vtkConfigurableAnalysisAdaptor::Initialize(MPI_Comm world, const std::string& filename) +bool ConfigurableAnalysis::Initialize(MPI_Comm world, const std::string& filename) { pugi::xml_document doc; pugi::xml_parse_result result = doc.load_file(filename.c_str()); @@ -187,9 +175,9 @@ bool vtkConfigurableAnalysisAdaptor::Initialize(MPI_Comm world, const std::strin } //---------------------------------------------------------------------------- -bool vtkConfigurableAnalysisAdaptor::Execute(vtkInsituDataAdaptor* data) +bool ConfigurableAnalysis::Execute(DataAdaptor* data) { - for (std::vector >::iterator iter + for (std::vector >::iterator iter = this->Internals->Analyses.begin(); iter != this->Internals->Analyses.end(); ++iter) { @@ -199,7 +187,9 @@ bool vtkConfigurableAnalysisAdaptor::Execute(vtkInsituDataAdaptor* data) } //---------------------------------------------------------------------------- -void vtkConfigurableAnalysisAdaptor::PrintSelf(ostream& os, vtkIndent indent) +void ConfigurableAnalysis::PrintSelf(ostream& os, vtkIndent indent) { this->Superclass::PrintSelf(os, indent); } + +} diff --git a/sensei/ConfigurableAnalysis.h b/sensei/ConfigurableAnalysis.h new file mode 100644 index 0000000000000000000000000000000000000000..75552eb535b81224a57388b8b1ab4ca2479da728 --- /dev/null +++ b/sensei/ConfigurableAnalysis.h @@ -0,0 +1,39 @@ +#ifndef sensei_ConfigurableAnalysis_h +#define sensei_ConfigurableAnalysis_h + +#include "AnalysisAdaptor.h" + +#include +#include + +namespace sensei +{ + +/// @brief ConfigurableAnalysis is all-in-one analysis adaptor that +/// can execute all available analysis adaptors. +class ConfigurableAnalysis : public AnalysisAdaptor +{ +public: + static ConfigurableAnalysis* New(); + vtkTypeMacro(ConfigurableAnalysis, AnalysisAdaptor); + void PrintSelf(ostream& os, vtkIndent indent); + + /// @brief Initialize the adaptor using the configuration specified. + bool Initialize(MPI_Comm world, const std::string& filename); + + virtual bool Execute(DataAdaptor* data); + +protected: + ConfigurableAnalysis(); + ~ConfigurableAnalysis(); + +private: + ConfigurableAnalysis(const ConfigurableAnalysis&); // Not implemented. + void operator=(const ConfigurableAnalysis&); // Not implemented. + + class vtkInternals; + vtkInternals* Internals; +}; + +} +#endif diff --git a/core/vtkInsituDataAdaptor.cxx b/sensei/DataAdaptor.cxx similarity index 50% rename from core/vtkInsituDataAdaptor.cxx rename to sensei/DataAdaptor.cxx index 1cc21ecc7668b0078c45226bffa40be29aa3e4f3..68a39dd2798616fc738b60f229aa4169cc8ca7ea 100644 --- a/core/vtkInsituDataAdaptor.cxx +++ b/sensei/DataAdaptor.cxx @@ -1,65 +1,54 @@ -/*========================================================================= - - Program: Visualization Toolkit - Module: vtkInsituDataAdaptor.cxx - - Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen - All rights reserved. - See Copyright.txt or http://www.kitware.com/Copyright.htm for details. - - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notice for more information. - -=========================================================================*/ -#include "vtkInsituDataAdaptor.h" +#include "DataAdaptor.h" #include "vtkDataObject.h" #include "vtkInformation.h" #include "vtkInformationIntegerKey.h" #include "vtkObjectFactory.h" -vtkInformationKeyMacro(vtkInsituDataAdaptor, DATA_TIME_STEP_INDEX, Integer); +namespace sensei +{ + +vtkInformationKeyMacro(DataAdaptor, DATA_TIME_STEP_INDEX, Integer); //---------------------------------------------------------------------------- -vtkInsituDataAdaptor::vtkInsituDataAdaptor() +DataAdaptor::DataAdaptor() { this->Information = vtkInformation::New(); } //---------------------------------------------------------------------------- -vtkInsituDataAdaptor::~vtkInsituDataAdaptor() +DataAdaptor::~DataAdaptor() { this->Information->Delete(); } //---------------------------------------------------------------------------- -double vtkInsituDataAdaptor::GetDataTime(vtkInformation* info) +double DataAdaptor::GetDataTime(vtkInformation* info) { return info->Has(vtkDataObject::DATA_TIME_STEP())? info->Get(vtkDataObject::DATA_TIME_STEP()) : 0.0; } //---------------------------------------------------------------------------- -void vtkInsituDataAdaptor::SetDataTime(vtkInformation* info, double time) +void DataAdaptor::SetDataTime(vtkInformation* info, double time) { info->Set(vtkDataObject::DATA_TIME_STEP(), time); } //---------------------------------------------------------------------------- -int vtkInsituDataAdaptor::GetDataTimeStep(vtkInformation* info) +int DataAdaptor::GetDataTimeStep(vtkInformation* info) { - return info->Has(vtkInsituDataAdaptor::DATA_TIME_STEP_INDEX())? - info->Get(vtkInsituDataAdaptor::DATA_TIME_STEP_INDEX()) : 0; + return info->Has(DataAdaptor::DATA_TIME_STEP_INDEX())? + info->Get(DataAdaptor::DATA_TIME_STEP_INDEX()) : 0; } //---------------------------------------------------------------------------- -void vtkInsituDataAdaptor::SetDataTimeStep(vtkInformation* info, int index) +void DataAdaptor::SetDataTimeStep(vtkInformation* info, int index) { - info->Set(vtkInsituDataAdaptor::DATA_TIME_STEP_INDEX(), index); + info->Set(DataAdaptor::DATA_TIME_STEP_INDEX(), index); } //---------------------------------------------------------------------------- -vtkDataObject* vtkInsituDataAdaptor::GetCompleteMesh() +vtkDataObject* DataAdaptor::GetCompleteMesh() { vtkDataObject* mesh = this->GetMesh(); for (int attr=vtkDataObject::FIELD_ASSOCIATION_POINTS; @@ -74,7 +63,9 @@ vtkDataObject* vtkInsituDataAdaptor::GetCompleteMesh() } //---------------------------------------------------------------------------- -void vtkInsituDataAdaptor::PrintSelf(ostream& os, vtkIndent indent) +void DataAdaptor::PrintSelf(ostream& os, vtkIndent indent) { this->Superclass::PrintSelf(os, indent); } + +} // end of namespace sensei diff --git a/core/vtkInsituDataAdaptor.h b/sensei/DataAdaptor.h similarity index 77% rename from core/vtkInsituDataAdaptor.h rename to sensei/DataAdaptor.h index 502ef0a691e7471486816f6e2a5f54d4c3cfeb01..dde63ed6002bedd136345270c3ff250f7a673c6d 100644 --- a/core/vtkInsituDataAdaptor.h +++ b/sensei/DataAdaptor.h @@ -1,39 +1,27 @@ -/*========================================================================= - - Program: Visualization Toolkit - Module: vtkInsituDataAdaptor.h - - Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen - All rights reserved. - See Copyright.txt or http://www.kitware.com/Copyright.htm for details. - - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notice for more information. - -=========================================================================*/ -// .NAME vtkInsituDataAdaptor -// .SECTION Description -// vtkInsituDataAdaptor is an adaptor that is used to get vtkDataObject and -// vtkAbstractArray. Each simulation code provides an implementation of -// vtkInsituDataAdaptor which maps simulation data-structures to VTK data model -// on request. - -#ifndef vtkInsituDataAdaptor_h -#define vtkInsituDataAdaptor_h +#ifndef sensei_DataAdaptor_h +#define sensei_DataAdaptor_h #include "vtkObjectBase.h" -#include "vtkSetGet.h" +#include "vtkSetGet.h" // needed for vtkTypeMacro. class vtkAbstractArray; class vtkDataObject; class vtkInformation; class vtkInformationIntegerKey; -class vtkInsituDataAdaptor : public vtkObjectBase +namespace sensei +{ + +/// @class DataAdaptor +/// @brief DataAdaptor is an abstract base class that defines the data interface. +/// +/// DataAdaptor defines the data interface. Any simulation code that interfaces with +/// Sensei needs to provide an implementation for this interface. Analysis routines +/// (via AnalysisAdator) use the DataAdaptor implementation to access simulation data. +class DataAdaptor : public vtkObjectBase { public: - vtkTypeMacro(vtkInsituDataAdaptor, vtkObjectBase); + vtkTypeMacro(DataAdaptor, vtkObjectBase); void PrintSelf(ostream& os, vtkIndent indent); /// @brief Return the data object with appropriate structure. @@ -119,7 +107,6 @@ public: /// @brief Convenience methods to set the time information. static void SetDataTimeStep(vtkInformation*, int index); - /// @brief convenience method to get full mesh will all arrays added to the /// mesh. vtkDataObject* GetCompleteMesh(); @@ -127,13 +114,14 @@ public: /// @brief Key to store the timestep index. static vtkInformationIntegerKey* DATA_TIME_STEP_INDEX(); protected: - vtkInsituDataAdaptor(); - ~vtkInsituDataAdaptor(); + DataAdaptor(); + ~DataAdaptor(); vtkInformation* Information; private: - vtkInsituDataAdaptor(const vtkInsituDataAdaptor&); // Not implemented. - void operator=(const vtkInsituDataAdaptor&); // Not implemented. + DataAdaptor(const DataAdaptor&); // Not implemented. + void operator=(const DataAdaptor&); // Not implemented. }; +} #endif diff --git a/analysis/histogram/HistogramAnalysisAdaptor.cxx b/sensei/Histogram.cxx similarity index 93% rename from analysis/histogram/HistogramAnalysisAdaptor.cxx rename to sensei/Histogram.cxx index 646d3d1cc498de63b8d4209b6947d368b853eef0..15b4f6c0a171fd76d10681c759db07a1440a297a 100644 --- a/analysis/histogram/HistogramAnalysisAdaptor.cxx +++ b/sensei/Histogram.cxx @@ -1,4 +1,4 @@ -#include "HistogramAnalysisAdaptor.h" +#include "Histogram.h" #include #include @@ -7,10 +7,11 @@ #include #include #include -#include #include #include +#include "DataAdaptor.h" + #include #include namespace @@ -125,9 +126,12 @@ public: } -vtkStandardNewMacro(HistogramAnalysisAdaptor); +namespace sensei +{ + +vtkStandardNewMacro(Histogram); //----------------------------------------------------------------------------- -HistogramAnalysisAdaptor::HistogramAnalysisAdaptor() : +Histogram::Histogram() : Communicator(MPI_COMM_WORLD), Bins(0), Association(vtkDataObject::FIELD_ASSOCIATION_POINTS) @@ -135,12 +139,12 @@ HistogramAnalysisAdaptor::HistogramAnalysisAdaptor() : } //----------------------------------------------------------------------------- -HistogramAnalysisAdaptor::~HistogramAnalysisAdaptor() +Histogram::~Histogram() { } //----------------------------------------------------------------------------- -void HistogramAnalysisAdaptor::Initialize( +void Histogram::Initialize( MPI_Comm comm, int bins, int association, const std::string& arrayname) { this->Communicator = comm; @@ -150,7 +154,7 @@ void HistogramAnalysisAdaptor::Initialize( } //----------------------------------------------------------------------------- -bool HistogramAnalysisAdaptor::Execute(vtkInsituDataAdaptor* data) +bool Histogram::Execute(sensei::DataAdaptor* data) { vtkHistogram histogram; vtkDataObject* mesh = data->GetMesh(/*structure_only*/true); @@ -190,7 +194,7 @@ bool HistogramAnalysisAdaptor::Execute(vtkInsituDataAdaptor* data) } //----------------------------------------------------------------------------- -vtkDataArray* HistogramAnalysisAdaptor::GetArray(vtkDataObject* dobj) +vtkDataArray* Histogram::GetArray(vtkDataObject* dobj) { assert(dobj != NULL && vtkCompositeDataSet::SafeDownCast(dobj) == NULL); if (vtkFieldData* fd = dobj->GetAttributesAsFieldData(this->Association)) @@ -199,3 +203,5 @@ vtkDataArray* HistogramAnalysisAdaptor::GetArray(vtkDataObject* dobj) } return NULL; } + +} // end of namespace sensei diff --git a/sensei/Histogram.h b/sensei/Histogram.h new file mode 100644 index 0000000000000000000000000000000000000000..d7331f6a890af4d0353c5e20728ece57d9e7bc4b --- /dev/null +++ b/sensei/Histogram.h @@ -0,0 +1,46 @@ +#ifndef sensei_Histogram_h +#define sensei_Histogram_h + +#include "AnalysisAdaptor.h" +#include + +class vtkDataObject; +class vtkDataArray; + +namespace sensei +{ + +/// @class Histogram +/// @brief sensei::Histogram is a AnalysisAdaptor specialization for histogram analysis. +/// +/// This class demonstrates how a custom analysis code may be written within the +/// Sensei infrastructure. +class Histogram : public AnalysisAdaptor +{ +public: + static Histogram* New(); + vtkTypeMacro(Histogram, AnalysisAdaptor); + + void Initialize(MPI_Comm comm, int bins, + int association, const std::string& arrayname); + + virtual bool Execute(sensei::DataAdaptor* data); + +protected: + Histogram(); + virtual ~Histogram(); + + vtkDataArray* GetArray(vtkDataObject* dobj); + + MPI_Comm Communicator; + int Bins; + std::string ArrayName; + int Association; +private: + Histogram(const Histogram&); + void operator=(const Histogram&); +}; + +} + +#endif diff --git a/infrastructures/adios/vtkADIOSAnalysisAdaptor.cxx b/sensei/adios/AnalysisAdaptor.cxx similarity index 96% rename from infrastructures/adios/vtkADIOSAnalysisAdaptor.cxx rename to sensei/adios/AnalysisAdaptor.cxx index da99abf2c8fda0d47580aba70792ab50b0867f5a..7f0636c63e93c92b0be565d424ae4f887df05084 100644 --- a/infrastructures/adios/vtkADIOSAnalysisAdaptor.cxx +++ b/sensei/adios/AnalysisAdaptor.cxx @@ -1,4 +1,6 @@ -#include "vtkADIOSAnalysisAdaptor.h" +#include "AnalysisAdaptor.h" + +#include #include #include @@ -8,15 +10,19 @@ #include #include #include -#include #include #include #include #include #include - #include + +namespace sensei +{ +namespace adios +{ + namespace internals { ADIOS_DATATYPES adiosType(vtkDataArray* da) @@ -178,9 +184,9 @@ namespace internals } } -vtkStandardNewMacro(vtkADIOSAnalysisAdaptor); +vtkStandardNewMacro(AnalysisAdaptor); //---------------------------------------------------------------------------- -vtkADIOSAnalysisAdaptor::vtkADIOSAnalysisAdaptor() : +AnalysisAdaptor::AnalysisAdaptor() : Initialized(false), FixedLengthVarSize(0) { @@ -189,12 +195,12 @@ vtkADIOSAnalysisAdaptor::vtkADIOSAnalysisAdaptor() : } //---------------------------------------------------------------------------- -vtkADIOSAnalysisAdaptor::~vtkADIOSAnalysisAdaptor() +AnalysisAdaptor::~AnalysisAdaptor() { } //---------------------------------------------------------------------------- -bool vtkADIOSAnalysisAdaptor::Execute(vtkInsituDataAdaptor* data) +bool AnalysisAdaptor::Execute(DataAdaptor* data) { vtkDataObject* mesh = data->GetCompleteMesh(); this->InitializeADIOS(data); @@ -203,7 +209,7 @@ bool vtkADIOSAnalysisAdaptor::Execute(vtkInsituDataAdaptor* data) } //---------------------------------------------------------------------------- -void vtkADIOSAnalysisAdaptor::InitializeADIOS(vtkInsituDataAdaptor* data) +void AnalysisAdaptor::InitializeADIOS(DataAdaptor* data) { // Ideally, we'd develop code that can write any VTK data object to ADIOS // using a schema that we can call VTK_ADIOS_SCHEMA. VTK and consequently @@ -265,7 +271,7 @@ void vtkADIOSAnalysisAdaptor::InitializeADIOS(vtkInsituDataAdaptor* data) } //---------------------------------------------------------------------------- -void vtkADIOSAnalysisAdaptor::WriteTimestep(vtkInsituDataAdaptor* data) +void AnalysisAdaptor::WriteTimestep(DataAdaptor* data) { vtkDataObject* mesh = data->GetCompleteMesh(); @@ -363,7 +369,10 @@ void vtkADIOSAnalysisAdaptor::WriteTimestep(vtkInsituDataAdaptor* data) } //---------------------------------------------------------------------------- -void vtkADIOSAnalysisAdaptor::PrintSelf(ostream& os, vtkIndent indent) +void AnalysisAdaptor::PrintSelf(ostream& os, vtkIndent indent) { this->Superclass::PrintSelf(os, indent); } + +} // adios +} // sensei diff --git a/infrastructures/adios/vtkADIOSAnalysisAdaptor.h b/sensei/adios/AnalysisAdaptor.h similarity index 56% rename from infrastructures/adios/vtkADIOSAnalysisAdaptor.h rename to sensei/adios/AnalysisAdaptor.h index 172565244f098cd17417b7ee73a3bdafea294549..a685525590dcc537ad57bf34100912020e41e893 100644 --- a/infrastructures/adios/vtkADIOSAnalysisAdaptor.h +++ b/sensei/adios/AnalysisAdaptor.h @@ -1,24 +1,30 @@ -#ifndef vtkADIOSAnalysisAdaptor_h -#define vtkADIOSAnalysisAdaptor_h +#ifndef sensei_adios_AnalysisAdaptor_h +#define sensei_adios_AnalysisAdaptor_h -#include +#include #include +namespace sensei +{ +namespace adios +{ +using sensei::DataAdaptor; + /// @brief Analysis adaptor for ADIOS. /// -/// vtkADIOSAnalysisAdaptor is an subclass of vtkInsituAnalysisAdaptor. Despite +/// adios::AnalysisAdaptor is an subclass of sensei::AnalysisAdaptor. Despite /// being called an analysis adaptor, this adaptor doesn't do any analysis. It's -/// main purpose is to serialize data provided via vtkInsituDataAdaptor using +/// main purpose is to serialize data provided via DataAdaptor using /// ADIOS. In theory, this class should be able to handle all types of /// vtkDataObject subclasses. Current implementation only supports vtkImageData /// and vtkMultiBlockDataSet of vtkImageData. /// /// \sa vtkADIOSDataAdaptor, ADIOSAnalysisEndPoint -class vtkADIOSAnalysisAdaptor : public vtkInsituAnalysisAdaptor +class AnalysisAdaptor : public sensei::AnalysisAdaptor { public: - static vtkADIOSAnalysisAdaptor* New(); - vtkTypeMacro(vtkADIOSAnalysisAdaptor, vtkInsituAnalysisAdaptor); + static AnalysisAdaptor* New(); + vtkTypeMacro(AnalysisAdaptor, sensei::AnalysisAdaptor); void PrintSelf(ostream& os, vtkIndent indent); /// @brief Set the ADIOS method e.g. MPI, FLEXPATH etc. @@ -37,21 +43,21 @@ public: std::string GetFileName() const { return this->FileName; } - virtual bool Execute(vtkInsituDataAdaptor* data); + virtual bool Execute(DataAdaptor* data); //BTX protected: - vtkADIOSAnalysisAdaptor(); - ~vtkADIOSAnalysisAdaptor(); + AnalysisAdaptor(); + ~AnalysisAdaptor(); - void InitializeADIOS(vtkInsituDataAdaptor* data); - void WriteTimestep(vtkInsituDataAdaptor* data); + void InitializeADIOS(DataAdaptor* data); + void WriteTimestep(DataAdaptor* data); std::string Method; std::string FileName; private: - vtkADIOSAnalysisAdaptor(const vtkADIOSAnalysisAdaptor&); // Not implemented. - void operator=(const vtkADIOSAnalysisAdaptor&); // Not implemented. + AnalysisAdaptor(const AnalysisAdaptor&); // Not implemented. + void operator=(const AnalysisAdaptor&); // Not implemented. bool Initialized; int64_t FixedLengthVarSize; @@ -59,4 +65,6 @@ private: //ETX }; +} // adios +} // sensei #endif diff --git a/infrastructures/adios/CMakeLists.txt b/sensei/adios/CMakeLists.txt similarity index 100% rename from infrastructures/adios/CMakeLists.txt rename to sensei/adios/CMakeLists.txt diff --git a/infrastructures/adios/vtkADIOSDataAdaptor.cxx b/sensei/adios/DataAdaptor.cxx similarity index 92% rename from infrastructures/adios/vtkADIOSDataAdaptor.cxx rename to sensei/adios/DataAdaptor.cxx index 975601bf5211b0f03d07a2772361d18a3aced1ae..dca514d3a5444f780afa2535f0391c3d62f6c304 100644 --- a/infrastructures/adios/vtkADIOSDataAdaptor.cxx +++ b/sensei/adios/DataAdaptor.cxx @@ -1,4 +1,4 @@ -#include "vtkADIOSDataAdaptor.h" +#include "DataAdaptor.h" #include #include @@ -10,6 +10,12 @@ #include #include + +namespace sensei +{ +namespace adios +{ + namespace internals { vtkDataArray* createVTKArray(ADIOS_DATATYPES type) @@ -96,21 +102,21 @@ namespace internals } } -vtkStandardNewMacro(vtkADIOSDataAdaptor); +vtkStandardNewMacro(DataAdaptor); //---------------------------------------------------------------------------- -vtkADIOSDataAdaptor::vtkADIOSDataAdaptor() +DataAdaptor::DataAdaptor() : File(NULL), Comm(MPI_COMM_WORLD) { } //---------------------------------------------------------------------------- -vtkADIOSDataAdaptor::~vtkADIOSDataAdaptor() +DataAdaptor::~DataAdaptor() { } //---------------------------------------------------------------------------- -bool vtkADIOSDataAdaptor::Open(MPI_Comm comm, +bool DataAdaptor::Open(MPI_Comm comm, ADIOS_READ_METHOD method, const std::string& filename) { this->Comm = comm; @@ -198,14 +204,14 @@ bool vtkADIOSDataAdaptor::Open(MPI_Comm comm, } //---------------------------------------------------------------------------- -bool vtkADIOSDataAdaptor::Advance() +bool DataAdaptor::Advance() { adios_release_step(this->File); return adios_advance_step(this->File, 0, /*timeout*/0.5) == 0; } //---------------------------------------------------------------------------- -bool vtkADIOSDataAdaptor::ReadStep() +bool DataAdaptor::ReadStep() { int tstep = 0; double time = 0; ADIOS_FILE* f = this->File; @@ -218,13 +224,13 @@ bool vtkADIOSDataAdaptor::ReadStep() } //---------------------------------------------------------------------------- -vtkDataObject* vtkADIOSDataAdaptor::GetMesh(bool /*structure_only*/) +vtkDataObject* DataAdaptor::GetMesh(bool /*structure_only*/) { return this->Mesh; } //---------------------------------------------------------------------------- -bool vtkADIOSDataAdaptor::AddArray(vtkDataObject* mesh, int association, const char* arrayname) +bool DataAdaptor::AddArray(vtkDataObject* mesh, int association, const char* arrayname) { ArraysType& arrays = this->AssociatedArrays[association]; ArraysType::iterator iter = arrays.find(arrayname); @@ -265,13 +271,13 @@ bool vtkADIOSDataAdaptor::AddArray(vtkDataObject* mesh, int association, const c } //---------------------------------------------------------------------------- -unsigned int vtkADIOSDataAdaptor::GetNumberOfArrays(int association) +unsigned int DataAdaptor::GetNumberOfArrays(int association) { return static_cast(this->AssociatedArrays[association].size()); } //---------------------------------------------------------------------------- -const char* vtkADIOSDataAdaptor::GetArrayName(int association, unsigned int index) +const char* DataAdaptor::GetArrayName(int association, unsigned int index) { ArraysType& arrays = this->AssociatedArrays[association]; unsigned int cc=0; @@ -286,7 +292,7 @@ const char* vtkADIOSDataAdaptor::GetArrayName(int association, unsigned int inde } //---------------------------------------------------------------------------- -void vtkADIOSDataAdaptor::ReleaseData() +void DataAdaptor::ReleaseData() { for (AssociatedArraysType::iterator iter1 = this->AssociatedArrays.begin(); iter1 != this->AssociatedArrays.end(); ++iter1) @@ -301,7 +307,10 @@ void vtkADIOSDataAdaptor::ReleaseData() } //---------------------------------------------------------------------------- -void vtkADIOSDataAdaptor::PrintSelf(ostream& os, vtkIndent indent) +void DataAdaptor::PrintSelf(ostream& os, vtkIndent indent) { this->Superclass::PrintSelf(os, indent); } + +} // adios +} // sensei diff --git a/infrastructures/adios/vtkADIOSDataAdaptor.h b/sensei/adios/DataAdaptor.h similarity index 67% rename from infrastructures/adios/vtkADIOSDataAdaptor.h rename to sensei/adios/DataAdaptor.h index 5f63f32099d21be105495ac42ee0dc7b53f92019..b109ce846b5c1c2cf07a6179ca8c4062d2e09ed5 100644 --- a/infrastructures/adios/vtkADIOSDataAdaptor.h +++ b/sensei/adios/DataAdaptor.h @@ -1,7 +1,8 @@ -#ifndef vtkADIOSDataAdaptor_h -#define vtkADIOSDataAdaptor_h +#ifndef sensei_adios_DataAdaptor_h +#define sensei_adios_DataAdaptor_h + +#include -#include "vtkInsituDataAdaptor.h" #include #include #include @@ -11,11 +12,17 @@ class vtkDataArray; class vtkImageData; -class vtkADIOSDataAdaptor : public vtkInsituDataAdaptor + +namespace sensei +{ +namespace adios +{ + +class DataAdaptor : public sensei::DataAdaptor { public: - static vtkADIOSDataAdaptor* New(); - vtkTypeMacro(vtkADIOSDataAdaptor, vtkInsituDataAdaptor); + static DataAdaptor* New(); + vtkTypeMacro(DataAdaptor, sensei::DataAdaptor); void PrintSelf(ostream& os, vtkIndent indent); bool Open(MPI_Comm comm, ADIOS_READ_METHOD method, const std::string& filename); @@ -30,8 +37,8 @@ public: //BTX protected: - vtkADIOSDataAdaptor(); - ~vtkADIOSDataAdaptor(); + DataAdaptor(); + ~DataAdaptor(); ADIOS_FILE* File; MPI_Comm Comm; @@ -42,9 +49,11 @@ protected: vtkSmartPointer Mesh; private: - vtkADIOSDataAdaptor(const vtkADIOSDataAdaptor&); // Not implemented. - void operator=(const vtkADIOSDataAdaptor&); // Not implemented. + DataAdaptor(const DataAdaptor&); // Not implemented. + void operator=(const DataAdaptor&); // Not implemented. //ETX }; +} // adios +} // sensei #endif diff --git a/infrastructures/catalyst/vtkCatalystAnalysisAdaptor.cxx b/sensei/catalyst/AnalysisAdaptor.cxx similarity index 78% rename from infrastructures/catalyst/vtkCatalystAnalysisAdaptor.cxx rename to sensei/catalyst/AnalysisAdaptor.cxx index b6546539970b6a7bd10aebd475955cef60c3e8f7..a881a788a35317f9486b40f80d8bc72c0dbd2692 100644 --- a/infrastructures/catalyst/vtkCatalystAnalysisAdaptor.cxx +++ b/sensei/catalyst/AnalysisAdaptor.cxx @@ -1,6 +1,6 @@ -#include "vtkCatalystAnalysisAdaptor.h" +#include "AnalysisAdaptor.h" -#include +#include #include #include @@ -9,14 +9,16 @@ #include #include -namespace +namespace sensei +{ +namespace catalyst { - static size_t vtkCPAdaptorAPIInitializationCounter = 0; -} -vtkStandardNewMacro(vtkCatalystAnalysisAdaptor); +static size_t vtkCPAdaptorAPIInitializationCounter = 0; + +vtkStandardNewMacro(AnalysisAdaptor); //----------------------------------------------------------------------------- -vtkCatalystAnalysisAdaptor::vtkCatalystAnalysisAdaptor() +AnalysisAdaptor::AnalysisAdaptor() { if (vtkCPAdaptorAPIInitializationCounter == 0) { @@ -26,7 +28,7 @@ vtkCatalystAnalysisAdaptor::vtkCatalystAnalysisAdaptor() } //----------------------------------------------------------------------------- -vtkCatalystAnalysisAdaptor::~vtkCatalystAnalysisAdaptor() +AnalysisAdaptor::~AnalysisAdaptor() { vtkCPAdaptorAPIInitializationCounter--; if (vtkCPAdaptorAPIInitializationCounter == 0) @@ -36,7 +38,7 @@ vtkCatalystAnalysisAdaptor::~vtkCatalystAnalysisAdaptor() } //----------------------------------------------------------------------------- -void vtkCatalystAnalysisAdaptor::AddPipeline(vtkCPPipeline* pipeline) +void AnalysisAdaptor::AddPipeline(vtkCPPipeline* pipeline) { if (pipeline) { @@ -45,7 +47,7 @@ void vtkCatalystAnalysisAdaptor::AddPipeline(vtkCPPipeline* pipeline) } //----------------------------------------------------------------------------- -bool vtkCatalystAnalysisAdaptor::Execute(vtkInsituDataAdaptor* dataAdaptor) +bool AnalysisAdaptor::Execute(DataAdaptor* dataAdaptor) { double time = dataAdaptor->GetDataTime(); int timeStep = dataAdaptor->GetDataTimeStep(); @@ -71,8 +73,8 @@ bool vtkCatalystAnalysisAdaptor::Execute(vtkInsituDataAdaptor* dataAdaptor) } //----------------------------------------------------------------------------- -bool vtkCatalystAnalysisAdaptor::FillDataDescriptionWithMetaData( - vtkInsituDataAdaptor* dA, vtkCPInputDataDescription* desc) +bool AnalysisAdaptor::FillDataDescriptionWithMetaData( + DataAdaptor* dA, vtkCPInputDataDescription* desc) { desc->Reset(); for (unsigned int cc=0, max=dA->GetNumberOfArrays(vtkDataObject::POINT); ccGetGenerateMesh()? false : true; vtkDataObject* mesh = dA->GetMesh(structure_only); @@ -111,7 +113,10 @@ bool vtkCatalystAnalysisAdaptor::FillDataDescriptionWithData( } //----------------------------------------------------------------------------- -void vtkCatalystAnalysisAdaptor::PrintSelf(ostream& os, vtkIndent indent) +void AnalysisAdaptor::PrintSelf(ostream& os, vtkIndent indent) { this->Superclass::PrintSelf(os, indent); } + +} // catalyst +} // sensei diff --git a/infrastructures/catalyst/vtkCatalystAnalysisAdaptor.h b/sensei/catalyst/AnalysisAdaptor.h similarity index 58% rename from infrastructures/catalyst/vtkCatalystAnalysisAdaptor.h rename to sensei/catalyst/AnalysisAdaptor.h index 723214320dd9409b4eda510ea739d78eacbf84fd..8843aab52a3cbcce0bd13130d06bf3aea4d05849 100644 --- a/infrastructures/catalyst/vtkCatalystAnalysisAdaptor.h +++ b/sensei/catalyst/AnalysisAdaptor.h @@ -1,19 +1,26 @@ -#ifndef vtkCatalystAnalysisAdaptor_h -#define vtkCatalystAnalysisAdaptor_h +#ifndef sensei_catalyst_AnalysisAdaptor_h +#define sensei_catalyst_AnalysisAdaptor_h + +#include -#include "vtkInsituAnalysisAdaptor.h" class vtkCPInputDataDescription; class vtkCPPipeline; +namespace sensei +{ +namespace catalyst +{ +using sensei::DataAdaptor; + /// @brief Analysis adaptor for Catalyst-based analysis pipelines. /// -/// vtkCatalystAnalysisAdaptor is a subclass of vtkInsituAnalysisAdaptor that is +/// AnalysisAdaptor is a subclass of AnalysisAdaptor that is /// that can be used as the superclass for all analysis that uses Catalyst. -class vtkCatalystAnalysisAdaptor : public vtkInsituAnalysisAdaptor +class AnalysisAdaptor : public sensei::AnalysisAdaptor { public: - static vtkCatalystAnalysisAdaptor* New(); - vtkTypeMacro(vtkCatalystAnalysisAdaptor, vtkInsituAnalysisAdaptor); + static AnalysisAdaptor* New(); + vtkTypeMacro(AnalysisAdaptor, sensei::AnalysisAdaptor); void PrintSelf(ostream& os, vtkIndent indent); /// @brief Add a vtkCPPipeline subclass to the global Catalyst Co-Processor. @@ -21,11 +28,11 @@ public: /// Adds a vtkCPPipeline subclass to the global Catalyst Co-Processor. virtual void AddPipeline(vtkCPPipeline* pipeline); - virtual bool Execute(vtkInsituDataAdaptor* data); + virtual bool Execute(DataAdaptor* data); //BTX protected: - vtkCatalystAnalysisAdaptor(); - ~vtkCatalystAnalysisAdaptor(); + AnalysisAdaptor(); + ~AnalysisAdaptor(); /// @brief Fill \c desc with meta data from \c dataAdaptor. /// @@ -34,7 +41,7 @@ protected: /// \c dataAdaptor. /// @return true on success, false to abort execution. virtual bool FillDataDescriptionWithMetaData( - vtkInsituDataAdaptor* dataAdaptor, vtkCPInputDataDescription* desc); + DataAdaptor* dataAdaptor, vtkCPInputDataDescription* desc); /// @brief Fill \c desc with data from \c dataAdaptor. /// @@ -42,11 +49,13 @@ protected: /// simulation data. /// @return true on success, false to abort execution. virtual bool FillDataDescriptionWithData( - vtkInsituDataAdaptor* dataAdaptor, vtkCPInputDataDescription* desc); + DataAdaptor* dataAdaptor, vtkCPInputDataDescription* desc); private: - vtkCatalystAnalysisAdaptor(const vtkCatalystAnalysisAdaptor&); // Not implemented. - void operator=(const vtkCatalystAnalysisAdaptor&); // Not implemented. + AnalysisAdaptor(const AnalysisAdaptor&); // Not implemented. + void operator=(const AnalysisAdaptor&); // Not implemented. //ETX }; +} // catalyst +} // sensei #endif diff --git a/infrastructures/catalyst/vtkCatalystSlicePipeline.cxx b/sensei/catalyst/Slice.cxx similarity index 87% rename from infrastructures/catalyst/vtkCatalystSlicePipeline.cxx rename to sensei/catalyst/Slice.cxx index 6dec0eacc388d6b5e529c798a7dd9ce4929ee992..581774f794dd718348e743d6b8546f0e2dc5757e 100644 --- a/infrastructures/catalyst/vtkCatalystSlicePipeline.cxx +++ b/sensei/catalyst/Slice.cxx @@ -1,4 +1,5 @@ -#include "vtkCatalystSlicePipeline.h" +#include "Slice.h" +#include "Utilities.h" #include #include @@ -13,9 +14,12 @@ #include #include -#include "vtkCatalystUtilities.h" +namespace sensei +{ +namespace catalyst +{ -class vtkCatalystSlicePipeline::vtkInternals +class Slice::vtkInternals { public: vtkSmartPointer TrivialProducer; @@ -114,15 +118,15 @@ public: }; -vtkStandardNewMacro(vtkCatalystSlicePipeline); +vtkStandardNewMacro(Slice); //---------------------------------------------------------------------------- -vtkCatalystSlicePipeline::vtkCatalystSlicePipeline() +Slice::Slice() { this->Internals = new vtkInternals(); } //---------------------------------------------------------------------------- -vtkCatalystSlicePipeline::~vtkCatalystSlicePipeline() +Slice::~Slice() { vtkInternals& internals = (*this->Internals); catalyst::DeletePipelineProxy(internals.Slice); @@ -131,7 +135,7 @@ vtkCatalystSlicePipeline::~vtkCatalystSlicePipeline() } //---------------------------------------------------------------------------- -void vtkCatalystSlicePipeline::SetSliceOrigin(double x, double y, double z) +void Slice::SetSliceOrigin(double x, double y, double z) { vtkInternals& internals = (*this->Internals); internals.Origin[0] = x; @@ -140,7 +144,7 @@ void vtkCatalystSlicePipeline::SetSliceOrigin(double x, double y, double z) } //---------------------------------------------------------------------------- -void vtkCatalystSlicePipeline::SetSliceNormal(double x, double y, double z) +void Slice::SetSliceNormal(double x, double y, double z) { vtkInternals& internals = (*this->Internals); internals.Normal[0] = x; @@ -149,14 +153,14 @@ void vtkCatalystSlicePipeline::SetSliceNormal(double x, double y, double z) } //---------------------------------------------------------------------------- -void vtkCatalystSlicePipeline::SetAutoCenter(bool val) +void Slice::SetAutoCenter(bool val) { vtkInternals& internals = (*this->Internals); internals.AutoCenter = val; } //---------------------------------------------------------------------------- -void vtkCatalystSlicePipeline::ColorBy(int association, const char* arrayname) +void Slice::ColorBy(int association, const char* arrayname) { vtkInternals& internals = (*this->Internals); internals.ColorArrayName = arrayname? arrayname : ""; @@ -164,7 +168,7 @@ void vtkCatalystSlicePipeline::ColorBy(int association, const char* arrayname) } //---------------------------------------------------------------------------- -int vtkCatalystSlicePipeline::RequestDataDescription(vtkCPDataDescription* dataDesc) +int Slice::RequestDataDescription(vtkCPDataDescription* dataDesc) { dataDesc->GetInputDescription(0)->GenerateMeshOn(); dataDesc->GetInputDescription(0)->AllFieldsOn(); @@ -172,7 +176,7 @@ int vtkCatalystSlicePipeline::RequestDataDescription(vtkCPDataDescription* dataD } //---------------------------------------------------------------------------- -int vtkCatalystSlicePipeline::CoProcess(vtkCPDataDescription* dataDesc) +int Slice::CoProcess(vtkCPDataDescription* dataDesc) { vtkInternals& internals = (*this->Internals); internals.UpdatePipeline(dataDesc->GetInputDescription(0)->GetGrid(), dataDesc->GetTime()); @@ -180,13 +184,16 @@ int vtkCatalystSlicePipeline::CoProcess(vtkCPDataDescription* dataDesc) } //---------------------------------------------------------------------------- -int vtkCatalystSlicePipeline::Finalize() +int Slice::Finalize() { return 1; } //---------------------------------------------------------------------------- -void vtkCatalystSlicePipeline::PrintSelf(ostream& os, vtkIndent indent) +void Slice::PrintSelf(ostream& os, vtkIndent indent) { this->Superclass::PrintSelf(os, indent); } + +} // catalyst +} // sensei diff --git a/infrastructures/catalyst/vtkCatalystSlicePipeline.h b/sensei/catalyst/Slice.h similarity index 66% rename from infrastructures/catalyst/vtkCatalystSlicePipeline.h rename to sensei/catalyst/Slice.h index 762621248d4ac367e8ade7fe56b17b7bfa8037a6..2c7373a60cfeb22b2a7dc9f1a79663f70426b9a9 100644 --- a/infrastructures/catalyst/vtkCatalystSlicePipeline.h +++ b/sensei/catalyst/Slice.h @@ -1,13 +1,17 @@ -#ifndef vtkCatalystSlicePipeline_h -#define vtkCatalystSlicePipeline_h +#ifndef sensei_catalyst_Slice_h +#define sensei_catalyst_Slice_h #include "vtkCPPipeline.h" -class vtkCatalystSlicePipeline : public vtkCPPipeline +namespace sensei +{ +namespace catalyst +{ +class Slice : public vtkCPPipeline { public: - static vtkCatalystSlicePipeline* New(); - vtkTypeMacro(vtkCatalystSlicePipeline, vtkCPPipeline); + static Slice* New(); + vtkTypeMacro(Slice, vtkCPPipeline); void PrintSelf(ostream& os, vtkIndent indent); /// @brief Set slice plane origin. @@ -30,16 +34,18 @@ public: virtual int Finalize(); protected: - vtkCatalystSlicePipeline(); - ~vtkCatalystSlicePipeline(); + Slice(); + ~Slice(); private: - vtkCatalystSlicePipeline(const vtkCatalystSlicePipeline&); // Not implemented. - void operator=(const vtkCatalystSlicePipeline&); // Not implemented. + Slice(const Slice&); // Not implemented. + void operator=(const Slice&); // Not implemented. class vtkInternals; vtkInternals* Internals; }; -#endif +} // catalyst +} // sensei +#endif diff --git a/infrastructures/catalyst/vtkCatalystUtilities.h b/sensei/catalyst/Utilities.h similarity index 95% rename from infrastructures/catalyst/vtkCatalystUtilities.h rename to sensei/catalyst/Utilities.h index 648bc2130f115c557c1238b242ace619ce384ddb..c24807560c6837ca79658925f7e59589a171f920 100644 --- a/infrastructures/catalyst/vtkCatalystUtilities.h +++ b/sensei/catalyst/Utilities.h @@ -1,5 +1,5 @@ -#ifndef vtkCatalystUtilities_h -#define vtkCatalystUtilities_h +#ifndef sensei_catalyst_Utilities_h +#define sensei_catalyst_Utilities_h #include #include @@ -14,6 +14,8 @@ #include #include +namespace sensei +{ namespace catalyst { vtkSMSourceProxy* CreatePipelineProxy(const char* group, const char* name, vtkSMProxy* input=NULL) @@ -68,4 +70,5 @@ namespace catalyst return controller->Show(producer, 0, view); } } +} #endif