mirror of
https://gitlab.kitware.com/vtk/vtk-m
synced 2024-09-08 13:23:51 +00:00
Update CoordinateSystem to use the Virtual Array
This commit is contained in:
parent
950b12b1f2
commit
70fcd1d1cc
@ -104,14 +104,11 @@ int main(int argc, char* argv[])
|
||||
output.AddCellSet(outputCellSet);
|
||||
|
||||
|
||||
auto inCoords = input.GetCoordinateSystem(0).GetData();
|
||||
timer.Reset();
|
||||
vtkm::cont::DynamicArrayHandle coords;
|
||||
{
|
||||
FieldMapper<DeviceAdapter> coordMapper(coords, clip, false);
|
||||
input.GetCoordinateSystem(0).GetData().CastAndCall(coordMapper);
|
||||
}
|
||||
auto outCoords = clip.ProcessCellField(inCoords, DeviceAdapter());
|
||||
vtkm::Float64 processCoordinatesTime = timer.GetElapsedTime();
|
||||
output.AddCoordinateSystem(vtkm::cont::CoordinateSystem("coordinates", coords));
|
||||
output.AddCoordinateSystem(vtkm::cont::CoordinateSystem("coordinates", outCoords));
|
||||
|
||||
timer.Reset();
|
||||
for (vtkm::Id i = 0; i < input.GetNumberOfFields(); ++i)
|
||||
|
@ -23,6 +23,7 @@
|
||||
#endif
|
||||
|
||||
#include <vtkm/Math.h>
|
||||
#include <vtkm/cont/ArrayCopy.h>
|
||||
#include <vtkm/cont/ArrayHandle.h>
|
||||
#include <vtkm/cont/DataSet.h>
|
||||
#include <vtkm/worklet/DispatcherMapField.h>
|
||||
@ -68,30 +69,6 @@ Quaternion qrot;
|
||||
int lastx, lasty;
|
||||
int mouse_state = 1;
|
||||
|
||||
//
|
||||
// Functor to retrieve vertex locations from the CoordinateSystem
|
||||
// Actually need a static cast to ArrayHandle from DynamicArrayHandleCoordinateSystem
|
||||
// but haven't been able to figure out what that is
|
||||
//
|
||||
struct GetVertexArray
|
||||
{
|
||||
template <typename ArrayHandleType>
|
||||
VTKM_CONT void operator()(ArrayHandleType array) const
|
||||
{
|
||||
this->GetVertexPortal(array.GetPortalConstControl());
|
||||
}
|
||||
|
||||
private:
|
||||
template <typename PortalType>
|
||||
VTKM_CONT void GetVertexPortal(const PortalType& portal) const
|
||||
{
|
||||
for (vtkm::Id index = 0; index < portal.GetNumberOfValues(); index++)
|
||||
{
|
||||
vertexArray.GetPortalControl().Set(index, portal.Get(index));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
// Initialize the OpenGL state
|
||||
//
|
||||
@ -145,16 +122,10 @@ void displayCall()
|
||||
// Get the cell set, coordinate system and coordinate data
|
||||
vtkm::cont::CellSetExplicit<> cellSet;
|
||||
outDataSet.GetCellSet(0).CopyTo(cellSet);
|
||||
const vtkm::cont::DynamicArrayHandleCoordinateSystem& coordArray =
|
||||
outDataSet.GetCoordinateSystem().GetData();
|
||||
auto coordArray = outDataSet.GetCoordinateSystem().GetData();
|
||||
|
||||
vtkm::Id numberOfCells = cellSet.GetNumberOfCells();
|
||||
vtkm::Id numberOfPoints = coordArray.GetNumberOfValues();
|
||||
|
||||
// Need the actual vertex points from a static cast of the dynamic array but can't get it right
|
||||
// So use cast and call on a functor that stores that dynamic array into static array we created
|
||||
vertexArray.Allocate(numberOfPoints);
|
||||
vtkm::cont::CastAndCall(coordArray, GetVertexArray());
|
||||
vtkm::cont::ArrayCopy(coordArray, vertexArray);
|
||||
|
||||
// Each cell is a polyline
|
||||
glColor3f(1.0f, 0.0f, 0.0f);
|
||||
|
@ -52,9 +52,6 @@ namespace
|
||||
// Takes input uniform grid and outputs unstructured grid of tets
|
||||
static vtkm::cont::DataSet outDataSet;
|
||||
|
||||
// Point location of vertices from a CastAndCall but needs a static cast eventually
|
||||
static vtkm::cont::ArrayHandle<vtkm::Vec<vtkm::Float64, 3>> vertexArray;
|
||||
|
||||
// OpenGL display variables
|
||||
Quaternion qrot;
|
||||
int lastx, lasty;
|
||||
@ -123,30 +120,6 @@ vtkm::cont::DataSet MakeTetrahedralizeExplicitDataSet()
|
||||
return builder.Create();
|
||||
}
|
||||
|
||||
//
|
||||
// Functor to retrieve vertex locations from the CoordinateSystem
|
||||
// Actually need a static cast to ArrayHandle from DynamicArrayHandleCoordinateSystem
|
||||
// but haven't been able to figure out what that is
|
||||
//
|
||||
struct GetVertexArray
|
||||
{
|
||||
template <typename ArrayHandleType>
|
||||
VTKM_CONT void operator()(ArrayHandleType array) const
|
||||
{
|
||||
this->GetVertexPortal(array.GetPortalConstControl());
|
||||
}
|
||||
|
||||
private:
|
||||
template <typename PortalType>
|
||||
VTKM_CONT void GetVertexPortal(const PortalType& portal) const
|
||||
{
|
||||
for (vtkm::Id index = 0; index < portal.GetNumberOfValues(); index++)
|
||||
{
|
||||
vertexArray.GetPortalControl().Set(index, portal.Get(index));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
// Initialize the OpenGL state
|
||||
//
|
||||
@ -201,10 +174,7 @@ void displayCall()
|
||||
outDataSet.GetCellSet(0).CopyTo(cellSet);
|
||||
vtkm::Id numberOfCells = cellSet.GetNumberOfCells();
|
||||
|
||||
// Need the actual vertex points from a static cast of the dynamic array but can't get it right
|
||||
// So use cast and call on a functor that stores that dynamic array into static array we created
|
||||
vertexArray.Allocate(cellSet.GetNumberOfPoints());
|
||||
vtkm::cont::CastAndCall(outDataSet.GetCoordinateSystem(), GetVertexArray());
|
||||
auto vertexArray = outDataSet.GetCoordinateSystem().GetData();
|
||||
|
||||
// Draw the five tetrahedra belonging to each hexadron
|
||||
vtkm::Float32 color[5][3] = { { 1.0f, 0.0f, 0.0f },
|
||||
@ -223,10 +193,10 @@ void displayCall()
|
||||
cellSet.GetIndices(tetra, tetIndices);
|
||||
|
||||
// Get the vertex points for this tetrahedron
|
||||
vtkm::Vec<vtkm::Float64, 3> pt0 = vertexArray.GetPortalConstControl().Get(tetIndices[0]);
|
||||
vtkm::Vec<vtkm::Float64, 3> pt1 = vertexArray.GetPortalConstControl().Get(tetIndices[1]);
|
||||
vtkm::Vec<vtkm::Float64, 3> pt2 = vertexArray.GetPortalConstControl().Get(tetIndices[2]);
|
||||
vtkm::Vec<vtkm::Float64, 3> pt3 = vertexArray.GetPortalConstControl().Get(tetIndices[3]);
|
||||
auto pt0 = vertexArray.GetPortalConstControl().Get(tetIndices[0]);
|
||||
auto pt1 = vertexArray.GetPortalConstControl().Get(tetIndices[1]);
|
||||
auto pt2 = vertexArray.GetPortalConstControl().Get(tetIndices[2]);
|
||||
auto pt3 = vertexArray.GetPortalConstControl().Get(tetIndices[3]);
|
||||
|
||||
// Draw the tetrahedron filled with alternating colors
|
||||
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
|
||||
@ -323,7 +293,6 @@ int main(int argc, char* argv[])
|
||||
glutMainLoop();
|
||||
|
||||
outDataSet.Clear();
|
||||
vertexArray.ReleaseResources();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -52,9 +52,6 @@ static vtkm::Id cellsToDisplay = 64;
|
||||
// Takes input uniform grid and outputs unstructured grid of tets
|
||||
static vtkm::cont::DataSet tetDataSet;
|
||||
|
||||
// Point location of vertices from a CastAndCall but needs a static cast eventually
|
||||
static vtkm::cont::ArrayHandle<vtkm::Vec<vtkm::Float64, 3>> vertexArray;
|
||||
|
||||
// OpenGL display variables
|
||||
static Quaternion qrot;
|
||||
static int lastx, lasty;
|
||||
@ -87,30 +84,6 @@ vtkm::cont::DataSet MakeTetrahedralizeTestDataSet(vtkm::Id3 dim)
|
||||
return dataSet;
|
||||
}
|
||||
|
||||
//
|
||||
// Functor to retrieve vertex locations from the CoordinateSystem
|
||||
// Actually need a static cast to ArrayHandle from DynamicArrayHandleCoordinateSystem
|
||||
// but haven't been able to figure out what that is
|
||||
//
|
||||
struct GetVertexArray
|
||||
{
|
||||
template <typename ArrayHandleType>
|
||||
VTKM_CONT void operator()(ArrayHandleType array) const
|
||||
{
|
||||
this->GetVertexPortal(array.GetPortalConstControl());
|
||||
}
|
||||
|
||||
private:
|
||||
template <typename PortalType>
|
||||
VTKM_CONT void GetVertexPortal(const PortalType& portal) const
|
||||
{
|
||||
for (vtkm::Id index = 0; index < portal.GetNumberOfValues(); index++)
|
||||
{
|
||||
vertexArray.GetPortalControl().Set(index, portal.Get(index));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
// Initialize the OpenGL state
|
||||
//
|
||||
@ -165,10 +138,7 @@ void displayCall()
|
||||
vtkm::cont::CellSetSingleType<> cellSet;
|
||||
tetDataSet.GetCellSet(0).CopyTo(cellSet);
|
||||
|
||||
// Need the actual vertex points from a static cast of the dynamic array but can't get it right
|
||||
// So use cast and call on a functor that stores that dynamic array into static array we created
|
||||
vertexArray.Allocate(cellSet.GetNumberOfPoints());
|
||||
vtkm::cont::CastAndCall(tetDataSet.GetCoordinateSystem(), GetVertexArray());
|
||||
auto vertexArray = tetDataSet.GetCoordinateSystem().GetData();
|
||||
|
||||
// Draw the five tetrahedra belonging to each hexadron
|
||||
vtkm::Id tetra = 0;
|
||||
@ -190,10 +160,10 @@ void displayCall()
|
||||
cellSet.GetIndices(tetra, tetIndices);
|
||||
|
||||
// Get the vertex points for this tetrahedron
|
||||
vtkm::Vec<vtkm::Float64, 3> pt0 = vertexArray.GetPortalConstControl().Get(tetIndices[0]);
|
||||
vtkm::Vec<vtkm::Float64, 3> pt1 = vertexArray.GetPortalConstControl().Get(tetIndices[1]);
|
||||
vtkm::Vec<vtkm::Float64, 3> pt2 = vertexArray.GetPortalConstControl().Get(tetIndices[2]);
|
||||
vtkm::Vec<vtkm::Float64, 3> pt3 = vertexArray.GetPortalConstControl().Get(tetIndices[3]);
|
||||
auto pt0 = vertexArray.GetPortalConstControl().Get(tetIndices[0]);
|
||||
auto pt1 = vertexArray.GetPortalConstControl().Get(tetIndices[1]);
|
||||
auto pt2 = vertexArray.GetPortalConstControl().Get(tetIndices[2]);
|
||||
auto pt3 = vertexArray.GetPortalConstControl().Get(tetIndices[3]);
|
||||
|
||||
// Draw the tetrahedron filled with alternating colors
|
||||
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
|
||||
@ -305,7 +275,6 @@ int main(int argc, char* argv[])
|
||||
glutMainLoop();
|
||||
|
||||
tetDataSet.Clear();
|
||||
vertexArray.ReleaseResources();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -50,9 +50,6 @@ namespace
|
||||
static vtkm::cont::DataSet outDataSet;
|
||||
static vtkm::Id numberOfInPoints;
|
||||
|
||||
// Point location of vertices from a CastAndCall but needs a static cast eventually
|
||||
static vtkm::cont::ArrayHandle<vtkm::Vec<vtkm::Float64, 3>> vertexArray;
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
//
|
||||
@ -125,30 +122,6 @@ vtkm::cont::DataSet MakeTriangulateExplicitDataSet()
|
||||
return builder.Create();
|
||||
}
|
||||
|
||||
//
|
||||
// Functor to retrieve vertex locations from the CoordinateSystem
|
||||
// Actually need a static cast to ArrayHandle from DynamicArrayHandleCoordinateSystem
|
||||
// but haven't been able to figure out what that is
|
||||
//
|
||||
struct GetVertexArray
|
||||
{
|
||||
template <typename ArrayHandleType>
|
||||
VTKM_CONT void operator()(ArrayHandleType array) const
|
||||
{
|
||||
this->GetVertexPortal(array.GetPortalConstControl());
|
||||
}
|
||||
|
||||
private:
|
||||
template <typename PortalType>
|
||||
VTKM_CONT void GetVertexPortal(const PortalType& portal) const
|
||||
{
|
||||
for (vtkm::Id index = 0; index < portal.GetNumberOfValues(); index++)
|
||||
{
|
||||
vertexArray.GetPortalControl().Set(index, portal.Get(index));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
// Initialize the OpenGL state
|
||||
//
|
||||
@ -173,10 +146,7 @@ void displayCall()
|
||||
outDataSet.GetCellSet(0).CopyTo(cellSet);
|
||||
vtkm::Id numberOfCells = cellSet.GetNumberOfCells();
|
||||
|
||||
// Need the actual vertex points from a static cast of the dynamic array but can't get it right
|
||||
// So use cast and call on a functor that stores that dynamic array into static array we created
|
||||
vertexArray.Allocate(numberOfInPoints);
|
||||
vtkm::cont::CastAndCall(outDataSet.GetCoordinateSystem(), GetVertexArray());
|
||||
auto vertexArray = outDataSet.GetCoordinateSystem().GetData();
|
||||
|
||||
// Draw the two triangles belonging to each quad
|
||||
vtkm::Float32 color[4][3] = {
|
||||
@ -239,7 +209,6 @@ int main(int argc, char* argv[])
|
||||
glutMainLoop();
|
||||
|
||||
outDataSet.Clear();
|
||||
vertexArray.ReleaseResources();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -50,9 +50,6 @@ static vtkm::Id cellsToDisplay = 16;
|
||||
// Takes input uniform grid and outputs unstructured grid of triangles
|
||||
static vtkm::cont::DataSet triDataSet;
|
||||
|
||||
// Point location of vertices from a CastAndCall but needs a static cast eventually
|
||||
static vtkm::cont::ArrayHandle<vtkm::Vec<vtkm::Float64, 3>> vertexArray;
|
||||
|
||||
//
|
||||
// Construct an input data set with uniform grid of indicated dimensions, origin and spacing
|
||||
//
|
||||
@ -78,30 +75,6 @@ vtkm::cont::DataSet MakeTriangulateTestDataSet(vtkm::Id2 dim)
|
||||
return dataSet;
|
||||
}
|
||||
|
||||
//
|
||||
// Functor to retrieve vertex locations from the CoordinateSystem
|
||||
// Actually need a static cast to ArrayHandle from DynamicArrayHandleCoordinateSystem
|
||||
// but haven't been able to figure out what that is
|
||||
//
|
||||
struct GetVertexArray
|
||||
{
|
||||
template <typename ArrayHandleType>
|
||||
VTKM_CONT void operator()(ArrayHandleType array) const
|
||||
{
|
||||
this->GetVertexPortal(array.GetPortalConstControl());
|
||||
}
|
||||
|
||||
private:
|
||||
template <typename PortalType>
|
||||
VTKM_CONT void GetVertexPortal(const PortalType& portal) const
|
||||
{
|
||||
for (vtkm::Id index = 0; index < portal.GetNumberOfValues(); index++)
|
||||
{
|
||||
vertexArray.GetPortalControl().Set(index, portal.Get(index));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
// Initialize the OpenGL state
|
||||
//
|
||||
@ -125,10 +98,7 @@ void displayCall()
|
||||
vtkm::cont::CellSetSingleType<> cellSet;
|
||||
triDataSet.GetCellSet(0).CopyTo(cellSet);
|
||||
|
||||
// Need the actual vertex points from a static cast of the dynamic array but can't get it right
|
||||
// So use cast and call on a functor that stores that dynamic array into static array we created
|
||||
vertexArray.Allocate(cellSet.GetNumberOfPoints());
|
||||
vtkm::cont::CastAndCall(triDataSet.GetCoordinateSystem(), GetVertexArray());
|
||||
auto vertexArray = triDataSet.GetCoordinateSystem().GetData();
|
||||
|
||||
// Draw the two triangles belonging to each quad
|
||||
vtkm::Id triangle = 0;
|
||||
@ -207,7 +177,6 @@ int main(int argc, char* argv[])
|
||||
glutMainLoop();
|
||||
|
||||
triDataSet.Clear();
|
||||
vertexArray.ReleaseResources();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -71,6 +71,10 @@ VTKM_ARRAY_RANGE_COMPUTE_IMPL_VEC(vtkm::UInt8, 4, vtkm::cont::StorageTagBasic);
|
||||
VTKM_ARRAY_RANGE_COMPUTE_IMPL_VEC(vtkm::Float32, 4, vtkm::cont::StorageTagBasic);
|
||||
VTKM_ARRAY_RANGE_COMPUTE_IMPL_VEC(vtkm::Float64, 4, vtkm::cont::StorageTagBasic);
|
||||
|
||||
VTKM_ARRAY_RANGE_COMPUTE_IMPL_VEC(vtkm::FloatDefault,
|
||||
3,
|
||||
vtkm::cont::ArrayHandleVirtualCoordinates::StorageTag);
|
||||
|
||||
#undef VTKM_ARRAY_RANGE_COMPUTE_IMPL_T
|
||||
#undef VTKM_ARRAY_RANGE_COMPUTE_IMPL_VEC
|
||||
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include <vtkm/cont/ArrayHandleCartesianProduct.h>
|
||||
#include <vtkm/cont/ArrayHandleCompositeVector.h>
|
||||
#include <vtkm/cont/ArrayHandleUniformPointCoordinates.h>
|
||||
#include <vtkm/cont/ArrayHandleVirtualCoordinates.h>
|
||||
#include <vtkm/cont/RuntimeDeviceTracker.h>
|
||||
|
||||
namespace vtkm
|
||||
@ -97,6 +98,10 @@ VTKM_ARRAY_RANGE_COMPUTE_EXPORT_VEC(vtkm::FloatDefault,
|
||||
3,
|
||||
vtkm::cont::ArrayHandleUniformPointCoordinates::StorageTag);
|
||||
|
||||
VTKM_ARRAY_RANGE_COMPUTE_EXPORT_VEC(vtkm::FloatDefault,
|
||||
3,
|
||||
vtkm::cont::ArrayHandleVirtualCoordinates::StorageTag);
|
||||
|
||||
#undef VTKM_ARRAY_RANGE_COMPUTE_EXPORT_T
|
||||
#undef VTKM_ARRAY_RANGE_COMPUTE_EXPORT_VEC
|
||||
|
||||
|
@ -102,13 +102,10 @@ set(sources
|
||||
CellSet.cxx
|
||||
CellSetExplicit.cxx
|
||||
CellSetStructured.cxx
|
||||
CoordinateSystem.cxx
|
||||
DataSet.cxx
|
||||
DynamicArrayHandle.cxx
|
||||
EnvironmentTracker.cxx
|
||||
Field.cxx
|
||||
internal/SimplePolymorphicContainer.cxx
|
||||
MultiBlock.cxx
|
||||
internal/ArrayManagerExecutionShareWithControl.cxx
|
||||
StorageBasic.cxx
|
||||
)
|
||||
@ -118,6 +115,9 @@ set(sources
|
||||
set(device_sources
|
||||
ArrayRangeCompute.cxx
|
||||
CellSetExplicit.cxx
|
||||
CoordinateSystem.cxx
|
||||
DataSet.cxx
|
||||
MultiBlock.cxx
|
||||
RuntimeDeviceTracker.cxx
|
||||
TryExecute.cxx
|
||||
)
|
||||
|
@ -496,24 +496,17 @@ public:
|
||||
|
||||
/// Builds the cell locator lookup structure
|
||||
///
|
||||
template <typename DeviceAdapter,
|
||||
typename CellSetList = VTKM_DEFAULT_CELL_SET_LIST_TAG,
|
||||
typename CoordsTypeList = VTKM_DEFAULT_COORDINATE_SYSTEM_TYPE_LIST_TAG,
|
||||
typename CoordsStorageList = VTKM_DEFAULT_COORDINATE_SYSTEM_STORAGE_LIST_TAG>
|
||||
void Build(DeviceAdapter,
|
||||
CellSetList cellSetTypes = CellSetList(),
|
||||
CoordsTypeList coordsValueTypes = CoordsTypeList(),
|
||||
CoordsStorageList coordsStorageType = CoordsStorageList())
|
||||
template <typename DeviceAdapter, typename CellSetList = VTKM_DEFAULT_CELL_SET_LIST_TAG>
|
||||
void Build(DeviceAdapter, CellSetList cellSetTypes = CellSetList())
|
||||
{
|
||||
using Algorithm = vtkm::cont::DeviceAdapterAlgorithm<DeviceAdapter>;
|
||||
|
||||
auto cellset = this->CellSet.ResetCellSetList(cellSetTypes);
|
||||
auto points =
|
||||
this->Coordinates.GetData().ResetTypeAndStorageLists(coordsValueTypes, coordsStorageType);
|
||||
const auto& coords = this->Coordinates;
|
||||
TwoLevelUniformGrid ls;
|
||||
|
||||
// 1: Compute the top level grid
|
||||
auto bounds = this->Coordinates.GetBounds(coordsValueTypes, coordsStorageType);
|
||||
auto bounds = this->Coordinates.GetBounds();
|
||||
FloatVec3 bmin(static_cast<vtkm::FloatDefault>(bounds.X.Min),
|
||||
static_cast<vtkm::FloatDefault>(bounds.Y.Min),
|
||||
static_cast<vtkm::FloatDefault>(bounds.Z.Min));
|
||||
@ -533,7 +526,7 @@ public:
|
||||
vtkm::cont::ArrayHandle<vtkm::Id> binCounts;
|
||||
CountBinsL1 countL1(ls.TopLevel);
|
||||
vtkm::worklet::DispatcherMapTopology<CountBinsL1, DeviceAdapter>(countL1).Invoke(
|
||||
cellset, points, binCounts);
|
||||
cellset, coords, binCounts);
|
||||
|
||||
// 3: Total number of unique (cell, bin) pairs (for pre-allocating arrays)
|
||||
vtkm::Id numPairsL1 = Algorithm::ScanExclusive(binCounts, binCounts);
|
||||
@ -543,7 +536,7 @@ public:
|
||||
binIds.Allocate(numPairsL1);
|
||||
FindBinsL1 findL1(ls.TopLevel);
|
||||
vtkm::worklet::DispatcherMapTopology<FindBinsL1, DeviceAdapter>(findL1).Invoke(
|
||||
cellset, points, binCounts, binIds);
|
||||
cellset, coords, binCounts, binIds);
|
||||
binCounts.ReleaseResources();
|
||||
|
||||
// 5: From above, find the number of cells that intersect each top level bin
|
||||
@ -577,7 +570,7 @@ public:
|
||||
// 8: For each cell, find the number of l2 bins they intersect
|
||||
CountBinsL2 countL2(ls.TopLevel);
|
||||
vtkm::worklet::DispatcherMapTopology<CountBinsL2, DeviceAdapter>(countL2).Invoke(
|
||||
cellset, points, ls.LeafDimensions, binCounts);
|
||||
cellset, coords, ls.LeafDimensions, binCounts);
|
||||
|
||||
// 9: Total number of unique (cell, bin) pairs (for pre-allocating arrays)
|
||||
vtkm::Id numPairsL2 = Algorithm::ScanExclusive(binCounts, binCounts);
|
||||
@ -587,7 +580,7 @@ public:
|
||||
ls.CellIds.Allocate(numPairsL2);
|
||||
FindBinsL2 findL2(ls.TopLevel);
|
||||
vtkm::worklet::DispatcherMapTopology<FindBinsL2, DeviceAdapter>(findL2).Invoke(
|
||||
cellset, points, ls.LeafDimensions, ls.LeafStartIndex, binCounts, binIds, ls.CellIds);
|
||||
cellset, coords, ls.LeafDimensions, ls.LeafStartIndex, binCounts, binIds, ls.CellIds);
|
||||
binCounts.ReleaseResources();
|
||||
|
||||
// 11: From above, find the cells that each l2 bin intersects
|
||||
@ -710,22 +703,18 @@ public:
|
||||
template <typename PointComponentType,
|
||||
typename PointStorageType,
|
||||
typename DeviceAdapter,
|
||||
typename CellSetList = VTKM_DEFAULT_CELL_SET_LIST_TAG,
|
||||
typename CoordsTypeList = VTKM_DEFAULT_COORDINATE_SYSTEM_TYPE_LIST_TAG,
|
||||
typename CoordsStorageList = VTKM_DEFAULT_COORDINATE_SYSTEM_STORAGE_LIST_TAG>
|
||||
typename CellSetList = VTKM_DEFAULT_CELL_SET_LIST_TAG>
|
||||
void FindCells(
|
||||
const vtkm::cont::ArrayHandle<vtkm::Vec<PointComponentType, 3>, PointStorageType>& points,
|
||||
vtkm::cont::ArrayHandle<vtkm::Id>& cellIds,
|
||||
vtkm::cont::ArrayHandle<FloatVec3>& parametricCoords,
|
||||
DeviceAdapter device,
|
||||
CellSetList cellSetTypes = CellSetList(),
|
||||
CoordsTypeList coordsValueTypes = CoordsTypeList(),
|
||||
CoordsStorageList coordsStorageType = CoordsStorageList()) const
|
||||
CellSetList cellSetTypes = CellSetList()) const
|
||||
{
|
||||
vtkm::worklet::DispatcherMapField<FindCellWorklet, DeviceAdapter>().Invoke(
|
||||
points,
|
||||
this->CellSet.ResetCellSetList(cellSetTypes),
|
||||
this->Coordinates.GetData().ResetTypeAndStorageLists(coordsValueTypes, coordsStorageType),
|
||||
this->Coordinates,
|
||||
this->PrepareForDevice(device),
|
||||
cellIds,
|
||||
parametricCoords);
|
||||
|
@ -25,6 +25,10 @@ namespace vtkm
|
||||
namespace cont
|
||||
{
|
||||
|
||||
using CoordinatesTypeList = vtkm::ListTagBase<vtkm::cont::ArrayHandleVirtualCoordinates::ValueType>;
|
||||
using CoordinatesStorageList =
|
||||
vtkm::ListTagBase<vtkm::cont::ArrayHandleVirtualCoordinates::StorageTag>;
|
||||
|
||||
VTKM_CONT
|
||||
void CoordinateSystem::PrintSummary(std::ostream& out) const
|
||||
{
|
||||
@ -35,23 +39,21 @@ void CoordinateSystem::PrintSummary(std::ostream& out) const
|
||||
VTKM_CONT
|
||||
void CoordinateSystem::GetRange(vtkm::Range* range) const
|
||||
{
|
||||
this->Superclass::GetRange(range,
|
||||
VTKM_DEFAULT_COORDINATE_SYSTEM_TYPE_LIST_TAG(),
|
||||
VTKM_DEFAULT_COORDINATE_SYSTEM_STORAGE_LIST_TAG());
|
||||
this->Superclass::GetRange(range, CoordinatesTypeList(), CoordinatesStorageList());
|
||||
}
|
||||
|
||||
VTKM_CONT
|
||||
const vtkm::cont::ArrayHandle<vtkm::Range>& CoordinateSystem::GetRange() const
|
||||
{
|
||||
return this->Superclass::GetRange(VTKM_DEFAULT_COORDINATE_SYSTEM_TYPE_LIST_TAG(),
|
||||
VTKM_DEFAULT_COORDINATE_SYSTEM_STORAGE_LIST_TAG());
|
||||
return this->Superclass::GetRange(CoordinatesTypeList(), CoordinatesStorageList());
|
||||
}
|
||||
|
||||
VTKM_CONT
|
||||
vtkm::Bounds CoordinateSystem::GetBounds() const
|
||||
{
|
||||
return this->GetBounds(VTKM_DEFAULT_COORDINATE_SYSTEM_TYPE_LIST_TAG(),
|
||||
VTKM_DEFAULT_COORDINATE_SYSTEM_STORAGE_LIST_TAG());
|
||||
vtkm::Range ranges[3];
|
||||
this->GetRange(ranges);
|
||||
return vtkm::Bounds(ranges[0], ranges[1], ranges[2]);
|
||||
}
|
||||
}
|
||||
} // namespace vtkm::cont
|
||||
|
@ -22,20 +22,11 @@
|
||||
|
||||
#include <vtkm/Bounds.h>
|
||||
|
||||
#include <vtkm/cont/ArrayHandleCartesianProduct.h>
|
||||
#include <vtkm/cont/ArrayHandleCompositeVector.h>
|
||||
#include <vtkm/cont/ArrayHandleCast.h>
|
||||
#include <vtkm/cont/ArrayHandleUniformPointCoordinates.h>
|
||||
#include <vtkm/cont/ArrayHandleVirtualCoordinates.h>
|
||||
#include <vtkm/cont/Field.h>
|
||||
|
||||
#ifndef VTKM_DEFAULT_COORDINATE_SYSTEM_TYPE_LIST_TAG
|
||||
#define VTKM_DEFAULT_COORDINATE_SYSTEM_TYPE_LIST_TAG ::vtkm::TypeListTagFieldVec3
|
||||
#endif
|
||||
|
||||
#ifndef VTKM_DEFAULT_COORDINATE_SYSTEM_STORAGE_LIST_TAG
|
||||
#define VTKM_DEFAULT_COORDINATE_SYSTEM_STORAGE_LIST_TAG \
|
||||
::vtkm::cont::StorageListTagCoordinateSystemDefault
|
||||
#endif
|
||||
|
||||
namespace vtkm
|
||||
{
|
||||
namespace cont
|
||||
@ -44,49 +35,49 @@ namespace cont
|
||||
namespace detail
|
||||
{
|
||||
|
||||
using ArrayHandleCompositeVectorFloat32_3Default =
|
||||
vtkm::cont::ArrayHandleCompositeVectorType<vtkm::cont::ArrayHandle<vtkm::Float32>,
|
||||
vtkm::cont::ArrayHandle<vtkm::Float32>,
|
||||
vtkm::cont::ArrayHandle<vtkm::Float32>>::type;
|
||||
struct MakeArrayHandleVirtualCoordinatesFunctor
|
||||
{
|
||||
VTKM_CONT explicit MakeArrayHandleVirtualCoordinatesFunctor(
|
||||
vtkm::cont::ArrayHandleVirtualCoordinates& out)
|
||||
: Out(&out)
|
||||
{
|
||||
}
|
||||
|
||||
using ArrayHandleCompositeVectorFloat64_3Default =
|
||||
vtkm::cont::ArrayHandleCompositeVectorType<vtkm::cont::ArrayHandle<vtkm::Float64>,
|
||||
vtkm::cont::ArrayHandle<vtkm::Float64>,
|
||||
vtkm::cont::ArrayHandle<vtkm::Float64>>::type;
|
||||
template <typename StorageTag>
|
||||
VTKM_CONT void operator()(
|
||||
const vtkm::cont::ArrayHandle<vtkm::Vec<vtkm::Float32, 3>, StorageTag>& array) const
|
||||
{
|
||||
*this->Out = vtkm::cont::ArrayHandleVirtualCoordinates(array);
|
||||
}
|
||||
|
||||
template <typename StorageTag>
|
||||
VTKM_CONT void operator()(
|
||||
const vtkm::cont::ArrayHandle<vtkm::Vec<vtkm::Float64, 3>, StorageTag>& array) const
|
||||
{
|
||||
*this->Out = vtkm::cont::ArrayHandleVirtualCoordinates(array);
|
||||
}
|
||||
|
||||
template <typename T, typename StorageTag>
|
||||
VTKM_CONT void operator()(const vtkm::cont::ArrayHandle<T, StorageTag>&) const
|
||||
{
|
||||
throw vtkm::cont::ErrorBadType("CoordinateSystem's value type should be a 3 component Vec "
|
||||
"of either vtkm::Float32 or vtkm::Float64");
|
||||
}
|
||||
|
||||
vtkm::cont::ArrayHandleVirtualCoordinates* Out;
|
||||
};
|
||||
|
||||
template <typename TypeList, typename StorageList>
|
||||
VTKM_CONT vtkm::cont::ArrayHandleVirtualCoordinates MakeArrayHandleVirtualCoordinates(
|
||||
const vtkm::cont::DynamicArrayHandleBase<TypeList, StorageList>& array)
|
||||
{
|
||||
vtkm::cont::ArrayHandleVirtualCoordinates out;
|
||||
array.CastAndCall(MakeArrayHandleVirtualCoordinatesFunctor(out));
|
||||
return out;
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
|
||||
/// \brief Default storage list for CoordinateSystem arrays.
|
||||
///
|
||||
/// \c VTKM_DEFAULT_COORDINATE_SYSTEM_STORAGE_LIST_TAG is set to this value
|
||||
/// by default (unless it is defined before including VTK-m headers.
|
||||
///
|
||||
struct StorageListTagCoordinateSystemDefault
|
||||
: vtkm::ListTagBase<vtkm::cont::StorageTagBasic,
|
||||
vtkm::cont::ArrayHandleUniformPointCoordinates::StorageTag,
|
||||
detail::ArrayHandleCompositeVectorFloat32_3Default::StorageTag,
|
||||
detail::ArrayHandleCompositeVectorFloat64_3Default::StorageTag,
|
||||
vtkm::cont::ArrayHandleCartesianProduct<
|
||||
vtkm::cont::ArrayHandle<vtkm::FloatDefault>,
|
||||
vtkm::cont::ArrayHandle<vtkm::FloatDefault>,
|
||||
vtkm::cont::ArrayHandle<vtkm::FloatDefault>>::StorageTag>
|
||||
{
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
namespace vtkm
|
||||
{
|
||||
|
||||
template struct ListCrossProduct<::vtkm::TypeListTagFieldVec3,
|
||||
::vtkm::cont::StorageListTagCoordinateSystemDefault>;
|
||||
|
||||
namespace cont
|
||||
{
|
||||
using DynamicArrayHandleCoordinateSystem =
|
||||
vtkm::cont::DynamicArrayHandleBase<VTKM_DEFAULT_COORDINATE_SYSTEM_TYPE_LIST_TAG,
|
||||
VTKM_DEFAULT_COORDINATE_SYSTEM_STORAGE_LIST_TAG>;
|
||||
|
||||
class VTKM_CONT_EXPORT CoordinateSystem : public vtkm::cont::Field
|
||||
{
|
||||
using Superclass = vtkm::cont::Field;
|
||||
@ -98,15 +89,22 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
VTKM_CONT
|
||||
CoordinateSystem(std::string name, const vtkm::cont::DynamicArrayHandle& data)
|
||||
VTKM_CONT CoordinateSystem(std::string name,
|
||||
const vtkm::cont::ArrayHandleVirtualCoordinates::Superclass& data)
|
||||
: Superclass(name, ASSOC_POINTS, data)
|
||||
{
|
||||
}
|
||||
|
||||
template <typename TypeList, typename StorageList>
|
||||
VTKM_CONT CoordinateSystem(std::string name,
|
||||
const vtkm::cont::DynamicArrayHandleBase<TypeList, StorageList>& data)
|
||||
: Superclass(name, ASSOC_POINTS, detail::MakeArrayHandleVirtualCoordinates(data))
|
||||
{
|
||||
}
|
||||
|
||||
template <typename T, typename Storage>
|
||||
VTKM_CONT CoordinateSystem(std::string name, const ArrayHandle<T, Storage>& data)
|
||||
: Superclass(name, ASSOC_POINTS, data)
|
||||
: Superclass(name, ASSOC_POINTS, vtkm::cont::ArrayHandleVirtualCoordinates(data))
|
||||
{
|
||||
}
|
||||
|
||||
@ -120,7 +118,7 @@ public:
|
||||
vtkm::Vec<vtkm::FloatDefault, 3> spacing = vtkm::Vec<vtkm::FloatDefault, 3>(1.0f, 1.0f, 1.0f))
|
||||
: Superclass(name,
|
||||
ASSOC_POINTS,
|
||||
vtkm::cont::DynamicArrayHandle(
|
||||
vtkm::cont::ArrayHandleVirtualCoordinates(
|
||||
vtkm::cont::ArrayHandleUniformPointCoordinates(dimensions, origin, spacing)))
|
||||
{
|
||||
}
|
||||
@ -129,93 +127,45 @@ public:
|
||||
CoordinateSystem& operator=(const vtkm::cont::CoordinateSystem& src) = default;
|
||||
|
||||
VTKM_CONT
|
||||
vtkm::cont::DynamicArrayHandleCoordinateSystem GetData() const
|
||||
vtkm::cont::ArrayHandleVirtualCoordinates GetData() const
|
||||
{
|
||||
return vtkm::cont::DynamicArrayHandleCoordinateSystem(this->Superclass::GetData());
|
||||
return this->Superclass::GetData().Cast<vtkm::cont::ArrayHandleVirtualCoordinates>();
|
||||
}
|
||||
|
||||
VTKM_CONT void SetData(const vtkm::cont::ArrayHandleVirtualCoordinates::Superclass& newdata)
|
||||
{
|
||||
this->Superclass::SetData(newdata);
|
||||
}
|
||||
|
||||
template <typename T, typename StorageTag>
|
||||
VTKM_CONT void SetData(const vtkm::cont::ArrayHandle<T, StorageTag>& newdata)
|
||||
{
|
||||
this->Superclass::SetData(vtkm::cont::ArrayHandleVirtualCoordinates(newdata));
|
||||
}
|
||||
|
||||
VTKM_CONT
|
||||
vtkm::cont::DynamicArrayHandleCoordinateSystem GetData()
|
||||
template <typename TypeList, typename StorageList>
|
||||
void SetData(const vtkm::cont::DynamicArrayHandleBase<TypeList, StorageList>& newdata)
|
||||
{
|
||||
return vtkm::cont::DynamicArrayHandleCoordinateSystem(this->Superclass::GetData());
|
||||
this->Superclass::SetData(detail::MakeArrayHandleVirtualCoordinates(newdata));
|
||||
}
|
||||
|
||||
VTKM_CONT
|
||||
void GetRange(vtkm::Range* range) const;
|
||||
|
||||
template <typename TypeList>
|
||||
VTKM_CONT void GetRange(vtkm::Range* range, TypeList) const
|
||||
{
|
||||
VTKM_IS_LIST_TAG(TypeList);
|
||||
|
||||
this->Superclass::GetRange(
|
||||
range, TypeList(), VTKM_DEFAULT_COORDINATE_SYSTEM_STORAGE_LIST_TAG());
|
||||
}
|
||||
|
||||
template <typename TypeList, typename StorageList>
|
||||
VTKM_CONT void GetRange(vtkm::Range* range, TypeList, StorageList) const
|
||||
{
|
||||
VTKM_IS_LIST_TAG(TypeList);
|
||||
VTKM_IS_LIST_TAG(StorageList);
|
||||
|
||||
this->Superclass::GetRange(range, TypeList(), StorageList());
|
||||
}
|
||||
|
||||
VTKM_CONT
|
||||
const vtkm::cont::ArrayHandle<vtkm::Range>& GetRange() const;
|
||||
|
||||
template <typename TypeList>
|
||||
VTKM_CONT const vtkm::cont::ArrayHandle<vtkm::Range>& GetRange(TypeList) const
|
||||
{
|
||||
VTKM_IS_LIST_TAG(TypeList);
|
||||
|
||||
return this->Superclass::GetRange(TypeList(),
|
||||
VTKM_DEFAULT_COORDINATE_SYSTEM_STORAGE_LIST_TAG());
|
||||
}
|
||||
|
||||
template <typename TypeList, typename StorageList>
|
||||
VTKM_CONT const vtkm::cont::ArrayHandle<vtkm::Range>& GetRange(TypeList, StorageList) const
|
||||
{
|
||||
VTKM_IS_LIST_TAG(TypeList);
|
||||
VTKM_IS_LIST_TAG(StorageList);
|
||||
|
||||
return this->Superclass::GetRange(TypeList(), StorageList());
|
||||
}
|
||||
|
||||
VTKM_CONT
|
||||
vtkm::Bounds GetBounds() const;
|
||||
|
||||
template <typename TypeList>
|
||||
VTKM_CONT vtkm::Bounds GetBounds(TypeList) const
|
||||
{
|
||||
VTKM_IS_LIST_TAG(TypeList);
|
||||
|
||||
return this->GetBounds(TypeList(), VTKM_DEFAULT_COORDINATE_SYSTEM_STORAGE_LIST_TAG());
|
||||
}
|
||||
|
||||
template <typename TypeList, typename StorageList>
|
||||
VTKM_CONT vtkm::Bounds GetBounds(TypeList, StorageList) const
|
||||
{
|
||||
VTKM_IS_LIST_TAG(TypeList);
|
||||
VTKM_IS_LIST_TAG(StorageList);
|
||||
|
||||
vtkm::cont::ArrayHandle<vtkm::Range> ranges = this->GetRange(TypeList(), StorageList());
|
||||
|
||||
VTKM_ASSERT(ranges.GetNumberOfValues() == 3);
|
||||
|
||||
vtkm::cont::ArrayHandle<vtkm::Range>::PortalConstControl rangePortal =
|
||||
ranges.GetPortalConstControl();
|
||||
|
||||
return vtkm::Bounds(rangePortal.Get(0), rangePortal.Get(1), rangePortal.Get(2));
|
||||
}
|
||||
|
||||
virtual void PrintSummary(std::ostream& out) const;
|
||||
};
|
||||
|
||||
template <typename Functor, typename... Args>
|
||||
void CastAndCall(const vtkm::cont::CoordinateSystem& coords, Functor&& f, Args&&... args)
|
||||
{
|
||||
coords.GetData().CastAndCall(std::forward<Functor>(f), std::forward<Args>(args)...);
|
||||
CastAndCall(coords.GetData(), std::forward<Functor>(f), std::forward<Args>(args)...);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
|
@ -205,29 +205,8 @@ void MultiBlock::ReplaceBlock(vtkm::Id index, vtkm::cont::DataSet& ds)
|
||||
}
|
||||
}
|
||||
|
||||
VTKM_CONT
|
||||
vtkm::Bounds MultiBlock::GetBounds(vtkm::Id coordinate_system_index) const
|
||||
VTKM_CONT vtkm::Bounds MultiBlock::GetBounds(vtkm::Id coordinate_system_index) const
|
||||
{
|
||||
return this->GetBounds(coordinate_system_index,
|
||||
VTKM_DEFAULT_COORDINATE_SYSTEM_TYPE_LIST_TAG(),
|
||||
VTKM_DEFAULT_COORDINATE_SYSTEM_STORAGE_LIST_TAG());
|
||||
}
|
||||
|
||||
template <typename TypeList>
|
||||
VTKM_CONT vtkm::Bounds MultiBlock::GetBounds(vtkm::Id coordinate_system_index, TypeList) const
|
||||
{
|
||||
VTKM_IS_LIST_TAG(TypeList);
|
||||
return this->GetBounds(
|
||||
coordinate_system_index, TypeList(), VTKM_DEFAULT_COORDINATE_SYSTEM_STORAGE_LIST_TAG());
|
||||
}
|
||||
template <typename TypeList, typename StorageList>
|
||||
VTKM_CONT vtkm::Bounds MultiBlock::GetBounds(vtkm::Id coordinate_system_index,
|
||||
TypeList,
|
||||
StorageList) const
|
||||
{
|
||||
VTKM_IS_LIST_TAG(TypeList);
|
||||
VTKM_IS_LIST_TAG(StorageList);
|
||||
|
||||
#if defined(VTKM_ENABLE_MPI)
|
||||
auto world = vtkm::cont::EnvironmentTracker::GetCommunicator();
|
||||
diy::Master master(world,
|
||||
@ -247,7 +226,7 @@ VTKM_CONT vtkm::Bounds MultiBlock::GetBounds(vtkm::Id coordinate_system_index,
|
||||
try
|
||||
{
|
||||
vtkm::cont::CoordinateSystem coords = block.GetCoordinateSystem(coordinate_system_index);
|
||||
*data = coords.GetBounds(TypeList(), StorageList());
|
||||
*data = coords.GetBounds();
|
||||
}
|
||||
catch (const vtkm::cont::Error&)
|
||||
{
|
||||
@ -288,44 +267,16 @@ VTKM_CONT vtkm::Bounds MultiBlock::GetBounds(vtkm::Id coordinate_system_index,
|
||||
vtkm::Bounds bounds;
|
||||
for (size_t i = 0; i < num_blocks; ++i)
|
||||
{
|
||||
vtkm::Bounds block_bounds = this->GetBlockBounds(i, index, TypeList(), StorageList());
|
||||
vtkm::Bounds block_bounds = this->GetBlockBounds(i, index);
|
||||
bounds.Include(block_bounds);
|
||||
}
|
||||
return bounds;
|
||||
#endif
|
||||
}
|
||||
|
||||
VTKM_CONT
|
||||
vtkm::Bounds MultiBlock::GetBlockBounds(const std::size_t& block_index,
|
||||
vtkm::Id coordinate_system_index) const
|
||||
{
|
||||
return this->GetBlockBounds(block_index,
|
||||
coordinate_system_index,
|
||||
VTKM_DEFAULT_COORDINATE_SYSTEM_TYPE_LIST_TAG(),
|
||||
VTKM_DEFAULT_COORDINATE_SYSTEM_STORAGE_LIST_TAG());
|
||||
}
|
||||
|
||||
template <typename TypeList>
|
||||
VTKM_CONT vtkm::Bounds MultiBlock::GetBlockBounds(const std::size_t& block_index,
|
||||
vtkm::Id coordinate_system_index,
|
||||
TypeList) const
|
||||
vtkm::Id coordinate_system_index) const
|
||||
{
|
||||
VTKM_IS_LIST_TAG(TypeList);
|
||||
return this->GetBlockBounds(block_index,
|
||||
coordinate_system_index,
|
||||
TypeList(),
|
||||
VTKM_DEFAULT_COORDINATE_SYSTEM_STORAGE_LIST_TAG());
|
||||
}
|
||||
|
||||
template <typename TypeList, typename StorageList>
|
||||
VTKM_CONT vtkm::Bounds MultiBlock::GetBlockBounds(const std::size_t& block_index,
|
||||
vtkm::Id coordinate_system_index,
|
||||
TypeList,
|
||||
StorageList) const
|
||||
{
|
||||
VTKM_IS_LIST_TAG(TypeList);
|
||||
VTKM_IS_LIST_TAG(StorageList);
|
||||
|
||||
const vtkm::Id index = coordinate_system_index;
|
||||
vtkm::cont::CoordinateSystem coords;
|
||||
try
|
||||
@ -340,56 +291,19 @@ VTKM_CONT vtkm::Bounds MultiBlock::GetBlockBounds(const std::size_t& block_index
|
||||
<< "block " << block_index << ". vtkm error message: " << error.GetMessage();
|
||||
throw ErrorExecution(msg.str());
|
||||
}
|
||||
return coords.GetBounds(TypeList(), StorageList());
|
||||
return coords.GetBounds();
|
||||
}
|
||||
|
||||
VTKM_CONT
|
||||
vtkm::cont::ArrayHandle<vtkm::Range> MultiBlock::GetGlobalRange(const int& index) const
|
||||
VTKM_CONT vtkm::cont::ArrayHandle<vtkm::Range> MultiBlock::GetGlobalRange(const int& index) const
|
||||
{
|
||||
return this->GetGlobalRange(index, VTKM_DEFAULT_TYPE_LIST_TAG(), VTKM_DEFAULT_STORAGE_LIST_TAG());
|
||||
}
|
||||
|
||||
template <typename TypeList>
|
||||
VTKM_CONT vtkm::cont::ArrayHandle<vtkm::Range> MultiBlock::GetGlobalRange(const int& index,
|
||||
TypeList) const
|
||||
{
|
||||
VTKM_IS_LIST_TAG(TypeList);
|
||||
return this->GetGlobalRange(index, TypeList(), VTKM_DEFAULT_STORAGE_LIST_TAG());
|
||||
}
|
||||
|
||||
template <typename TypeList, typename StorageList>
|
||||
VTKM_CONT vtkm::cont::ArrayHandle<vtkm::Range> MultiBlock::GetGlobalRange(const int& index,
|
||||
TypeList,
|
||||
StorageList) const
|
||||
{
|
||||
VTKM_IS_LIST_TAG(TypeList);
|
||||
VTKM_IS_LIST_TAG(StorageList);
|
||||
|
||||
assert(this->Blocks.size() > 0);
|
||||
vtkm::cont::Field field = this->Blocks.at(0).GetField(index);
|
||||
std::string field_name = field.GetName();
|
||||
return this->GetGlobalRange(field_name, TypeList(), StorageList());
|
||||
return this->GetGlobalRange(field_name);
|
||||
}
|
||||
|
||||
VTKM_CONT
|
||||
vtkm::cont::ArrayHandle<vtkm::Range> MultiBlock::GetGlobalRange(const std::string& field_name) const
|
||||
{
|
||||
return this->GetGlobalRange(
|
||||
field_name, VTKM_DEFAULT_TYPE_LIST_TAG(), VTKM_DEFAULT_STORAGE_LIST_TAG());
|
||||
}
|
||||
|
||||
template <typename TypeList>
|
||||
VTKM_CONT vtkm::cont::ArrayHandle<vtkm::Range> MultiBlock::GetGlobalRange(
|
||||
const std::string& field_name,
|
||||
TypeList) const
|
||||
{
|
||||
VTKM_IS_LIST_TAG(TypeList);
|
||||
return this->GetGlobalRange(field_name, TypeList(), VTKM_DEFAULT_STORAGE_LIST_TAG());
|
||||
}
|
||||
|
||||
template <typename TypeList, typename StorageList>
|
||||
VTKM_CONT vtkm::cont::ArrayHandle<vtkm::Range>
|
||||
MultiBlock::GetGlobalRange(const std::string& field_name, TypeList, StorageList) const
|
||||
const std::string& field_name) const
|
||||
{
|
||||
#if defined(VTKM_ENABLE_MPI)
|
||||
using BlockMetaData = std::vector<vtkm::Range>;
|
||||
@ -411,7 +325,7 @@ MultiBlock::GetGlobalRange(const std::string& field_name, TypeList, StorageList)
|
||||
if (block.HasField(field_name))
|
||||
{
|
||||
auto field = block.GetField(field_name);
|
||||
const vtkm::cont::ArrayHandle<vtkm::Range> range = field.GetRange(TypeList(), StorageList());
|
||||
const vtkm::cont::ArrayHandle<vtkm::Range> range = field.GetRange();
|
||||
*data = vtkm::cont::detail::CopyArrayPortalToVector(range.GetPortalConstControl());
|
||||
}
|
||||
});
|
||||
@ -468,7 +382,7 @@ MultiBlock::GetGlobalRange(const std::string& field_name, TypeList, StorageList)
|
||||
}
|
||||
|
||||
const vtkm::cont::Field& field = this->Blocks[i].GetField(field_name);
|
||||
vtkm::cont::ArrayHandle<vtkm::Range> sub_range = field.GetRange(TypeList(), StorageList());
|
||||
vtkm::cont::ArrayHandle<vtkm::Range> sub_range = field.GetRange();
|
||||
|
||||
vtkm::cont::ArrayHandle<vtkm::Range>::PortalConstControl sub_range_control =
|
||||
sub_range.GetPortalConstControl();
|
||||
@ -492,7 +406,6 @@ MultiBlock::GetGlobalRange(const std::string& field_name, TypeList, StorageList)
|
||||
throw ErrorExecution(msg.str());
|
||||
}
|
||||
|
||||
|
||||
for (vtkm::Id c = 0; c < components; ++c)
|
||||
{
|
||||
vtkm::Range s_range = sub_range_control.Get(c);
|
||||
|
@ -92,27 +92,11 @@ public:
|
||||
VTKM_CONT
|
||||
vtkm::Bounds GetBounds(vtkm::Id coordinate_system_index = 0) const;
|
||||
|
||||
template <typename TypeList>
|
||||
VTKM_CONT vtkm::Bounds GetBounds(vtkm::Id coordinate_system_index, TypeList) const;
|
||||
|
||||
template <typename TypeList, typename StorageList>
|
||||
VTKM_CONT vtkm::Bounds GetBounds(vtkm::Id coordinate_system_index, TypeList, StorageList) const;
|
||||
/// get the bounds of a coordinate system within a given DataSet
|
||||
VTKM_CONT
|
||||
vtkm::Bounds GetBlockBounds(const std::size_t& block_index,
|
||||
vtkm::Id coordinate_system_index = 0) const;
|
||||
|
||||
template <typename TypeList>
|
||||
VTKM_CONT vtkm::Bounds GetBlockBounds(const std::size_t& block_index,
|
||||
vtkm::Id coordinate_system_index,
|
||||
TypeList) const;
|
||||
|
||||
template <typename TypeList, typename StorageList>
|
||||
VTKM_CONT vtkm::Bounds GetBlockBounds(const std::size_t& block_index,
|
||||
vtkm::Id coordinate_system_index,
|
||||
TypeList,
|
||||
StorageList) const;
|
||||
|
||||
//@{
|
||||
/// Get the unified range of the same field within all contained DataSet.
|
||||
/// These methods are not thread-safe and may involve global communication
|
||||
@ -120,25 +104,8 @@ public:
|
||||
VTKM_CONT
|
||||
vtkm::cont::ArrayHandle<vtkm::Range> GetGlobalRange(const std::string& field_name) const;
|
||||
|
||||
template <typename TypeList>
|
||||
VTKM_CONT vtkm::cont::ArrayHandle<vtkm::Range> GetGlobalRange(const std::string& field_name,
|
||||
TypeList) const;
|
||||
|
||||
template <typename TypeList, typename StorageList>
|
||||
VTKM_CONT vtkm::cont::ArrayHandle<vtkm::Range> GetGlobalRange(const std::string& field_name,
|
||||
TypeList,
|
||||
StorageList) const;
|
||||
|
||||
VTKM_CONT
|
||||
vtkm::cont::ArrayHandle<vtkm::Range> GetGlobalRange(const int& index) const;
|
||||
|
||||
template <typename TypeList>
|
||||
VTKM_CONT vtkm::cont::ArrayHandle<vtkm::Range> GetGlobalRange(const int& index, TypeList) const;
|
||||
|
||||
template <typename TypeList, typename StorageList>
|
||||
VTKM_CONT vtkm::cont::ArrayHandle<vtkm::Range> GetGlobalRange(const int& index,
|
||||
TypeList,
|
||||
StorageList) const;
|
||||
//@}
|
||||
|
||||
VTKM_CONT
|
||||
|
@ -91,10 +91,7 @@ vtkm::cont::DataSet MakeTestDataSet(const vtkm::Vec<vtkm::Id, DIMENSIONS>& dims,
|
||||
|
||||
// copy points
|
||||
vtkm::cont::ArrayHandle<PointType> points;
|
||||
Algorithm::Copy(uniformDs.GetCoordinateSystem()
|
||||
.GetData()
|
||||
.template Cast<vtkm::cont::ArrayHandleUniformPointCoordinates>(),
|
||||
points);
|
||||
Algorithm::Copy(uniformDs.GetCoordinateSystem().GetData(), points);
|
||||
|
||||
vtkm::Id numberOfCells = uniformDs.GetCellSet().GetNumberOfCells();
|
||||
vtkm::Id numberOfIndices = numberOfCells * PointsPerCell;
|
||||
|
@ -28,38 +28,6 @@ namespace vtkm
|
||||
namespace filter
|
||||
{
|
||||
|
||||
namespace detail
|
||||
{
|
||||
|
||||
template <typename Device>
|
||||
struct CleanCompactPointArrayFunctor
|
||||
{
|
||||
vtkm::cont::DataSet& OutDataSet;
|
||||
std::string Name;
|
||||
const vtkm::filter::CleanGrid* Self;
|
||||
|
||||
CleanCompactPointArrayFunctor(vtkm::cont::DataSet& outDataSet,
|
||||
const std::string& name,
|
||||
const vtkm::filter::CleanGrid* self)
|
||||
: OutDataSet(outDataSet)
|
||||
, Name(name)
|
||||
, Self(self)
|
||||
{
|
||||
}
|
||||
|
||||
template <typename ArrayHandleType>
|
||||
void operator()(const ArrayHandleType& coordSystemArray) const
|
||||
{
|
||||
VTKM_IS_ARRAY_HANDLE(ArrayHandleType);
|
||||
|
||||
vtkm::cont::ArrayHandle<typename ArrayHandleType::ValueType> outArray =
|
||||
this->Self->MapPointField(coordSystemArray, Device());
|
||||
this->OutDataSet.AddCoordinateSystem(vtkm::cont::CoordinateSystem(this->Name, outArray));
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
|
||||
inline VTKM_CONT CleanGrid::CleanGrid()
|
||||
: CompactPointFields(true)
|
||||
{
|
||||
@ -128,9 +96,8 @@ inline VTKM_CONT vtkm::filter::Result CleanGrid::DoExecute(const vtkm::cont::Dat
|
||||
|
||||
if (this->GetCompactPointFields())
|
||||
{
|
||||
vtkm::filter::ApplyPolicy(coordSystem, policy, vtkm::filter::FilterTraits<CleanGrid>())
|
||||
.CastAndCall(
|
||||
detail::CleanCompactPointArrayFunctor<Device>(outData, coordSystem.GetName(), this));
|
||||
auto outArray = this->MapPointField(coordSystem.GetData(), Device());
|
||||
outData.AddCoordinateSystem(vtkm::cont::CoordinateSystem(coordSystem.GetName(), outArray));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -95,9 +95,7 @@ inline VTKM_CONT vtkm::filter::Result ClipWithField::DoExecute(
|
||||
output.AddCellSet(outputCellSet);
|
||||
|
||||
// Compute the new boundary points and add them to the output:
|
||||
vtkm::cont::DynamicArrayHandle outputCoordsArray;
|
||||
PointMapHelper<DeviceAdapter> pointMapper(this->Worklet, outputCoordsArray);
|
||||
vtkm::filter::ApplyPolicy(inputCoords, policy).CastAndCall(pointMapper);
|
||||
auto outputCoordsArray = this->Worklet.ProcessPointField(inputCoords.GetData(), device);
|
||||
vtkm::cont::CoordinateSystem outputCoords(inputCoords.GetName(), outputCoordsArray);
|
||||
output.AddCoordinateSystem(outputCoords);
|
||||
vtkm::filter::Result result(output);
|
||||
|
@ -72,9 +72,7 @@ inline vtkm::filter::Result ClipWithImplicitFunction::DoExecute(
|
||||
vtkm::filter::ApplyPolicy(cells, policy), this->Function, inputCoords, device);
|
||||
|
||||
// compute output coordinates
|
||||
vtkm::cont::DynamicArrayHandle outputCoordsArray;
|
||||
PointMapHelper<DeviceAdapter> pointMapper(this->Worklet, outputCoordsArray);
|
||||
vtkm::filter::ApplyPolicy(inputCoords, policy).CastAndCall(pointMapper);
|
||||
auto outputCoordsArray = this->Worklet.ProcessPointField(inputCoords.GetData(), device);
|
||||
vtkm::cont::CoordinateSystem outputCoords(inputCoords.GetName(), outputCoordsArray);
|
||||
|
||||
//create the output data
|
||||
|
@ -69,7 +69,7 @@ inline vtkm::filter::Result ExtractPoints::DoExecute(
|
||||
vtkm::worklet::ExtractPoints worklet;
|
||||
|
||||
outCellSet = worklet.Run(vtkm::filter::ApplyPolicy(cells, policy),
|
||||
vtkm::filter::ApplyPolicy(coords, policy),
|
||||
coords.GetData(),
|
||||
this->Function,
|
||||
this->ExtractInside,
|
||||
device);
|
||||
|
@ -52,10 +52,8 @@ inline VTKM_CONT vtkm::filter::Result ExtractStructured::DoExecute(
|
||||
this->IncludeBoundary,
|
||||
device);
|
||||
|
||||
auto coords =
|
||||
this->Worklet.MapCoordinates(vtkm::filter::ApplyPolicy(coordinates, policy), device);
|
||||
vtkm::cont::CoordinateSystem outputCoordinates(coordinates.GetName(),
|
||||
vtkm::cont::DynamicArrayHandle(coords));
|
||||
auto coords = this->Worklet.MapCoordinates(coordinates, device);
|
||||
vtkm::cont::CoordinateSystem outputCoordinates(coordinates.GetName(), coords);
|
||||
|
||||
vtkm::cont::DataSet output;
|
||||
output.AddCellSet(vtkm::cont::DynamicCellSet(cellset));
|
||||
|
@ -183,10 +183,8 @@ FilterField<Derived>::PrepareForExecution(const vtkm::cont::DataSet& input,
|
||||
|
||||
typedef internal::ResolveFieldTypeAndExecute<Derived, DerivedPolicy, Result> FunctorType;
|
||||
FunctorType functor(static_cast<Derived*>(this), input, metaData, policy, result);
|
||||
vtkm::cont::CastAndCall(field, functor, this->Tracker);
|
||||
|
||||
typedef vtkm::filter::FilterTraits<Derived> Traits;
|
||||
vtkm::cont::CastAndCall(
|
||||
vtkm::filter::ApplyPolicy(field, policy, Traits()), functor, this->Tracker);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
@ -115,20 +115,14 @@ inline vtkm::filter::Result Gradient::DoExecute(
|
||||
if (this->ComputePointGradient)
|
||||
{
|
||||
vtkm::worklet::PointGradient gradient;
|
||||
outArray = gradient.Run(vtkm::filter::ApplyPolicy(cells, policy),
|
||||
vtkm::filter::ApplyPolicy(coords, policy),
|
||||
inField,
|
||||
gradientfields,
|
||||
adapter);
|
||||
outArray = gradient.Run(
|
||||
vtkm::filter::ApplyPolicy(cells, policy), coords, inField, gradientfields, adapter);
|
||||
}
|
||||
else
|
||||
{
|
||||
vtkm::worklet::CellGradient gradient;
|
||||
outArray = gradient.Run(vtkm::filter::ApplyPolicy(cells, policy),
|
||||
vtkm::filter::ApplyPolicy(coords, policy),
|
||||
inField,
|
||||
gradientfields,
|
||||
adapter);
|
||||
outArray = gradient.Run(
|
||||
vtkm::filter::ApplyPolicy(cells, policy), coords, inField, gradientfields, adapter);
|
||||
}
|
||||
if (!this->RowOrdering)
|
||||
{
|
||||
|
@ -167,7 +167,7 @@ inline VTKM_CONT vtkm::filter::Result MarchingCubes::DoExecute(
|
||||
outputCells = this->Worklet.Run(&ivalues[0],
|
||||
static_cast<vtkm::Id>(ivalues.size()),
|
||||
vtkm::filter::ApplyPolicy(cells, policy),
|
||||
vtkm::filter::ApplyPolicy(coords, policy),
|
||||
coords.GetData(),
|
||||
field,
|
||||
vertices,
|
||||
normals,
|
||||
@ -178,7 +178,7 @@ inline VTKM_CONT vtkm::filter::Result MarchingCubes::DoExecute(
|
||||
outputCells = this->Worklet.Run(&ivalues[0],
|
||||
static_cast<vtkm::Id>(ivalues.size()),
|
||||
vtkm::filter::ApplyPolicy(cells, policy),
|
||||
vtkm::filter::ApplyPolicy(coords, policy),
|
||||
coords.GetData(),
|
||||
field,
|
||||
vertices,
|
||||
device);
|
||||
|
@ -47,9 +47,6 @@ struct PolicyBase
|
||||
typedef vtkm::cont::CellSetListTagUnstructured UnstructuredCellSetList;
|
||||
typedef VTKM_DEFAULT_CELL_SET_LIST_TAG AllCellSetList;
|
||||
|
||||
typedef VTKM_DEFAULT_COORDINATE_SYSTEM_TYPE_LIST_TAG CoordinateTypeList;
|
||||
typedef VTKM_DEFAULT_COORDINATE_SYSTEM_STORAGE_LIST_TAG CoordinateStorageList;
|
||||
|
||||
// List of backends to try in sequence (if one fails, the next is attempted).
|
||||
typedef VTKM_DEFAULT_DEVICE_ADAPTER_LIST_TAG DeviceAdapterList;
|
||||
};
|
||||
@ -81,33 +78,6 @@ ApplyPolicy(const vtkm::cont::Field& field,
|
||||
return field.GetData().ResetTypeAndStorageLists(TypeList(), StorageList());
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
template <typename DerivedPolicy>
|
||||
VTKM_CONT vtkm::cont::DynamicArrayHandleBase<typename DerivedPolicy::CoordinateTypeList,
|
||||
typename DerivedPolicy::CoordinateStorageList>
|
||||
ApplyPolicy(const vtkm::cont::CoordinateSystem& coordinates,
|
||||
const vtkm::filter::PolicyBase<DerivedPolicy>&)
|
||||
{
|
||||
typedef typename DerivedPolicy::CoordinateTypeList TypeList;
|
||||
typedef typename DerivedPolicy::CoordinateStorageList StorageList;
|
||||
return coordinates.GetData().ResetTypeAndStorageLists(TypeList(), StorageList());
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
template <typename DerivedPolicy, typename FilterType>
|
||||
VTKM_CONT vtkm::cont::DynamicArrayHandleBase<typename DerivedPolicy::CoordinateTypeList,
|
||||
typename DerivedPolicy::CoordinateStorageList>
|
||||
ApplyPolicy(const vtkm::cont::CoordinateSystem& coordinates,
|
||||
const vtkm::filter::PolicyBase<DerivedPolicy>&,
|
||||
const vtkm::filter::FilterTraits<FilterType>&)
|
||||
{
|
||||
//todo: we need to intersect the policy field type list and the
|
||||
//filter traits to the get smallest set of valid types
|
||||
typedef typename DerivedPolicy::CoordinateTypeList TypeList;
|
||||
typedef typename DerivedPolicy::CoordinateStorageList StorageList;
|
||||
return coordinates.GetData().ResetTypeAndStorageLists(TypeList(), StorageList());
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
template <typename DerivedPolicy>
|
||||
VTKM_CONT vtkm::cont::DynamicCellSetBase<typename DerivedPolicy::AllCellSetList> ApplyPolicy(
|
||||
|
@ -40,12 +40,11 @@ inline VTKM_CONT vtkm::filter::Result VertexClustering::DoExecute(
|
||||
// todo this code needs to obey the policy for what storage types
|
||||
// the output should use
|
||||
//need to compute bounds first
|
||||
vtkm::Bounds bounds = input.GetCoordinateSystem().GetBounds(
|
||||
typename DerivedPolicy::CoordinateTypeList(), typename DerivedPolicy::CoordinateStorageList());
|
||||
vtkm::Bounds bounds = input.GetCoordinateSystem().GetBounds();
|
||||
|
||||
vtkm::cont::DataSet outDataSet =
|
||||
this->Worklet.Run(vtkm::filter::ApplyPolicyUnstructured(input.GetCellSet(), policy),
|
||||
vtkm::filter::ApplyPolicy(input.GetCoordinateSystem(), policy),
|
||||
input.GetCoordinateSystem(),
|
||||
bounds,
|
||||
this->GetNumberOfDivisions(),
|
||||
tag);
|
||||
|
@ -91,9 +91,7 @@ void TestPointElevationNoPolicy()
|
||||
const bool valid = result.FieldAs(resultArrayHandle);
|
||||
if (valid)
|
||||
{
|
||||
vtkm::cont::ArrayHandle<vtkm::Vec<vtkm::Float32, 3>> coordinates;
|
||||
inputData.GetCoordinateSystem().GetData().CopyTo(coordinates);
|
||||
|
||||
auto coordinates = inputData.GetCoordinateSystem().GetData();
|
||||
for (vtkm::Id i = 0; i < resultArrayHandle.GetNumberOfValues(); ++i)
|
||||
{
|
||||
VTKM_TEST_ASSERT(test_equal(coordinates.GetPortalConstControl().Get(i)[1] * 2.0,
|
||||
@ -131,9 +129,7 @@ void TestPointElevationWithPolicy()
|
||||
const bool valid = result.FieldAs(resultArrayHandle);
|
||||
if (valid)
|
||||
{
|
||||
vtkm::cont::ArrayHandle<vtkm::Vec<vtkm::Float32, 3>> coordinates;
|
||||
inputData.GetCoordinateSystem().GetData().CopyTo(coordinates);
|
||||
|
||||
auto coordinates = inputData.GetCoordinateSystem().GetData();
|
||||
for (vtkm::Id i = 0; i < resultArrayHandle.GetNumberOfValues(); ++i)
|
||||
{
|
||||
VTKM_TEST_ASSERT(test_equal(coordinates.GetPortalConstControl().Get(i)[1] * 2.0,
|
||||
|
@ -78,9 +78,7 @@ void TestVertexClustering()
|
||||
}
|
||||
|
||||
{
|
||||
typedef vtkm::Vec<vtkm::Float64, 3> PointType;
|
||||
vtkm::cont::ArrayHandle<PointType> pointArray;
|
||||
output.GetCoordinateSystem(0).GetData().CopyTo(pointArray);
|
||||
auto pointArray = output.GetCoordinateSystem(0).GetData();
|
||||
std::cerr << "output_points = " << pointArray.GetNumberOfValues() << "\n";
|
||||
std::cerr << "output_point[] = ";
|
||||
vtkm::cont::printSummary_ArrayHandle(pointArray, std::cerr, true);
|
||||
@ -90,8 +88,7 @@ void TestVertexClustering()
|
||||
vtkm::cont::printSummary_ArrayHandle(cellvar, std::cerr, true);
|
||||
|
||||
typedef vtkm::Vec<vtkm::Float64, 3> PointType;
|
||||
vtkm::cont::ArrayHandle<PointType> pointArray;
|
||||
output.GetCoordinateSystem(0).GetData().CopyTo(pointArray);
|
||||
auto pointArray = output.GetCoordinateSystem(0).GetData();
|
||||
VTKM_TEST_ASSERT(pointArray.GetNumberOfValues() == output_points,
|
||||
"Number of output points mismatch");
|
||||
for (vtkm::Id i = 0; i < pointArray.GetNumberOfValues(); ++i)
|
||||
|
@ -161,17 +161,13 @@ private:
|
||||
{
|
||||
///\todo: support other coordinate systems
|
||||
int cindex = 0;
|
||||
|
||||
vtkm::cont::CoordinateSystem coords = dataSet.GetCoordinateSystem(cindex);
|
||||
vtkm::cont::DynamicArrayHandleCoordinateSystem cdata = coords.GetData();
|
||||
auto cdata = dataSet.GetCoordinateSystem(cindex).GetData();
|
||||
|
||||
vtkm::Id npoints = cdata.GetNumberOfValues();
|
||||
out << "POINTS " << npoints << " "
|
||||
<< vtkm::io::internal::DataTypeName<vtkm::FloatDefault>::Name() << " " << std::endl;
|
||||
|
||||
std::string typeName;
|
||||
vtkm::cont::CastAndCall(cdata, detail::GetDataTypeName(typeName));
|
||||
|
||||
out << "POINTS " << npoints << " " << typeName << " " << std::endl;
|
||||
vtkm::cont::CastAndCall(cdata, detail::OutputPointsFunctor(out));
|
||||
detail::OutputPointsFunctor{ out }(cdata);
|
||||
}
|
||||
|
||||
template <class CellSetType>
|
||||
|
@ -66,7 +66,7 @@ protected:
|
||||
{
|
||||
VTKM_IS_DEVICE_ADAPTER_TAG(Device);
|
||||
|
||||
Internals->SpatialBounds = Internals->Coords.GetBounds(Device());
|
||||
Internals->SpatialBounds = Internals->Coords.GetBounds();
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
@ -432,7 +432,7 @@ void MapperGL::RenderCells(const vtkm::cont::DynamicCellSet& cellset,
|
||||
{
|
||||
vtkm::cont::ArrayHandle<vtkm::Float32> sf;
|
||||
sf = scalarField.GetData().Cast<vtkm::cont::ArrayHandle<vtkm::Float32>>();
|
||||
vtkm::cont::DynamicArrayHandleCoordinateSystem dcoords = coords.GetData();
|
||||
auto dcoords = coords.GetData();
|
||||
vtkm::Id numVerts = coords.GetData().GetNumberOfValues();
|
||||
|
||||
//Handle 1D cases.
|
||||
@ -459,20 +459,20 @@ void MapperGL::RenderCells(const vtkm::cont::DynamicCellSet& cellset,
|
||||
vtkm::cont::ArrayHandleUniformPointCoordinates uVerts;
|
||||
vtkm::cont::ArrayHandle<vtkm::Vec<vtkm::Float32, 3>> eVerts;
|
||||
|
||||
if (dcoords.IsSameType(vtkm::cont::ArrayHandleUniformPointCoordinates()))
|
||||
if (dcoords.IsSameType<vtkm::cont::ArrayHandleUniformPointCoordinates>())
|
||||
{
|
||||
uVerts = dcoords.Cast<vtkm::cont::ArrayHandleUniformPointCoordinates>();
|
||||
RenderTriangles(*this, numTri, uVerts, indices, sf, colorTable, scalarRange, camera);
|
||||
}
|
||||
else if (dcoords.IsSameType(vtkm::cont::ArrayHandle<vtkm::Vec<vtkm::Float32, 3>>()))
|
||||
else if (dcoords.IsSameType<vtkm::cont::ArrayHandle<vtkm::Vec<vtkm::Float32, 3>>>())
|
||||
{
|
||||
eVerts = dcoords.Cast<vtkm::cont::ArrayHandle<vtkm::Vec<vtkm::Float32, 3>>>();
|
||||
RenderTriangles(*this, numTri, eVerts, indices, sf, colorTable, scalarRange, camera);
|
||||
}
|
||||
else if (dcoords.IsSameType(vtkm::cont::ArrayHandleCartesianProduct<
|
||||
vtkm::cont::ArrayHandle<vtkm::FloatDefault>,
|
||||
vtkm::cont::ArrayHandle<vtkm::FloatDefault>,
|
||||
vtkm::cont::ArrayHandle<vtkm::FloatDefault>>()))
|
||||
else if (dcoords.IsSameType<vtkm::cont::ArrayHandleCartesianProduct<
|
||||
vtkm::cont::ArrayHandle<vtkm::FloatDefault>,
|
||||
vtkm::cont::ArrayHandle<vtkm::FloatDefault>,
|
||||
vtkm::cont::ArrayHandle<vtkm::FloatDefault>>>())
|
||||
{
|
||||
vtkm::cont::ArrayHandleCartesianProduct<vtkm::cont::ArrayHandle<vtkm::FloatDefault>,
|
||||
vtkm::cont::ArrayHandle<vtkm::FloatDefault>,
|
||||
|
@ -451,7 +451,7 @@ public:
|
||||
const vtkm::Range& fieldRange)
|
||||
{
|
||||
this->Bounds = coords.GetBounds();
|
||||
this->Coordinates = coords.GetData();
|
||||
this->Coordinates = coords;
|
||||
this->PointIndices = endPointIndices;
|
||||
this->ScalarField = field;
|
||||
this->ScalarFieldRange = fieldRange;
|
||||
@ -583,7 +583,7 @@ private:
|
||||
bool ShowInternalZones;
|
||||
bool IsOverlay;
|
||||
ColorMapHandle ColorMap;
|
||||
vtkm::cont::DynamicArrayHandleCoordinateSystem Coordinates;
|
||||
vtkm::cont::CoordinateSystem Coordinates;
|
||||
IndicesHandle PointIndices;
|
||||
vtkm::cont::Field ScalarField;
|
||||
vtkm::Range ScalarFieldRange;
|
||||
|
@ -689,7 +689,7 @@ VTKM_CONT void LinearBVHBuilder::RunOnDevice(LinearBVH& linearBVH, Device device
|
||||
logger->AddLogData("device", GetDeviceString(Device()));
|
||||
vtkm::cont::Timer<Device> constructTimer;
|
||||
|
||||
vtkm::cont::DynamicArrayHandleCoordinateSystem coordsHandle = linearBVH.GetCoordsHandle();
|
||||
auto coordsHandle = linearBVH.GetCoordsHandle();
|
||||
vtkm::cont::ArrayHandle<vtkm::Vec<vtkm::Id, 4>> triangleIndices = linearBVH.GetTriangles();
|
||||
vtkm::Id numberOfTriangles = linearBVH.GetNumberOfTriangles();
|
||||
|
||||
@ -811,7 +811,7 @@ LinearBVH::LinearBVH()
|
||||
, CanConstruct(false){};
|
||||
|
||||
VTKM_CONT
|
||||
LinearBVH::LinearBVH(vtkm::cont::DynamicArrayHandleCoordinateSystem coordsHandle,
|
||||
LinearBVH::LinearBVH(vtkm::cont::ArrayHandleVirtualCoordinates coordsHandle,
|
||||
vtkm::cont::ArrayHandle<vtkm::Vec<vtkm::Id, 4>> triangles,
|
||||
vtkm::Bounds coordBounds)
|
||||
: CoordBounds(coordBounds)
|
||||
@ -856,7 +856,7 @@ void LinearBVH::Construct()
|
||||
}
|
||||
|
||||
VTKM_CONT
|
||||
void LinearBVH::SetData(vtkm::cont::DynamicArrayHandleCoordinateSystem coordsHandle,
|
||||
void LinearBVH::SetData(vtkm::cont::ArrayHandleVirtualCoordinates coordsHandle,
|
||||
vtkm::cont::ArrayHandle<vtkm::Vec<vtkm::Id, 4>> triangles,
|
||||
vtkm::Bounds coordBounds)
|
||||
{
|
||||
@ -918,7 +918,7 @@ bool LinearBVH::GetIsConstructed() const
|
||||
return IsConstructed;
|
||||
}
|
||||
VTKM_CONT
|
||||
vtkm::cont::DynamicArrayHandleCoordinateSystem LinearBVH::GetCoordsHandle() const
|
||||
vtkm::cont::ArrayHandleVirtualCoordinates LinearBVH::GetCoordsHandle() const
|
||||
{
|
||||
return CoordsHandle;
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ public:
|
||||
vtkm::Bounds CoordBounds;
|
||||
|
||||
protected:
|
||||
vtkm::cont::DynamicArrayHandleCoordinateSystem CoordsHandle;
|
||||
vtkm::cont::ArrayHandleVirtualCoordinates CoordsHandle;
|
||||
vtkm::cont::ArrayHandle<vtkm::Vec<vtkm::Id, 4>> Triangles;
|
||||
bool IsConstructed;
|
||||
bool CanConstruct;
|
||||
@ -55,7 +55,7 @@ public:
|
||||
LinearBVH();
|
||||
|
||||
VTKM_CONT
|
||||
LinearBVH(vtkm::cont::DynamicArrayHandleCoordinateSystem coordsHandle,
|
||||
LinearBVH(vtkm::cont::ArrayHandleVirtualCoordinates coordsHandle,
|
||||
vtkm::cont::ArrayHandle<vtkm::Vec<vtkm::Id, 4>> triangles,
|
||||
vtkm::Bounds coordBounds);
|
||||
|
||||
@ -69,7 +69,7 @@ public:
|
||||
void Construct();
|
||||
|
||||
VTKM_CONT
|
||||
void SetData(vtkm::cont::DynamicArrayHandleCoordinateSystem coordsHandle,
|
||||
void SetData(vtkm::cont::ArrayHandleVirtualCoordinates coordsHandle,
|
||||
vtkm::cont::ArrayHandle<vtkm::Vec<vtkm::Id, 4>> triangles,
|
||||
vtkm::Bounds coordBounds);
|
||||
|
||||
@ -80,7 +80,7 @@ public:
|
||||
bool GetIsConstructed() const;
|
||||
|
||||
VTKM_CONT
|
||||
vtkm::cont::DynamicArrayHandleCoordinateSystem GetCoordsHandle() const;
|
||||
vtkm::cont::ArrayHandleVirtualCoordinates GetCoordsHandle() const;
|
||||
|
||||
VTKM_CONT
|
||||
vtkm::cont::ArrayHandle<vtkm::Vec<vtkm::Id, 4>> GetTriangles() const;
|
||||
|
@ -1461,7 +1461,7 @@ public:
|
||||
{
|
||||
|
||||
vtkm::cont::ArrayHandleCounting<vtkm::Id> pCounter(0, 1, rays.NumRays);
|
||||
vtkm::worklet::DispatcherMapField<IdentifyMissedRay>(
|
||||
vtkm::worklet::DispatcherMapField<IdentifyMissedRay, Device>(
|
||||
IdentifyMissedRay(rays.DebugWidth, rays.DebugHeight, this->BackgroundColor))
|
||||
.Invoke(pCounter, rays.Buffers.at(0).Buffer);
|
||||
}
|
||||
|
@ -525,7 +525,7 @@ public:
|
||||
|
||||
VTKM_CONT
|
||||
void BuildConnectivity(vtkm::cont::CellSetSingleType<>& cellSetUnstructured,
|
||||
DynamicArrayHandleExplicitCoordinateSystem& coordinates,
|
||||
const vtkm::cont::ArrayHandleVirtualCoordinates& coordinates,
|
||||
vtkm::Bounds coordsBounds)
|
||||
{
|
||||
Logger* logger = Logger::GetInstance();
|
||||
@ -571,7 +571,7 @@ public:
|
||||
|
||||
|
||||
// scatter the coonectivity into the original order
|
||||
vtkm::worklet::DispatcherMapField<WriteFaceConn>(WriteFaceConn())
|
||||
vtkm::worklet::DispatcherMapField<WriteFaceConn, DeviceAdapter>(WriteFaceConn())
|
||||
.Invoke(cellFaceId, this->FaceOffsets, faceConnectivity);
|
||||
|
||||
|
||||
@ -584,7 +584,7 @@ public:
|
||||
|
||||
VTKM_CONT
|
||||
void BuildConnectivity(vtkm::cont::CellSetExplicit<>& cellSetUnstructured,
|
||||
DynamicArrayHandleExplicitCoordinateSystem& coordinates,
|
||||
const vtkm::cont::ArrayHandleVirtualCoordinates& coordinates,
|
||||
vtkm::Bounds coordsBounds)
|
||||
{
|
||||
Logger* logger = Logger::GetInstance();
|
||||
@ -628,7 +628,7 @@ public:
|
||||
this->ExtractExternalFaces(cellFaceId, faceConnectivity, shapes, conn, shapeOffsets);
|
||||
|
||||
// scatter the coonectivity into the original order
|
||||
vtkm::worklet::DispatcherMapField<WriteFaceConn>(WriteFaceConn())
|
||||
vtkm::worklet::DispatcherMapField<WriteFaceConn, DeviceAdapter>(WriteFaceConn())
|
||||
.Invoke(cellFaceId, this->FaceOffsets, faceConnectivity);
|
||||
|
||||
FaceConnectivity = faceConnectivity;
|
||||
@ -653,7 +653,7 @@ public:
|
||||
triangles.PrepareForOutput(numFaces * 2, DeviceAdapter());
|
||||
vtkm::cont::ArrayHandleCounting<vtkm::Id> counting(0, 1, numFaces);
|
||||
|
||||
vtkm::worklet::DispatcherMapField<StructuredExternalTriangles>(
|
||||
vtkm::worklet::DispatcherMapField<StructuredExternalTriangles, DeviceAdapter>(
|
||||
StructuredExternalTriangles(cellSetStructured.PrepareForInput(
|
||||
DeviceAdapter(), vtkm::TopologyElementTagPoint(), vtkm::TopologyElementTagCell())))
|
||||
.Invoke(counting, triangles);
|
||||
@ -683,7 +683,7 @@ protected:
|
||||
const ShapeHandleType shapes,
|
||||
const ConnHandleType conn,
|
||||
const OffsetsHandleType shapeOffsets,
|
||||
DynamicArrayHandleExplicitCoordinateSystem& coordinates,
|
||||
const vtkm::cont::ArrayHandleVirtualCoordinates& coords,
|
||||
vtkm::cont::ArrayHandle<vtkm::Id>& faceConnectivity,
|
||||
vtkm::cont::ArrayHandle<vtkm::Vec<vtkm::Id, 3>>& cellFaceId,
|
||||
vtkm::Float32 BoundingBox[6])
|
||||
@ -693,6 +693,9 @@ protected:
|
||||
|
||||
vtkm::Id numCells = shapes.GetNumberOfValues();
|
||||
|
||||
vtkm::cont::ArrayHandle<vtkm::Vec<vtkm::FloatDefault, 3>> coordinates;
|
||||
vtkm::cont::DeviceAdapterAlgorithm<DeviceAdapter>::Copy(coords, coordinates);
|
||||
|
||||
/*-----------------------------------------------------------------*/
|
||||
|
||||
// Count the number of total faces in the cell set
|
||||
@ -744,8 +747,10 @@ protected:
|
||||
vtkm::worklet::DispatcherMapTopology<MortonCodeFace, DeviceAdapter>(
|
||||
MortonCodeFace(inverseExtent, minPoint))
|
||||
.Invoke(cellSet, coordinates, cellOffsets, faceMortonCodes, cellFaceId);
|
||||
|
||||
// Sort the "faces" (i.e., morton codes)
|
||||
vtkm::cont::DeviceAdapterAlgorithm<DeviceAdapter>::SortByKey(faceMortonCodes, cellFaceId);
|
||||
|
||||
// Allocate space for the final face-to-face conectivity
|
||||
faceConnectivity.PrepareForOutput(totalFaces, DeviceAdapter());
|
||||
|
||||
|
@ -69,8 +69,6 @@ public:
|
||||
Id4Handle ExternalTriangles;
|
||||
LinearBVH Bvh;
|
||||
|
||||
// Restrict the coordinates to the types that be for unstructured meshes
|
||||
DynamicArrayHandleExplicitCoordinateSystem Coordinates;
|
||||
vtkm::Bounds CoordinateBounds;
|
||||
vtkm::cont::CellSetExplicit<> Cellset;
|
||||
vtkm::cont::CoordinateSystem Coords;
|
||||
@ -89,15 +87,6 @@ public:
|
||||
: IsConstructed(false)
|
||||
{
|
||||
Coords = coords;
|
||||
vtkm::cont::DynamicArrayHandleCoordinateSystem dynamicCoordsHandle = coords.GetData();
|
||||
|
||||
//
|
||||
// Reset the type lists to only contain the coordinate systemss of an
|
||||
// unstructured cell set.
|
||||
//
|
||||
|
||||
Coordinates = dynamicCoordsHandle.ResetTypeList(ExplicitCoordinatesType())
|
||||
.ResetStorageList(StorageListTagExplicitCoordinateSystem());
|
||||
|
||||
if (!cellset.IsSameType(vtkm::cont::CellSetExplicit<>()))
|
||||
{
|
||||
@ -130,7 +119,6 @@ public:
|
||||
, Shapes(other.Shapes)
|
||||
, ExternalTriangles(other.ExternalTriangles)
|
||||
, Bvh(other.Bvh)
|
||||
, Coordinates(other.Coordinates)
|
||||
, CoordinateBounds(other.CoordinateBounds)
|
||||
, Cellset(other.Cellset)
|
||||
, Coords(other.Coords)
|
||||
@ -153,7 +141,7 @@ public:
|
||||
//
|
||||
// Build the face-to-face connectivity
|
||||
//
|
||||
connBuilder.BuildConnectivity(Cellset, Coordinates, CoordinateBounds);
|
||||
connBuilder.BuildConnectivity(Cellset, Coords.GetData(), CoordinateBounds);
|
||||
|
||||
//
|
||||
// Initialize all of the array handles
|
||||
@ -184,7 +172,7 @@ public:
|
||||
}
|
||||
TriangleIntersector<Device, TriLeafIntersector<WaterTight<T>>> intersector;
|
||||
bool getCellIndex = true;
|
||||
intersector.runHitOnly(rays, Bvh, Coordinates, getCellIndex);
|
||||
intersector.runHitOnly(rays, Bvh, Coords.GetData(), getCellIndex);
|
||||
}
|
||||
//----------------------------------------------------------------------------
|
||||
VTKM_CONT
|
||||
@ -198,7 +186,7 @@ public:
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
VTKM_CONT
|
||||
DynamicArrayHandleExplicitCoordinateSystem GetCoordinates() { return Coordinates; }
|
||||
vtkm::cont::ArrayHandleVirtualCoordinates GetCoordinates() { return Coords.GetData(); }
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
template <typename Device>
|
||||
@ -319,8 +307,7 @@ public:
|
||||
// Mesh Boundry
|
||||
LinearBVH Bvh;
|
||||
Id4Handle ExternalTriangles;
|
||||
// Restrict the coordinates to the types that be for unstructured meshes
|
||||
DynamicArrayHandleExplicitCoordinateSystem Coordinates;
|
||||
|
||||
vtkm::Bounds CoordinateBounds;
|
||||
vtkm::cont::CoordinateSystem Coords;
|
||||
vtkm::cont::CellSetSingleType<> Cellset;
|
||||
@ -344,15 +331,6 @@ public:
|
||||
{
|
||||
|
||||
Coords = coords;
|
||||
vtkm::cont::DynamicArrayHandleCoordinateSystem dynamicCoordsHandle = coords.GetData();
|
||||
|
||||
//
|
||||
// Reset the type lists to only contain the coordinate systemss of an
|
||||
// unstructured cell set.
|
||||
//
|
||||
|
||||
Coordinates = dynamicCoordsHandle.ResetTypeList(ExplicitCoordinatesType())
|
||||
.ResetStorageList(StorageListTagExplicitCoordinateSystem());
|
||||
|
||||
if (!cellset.IsSameType(vtkm::cont::CellSetSingleType<>()))
|
||||
{
|
||||
@ -393,7 +371,6 @@ public:
|
||||
, CellConnectivity(other.CellConnectivity)
|
||||
, Bvh(other.Bvh)
|
||||
, ExternalTriangles(other.ExternalTriangles)
|
||||
, Coordinates(other.Coordinates)
|
||||
, CoordinateBounds(other.CoordinateBounds)
|
||||
, Coords(other.coords)
|
||||
, Cellset(other.Cellset)
|
||||
@ -420,7 +397,7 @@ public:
|
||||
//
|
||||
// Build the face-to-face connectivity
|
||||
//
|
||||
connBuilder.BuildConnectivity(Cellset, Coordinates, CoordinateBounds);
|
||||
connBuilder.BuildConnectivity(Cellset, Coords.GetData(), CoordinateBounds);
|
||||
//
|
||||
// Initialize all of the array handles
|
||||
//
|
||||
@ -451,7 +428,7 @@ public:
|
||||
}
|
||||
TriangleIntersector<Device, TriLeafIntersector<WaterTight<T>>> intersector;
|
||||
bool getCellIndex = true;
|
||||
intersector.runHitOnly(rays, Bvh, Coordinates, getCellIndex);
|
||||
intersector.runHitOnly(rays, Bvh, Coords.GetData(), getCellIndex);
|
||||
}
|
||||
//----------------------------------------------------------------------------
|
||||
VTKM_CONT
|
||||
@ -461,7 +438,7 @@ public:
|
||||
Id4Handle GetExternalTriangles() { return ExternalTriangles; }
|
||||
//----------------------------------------------------------------------------
|
||||
VTKM_CONT
|
||||
DynamicArrayHandleExplicitCoordinateSystem GetCoordinates() { return Coordinates; }
|
||||
vtkm::cont::ArrayHandleVirtualCoordinates GetCoordinates() { return Coords.GetData(); }
|
||||
//----------------------------------------------------------------------------
|
||||
template <typename Device>
|
||||
VTKM_CONT vtkm::Bounds GetCoordinateBounds(Device)
|
||||
@ -567,7 +544,6 @@ public:
|
||||
typedef vtkm::cont::ArrayHandle<vtkm::Vec<vtkm::Id, 4>> Id4Handle;
|
||||
vtkm::Id3 CellDims;
|
||||
vtkm::Id3 PointDims;
|
||||
DynamicArrayHandleStructuredCoordinateSystem Coordinates;
|
||||
vtkm::Bounds CoordinateBounds;
|
||||
vtkm::cont::CoordinateSystem Coords;
|
||||
vtkm::cont::CellSetStructured<3> Cellset;
|
||||
@ -589,15 +565,7 @@ public:
|
||||
: IsConstructed(false)
|
||||
{
|
||||
Coords = coords;
|
||||
vtkm::cont::DynamicArrayHandleCoordinateSystem dynamicCoordsHandle = coords.GetData();
|
||||
|
||||
//
|
||||
// Reset the type lists to only contain the coordinate systemss of an
|
||||
// unstructured cell set.
|
||||
//
|
||||
|
||||
Coordinates = dynamicCoordsHandle.ResetTypeList(ExplicitCoordinatesType())
|
||||
.ResetStorageList(StructuredStorage());
|
||||
if (!cellset.IsSameType(vtkm::cont::CellSetStructured<3>()))
|
||||
{
|
||||
throw vtkm::cont::ErrorBadValue(
|
||||
@ -612,7 +580,6 @@ public:
|
||||
VTKM_CONT StructuredMeshConn(const T& other)
|
||||
: CellDims(other.CellDims)
|
||||
, PointDims(other.PointDims)
|
||||
, Coordinates(other.Coordinates)
|
||||
, CoordinateBounds(other.CoordinateBounds)
|
||||
, Coords(other.coords)
|
||||
, Cellset(other.Cellset)
|
||||
@ -659,7 +626,7 @@ public:
|
||||
}
|
||||
TriangleIntersector<Device, TriLeafIntersector<WaterTight<T>>> intersector;
|
||||
bool getCellIndex = true;
|
||||
intersector.runHitOnly(rays, Bvh, Coordinates, getCellIndex);
|
||||
intersector.runHitOnly(rays, Bvh, Coords.GetData(), getCellIndex);
|
||||
}
|
||||
//----------------------------------------------------------------------------
|
||||
VTKM_CONT
|
||||
@ -672,7 +639,7 @@ public:
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
VTKM_CONT
|
||||
DynamicArrayHandleStructuredCoordinateSystem GetCoordinates() { return Coordinates; }
|
||||
vtkm::cont::ArrayHandleVirtualCoordinates GetCoordinates() { return Coords.GetData(); }
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
template <typename Device>
|
||||
|
@ -233,8 +233,8 @@ public:
|
||||
template <typename Precision>
|
||||
VTKM_CONT void run(Ray<Precision>& rays,
|
||||
LinearBVH& bvh,
|
||||
vtkm::cont::DynamicArrayHandleCoordinateSystem& coordsHandle,
|
||||
vtkm::cont::Field& scalarField,
|
||||
vtkm::cont::ArrayHandleVirtualCoordinates& coordsHandle,
|
||||
const vtkm::cont::Field& scalarField,
|
||||
const vtkm::Range& scalarRange)
|
||||
{
|
||||
bool isSupportedField = (scalarField.GetAssociation() == vtkm::cont::Field::ASSOC_POINTS ||
|
||||
@ -396,7 +396,7 @@ Camera& RayTracer::GetCamera()
|
||||
return camera;
|
||||
}
|
||||
|
||||
void RayTracer::SetData(const vtkm::cont::DynamicArrayHandleCoordinateSystem& coordsHandle,
|
||||
void RayTracer::SetData(const vtkm::cont::ArrayHandleVirtualCoordinates& coordsHandle,
|
||||
const vtkm::cont::ArrayHandle<vtkm::Vec<vtkm::Id, 4>>& indices,
|
||||
vtkm::cont::Field& scalarField,
|
||||
const vtkm::Id& numberOfTriangles,
|
||||
|
@ -39,7 +39,7 @@ class VTKM_RENDERING_EXPORT RayTracer
|
||||
protected:
|
||||
LinearBVH Bvh;
|
||||
Camera camera;
|
||||
vtkm::cont::DynamicArrayHandleCoordinateSystem CoordsHandle;
|
||||
vtkm::cont::ArrayHandleVirtualCoordinates CoordsHandle;
|
||||
vtkm::cont::Field ScalarField;
|
||||
vtkm::cont::ArrayHandle<vtkm::Vec<vtkm::Id, 4>> Indices;
|
||||
vtkm::cont::ArrayHandle<vtkm::Float32> Scalars;
|
||||
@ -61,7 +61,7 @@ public:
|
||||
Camera& GetCamera();
|
||||
|
||||
VTKM_CONT
|
||||
void SetData(const vtkm::cont::DynamicArrayHandleCoordinateSystem& coordsHandle,
|
||||
void SetData(const vtkm::cont::ArrayHandleVirtualCoordinates& coordsHandle,
|
||||
const vtkm::cont::ArrayHandle<vtkm::Vec<vtkm::Id, 4>>& indices,
|
||||
vtkm::cont::Field& scalarField,
|
||||
const vtkm::Id& numberOfTriangles,
|
||||
|
@ -723,7 +723,7 @@ void VolumeRendererStructured::SetData(const vtkm::cont::CoordinateSystem& coord
|
||||
const vtkm::cont::CellSetStructured<3>& cellset,
|
||||
const vtkm::Range& scalarRange)
|
||||
{
|
||||
if (coords.GetData().IsSameType(CartesianArrayHandle()))
|
||||
if (coords.GetData().IsSameType<CartesianArrayHandle>())
|
||||
IsUniformDataSet = false;
|
||||
IsSceneDirty = true;
|
||||
SpatialExtent = coords.GetBounds();
|
||||
|
@ -79,7 +79,7 @@ protected:
|
||||
bool IsSceneDirty;
|
||||
bool IsUniformDataSet;
|
||||
vtkm::Bounds SpatialExtent;
|
||||
vtkm::cont::DynamicArrayHandleCoordinateSystem Coordinates;
|
||||
vtkm::cont::ArrayHandleVirtualCoordinates Coordinates;
|
||||
vtkm::cont::CellSetStructured<3> Cellset;
|
||||
const vtkm::cont::Field* ScalarField;
|
||||
vtkm::cont::ArrayHandle<vtkm::Vec<vtkm::Float32, 4>> ColorMap;
|
||||
|
@ -789,23 +789,17 @@ public:
|
||||
{
|
||||
vtkm::Vec<vtkm::Float64, 3> MinPoint;
|
||||
vtkm::Vec<vtkm::Float64, 3> MaxPoint;
|
||||
vtkm::exec::ConnectivityStructured<vtkm::TopologyElementTagPoint,
|
||||
vtkm::TopologyElementTagCell,
|
||||
3>
|
||||
Conn;
|
||||
|
||||
Conn = inCellSet.PrepareForInput(
|
||||
DeviceAdapter(), vtkm::TopologyElementTagPoint(), vtkm::TopologyElementTagCell());
|
||||
vtkm::Id3 PointDimensions = inCellSet.GetPointDimensions();
|
||||
|
||||
vtkm::Id3 PointDimensions = Conn.GetPointDimensions();
|
||||
typedef vtkm::cont::ArrayHandle<vtkm::FloatDefault> DefaultHandle;
|
||||
typedef vtkm::cont::ArrayHandleCartesianProduct<DefaultHandle, DefaultHandle, DefaultHandle>
|
||||
CartesianArrayHandle;
|
||||
|
||||
if (coord.GetData().IsSameType(CartesianArrayHandle()))
|
||||
auto coordData = coord.GetData();
|
||||
if (coordData.IsSameType<CartesianArrayHandle>())
|
||||
{
|
||||
CartesianArrayHandle vertices;
|
||||
vertices = coord.GetData().Cast<CartesianArrayHandle>();
|
||||
auto vertices = coordData.Cast<CartesianArrayHandle>();
|
||||
|
||||
MinPoint[0] =
|
||||
static_cast<vtkm::Float64>(vertices.GetPortalConstControl().GetFirstPortal().Get(0));
|
||||
@ -823,12 +817,8 @@ public:
|
||||
}
|
||||
else
|
||||
{
|
||||
vtkm::cont::ArrayHandleUniformPointCoordinates vertices;
|
||||
vertices = coord.GetData().Cast<vtkm::cont::ArrayHandleUniformPointCoordinates>();
|
||||
typedef typename vtkm::cont::ArrayHandleUniformPointCoordinates UniformArrayHandle;
|
||||
typedef
|
||||
typename UniformArrayHandle::ExecutionTypes<DeviceAdapter>::PortalConst UniformConstPortal;
|
||||
UniformConstPortal Coordinates = vertices.PrepareForInput(DeviceAdapter());
|
||||
auto vertices = coordData.Cast<vtkm::cont::ArrayHandleUniformPointCoordinates>();
|
||||
auto Coordinates = vertices.GetPortalConstControl();
|
||||
|
||||
MinPoint = Coordinates.GetOrigin();
|
||||
vtkm::Vec<vtkm::Float64, 3> spacing = Coordinates.GetSpacing();
|
||||
@ -842,10 +832,10 @@ public:
|
||||
|
||||
// Create a worklet to count the number of external faces on each cell
|
||||
vtkm::cont::ArrayHandle<vtkm::IdComponent> numExternalFaces;
|
||||
vtkm::worklet::DispatcherMapTopology<NumExternalFacesPerStructuredCell>
|
||||
vtkm::worklet::DispatcherMapTopology<NumExternalFacesPerStructuredCell, DeviceAdapter>
|
||||
numExternalFacesDispatcher((NumExternalFacesPerStructuredCell(MinPoint, MaxPoint)));
|
||||
|
||||
numExternalFacesDispatcher.Invoke(inCellSet, numExternalFaces, coord.GetData());
|
||||
numExternalFacesDispatcher.Invoke(inCellSet, numExternalFaces, coordData);
|
||||
|
||||
typedef typename vtkm::cont::DeviceAdapterAlgorithm<DeviceAdapter> DeviceAlgorithms;
|
||||
vtkm::Id numberOfExternalFaces = DeviceAlgorithms::Reduce(numExternalFaces, 0, vtkm::Sum());
|
||||
@ -865,7 +855,7 @@ public:
|
||||
// information to.
|
||||
faceConnectivity.Allocate(connectivitySize);
|
||||
|
||||
vtkm::worklet::DispatcherMapTopology<BuildConnectivityStructured>
|
||||
vtkm::worklet::DispatcherMapTopology<BuildConnectivityStructured, DeviceAdapter>
|
||||
buildConnectivityStructuredDispatcher(
|
||||
(BuildConnectivityStructured(MinPoint, MaxPoint, scatterCellToExternalFace)));
|
||||
|
||||
@ -875,7 +865,7 @@ public:
|
||||
faceShapes,
|
||||
facePointCount,
|
||||
vtkm::cont::make_ArrayHandleGroupVec<4>(faceConnectivity),
|
||||
coord.GetData());
|
||||
coordData);
|
||||
outCellSet.Fill(inCellSet.GetNumberOfPoints(), faceShapes, facePointCount, faceConnectivity);
|
||||
}
|
||||
|
||||
@ -901,7 +891,7 @@ public:
|
||||
|
||||
//Create a worklet to map the number of faces to each cell
|
||||
vtkm::cont::ArrayHandle<vtkm::IdComponent> facesPerCell;
|
||||
vtkm::worklet::DispatcherMapTopology<NumFacesPerCell> numFacesDispatcher;
|
||||
vtkm::worklet::DispatcherMapTopology<NumFacesPerCell, DeviceAdapter> numFacesDispatcher;
|
||||
|
||||
numFacesDispatcher.Invoke(inCellSet, facesPerCell);
|
||||
|
||||
@ -917,7 +907,7 @@ public:
|
||||
if (this->PassPolyData)
|
||||
{
|
||||
vtkm::cont::ArrayHandle<vtkm::IdComponent> isPolyDataCell;
|
||||
vtkm::worklet::DispatcherMapTopology<IsPolyDataCell> isPolyDataCellDispatcher;
|
||||
vtkm::worklet::DispatcherMapTopology<IsPolyDataCell, DeviceAdapter> isPolyDataCellDispatcher;
|
||||
|
||||
isPolyDataCellDispatcher.Invoke(inCellSet, isPolyDataCell);
|
||||
|
||||
|
@ -358,7 +358,7 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
template <typename DynamicCoordinates, typename DeviceAdapter>
|
||||
template <typename DeviceAdapter>
|
||||
class CoordinatesMapper
|
||||
{
|
||||
private:
|
||||
@ -372,7 +372,8 @@ private:
|
||||
vtkm::cont::ArrayHandle<T, Storage3>>::Superclass;
|
||||
|
||||
public:
|
||||
CoordinatesMapper(const ExtractStructured* worklet, DynamicCoordinates& result)
|
||||
CoordinatesMapper(const ExtractStructured* worklet,
|
||||
vtkm::cont::ArrayHandleVirtualCoordinates& result)
|
||||
: Worklet(worklet)
|
||||
, Result(&result)
|
||||
{
|
||||
@ -394,7 +395,8 @@ private:
|
||||
inOrigin[2] + static_cast<ValueType>(this->Worklet->VOI.Z.Min) * inSpacing[2]);
|
||||
CoordType outSpacing = inSpacing * static_cast<CoordType>(this->Worklet->SampleRate);
|
||||
|
||||
*this->Result = CoordsArray(this->Worklet->OutputDimensions, outOrigin, outSpacing);
|
||||
auto out = CoordsArray(this->Worklet->OutputDimensions, outOrigin, outSpacing);
|
||||
*this->Result = vtkm::cont::ArrayHandleVirtualCoordinates(out);
|
||||
}
|
||||
|
||||
template <typename T, typename Storage1, typename Storage2, typename Storage3>
|
||||
@ -419,13 +421,15 @@ private:
|
||||
dim += RectilinearCoordsCopy(coords.GetStorage().GetThirdArray(), *validIds[dim], zs);
|
||||
VTKM_ASSERT(dim == this->Worklet->InputDimensionality);
|
||||
|
||||
*this->Result = vtkm::cont::make_ArrayHandleCartesianProduct(xs, ys, zs);
|
||||
auto out = vtkm::cont::make_ArrayHandleCartesianProduct(xs, ys, zs);
|
||||
*this->Result = vtkm::cont::ArrayHandleVirtualCoordinates(out);
|
||||
}
|
||||
|
||||
template <typename T, typename Storage>
|
||||
void operator()(const vtkm::cont::ArrayHandle<vtkm::Vec<T, 3>, Storage>& coords) const
|
||||
{
|
||||
*this->Result = this->Worklet->ProcessPointField(coords, DeviceAdapter());
|
||||
auto out = this->Worklet->ProcessPointField(coords, DeviceAdapter());
|
||||
*this->Result = vtkm::cont::ArrayHandleVirtualCoordinates(out);
|
||||
}
|
||||
|
||||
private:
|
||||
@ -448,15 +452,17 @@ private:
|
||||
}
|
||||
|
||||
const ExtractStructured* Worklet;
|
||||
DynamicCoordinates* Result;
|
||||
vtkm::cont::ArrayHandleVirtualCoordinates* Result;
|
||||
};
|
||||
|
||||
public:
|
||||
template <typename DynamicCoordinates, typename DeviceAdapter>
|
||||
DynamicCoordinates MapCoordinates(const DynamicCoordinates& coordinates, DeviceAdapter)
|
||||
template <typename DeviceAdapter>
|
||||
vtkm::cont::ArrayHandleVirtualCoordinates MapCoordinates(
|
||||
const vtkm::cont::CoordinateSystem& coordinates,
|
||||
DeviceAdapter)
|
||||
{
|
||||
DynamicCoordinates result;
|
||||
CoordinatesMapper<DynamicCoordinates, DeviceAdapter> mapper(this, result);
|
||||
vtkm::cont::ArrayHandleVirtualCoordinates result;
|
||||
CoordinatesMapper<DeviceAdapter> mapper(this, result);
|
||||
vtkm::cont::CastAndCall(coordinates, mapper);
|
||||
return result;
|
||||
}
|
||||
|
@ -379,7 +379,8 @@ public:
|
||||
OutFieldType& result) const
|
||||
{
|
||||
//fetch the low / high values from inPortal
|
||||
result = vtkm::Lerp(inPortal.Get(low_high[0]), inPortal.Get(low_high[1]), weight);
|
||||
result = static_cast<OutFieldType>(
|
||||
vtkm::Lerp(inPortal.Get(low_high[0]), inPortal.Get(low_high[1]), weight));
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -522,9 +522,7 @@ public:
|
||||
|
||||
/// output
|
||||
vtkm::cont::DataSet output;
|
||||
|
||||
output.AddCoordinateSystem(
|
||||
vtkm::cont::CoordinateSystem("coordinates", vtkm::cont::DynamicArrayHandle(repPointArray)));
|
||||
output.AddCoordinateSystem(vtkm::cont::CoordinateSystem("coordinates", repPointArray));
|
||||
|
||||
vtkm::cont::CellSetSingleType<> triangles("cells");
|
||||
triangles.Fill(repPointArray.GetNumberOfValues(),
|
||||
|
@ -146,7 +146,7 @@ public:
|
||||
typedef vtkm::cont::ArrayHandleUniformPointCoordinates UniformType;
|
||||
typedef vtkm::cont::CellSetStructured<3> StructuredType;
|
||||
|
||||
if (!coords.GetData().IsSameType(UniformType()))
|
||||
if (!coords.GetData().IsSameType<UniformType>())
|
||||
throw vtkm::cont::ErrorInternal("Coordinates are not uniform.");
|
||||
if (!cellSet.IsSameType(StructuredType()))
|
||||
throw vtkm::cont::ErrorInternal("Cells are not 3D structured.");
|
||||
@ -176,8 +176,8 @@ public:
|
||||
{
|
||||
typedef vtkm::cont::ArrayHandleUniformPointCoordinates UniformType;
|
||||
|
||||
vtkm::cont::DynamicArrayHandleCoordinateSystem coordArray = ds.GetCoordinateSystem().GetData();
|
||||
if (!coordArray.IsSameType(UniformType()))
|
||||
auto coordArray = ds.GetCoordinateSystem().GetData();
|
||||
if (!coordArray.IsSameType<UniformType>())
|
||||
throw vtkm::cont::ErrorInternal("Given dataset is was not uniform.");
|
||||
|
||||
bounds = ds.GetCoordinateSystem(0).GetBounds();
|
||||
@ -321,7 +321,7 @@ public:
|
||||
{
|
||||
typedef vtkm::cont::CellSetStructured<3> StructuredType;
|
||||
|
||||
if (!coords.GetData().IsSameType(RectilinearType()))
|
||||
if (!coords.GetData().IsSameType<RectilinearType>())
|
||||
throw vtkm::cont::ErrorInternal("Coordinates are not rectilinear.");
|
||||
if (!cellSet.IsSameType(StructuredType()))
|
||||
throw vtkm::cont::ErrorInternal("Cells are not 3D structured.");
|
||||
@ -351,9 +351,8 @@ public:
|
||||
dims = cells.GetSchedulingRange(vtkm::TopologyElementTagPoint());
|
||||
planeSize = dims[0] * dims[1];
|
||||
rowSize = dims[0];
|
||||
vtkm::cont::DynamicArrayHandleCoordinateSystem coordArray =
|
||||
dataset.GetCoordinateSystem().GetData();
|
||||
if (coordArray.IsSameType(RectilinearType()))
|
||||
auto coordArray = dataset.GetCoordinateSystem().GetData();
|
||||
if (coordArray.IsSameType<RectilinearType>())
|
||||
{
|
||||
RectilinearType gridPoints = coordArray.Cast<RectilinearType>();
|
||||
xAxis = gridPoints.GetPortalConstControl().GetFirstPortal();
|
||||
|
@ -132,8 +132,7 @@ void TestClippingExplicit()
|
||||
vtkm::cont::CellSetExplicit<> outputCellSet =
|
||||
clip.Run(ds.GetCellSet(0), ds.GetField("scalars").GetData(), clipValue, DeviceAdapter());
|
||||
|
||||
vtkm::cont::ArrayHandle<Coord3D> coordsIn;
|
||||
ds.GetCoordinateSystem("coords").GetData().CopyTo(coordsIn);
|
||||
auto coordsIn = ds.GetCoordinateSystem("coords").GetData();
|
||||
vtkm::cont::ArrayHandle<Coord3D> coords = clip.ProcessPointField(coordsIn, DeviceAdapter());
|
||||
|
||||
vtkm::cont::ArrayHandle<vtkm::Float32> scalarsIn;
|
||||
@ -188,8 +187,7 @@ void TestClippingStrucutred()
|
||||
vtkm::cont::CellSetExplicit<> outputCellSet =
|
||||
clip.Run(ds.GetCellSet(0), ds.GetField("scalars").GetData(), clipValue, DeviceAdapter());
|
||||
|
||||
vtkm::cont::ArrayHandleUniformPointCoordinates coordsIn;
|
||||
ds.GetCoordinateSystem("coords").GetData().CopyTo(coordsIn);
|
||||
auto coordsIn = ds.GetCoordinateSystem("coords").GetData();
|
||||
CoordsOutType coords = clip.ProcessPointField(coordsIn, DeviceAdapter());
|
||||
|
||||
vtkm::cont::ArrayHandle<vtkm::Float32> scalarsIn;
|
||||
@ -253,8 +251,7 @@ void TestClippingWithImplicitFunction()
|
||||
ds.GetCoordinateSystem("coords"),
|
||||
DeviceAdapter());
|
||||
|
||||
vtkm::cont::ArrayHandleUniformPointCoordinates coordsIn;
|
||||
ds.GetCoordinateSystem("coords").GetData().CopyTo(coordsIn);
|
||||
auto coordsIn = ds.GetCoordinateSystem("coords").GetData();
|
||||
vtkm::cont::ArrayHandle<Coord3D> coords = clip.ProcessPointField(coordsIn, DeviceAdapter());
|
||||
|
||||
vtkm::cont::ArrayHandle<vtkm::Float32> scalarsIn;
|
||||
|
@ -88,9 +88,7 @@ void TestPointElevation()
|
||||
pointElevationWorklet);
|
||||
dispatcher.Invoke(dataSet.GetCoordinateSystem(), result);
|
||||
|
||||
vtkm::cont::ArrayHandle<vtkm::Vec<vtkm::Float32, 3>> coordinates;
|
||||
dataSet.GetCoordinateSystem().GetData().CopyTo(coordinates);
|
||||
|
||||
auto coordinates = dataSet.GetCoordinateSystem().GetData();
|
||||
for (vtkm::Id i = 0; i < result.GetNumberOfValues(); ++i)
|
||||
{
|
||||
VTKM_TEST_ASSERT(test_equal(coordinates.GetPortalConstControl().Get(i)[1] * 2.0,
|
||||
|
@ -156,8 +156,7 @@ void TestStreamLineUniformGrid()
|
||||
// Check output
|
||||
vtkm::cont::CellSetExplicit<> outCellSet;
|
||||
outDataSet.GetCellSet(0).CopyTo(outCellSet);
|
||||
const vtkm::cont::DynamicArrayHandleCoordinateSystem& coordArray =
|
||||
outDataSet.GetCoordinateSystem(0).GetData();
|
||||
auto coordArray = outDataSet.GetCoordinateSystem(0).GetData();
|
||||
|
||||
vtkm::Id numberOfCells = outCellSet.GetNumberOfCells();
|
||||
vtkm::Id numberOfPoints = coordArray.GetNumberOfValues();
|
||||
|
@ -78,9 +78,7 @@ void TestVertexClustering()
|
||||
}
|
||||
|
||||
{
|
||||
typedef vtkm::Vec<vtkm::Float64, 3> PointType;
|
||||
vtkm::cont::ArrayHandle<PointType> pointArray;
|
||||
outDataSet.GetCoordinateSystem(0).GetData().CopyTo(pointArray);
|
||||
auto pointArray = outDataSet.GetCoordinateSystem(0).GetData();
|
||||
std::cerr << "output_points = " << pointArray.GetNumberOfValues() << "\n";
|
||||
std::cerr << "output_point[] = ";
|
||||
vtkm::cont::printSummary_ArrayHandle(pointArray, std::cerr, true);
|
||||
@ -92,8 +90,7 @@ void TestVertexClustering()
|
||||
VTKM_TEST_ASSERT(outDataSet.GetNumberOfCoordinateSystems() == 1,
|
||||
"Number of output coordinate systems mismatch");
|
||||
typedef vtkm::Vec<vtkm::Float64, 3> PointType;
|
||||
vtkm::cont::ArrayHandle<PointType> pointArray;
|
||||
outDataSet.GetCoordinateSystem(0).GetData().CopyTo(pointArray);
|
||||
auto pointArray = outDataSet.GetCoordinateSystem(0).GetData();
|
||||
VTKM_TEST_ASSERT(pointArray.GetNumberOfValues() == output_points,
|
||||
"Number of output points mismatch");
|
||||
for (vtkm::Id i = 0; i < pointArray.GetNumberOfValues(); ++i)
|
||||
|
Loading…
Reference in New Issue
Block a user