291 lines
13 KiB
Diff
Executable file
291 lines
13 KiB
Diff
Executable file
diff --git a/Accelerators/Vtkm/Core/vtkmlib/DataArrayConverters.h b/Accelerators/Vtkm/Core/vtkmlib/DataArrayConverters.h
|
|
index 0b3f1a963063cdf5f1685dbde55deaaea7a77d2f..24198dada846d6d81fb9f1c155e5a6612e1e7055 100644
|
|
--- a/Accelerators/Vtkm/Core/vtkmlib/DataArrayConverters.h
|
|
+++ b/Accelerators/Vtkm/Core/vtkmlib/DataArrayConverters.h
|
|
@@ -25,6 +25,7 @@
|
|
|
|
#include <vtkm/cont/ArrayHandleSOA.h>
|
|
#include <vtkm/cont/Field.h>
|
|
+#include <vtkm/cont/VariantArrayHandle.h>
|
|
|
|
#include <type_traits> // for std::underlying_type
|
|
|
|
diff --git a/Accelerators/Vtkm/DataModel/Testing/Cxx/TestVTKMDataSet.cxx b/Accelerators/Vtkm/DataModel/Testing/Cxx/TestVTKMDataSet.cxx
|
|
index ec41b18b60db354a8c4a1532eb5cedfd70ce7534..2493ae5b03cf29c5dfc90614489a8049fc623715 100644
|
|
--- a/Accelerators/Vtkm/DataModel/Testing/Cxx/TestVTKMDataSet.cxx
|
|
+++ b/Accelerators/Vtkm/DataModel/Testing/Cxx/TestVTKMDataSet.cxx
|
|
@@ -274,18 +274,19 @@ vtkm::cont::testing::MakeTestDataSet Maker;
|
|
void TestUniformDataSet()
|
|
{
|
|
auto dataset = Maker.Make3DUniformDataSet0();
|
|
- auto coords =
|
|
- dataset.GetCoordinateSystem().GetData().Cast<vtkm::cont::ArrayHandleUniformPointCoordinates>();
|
|
+ auto coords = dataset.GetCoordinateSystem()
|
|
+ .GetData()
|
|
+ .AsArrayHandle<vtkm::cont::ArrayHandleUniformPointCoordinates>();
|
|
auto portal = coords.ReadPortal();
|
|
auto dims = portal.GetDimensions();
|
|
auto origin = portal.GetOrigin();
|
|
auto spacing = portal.GetSpacing();
|
|
|
|
vtkNew<vtkFloatArray> pointField, cellField;
|
|
- FieldCopy(dataset.GetField("pointvar").GetData().Cast<vtkm::cont::ArrayHandle<float>>(),
|
|
+ FieldCopy(dataset.GetField("pointvar").GetData().AsArrayHandle<vtkm::cont::ArrayHandle<float>>(),
|
|
"pointvar", pointField);
|
|
- FieldCopy(dataset.GetField("cellvar").GetData().Cast<vtkm::cont::ArrayHandle<float>>(), "cellvar",
|
|
- cellField);
|
|
+ FieldCopy(dataset.GetField("cellvar").GetData().AsArrayHandle<vtkm::cont::ArrayHandle<float>>(),
|
|
+ "cellvar", cellField);
|
|
|
|
vtkNew<vtkImageData> imageData;
|
|
imageData->SetDimensions(dims[0], dims[1], dims[2]);
|
|
@@ -315,10 +316,10 @@ void TestCurvilinearDataSet()
|
|
CoordsCopy(dataset.GetCoordinateSystem(), points);
|
|
|
|
vtkNew<vtkFloatArray> pointField, cellField;
|
|
- FieldCopy(dataset.GetField("pointvar").GetData().Cast<vtkm::cont::ArrayHandle<float>>(),
|
|
+ FieldCopy(dataset.GetField("pointvar").GetData().AsArrayHandle<vtkm::cont::ArrayHandle<float>>(),
|
|
"pointvar", pointField);
|
|
- FieldCopy(dataset.GetField("cellvar").GetData().Cast<vtkm::cont::ArrayHandle<float>>(), "cellvar",
|
|
- cellField);
|
|
+ FieldCopy(dataset.GetField("cellvar").GetData().AsArrayHandle<vtkm::cont::ArrayHandle<float>>(),
|
|
+ "cellvar", cellField);
|
|
|
|
vtkNew<vtkStructuredGrid> dsVtk;
|
|
dsVtk->SetDimensions(dims[0], dims[1], dims[2]);
|
|
@@ -357,10 +358,10 @@ void TestExplicitDataSet()
|
|
}
|
|
|
|
vtkNew<vtkFloatArray> pointField, cellField;
|
|
- FieldCopy(dataset.GetField("pointvar").GetData().Cast<vtkm::cont::ArrayHandle<float>>(),
|
|
+ FieldCopy(dataset.GetField("pointvar").GetData().AsArrayHandle<vtkm::cont::ArrayHandle<float>>(),
|
|
"pointvar", pointField);
|
|
- FieldCopy(dataset.GetField("cellvar").GetData().Cast<vtkm::cont::ArrayHandle<float>>(), "cellvar",
|
|
- cellField);
|
|
+ FieldCopy(dataset.GetField("cellvar").GetData().AsArrayHandle<vtkm::cont::ArrayHandle<float>>(),
|
|
+ "cellvar", cellField);
|
|
|
|
vtkNew<vtkUnstructuredGrid> dsVtk;
|
|
dsVtk->SetPoints(points);
|
|
diff --git a/Accelerators/Vtkm/DataModel/vtkmDataSet.cxx b/Accelerators/Vtkm/DataModel/vtkmDataSet.cxx
|
|
index 147c3c6e175dbd342095805750bfc4fee81735dc..f1ef72ffae91ca843ca56bdc305ab68bbc955157 100644
|
|
--- a/Accelerators/Vtkm/DataModel/vtkmDataSet.cxx
|
|
+++ b/Accelerators/Vtkm/DataModel/vtkmDataSet.cxx
|
|
@@ -35,8 +35,7 @@
|
|
#include <vtkm/cont/CellLocatorGeneral.h>
|
|
#include <vtkm/cont/DataSet.h>
|
|
#include <vtkm/cont/Invoker.h>
|
|
-#include <vtkm/cont/PointLocator.h>
|
|
-#include <vtkm/cont/PointLocatorUniformGrid.h>
|
|
+#include <vtkm/cont/PointLocatorSparseGrid.h>
|
|
#include <vtkm/worklet/ScatterPermutation.h>
|
|
|
|
#include <mutex>
|
|
@@ -62,8 +61,8 @@ struct vtkmDataSet::DataMembers
|
|
vtkm::cont::CoordinateSystem Coordinates;
|
|
vtkNew<vtkGenericCell> Cell;
|
|
|
|
- VtkmLocator<vtkm::cont::PointLocator> PointLocator;
|
|
- VtkmLocator<vtkm::cont::CellLocator> CellLocator;
|
|
+ VtkmLocator<vtkm::cont::PointLocatorSparseGrid> PointLocator;
|
|
+ VtkmLocator<vtkm::cont::CellLocatorGeneral> CellLocator;
|
|
};
|
|
|
|
//------------------------------------------------------------------------------
|
|
@@ -172,7 +171,7 @@ void vtkmDataSet::GetCellBounds(vtkIdType cellId, double bounds[6])
|
|
this->Internals->CellSet.IsType<vtkm::cont::CellSetStructured<3>>())
|
|
{
|
|
auto portal = this->Internals->Coordinates.GetData()
|
|
- .Cast<vtkm::cont::ArrayHandleUniformPointCoordinates>()
|
|
+ .AsArrayHandle<vtkm::cont::ArrayHandleUniformPointCoordinates>()
|
|
.ReadPortal();
|
|
|
|
vtkm::internal::ConnectivityStructuredInternals<3> helper;
|
|
@@ -279,7 +278,7 @@ vtkIdType vtkmDataSet::FindPoint(double x[3])
|
|
vtkm::Id pointId = -1;
|
|
vtkm::FloatDefault d2 = 0;
|
|
// exec object created for the Serial device can be called directly
|
|
- execLocator->FindNearestNeighbor(point, pointId, d2);
|
|
+ execLocator.FindNearestNeighbor(point, pointId, d2);
|
|
return pointId;
|
|
}
|
|
|
|
@@ -316,7 +315,7 @@ vtkIdType vtkmDataSet::FindCell(double x[3], vtkCell*, vtkGenericCell*, vtkIdTyp
|
|
vtkm::Vec<vtkm::FloatDefault, 3> pc;
|
|
vtkm::Id cellId = -1;
|
|
// exec object created for the Serial device can be called directly
|
|
- execLocator->FindCell(point, cellId, pc);
|
|
+ execLocator.FindCell(point, cellId, pc);
|
|
|
|
if (cellId >= 0)
|
|
{
|
|
diff --git a/Accelerators/Vtkm/DataModel/vtkmlib/ImageDataConverter.cxx b/Accelerators/Vtkm/DataModel/vtkmlib/ImageDataConverter.cxx
|
|
index 351c0d5ce169cf455d2d3c0a1307ba8e60510371..c7ecff3c9fc5eafecb9dd11d9dbea15cbd44bd3d 100644
|
|
--- a/Accelerators/Vtkm/DataModel/vtkmlib/ImageDataConverter.cxx
|
|
+++ b/Accelerators/Vtkm/DataModel/vtkmlib/ImageDataConverter.cxx
|
|
@@ -121,7 +121,7 @@ bool Convert(
|
|
return false;
|
|
}
|
|
|
|
- auto points = cs.GetData().Cast<vtkm::cont::ArrayHandleUniformPointCoordinates>();
|
|
+ auto points = cs.GetData().AsArrayHandle<vtkm::cont::ArrayHandleUniformPointCoordinates>();
|
|
auto portal = points.ReadPortal();
|
|
|
|
auto origin = portal.GetOrigin();
|
|
@@ -156,7 +156,7 @@ bool Convert(const vtkm::cont::DataSet& voutput, vtkImageData* output, vtkDataSe
|
|
return false;
|
|
}
|
|
|
|
- auto points = cs.GetData().Cast<vtkm::cont::ArrayHandleUniformPointCoordinates>();
|
|
+ auto points = cs.GetData().AsArrayHandle<vtkm::cont::ArrayHandleUniformPointCoordinates>();
|
|
auto portal = points.ReadPortal();
|
|
|
|
auto dim = portal.GetDimensions();
|
|
diff --git a/Accelerators/Vtkm/DataModel/vtkmlib/ImplicitFunctionConverter.cxx b/Accelerators/Vtkm/DataModel/vtkmlib/ImplicitFunctionConverter.cxx
|
|
index f2411d0e70505435cd312ee23b3cb2e653eb28d8..814af43cc168b4c3b44107b0c19e68cc1b42538d 100644
|
|
--- a/Accelerators/Vtkm/DataModel/vtkmlib/ImplicitFunctionConverter.cxx
|
|
+++ b/Accelerators/Vtkm/DataModel/vtkmlib/ImplicitFunctionConverter.cxx
|
|
@@ -52,8 +52,7 @@ void ImplicitFunctionConverter::Set(vtkImplicitFunction* function)
|
|
box->GetXMin(xmin);
|
|
box->GetXMax(xmax);
|
|
|
|
- auto b = new vtkm::Box(MakeFVec3(xmin), MakeFVec3(xmax));
|
|
- this->OutFunction.Reset(b, true);
|
|
+ this->OutFunction = vtkm::Box(MakeFVec3(xmin), MakeFVec3(xmax));
|
|
}
|
|
else if ((cylinder = vtkCylinder::SafeDownCast(function)))
|
|
{
|
|
@@ -62,9 +61,8 @@ void ImplicitFunctionConverter::Set(vtkImplicitFunction* function)
|
|
cylinder->GetAxis(axis);
|
|
radius = cylinder->GetRadius();
|
|
|
|
- auto c = new vtkm::Cylinder(
|
|
- MakeFVec3(center), MakeFVec3(axis), static_cast<vtkm::FloatDefault>(radius));
|
|
- this->OutFunction.Reset(c, true);
|
|
+ this->OutFunction =
|
|
+ vtkm::Cylinder(MakeFVec3(center), MakeFVec3(axis), static_cast<vtkm::FloatDefault>(radius));
|
|
}
|
|
else if ((plane = vtkPlane::SafeDownCast(function)))
|
|
{
|
|
@@ -72,8 +70,7 @@ void ImplicitFunctionConverter::Set(vtkImplicitFunction* function)
|
|
plane->GetOrigin(origin);
|
|
plane->GetNormal(normal);
|
|
|
|
- auto p = new vtkm::Plane(MakeFVec3(origin), MakeFVec3(normal));
|
|
- this->OutFunction.Reset(p, true);
|
|
+ this->OutFunction = vtkm::Plane(MakeFVec3(origin), MakeFVec3(normal));
|
|
}
|
|
else if ((sphere = vtkSphere::SafeDownCast(function)))
|
|
{
|
|
@@ -81,8 +78,7 @@ void ImplicitFunctionConverter::Set(vtkImplicitFunction* function)
|
|
sphere->GetCenter(center);
|
|
radius = sphere->GetRadius();
|
|
|
|
- auto s = new vtkm::Sphere(MakeFVec3(center), static_cast<vtkm::FloatDefault>(radius));
|
|
- this->OutFunction.Reset(s, true);
|
|
+ this->OutFunction = vtkm::Sphere(MakeFVec3(center), static_cast<vtkm::FloatDefault>(radius));
|
|
}
|
|
else
|
|
{
|
|
@@ -95,7 +91,7 @@ void ImplicitFunctionConverter::Set(vtkImplicitFunction* function)
|
|
this->InFunction = function;
|
|
}
|
|
|
|
-const vtkm::cont::ImplicitFunctionHandle& ImplicitFunctionConverter::Get() const
|
|
+const vtkm::ImplicitFunctionGeneral& ImplicitFunctionConverter::Get()
|
|
{
|
|
if (this->InFunction && (this->MTime < this->InFunction->GetMTime()))
|
|
{
|
|
@@ -110,9 +106,7 @@ const vtkm::cont::ImplicitFunctionHandle& ImplicitFunctionConverter::Get() const
|
|
box->GetXMin(xmin);
|
|
box->GetXMax(xmax);
|
|
|
|
- auto b = static_cast<vtkm::Box*>(this->OutFunction.Get());
|
|
- b->SetMinPoint(MakeFVec3(xmin));
|
|
- b->SetMaxPoint(MakeFVec3(xmax));
|
|
+ this->OutFunction = vtkm::Box(MakeFVec3(xmin), MakeFVec3(xmax));
|
|
}
|
|
else if ((cylinder = vtkCylinder::SafeDownCast(this->InFunction)))
|
|
{
|
|
@@ -121,10 +115,8 @@ const vtkm::cont::ImplicitFunctionHandle& ImplicitFunctionConverter::Get() const
|
|
cylinder->GetAxis(axis);
|
|
radius = cylinder->GetRadius();
|
|
|
|
- auto c = static_cast<vtkm::Cylinder*>(this->OutFunction.Get());
|
|
- c->SetCenter(MakeFVec3(center));
|
|
- c->SetAxis(MakeFVec3(axis));
|
|
- c->SetRadius(static_cast<vtkm::FloatDefault>(radius));
|
|
+ this->OutFunction =
|
|
+ vtkm::Cylinder(MakeFVec3(center), MakeFVec3(axis), static_cast<vtkm::FloatDefault>(radius));
|
|
}
|
|
else if ((plane = vtkPlane::SafeDownCast(this->InFunction)))
|
|
{
|
|
@@ -132,9 +124,7 @@ const vtkm::cont::ImplicitFunctionHandle& ImplicitFunctionConverter::Get() const
|
|
plane->GetOrigin(origin);
|
|
plane->GetNormal(normal);
|
|
|
|
- auto p = static_cast<vtkm::Plane*>(this->OutFunction.Get());
|
|
- p->SetOrigin(MakeFVec3(origin));
|
|
- p->SetNormal(MakeFVec3(normal));
|
|
+ this->OutFunction = vtkm::Plane(MakeFVec3(origin), MakeFVec3(normal));
|
|
}
|
|
else if ((sphere = vtkSphere::SafeDownCast(this->InFunction)))
|
|
{
|
|
@@ -142,9 +132,7 @@ const vtkm::cont::ImplicitFunctionHandle& ImplicitFunctionConverter::Get() const
|
|
sphere->GetCenter(center);
|
|
radius = sphere->GetRadius();
|
|
|
|
- auto s = static_cast<vtkm::Sphere*>(this->OutFunction.Get());
|
|
- s->SetCenter(MakeFVec3(center));
|
|
- s->SetRadius(static_cast<vtkm::FloatDefault>(radius));
|
|
+ this->OutFunction = vtkm::Sphere(MakeFVec3(center), static_cast<vtkm::FloatDefault>(radius));
|
|
}
|
|
|
|
this->MTime = this->InFunction->GetMTime();
|
|
diff --git a/Accelerators/Vtkm/DataModel/vtkmlib/ImplicitFunctionConverter.h b/Accelerators/Vtkm/DataModel/vtkmlib/ImplicitFunctionConverter.h
|
|
index 10e2ae99ae819ca86516bf7ab5a0988c75b6323e..a1a571c93d44a7d62f79afc86aab05d1f359af82 100644
|
|
--- a/Accelerators/Vtkm/DataModel/vtkmlib/ImplicitFunctionConverter.h
|
|
+++ b/Accelerators/Vtkm/DataModel/vtkmlib/ImplicitFunctionConverter.h
|
|
@@ -20,7 +20,7 @@
|
|
#include "vtkType.h" // For vtkMTimeType
|
|
#include "vtkmConfigDataModel.h" //required for general vtkm setup
|
|
|
|
-#include "vtkm/cont/ImplicitFunctionHandle.h"
|
|
+#include "vtkm/ImplicitFunction.h"
|
|
|
|
class vtkImplicitFunction;
|
|
|
|
@@ -33,11 +33,11 @@ public:
|
|
ImplicitFunctionConverter();
|
|
|
|
void Set(vtkImplicitFunction*);
|
|
- const vtkm::cont::ImplicitFunctionHandle& Get() const;
|
|
+ const vtkm::ImplicitFunctionGeneral& Get();
|
|
|
|
private:
|
|
vtkImplicitFunction* InFunction;
|
|
- vtkm::cont::ImplicitFunctionHandle OutFunction;
|
|
+ vtkm::ImplicitFunctionGeneral OutFunction;
|
|
mutable vtkMTimeType MTime;
|
|
};
|
|
|
|
diff --git a/Accelerators/Vtkm/Filters/vtkmClipInstantiationsWithImplicitFunction.cxx b/Accelerators/Vtkm/Filters/vtkmClipInstantiationsWithImplicitFunction.cxx
|
|
index 04a637a92d487b019742bbf81884750c48ba105d..674d9b6e0dfe36edd787e519e70ec0bf46602c81 100644
|
|
--- a/Accelerators/Vtkm/Filters/vtkmClipInstantiationsWithImplicitFunction.cxx
|
|
+++ b/Accelerators/Vtkm/Filters/vtkmClipInstantiationsWithImplicitFunction.cxx
|
|
@@ -24,12 +24,9 @@ vtkm::cont::DataSet vtkmClip::internals::ExecuteClipWithImplicitFunction(vtkm::c
|
|
auto function = this->ClipFunctionConverter->Get();
|
|
|
|
vtkm::cont::DataSet result;
|
|
- if (function.GetValid())
|
|
- {
|
|
- vtkm::filter::ClipWithImplicitFunction functionFilter;
|
|
- functionFilter.SetImplicitFunction(function);
|
|
- result = functionFilter.Execute(in);
|
|
- }
|
|
+ vtkm::filter::ClipWithImplicitFunction functionFilter;
|
|
+ functionFilter.SetImplicitFunction(function);
|
|
+ result = functionFilter.Execute(in);
|
|
|
|
return result;
|
|
}
|