Commit 04f961ec authored by Brad Whitlock's avatar Brad Whitlock
Browse files

1st build of libsim sensei adaptor.

parent 6d24578f
find_package(LIBSIM REQUIRED)
add_library(libsim INTERFACE)
target_link_libraries(libsim INTERFACE ${LIBSIM_STATIC_PAR_LIBRARIES})
target_include_directories(libsim SYSTEM INTERFACE ${LIBSIM_INCLUDE_DIRS})
......@@ -49,6 +49,11 @@ cmake_dependent_option(
cmake_dependent_option(
ENABLE_ADIOS "Enable analysis methods that use ADIOS" OFF "ENABLE_SENSEI" OFF)
#------------------------------------------------------------------------------
# Enable Libsim and analysis using Libsim
cmake_dependent_option(
ENABLE_LIBSIM "Enable analysis methods that use Libsim" OFF "ENABLE_SENSEI" OFF)
#------------------------------------------------------------------------------
option(ENABLE_VTK_XMLP "Enable use of vtk parallel I/O" OFF)
......@@ -57,6 +62,9 @@ include(mpi)
if(ENABLE_ADIOS)
include(adios)
endif()
if(ENABLE_LIBSIM)
include(libsim)
endif()
add_subdirectory(utils)
......
......@@ -4,4 +4,5 @@
<analysis type="histogram" array="temperature" association="cell" bins="10" />
<analysis type="adios" filename="3D_Grid.bp" method="MPI" />
<analysis type="catalyst" pipeline="slice" />
<analysis type="libsim" trace="libsim_trace" options="-debug 5" plot="Pseudocolor" plotvar="pressure" />
</sensei>
......@@ -27,7 +27,12 @@ inline bool areBoundsValid(const diy::DiscreteBounds& bds)
return (bds.min[0] <= bds.max[0] && bds.min[1] <= bds.max[1] && bds.min[2] <= bds.max[2]);
}
#if VTK_MAJOR_VERSION == 6 && VTK_MINOR_VERSION == 1
DataAdaptor *DataAdaptor::New() { return new DataAdaptor; }
#else
vtkStandardNewMacro(DataAdaptor);
#endif
//-----------------------------------------------------------------------------
DataAdaptor::DataAdaptor() :
Internals(new DataAdaptor::DInternals())
......
......@@ -9,7 +9,11 @@
namespace parallel3d
{
#if VTK_MAJOR_VERSION == 6 && VTK_MINOR_VERSION == 1
DataAdaptor *DataAdaptor::New() { return new DataAdaptor; }
#else
vtkStandardNewMacro(DataAdaptor);
#endif
//-----------------------------------------------------------------------------
DataAdaptor::DataAdaptor()
{
......
......@@ -135,7 +135,11 @@ public:
img->GetExtent(ext);
if (this->Association == vtkDataObject::CELL)
{
#if VTK_MAJOR_VERSION == 6 && VTK_MINOR_VERSION == 1
vtkStructuredData::GetCellExtentFromNodeExtent(ext, ext);
#else
vtkStructuredData::GetCellExtentFromPointExtent(ext, ext);
#endif
}
Vertex from { ext[0], ext[2], ext[4] };
Vertex to { ext[1], ext[3], ext[5] };
......@@ -160,7 +164,11 @@ public:
id->GetExtent(ext);
if (this->Association == vtkDataObject::CELL)
{
#if VTK_MAJOR_VERSION == 6 && VTK_MINOR_VERSION == 1
vtkStructuredData::GetCellExtentFromNodeExtent(ext, ext);
#else
vtkStructuredData::GetCellExtentFromPointExtent(ext, ext);
#endif
}
Vertex from { ext[0], ext[2], ext[4] };
Vertex to { ext[1], ext[3], ext[5] };
......@@ -175,7 +183,11 @@ public:
}
};
#if VTK_MAJOR_VERSION == 6 && VTK_MINOR_VERSION == 1
Autocorrelation *Autocorrelation::New() { return new Autocorrelation; }
#else
vtkStandardNewMacro(Autocorrelation);
#endif
//-----------------------------------------------------------------------------
Autocorrelation::Autocorrelation()
: Internals(new Autocorrelation::AInternals())
......
......@@ -28,6 +28,11 @@ if(ENABLE_ADIOS)
adios/DataAdaptor.cxx
adios/DataAdaptor.h)
endif()
if(ENABLE_LIBSIM)
list(APPEND sources
libsim/AnalysisAdaptor.cxx
libsim/AnalysisAdaptor.h)
endif()
#-----------------------------------------------------------------------
add_library(sensei STATIC ${sources})
......@@ -68,6 +73,11 @@ if(ENABLE_ADIOS)
target_compile_definitions(sensei PUBLIC ENABLE_ADIOS)
endif()
if(ENABLE_LIBSIM)
target_include_directories(sensei SYSTEM PUBLIC ${LIBSIM_INCLUDE_DIRS})
target_link_libraries(sensei PRIVATE libsim)
endif()
if (ENABLE_VTK_XMLP)
target_compile_definitions(sensei PUBLIC ENABLE_VTK_XMLP)
endif()
......
......@@ -15,6 +15,9 @@
# include "catalyst/AnalysisAdaptor.h"
# include "catalyst/Slice.h"
#endif
#ifdef ENABLE_LIBSIM
# include "libsim/AnalysisAdaptor.h"
#endif
#include <vector>
#include <pugixml.hpp>
......@@ -188,6 +191,34 @@ public:
}
#endif
#ifdef ENABLE_LIBSIM
vtkSmartPointer<libsim::AnalysisAdaptor> LibsimAnalysisAdaptor;
int AddLibsim(MPI_Comm comm, pugi::xml_node node)
{
if (node.attribute("enabled") && !node.attribute("enabled").as_int())
return -1;
// We keep around a single instance of the libsim adaptor and then tell it to
// do different things.
if (!this->LibsimAnalysisAdaptor)
{
this->LibsimAnalysisAdaptor = vtkSmartPointer<libsim::AnalysisAdaptor>::New();
this->LibsimAnalysisAdaptor->SetComm(comm);
if(node.attribute("trace"))
this->LibsimAnalysisAdaptor->SetTraceFile(node.attribute("trace").value());
if(node.attribute("options"))
this->LibsimAnalysisAdaptor->SetOptions(node.attribute("options").value());
this->LibsimAnalysisAdaptor->Initialize();
this->Analyses.push_back(this->LibsimAnalysisAdaptor);
}
// Add slice stuff ...
return 0;
}
#endif
int AddAutoCorrelation(MPI_Comm comm, pugi::xml_node node)
{
if (node.attribute("enabled") && !node.attribute("enabled").as_int())
......@@ -269,7 +300,11 @@ public:
};
//----------------------------------------------------------------------------
#if VTK_MAJOR_VERSION == 6 && VTK_MINOR_VERSION == 1
ConfigurableAnalysis *ConfigurableAnalysis::New() { return new ConfigurableAnalysis; }
#else
vtkStandardNewMacro(ConfigurableAnalysis);
#endif
//----------------------------------------------------------------------------
ConfigurableAnalysis::ConfigurableAnalysis()
......@@ -313,6 +348,11 @@ bool ConfigurableAnalysis::Initialize(MPI_Comm comm, const std::string& filename
if ((type == "catalyst") &&
!this->Internals->AddCatalyst(comm, analysis))
continue;
#endif
#ifdef ENABLE_LIBSIM
if ((type == "libsim") &&
!this->Internals->AddLibsim(comm, analysis))
continue;
#endif
if ((type == "autocorrelation") &&
!this->Internals->AddAutoCorrelation(comm, analysis))
......
......@@ -24,7 +24,12 @@
namespace sensei
{
#if VTK_MAJOR_VERSION == 6 && VTK_MINOR_VERSION == 1
Histogram *Histogram::New() { return new Histogram; }
#else
vtkStandardNewMacro(Histogram);
#endif
//-----------------------------------------------------------------------------
Histogram::Histogram() :
Communicator(MPI_COMM_WORLD),
......
......@@ -126,7 +126,11 @@ int write(MPI_File file, MPI_Info hints,
namespace sensei
{
//-----------------------------------------------------------------------------
#if VTK_MAJOR_VERSION == 6 && VTK_MINOR_VERSION == 1
PosthocIO *PosthocIO::New() { return new PosthocIO; }
#else
vtkStandardNewMacro(PosthocIO);
#endif
//-----------------------------------------------------------------------------
PosthocIO::PosthocIO() : Comm(MPI_COMM_WORLD), CommRank(0), CommSize(1),
......
This diff is collapsed.
#ifndef sensei_libsim_AnalysisAdaptor_h
#define sensei_libsim_AnalysisAdaptor_h
#include <string>
#include <sensei/AnalysisAdaptor.h>
#include <mpi.h>
namespace sensei
{
namespace libsim
{
using sensei::DataAdaptor;
/// @brief Analysis adaptor for libsim-based analysis pipelines.
///
/// AnalysisAdaptor is a subclass of AnalysisAdaptor that is
/// that can be used as the superclass for all analysis that uses libsim.
class AnalysisAdaptor : public sensei::AnalysisAdaptor
{
public:
static AnalysisAdaptor* New();
vtkTypeMacro(AnalysisAdaptor, sensei::AnalysisAdaptor);
void PrintSelf(ostream& os, vtkIndent indent);
// Set some Libsim startup options.
void SetTraceFile(const std::string &traceFile);
void SetOptions(const std::string &options);
void SetVisItDirectory(const std::string &dir);
void SetComm(MPI_Comm comm);
// Let the caller explicitly initialize.
void Initialize();
virtual bool Execute(DataAdaptor* data);
// NOTE: we might need to provide a method to accept some kind of pipeline description.
//BTX
protected:
AnalysisAdaptor();
~AnalysisAdaptor();
private:
AnalysisAdaptor(const AnalysisAdaptor&); // Not implemented.
void operator=(const AnalysisAdaptor&); // Not implemented.
class PrivateData;
PrivateData *d;
//ETX
};
} // libsim
} // sensei
#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