Commit 6e56d34a authored by Andrew Bauer's avatar Andrew Bauer
Browse files

Catalyst computes the extents for topologically structured grids

parent 81eff7b9
......@@ -52,7 +52,8 @@ if(ENABLE_CATALYST)
set(CATALYST_PYTHON_MODULE "vtkPVPythonCatalyst")
endif()
find_package(ParaView QUIET COMPONENTS vtkPVCatalyst vtkCommonDataModel vtkPVServerManagerRendering ${CATALYST_PYTHON_MODULE})
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 "
......
......@@ -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