mirror of
https://gitlab.kitware.com/vtk/vtk-m
synced 2024-09-19 18:45:43 +00:00
Adding testing paths for Curvilinear case
Adding testing paths for curvilinear case Changing names of interpolation helpers to be consistent Rectifying interpolation helper error messages to reflect correct location and types of failures
This commit is contained in:
parent
f454912813
commit
1df07f7395
@ -100,18 +100,18 @@ private:
|
||||
};
|
||||
|
||||
template <typename DeviceAdapter>
|
||||
class SingleCellExplicitInterpolationHelper : public vtkm::exec::CellInterpolationHelper
|
||||
class SingleCellTypeInterpolationHelper : public vtkm::exec::CellInterpolationHelper
|
||||
{
|
||||
using ConnType = vtkm::cont::ArrayHandle<vtkm::Id>;
|
||||
using ConnPortalType = typename ConnType::template ExecutionTypes<DeviceAdapter>::PortalConst;
|
||||
|
||||
public:
|
||||
SingleCellExplicitInterpolationHelper() = default;
|
||||
SingleCellTypeInterpolationHelper() = default;
|
||||
|
||||
VTKM_CONT
|
||||
SingleCellExplicitInterpolationHelper(vtkm::UInt8 cellShape,
|
||||
vtkm::IdComponent pointsPerCell,
|
||||
const ConnType& connectivity)
|
||||
SingleCellTypeInterpolationHelper(vtkm::UInt8 cellShape,
|
||||
vtkm::IdComponent pointsPerCell,
|
||||
const ConnType& connectivity)
|
||||
: CellShape(cellShape)
|
||||
, PointsPerCell(pointsPerCell)
|
||||
, Connectivity(connectivity.PrepareForInput(DeviceAdapter()))
|
||||
@ -140,7 +140,7 @@ private:
|
||||
};
|
||||
|
||||
template <typename DeviceAdapter>
|
||||
class CellExplicitInterpolationHelper : public vtkm::exec::CellInterpolationHelper
|
||||
class ExplicitCellInterpolationHelper : public vtkm::exec::CellInterpolationHelper
|
||||
{
|
||||
using ShapeType = vtkm::cont::ArrayHandle<vtkm::UInt8>;
|
||||
using NumIdxType = vtkm::cont::ArrayHandle<vtkm::IdComponent>;
|
||||
@ -153,10 +153,10 @@ class CellExplicitInterpolationHelper : public vtkm::exec::CellInterpolationHelp
|
||||
using ConnPortalType = typename ConnType::template ExecutionTypes<DeviceAdapter>::PortalConst;
|
||||
|
||||
public:
|
||||
CellExplicitInterpolationHelper() = default;
|
||||
ExplicitCellInterpolationHelper() = default;
|
||||
|
||||
VTKM_CONT
|
||||
CellExplicitInterpolationHelper(const ShapeType& shape,
|
||||
ExplicitCellInterpolationHelper(const ShapeType& shape,
|
||||
const NumIdxType& numIdx,
|
||||
const OffsetType& offset,
|
||||
const ConnType& connectivity)
|
||||
@ -237,7 +237,7 @@ public:
|
||||
cellSet.Cast<Structured3DType>().GetSchedulingRange(vtkm::TopologyElementTagPoint());
|
||||
}
|
||||
else
|
||||
throw vtkm::cont::ErrorBadType("Cell set is not structured type");
|
||||
throw vtkm::cont::ErrorBadType("Cell set is not of type CellSetStructured");
|
||||
}
|
||||
|
||||
VTKM_CONT
|
||||
@ -265,15 +265,15 @@ private:
|
||||
mutable HandleType ExecHandle;
|
||||
};
|
||||
|
||||
class SingleCellExplicitInterpolationHelper : public vtkm::cont::CellInterpolationHelper
|
||||
class SingleCellTypeInterpolationHelper : public vtkm::cont::CellInterpolationHelper
|
||||
{
|
||||
public:
|
||||
using SingleExplicitType = vtkm::cont::CellSetSingleType<>;
|
||||
|
||||
SingleCellExplicitInterpolationHelper() = default;
|
||||
SingleCellTypeInterpolationHelper() = default;
|
||||
|
||||
VTKM_CONT
|
||||
SingleCellExplicitInterpolationHelper(const vtkm::cont::DynamicCellSet& cellSet)
|
||||
SingleCellTypeInterpolationHelper(const vtkm::cont::DynamicCellSet& cellSet)
|
||||
{
|
||||
if (cellSet.IsSameType(SingleExplicitType()))
|
||||
{
|
||||
@ -290,18 +290,17 @@ public:
|
||||
vtkm::TopologyElementTagPoint());
|
||||
}
|
||||
else
|
||||
throw vtkm::cont::ErrorBadType("Cell set is not CellSetSingleType");
|
||||
throw vtkm::cont::ErrorBadType("Cell set is not of type CellSetSingleType");
|
||||
}
|
||||
|
||||
struct SingleCellExplicitFunctor
|
||||
struct SingleCellTypeFunctor
|
||||
{
|
||||
template <typename DeviceAdapter>
|
||||
VTKM_CONT bool operator()(
|
||||
DeviceAdapter,
|
||||
const vtkm::cont::SingleCellExplicitInterpolationHelper& contInterpolator,
|
||||
HandleType& execInterpolator) const
|
||||
VTKM_CONT bool operator()(DeviceAdapter,
|
||||
const vtkm::cont::SingleCellTypeInterpolationHelper& contInterpolator,
|
||||
HandleType& execInterpolator) const
|
||||
{
|
||||
using ExecutionType = vtkm::exec::SingleCellExplicitInterpolationHelper<DeviceAdapter>;
|
||||
using ExecutionType = vtkm::exec::SingleCellTypeInterpolationHelper<DeviceAdapter>;
|
||||
ExecutionType* execObject = new ExecutionType(
|
||||
contInterpolator.CellShape, contInterpolator.PointsPerCell, contInterpolator.Connectivity);
|
||||
execInterpolator.Reset(execObject);
|
||||
@ -313,11 +312,11 @@ public:
|
||||
const vtkm::exec::CellInterpolationHelper* PrepareForExecution(
|
||||
vtkm::cont::DeviceAdapterId deviceId) const override
|
||||
{
|
||||
const bool success = vtkm::cont::TryExecuteOnDevice(
|
||||
deviceId, SingleCellExplicitFunctor(), *this, this->ExecHandle);
|
||||
const bool success =
|
||||
vtkm::cont::TryExecuteOnDevice(deviceId, SingleCellTypeFunctor(), *this, this->ExecHandle);
|
||||
if (!success)
|
||||
{
|
||||
throwFailedRuntimeDeviceTransfer("SingleCellExplicitInterpolationHelper", deviceId);
|
||||
throwFailedRuntimeDeviceTransfer("SingleCellTypeInterpolationHelper", deviceId);
|
||||
}
|
||||
return this->ExecHandle.PrepareForExecution(deviceId);
|
||||
}
|
||||
@ -329,13 +328,13 @@ private:
|
||||
mutable HandleType ExecHandle;
|
||||
};
|
||||
|
||||
class CellExplicitInterpolationHelper : public vtkm::cont::CellInterpolationHelper
|
||||
class ExplicitCellInterpolationHelper : public vtkm::cont::CellInterpolationHelper
|
||||
{
|
||||
public:
|
||||
CellExplicitInterpolationHelper() = default;
|
||||
ExplicitCellInterpolationHelper() = default;
|
||||
|
||||
VTKM_CONT
|
||||
CellExplicitInterpolationHelper(const vtkm::cont::DynamicCellSet& cellSet)
|
||||
ExplicitCellInterpolationHelper(const vtkm::cont::DynamicCellSet& cellSet)
|
||||
{
|
||||
if (cellSet.IsSameType(vtkm::cont::CellSetExplicit<>()))
|
||||
{
|
||||
@ -350,17 +349,17 @@ public:
|
||||
vtkm::TopologyElementTagPoint());
|
||||
}
|
||||
else
|
||||
throw vtkm::cont::ErrorBadType("Cell set is not CellSetSingleType");
|
||||
throw vtkm::cont::ErrorBadType("Cell set is not of type CellSetExplicit");
|
||||
}
|
||||
|
||||
struct SingleCellExplicitFunctor
|
||||
struct ExplicitCellFunctor
|
||||
{
|
||||
template <typename DeviceAdapter>
|
||||
VTKM_CONT bool operator()(DeviceAdapter,
|
||||
const vtkm::cont::CellExplicitInterpolationHelper& contInterpolator,
|
||||
const vtkm::cont::ExplicitCellInterpolationHelper& contInterpolator,
|
||||
HandleType& execInterpolator) const
|
||||
{
|
||||
using ExecutionType = vtkm::exec::CellExplicitInterpolationHelper<DeviceAdapter>;
|
||||
using ExecutionType = vtkm::exec::ExplicitCellInterpolationHelper<DeviceAdapter>;
|
||||
ExecutionType* execObject = new ExecutionType(contInterpolator.Shape,
|
||||
contInterpolator.NumIdx,
|
||||
contInterpolator.Offset,
|
||||
@ -374,11 +373,11 @@ public:
|
||||
const vtkm::exec::CellInterpolationHelper* PrepareForExecution(
|
||||
vtkm::cont::DeviceAdapterId deviceId) const override
|
||||
{
|
||||
const bool success = vtkm::cont::TryExecuteOnDevice(
|
||||
deviceId, SingleCellExplicitFunctor(), *this, this->ExecHandle);
|
||||
const bool success =
|
||||
vtkm::cont::TryExecuteOnDevice(deviceId, ExplicitCellFunctor(), *this, this->ExecHandle);
|
||||
if (!success)
|
||||
{
|
||||
throwFailedRuntimeDeviceTransfer("SingleCellExplicitInterpolationHelper", deviceId);
|
||||
throwFailedRuntimeDeviceTransfer("ExplicitCellInterpolationHelper", deviceId);
|
||||
}
|
||||
return this->ExecHandle.PrepareForExecution(deviceId);
|
||||
}
|
||||
|
@ -148,9 +148,6 @@ public:
|
||||
locator.SetCellSet(cellset);
|
||||
locator.Update();
|
||||
this->Locator = std::make_shared<vtkm::cont::CellLocatorUniformGrid>(locator);
|
||||
vtkm::cont::StructuredCellInterpolationHelper interpolationHelper(cellset);
|
||||
this->InterpolationHelper =
|
||||
std::make_shared<vtkm::cont::StructuredCellInterpolationHelper>(interpolationHelper);
|
||||
}
|
||||
else if (coordinates.GetData().IsType<RectilinearType>())
|
||||
{
|
||||
@ -159,22 +156,19 @@ public:
|
||||
locator.SetCellSet(cellset);
|
||||
locator.Update();
|
||||
this->Locator = std::make_shared<vtkm::cont::CellLocatorRectilinearGrid>(locator);
|
||||
vtkm::cont::StructuredCellInterpolationHelper interpolationHelper(cellset);
|
||||
this->InterpolationHelper =
|
||||
std::make_shared<vtkm::cont::StructuredCellInterpolationHelper>(interpolationHelper);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Default to using an explicit grid.
|
||||
// Default to using an locator for explicit meshes.
|
||||
vtkm::cont::CellLocatorUniformBins locator;
|
||||
locator.SetCoordinates(coordinates);
|
||||
locator.SetCellSet(cellset);
|
||||
locator.Update();
|
||||
this->Locator = std::make_shared<vtkm::cont::CellLocatorUniformBins>(locator);
|
||||
vtkm::cont::CellExplicitInterpolationHelper interpolationHelper(cellset);
|
||||
this->InterpolationHelper =
|
||||
std::make_shared<vtkm::cont::CellExplicitInterpolationHelper>(interpolationHelper);
|
||||
}
|
||||
vtkm::cont::StructuredCellInterpolationHelper interpolationHelper(cellset);
|
||||
this->InterpolationHelper =
|
||||
std::make_shared<vtkm::cont::StructuredCellInterpolationHelper>(interpolationHelper);
|
||||
}
|
||||
else if (cellset.IsSameType(vtkm::cont::CellSetSingleType<>()))
|
||||
{
|
||||
@ -183,9 +177,9 @@ public:
|
||||
locator.SetCellSet(cellset);
|
||||
locator.Update();
|
||||
this->Locator = std::make_shared<vtkm::cont::CellLocatorUniformBins>(locator);
|
||||
vtkm::cont::SingleCellExplicitInterpolationHelper interpolationHelper(cellset);
|
||||
vtkm::cont::SingleCellTypeInterpolationHelper interpolationHelper(cellset);
|
||||
this->InterpolationHelper =
|
||||
std::make_shared<vtkm::cont::SingleCellExplicitInterpolationHelper>(interpolationHelper);
|
||||
std::make_shared<vtkm::cont::SingleCellTypeInterpolationHelper>(interpolationHelper);
|
||||
}
|
||||
else if (cellset.IsSameType(vtkm::cont::CellSetExplicit<>()))
|
||||
{
|
||||
@ -194,9 +188,9 @@ public:
|
||||
locator.SetCellSet(cellset);
|
||||
locator.Update();
|
||||
this->Locator = std::make_shared<vtkm::cont::CellLocatorUniformBins>(locator);
|
||||
vtkm::cont::CellExplicitInterpolationHelper interpolationHelper(cellset);
|
||||
vtkm::cont::ExplicitCellInterpolationHelper interpolationHelper(cellset);
|
||||
this->InterpolationHelper =
|
||||
std::make_shared<vtkm::cont::CellExplicitInterpolationHelper>(interpolationHelper);
|
||||
std::make_shared<vtkm::cont::ExplicitCellInterpolationHelper>(interpolationHelper);
|
||||
}
|
||||
else
|
||||
throw vtkm::cont::ErrorInternal("Unsupported cellset type.");
|
||||
|
@ -213,25 +213,51 @@ vtkm::cont::DataSet CreateWeirdnessFromStructuredDataSet(const vtkm::cont::DataS
|
||||
vtkm::cont::DataSet output;
|
||||
vtkm::cont::DataSetBuilderExplicit dsb;
|
||||
|
||||
if (cellSet.IsType<vtkm::cont::CellSetStructured<2>>())
|
||||
using Structured2DType = vtkm::cont::CellSetStructured<2>;
|
||||
using Structured3DType = vtkm::cont::CellSetStructured<3>;
|
||||
|
||||
switch (option)
|
||||
{
|
||||
vtkm::cont::CellSetStructured<2> cells2D = cellSet.Cast<vtkm::cont::CellSetStructured<2>>();
|
||||
vtkm::Id2 cellDims = cells2D.GetCellDimensions();
|
||||
MakeExplicitCells(cells2D, cellDims, numIndices, shapes, conn);
|
||||
if (createSingleType)
|
||||
output = dsb.Create(explCoords, vtkm::CellShapeTagQuad(), 4, conn, "coordinates");
|
||||
else
|
||||
output = dsb.Create(explCoords, shapes, numIndices, conn, "coordinates");
|
||||
}
|
||||
else if (cellSet.IsType<vtkm::cont::CellSetStructured<3>>())
|
||||
{
|
||||
vtkm::cont::CellSetStructured<3> cells3D = cellSet.Cast<vtkm::cont::CellSetStructured<3>>();
|
||||
vtkm::Id3 cellDims = cells3D.GetCellDimensions();
|
||||
MakeExplicitCells(cells3D, cellDims, numIndices, shapes, conn);
|
||||
if (createSingleType)
|
||||
output = dsb.Create(explCoords, vtkm::CellShapeTagHexahedron(), 8, conn, "coordinates");
|
||||
else
|
||||
output = dsb.Create(explCoords, shapes, numIndices, conn, "coordinates");
|
||||
case DataSetOption::SINGLE:
|
||||
if (cellSet.IsType<Structured2DType>())
|
||||
{
|
||||
Structured2DType cells2D = cellSet.Cast<Structured2DType>();
|
||||
vtkm::Id2 cellDims = cells2D.GetCellDimensions();
|
||||
MakeExplicitCells(cells2D, cellDims, numIndices, shapes, conn);
|
||||
output = dsb.Create(explCoords, vtkm::CellShapeTagQuad(), 4, conn, "coordinates");
|
||||
}
|
||||
else
|
||||
{
|
||||
Structured3DType cells3D = cellSet.Cast<Structured3DType>();
|
||||
vtkm::Id3 cellDims = cells3D.GetCellDimensions();
|
||||
MakeExplicitCells(cells3D, cellDims, numIndices, shapes, conn);
|
||||
output = dsb.Create(explCoords, vtkm::CellShapeTagHexahedron(), 8, conn, "coordinates");
|
||||
}
|
||||
break;
|
||||
|
||||
case DataSetOption::CURVILINEAR:
|
||||
// In this case the cell set/connectivity is the same as the input
|
||||
// Only the coords are no longer Uniform / Rectilinear
|
||||
output.SetCellSet(cellSet);
|
||||
output.AddCoordinateSystem(vtkm::cont::CoordinateSystem("coordinates", explCoords));
|
||||
break;
|
||||
|
||||
case DataSetOption::EXPLICIT:
|
||||
if (cellSet.IsType<Structured2DType>())
|
||||
{
|
||||
Structured2DType cells2D = cellSet.Cast<Structured2DType>();
|
||||
vtkm::Id2 cellDims = cells2D.GetCellDimensions();
|
||||
MakeExplicitCells(cells2D, cellDims, numIndices, shapes, conn);
|
||||
output = dsb.Create(explCoords, shapes, numIndices, conn, "coordinates");
|
||||
}
|
||||
else
|
||||
{
|
||||
Structured3DType cells3D = cellSet.Cast<Structured3DType>();
|
||||
vtkm::Id3 cellDims = cells3D.GetCellDimensions();
|
||||
MakeExplicitCells(cells3D, cellDims, numIndices, shapes, conn);
|
||||
output = dsb.Create(explCoords, shapes, numIndices, conn, "coordinates");
|
||||
}
|
||||
break;
|
||||
}
|
||||
return output;
|
||||
}
|
||||
@ -506,15 +532,6 @@ void ValidateStreamlineResult(const vtkm::worklet::StreamlineResult& res,
|
||||
for (vtkm::Id i = 0; i < nSeeds; i++)
|
||||
VTKM_TEST_ASSERT(res.stepsTaken.GetPortalConstControl().Get(i) <= maxSteps,
|
||||
"Too many steps taken in streamline");
|
||||
|
||||
/*
|
||||
vtkm::cont::DataSet ds;
|
||||
ds.AddCoordinateSystem(vtkm::cont::CoordinateSystem("coords", res.positions));
|
||||
ds.SetCellSet(res.polyLines);
|
||||
ds.PrintSummary(std::cout);
|
||||
vtkm::io::writer::VTKDataSetWriter writer1("ds.vtk");
|
||||
writer1.WriteDataSet(ds);
|
||||
*/
|
||||
}
|
||||
|
||||
void TestParticleWorklets()
|
||||
|
Loading…
Reference in New Issue
Block a user