mirror of
https://gitlab.kitware.com/vtk/vtk-m
synced 2024-09-08 13:23:51 +00:00
Change Field to hold UnknownArrayHandle rather than VariantArrayHandle
The `VariantArrayHandle` will soon be deprecated for its replacement of `UnknownArrayHandle`. Thus, `Field` and related classes should start using the new `UnknownArrayHandle`.
This commit is contained in:
parent
30b8a31a58
commit
11a4c9867e
@ -71,8 +71,12 @@ class Redistributor
|
||||
|
||||
if (this->Field.GetNumberOfValues() == 0)
|
||||
{
|
||||
// Copy metadata
|
||||
this->Field = field;
|
||||
field.GetData().CastAndCall(Allocator{}, this->Field, this->TotalSize);
|
||||
// Reset array
|
||||
this->Field.SetData(field.GetData().NewInstanceBasic());
|
||||
// Preallocate array
|
||||
this->Field.GetData().Allocate(this->TotalSize);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -80,26 +84,14 @@ class Redistributor
|
||||
this->Field.GetAssociation() == field.GetAssociation());
|
||||
}
|
||||
|
||||
field.GetData().CastAndCall(Appender{}, this->Field, this->CurrentIdx);
|
||||
field.GetData().CastAndCallForTypes<VTKM_DEFAULT_TYPE_LIST, VTKM_DEFAULT_STORAGE_LIST>(
|
||||
Appender{}, this->Field, this->CurrentIdx);
|
||||
this->CurrentIdx += field.GetNumberOfValues();
|
||||
}
|
||||
|
||||
const vtkm::cont::Field& GetResult() const { return this->Field; }
|
||||
|
||||
private:
|
||||
struct Allocator
|
||||
{
|
||||
template <typename T, typename S>
|
||||
void operator()(const vtkm::cont::ArrayHandle<T, S>&,
|
||||
vtkm::cont::Field& field,
|
||||
vtkm::Id totalSize) const
|
||||
{
|
||||
vtkm::cont::ArrayHandle<T> init;
|
||||
init.Allocate(totalSize);
|
||||
field.SetData(init);
|
||||
}
|
||||
};
|
||||
|
||||
struct Appender
|
||||
{
|
||||
template <typename T, typename S>
|
||||
|
@ -159,6 +159,11 @@ VTKM_CONT void ArrayCopy(const vtkm::cont::ArrayHandle<InValueType, InStorage>&
|
||||
detail::ArrayCopyImpl(source, destination, std::integral_constant<bool, !IsOldStyle::value>{});
|
||||
}
|
||||
|
||||
// Forward declaration
|
||||
// Cannot include UncertainArrayHandle.h here due to circular dependency.
|
||||
template <typename ValueList, typename StorageList>
|
||||
class UncertainArrayHandle;
|
||||
|
||||
// Forward declaration
|
||||
// Cannot include VariantArrayHandle.h here due to circular dependency.
|
||||
template <typename TypeList>
|
||||
@ -179,6 +184,19 @@ struct ArrayCopyFunctor
|
||||
|
||||
} // namespace detail
|
||||
|
||||
/// \brief Deep copies data in an `UncertainArrayHandle` to an array of a known type.
|
||||
///
|
||||
/// This form of `ArrayCopy` can be used to copy data from an unknown array type to
|
||||
/// an array of a known type. Note that regardless of the source type, the data will
|
||||
/// be deep copied.
|
||||
///
|
||||
template <typename InValueList, typename InStorageList, typename OutValue, typename OutStorage>
|
||||
VTKM_CONT void ArrayCopy(const vtkm::cont::UncertainArrayHandle<InValueList, InStorageList>& src,
|
||||
vtkm::cont::ArrayHandle<OutValue, OutStorage>& dest)
|
||||
{
|
||||
src.CastAndCall(detail::ArrayCopyFunctor{}, dest);
|
||||
}
|
||||
|
||||
/// \brief Deep copies data in a `VariantArrayHandle` to an array of a known type.
|
||||
///
|
||||
/// This form of `ArrayCopy` can be used to copy data from an unknown array type to
|
||||
|
@ -73,6 +73,12 @@ public:
|
||||
numberOfValues))
|
||||
{
|
||||
}
|
||||
|
||||
/// \brief Returns the constant value stored in this array.
|
||||
///
|
||||
/// The value set in the constructor of this array is returned even if the number of values is 0.
|
||||
///
|
||||
VTKM_CONT T GetValue() const { return this->ReadPortal().GetFunctor()(0); }
|
||||
};
|
||||
|
||||
/// make_ArrayHandleConstant is convenience function to generate an
|
||||
|
@ -107,5 +107,15 @@ vtkm::cont::ArrayHandle<vtkm::Range> ArrayRangeCompute(
|
||||
|
||||
return rangeArray;
|
||||
}
|
||||
|
||||
VTKM_CONT vtkm::cont::ArrayHandle<vtkm::Range> ArrayRangeCompute(
|
||||
const vtkm::cont::ArrayHandle<vtkm::Id, vtkm::cont::StorageTagIndex>& input,
|
||||
vtkm::cont::DeviceAdapterId)
|
||||
{
|
||||
vtkm::cont::ArrayHandle<vtkm::Range> result;
|
||||
result.Allocate(1);
|
||||
result.WritePortal().Set(0, vtkm::Range(0, input.GetNumberOfValues() - 1));
|
||||
return result;
|
||||
}
|
||||
}
|
||||
} // namespace vtkm::cont
|
||||
|
@ -11,10 +11,14 @@
|
||||
#define vtk_m_cont_ArrayRangeCompute_h
|
||||
|
||||
#include <vtkm/Range.h>
|
||||
#include <vtkm/VecTraits.h>
|
||||
|
||||
#include <vtkm/cont/ArrayHandle.h>
|
||||
#include <vtkm/cont/ArrayHandleCartesianProduct.h>
|
||||
#include <vtkm/cont/ArrayHandleCompositeVector.h>
|
||||
#include <vtkm/cont/ArrayHandleConstant.h>
|
||||
#include <vtkm/cont/ArrayHandleCounting.h>
|
||||
#include <vtkm/cont/ArrayHandleIndex.h>
|
||||
#include <vtkm/cont/ArrayHandleSOA.h>
|
||||
#include <vtkm/cont/ArrayHandleUniformPointCoordinates.h>
|
||||
#include <vtkm/cont/DeviceAdapterTag.h>
|
||||
@ -162,6 +166,65 @@ VTKM_CONT inline vtkm::cont::ArrayHandle<vtkm::Range> ArrayRangeCompute(
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
// Implementation of constant arrays
|
||||
template <typename T>
|
||||
VTKM_CONT inline vtkm::cont::ArrayHandle<vtkm::Range> ArrayRangeCompute(
|
||||
const vtkm::cont::ArrayHandle<T, vtkm::cont::StorageTagConstant>& input,
|
||||
vtkm::cont::DeviceAdapterId vtkmNotUsed(device) = vtkm::cont::DeviceAdapterTagAny{})
|
||||
{
|
||||
using Traits = vtkm::VecTraits<T>;
|
||||
const T value = vtkm::cont::ArrayHandleConstant<T>(input).GetValue();
|
||||
vtkm::IdComponent numComponents = Traits::GetNumberOfComponents(value);
|
||||
vtkm::cont::ArrayHandle<vtkm::Range> result;
|
||||
result.Allocate(numComponents);
|
||||
auto portal = result.WritePortal();
|
||||
for (vtkm::IdComponent cIndex = 0; cIndex < numComponents; ++cIndex)
|
||||
{
|
||||
auto component = Traits::GetComponent(value, cIndex);
|
||||
portal.Set(cIndex, vtkm::Range(component, component));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
// Implementation of counting arrays
|
||||
template <typename T>
|
||||
VTKM_CONT inline vtkm::cont::ArrayHandle<vtkm::Range> ArrayRangeCompute(
|
||||
const vtkm::cont::ArrayHandle<T, vtkm::cont::StorageTagCounting>& input,
|
||||
vtkm::cont::DeviceAdapterId vtkmNotUsed(device) = vtkm::cont::DeviceAdapterTagAny{})
|
||||
{
|
||||
using Traits = vtkm::VecTraits<T>;
|
||||
vtkm::cont::ArrayHandle<vtkm::Range> result;
|
||||
result.Allocate(Traits::NUM_COMPONENTS);
|
||||
auto portal = result.WritePortal();
|
||||
if (portal.GetNumberOfValues() > 0)
|
||||
{
|
||||
T first = input.ReadPortal().Get(0);
|
||||
T last = input.ReadPortal().Get(portal.GetNumberOfValues() - 1);
|
||||
for (vtkm::IdComponent cIndex = 0; cIndex < Traits::NUM_COMPONENTS; ++cIndex)
|
||||
{
|
||||
auto firstComponent = Traits::GetComponent(first, cIndex);
|
||||
auto lastComponent = Traits::GetComponent(last, cIndex);
|
||||
portal.Set(cIndex,
|
||||
vtkm::Range(vtkm::Min(firstComponent, lastComponent),
|
||||
vtkm::Max(firstComponent, lastComponent)));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Array is empty
|
||||
for (vtkm::IdComponent cIndex = 0; cIndex < Traits::NUM_COMPONENTS; ++cIndex)
|
||||
{
|
||||
portal.Set(cIndex, vtkm::Range{});
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
// Implementation of index arrays
|
||||
VTKM_CONT vtkm::cont::ArrayHandle<vtkm::Range> ArrayRangeCompute(
|
||||
const vtkm::cont::ArrayHandle<vtkm::Id, vtkm::cont::StorageTagIndex>& input,
|
||||
vtkm::cont::DeviceAdapterId device = vtkm::cont::DeviceAdapterTagAny{});
|
||||
///@}
|
||||
|
||||
VTKM_CONT_EXPORT void ThrowArrayRangeComputeFailed();
|
||||
|
@ -36,8 +36,8 @@ VTKM_CONT CoordinateSystem::CoordinateSystem()
|
||||
}
|
||||
|
||||
VTKM_CONT CoordinateSystem::CoordinateSystem(std::string name,
|
||||
const vtkm::cont::VariantArrayHandleCommon& data)
|
||||
: Superclass(name, Association::POINTS, vtkm::cont::VariantArrayHandle{ data })
|
||||
const vtkm::cont::UnknownArrayHandle& data)
|
||||
: Superclass(name, Association::POINTS, data)
|
||||
{
|
||||
}
|
||||
|
||||
@ -60,10 +60,11 @@ VTKM_CONT vtkm::cont::detail::CoordDataDepWrapper CoordinateSystem::GetData() co
|
||||
return vtkm::cont::detail::CoordDataDepWrapper(this->Superclass::GetData());
|
||||
}
|
||||
#else //!VTKM_NO_DEPRECATED_VIRTUAL
|
||||
VTKM_CONT vtkm::cont::VariantArrayHandleBase<vtkm::TypeListFieldVec3> CoordinateSystem::GetData()
|
||||
const
|
||||
VTKM_CONT vtkm::cont::UncertainArrayHandle<vtkm::TypeListFieldVec3, VTKM_DEFAULT_STORAGE_LIST>
|
||||
CoordinateSystem::GetData() const
|
||||
{
|
||||
return vtkm::cont::VariantArrayHandleBase<vtkm::TypeListFieldVec3>(this->Superclass::GetData());
|
||||
return vtkm::cont::UncertainArrayHandle<vtkm::TypeListFieldVec3, VTKM_DEFAULT_STORAGE_LIST>(
|
||||
this->Superclass::GetData());
|
||||
}
|
||||
#endif //!VTKM_NO_DEPRECATED_VIRTUAL
|
||||
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include <vtkm/cont/ArrayHandleCast.h>
|
||||
#include <vtkm/cont/CastAndCall.h>
|
||||
#include <vtkm/cont/Field.h>
|
||||
#include <vtkm/cont/UncertainArrayHandle.h>
|
||||
|
||||
#ifndef VTKM_NO_DEPRECATED_VIRTUAL
|
||||
#include <vtkm/cont/ArrayHandleVirtualCoordinates.h>
|
||||
@ -31,15 +32,16 @@ namespace detail
|
||||
{
|
||||
|
||||
// CoordinateSystem::GetData used to return an ArrayHandleVirtualCoordinates.
|
||||
// That behavior is deprecated, and CoordianteSystem::GetData now returns a
|
||||
// VariantArrayHandle similar (although slightly different than) its superclass.
|
||||
// That behavior is deprecated, and CoordianteSystem::GetData now returns am
|
||||
// UncertainArrayHandle similar (although slightly different than) its superclass.
|
||||
// This wrapper class supports the old deprecated behavior until it is no longer
|
||||
// supported. Once the behavior is removed (probably when
|
||||
// ArrayHandleVirtualCoordinates is removed), then this class should be removed.
|
||||
class VTKM_ALWAYS_EXPORT CoordDataDepWrapper
|
||||
: public vtkm::cont::VariantArrayHandleBase<vtkm::TypeListFieldVec3>
|
||||
: public vtkm::cont::UncertainArrayHandle<vtkm::TypeListFieldVec3, VTKM_DEFAULT_STORAGE_LIST>
|
||||
{
|
||||
using Superclass = vtkm::cont::VariantArrayHandleBase<vtkm::TypeListFieldVec3>;
|
||||
using Superclass =
|
||||
vtkm::cont::UncertainArrayHandle<vtkm::TypeListFieldVec3, VTKM_DEFAULT_STORAGE_LIST>;
|
||||
|
||||
VTKM_DEPRECATED_SUPPRESS_BEGIN
|
||||
VTKM_CONT_EXPORT VTKM_CONT vtkm::cont::ArrayHandleVirtualCoordinates ToArray() const;
|
||||
@ -51,36 +53,36 @@ public:
|
||||
// Make the return also behave as ArrayHandleVirtualCoordiantes
|
||||
VTKM_DEPRECATED_SUPPRESS_BEGIN
|
||||
|
||||
VTKM_CONT VTKM_DEPRECATED(1.6, "CoordinateSystem::GetData() now returns a VariantArrayHandle.")
|
||||
VTKM_CONT VTKM_DEPRECATED(1.6, "CoordinateSystem::GetData() now returns an UncertainArrayHandle.")
|
||||
operator vtkm::cont::ArrayHandleVirtualCoordinates() const
|
||||
{
|
||||
return this->ToArray();
|
||||
}
|
||||
|
||||
VTKM_CONT VTKM_DEPRECATED(1.6, "CoordinateSystem::GetData() now returns a VariantArrayHandle.")
|
||||
VTKM_CONT VTKM_DEPRECATED(1.6, "CoordinateSystem::GetData() now returns an UncertainArrayHandle.")
|
||||
operator vtkm::cont::ArrayHandle<vtkm::Vec3f, vtkm::cont::StorageTagVirtual>() const
|
||||
{
|
||||
return this->ToArray();
|
||||
}
|
||||
|
||||
using ValueType VTKM_DEPRECATED(1.6,
|
||||
"CoordinateSystem::GetData() now returns a VariantArrayHandle.") =
|
||||
vtkm::Vec3f;
|
||||
using ValueType VTKM_DEPRECATED(
|
||||
1.6,
|
||||
"CoordinateSystem::GetData() now returns an UncertainArrayHandle.") = vtkm::Vec3f;
|
||||
|
||||
VTKM_CONT VTKM_DEPRECATED(1.6, "CoordinateSystem::GetData() now returns a VariantArrayHandle.")
|
||||
VTKM_CONT VTKM_DEPRECATED(1.6, "CoordinateSystem::GetData() now returns an UncertainArrayHandle.")
|
||||
ArrayHandleVirtualCoordinates::ReadPortalType ReadPortal() const
|
||||
{
|
||||
return this->ToArray().ReadPortal();
|
||||
}
|
||||
|
||||
VTKM_CONT VTKM_DEPRECATED(1.6, "CoordinateSystem::GetData() now returns a VariantArrayHandle.")
|
||||
VTKM_CONT VTKM_DEPRECATED(1.6, "CoordinateSystem::GetData() now returns an UncertainArrayHandle.")
|
||||
ArrayHandleVirtualCoordinates::WritePortalType WritePortal() const
|
||||
{
|
||||
return this->ToArray().WritePortal();
|
||||
}
|
||||
|
||||
template <typename Device>
|
||||
VTKM_CONT VTKM_DEPRECATED(1.6, "CoordinateSystem::GetData() now returns a VariantArrayHandle.")
|
||||
VTKM_CONT VTKM_DEPRECATED(1.6, "CoordinateSystem::GetData() now returns an UncertainArrayHandle.")
|
||||
typename ArrayHandleVirtualCoordinates::ExecutionTypes<Device>::PortalConst
|
||||
PrepareForInput(Device device, vtkm::cont::Token& token) const
|
||||
{
|
||||
@ -88,7 +90,7 @@ public:
|
||||
}
|
||||
|
||||
template <typename Device>
|
||||
VTKM_CONT VTKM_DEPRECATED(1.6, "CoordinateSystem::GetData() now returns a VariantArrayHandle.")
|
||||
VTKM_CONT VTKM_DEPRECATED(1.6, "CoordinateSystem::GetData() now returns an UncertainArrayHandle.")
|
||||
typename ArrayHandleVirtualCoordinates::ExecutionTypes<Device>::Portal
|
||||
PrepareForInPlace(Device device, vtkm::cont::Token& token) const
|
||||
{
|
||||
@ -96,7 +98,7 @@ public:
|
||||
}
|
||||
|
||||
template <typename Device>
|
||||
VTKM_CONT VTKM_DEPRECATED(1.6, "CoordinateSystem::GetData() now returns a VariantArrayHandle.")
|
||||
VTKM_CONT VTKM_DEPRECATED(1.6, "CoordinateSystem::GetData() now returns an UncertainArrayHandle.")
|
||||
typename ArrayHandleVirtualCoordinates::ExecutionTypes<Device>::Portal
|
||||
PrepareForOutput(vtkm::Id numberOfValues, Device device, vtkm::cont::Token& token) const
|
||||
{
|
||||
@ -111,11 +113,11 @@ public:
|
||||
VTKM_DEPRECATED_SUPPRESS_BEGIN
|
||||
VTKM_CONT VTKM_DEPRECATED(
|
||||
1.6,
|
||||
"CoordinateSystem::GetData() now returns a "
|
||||
"VariantArrayHandle.") inline void printSummary_ArrayHandle(const detail::CoordDataDepWrapper&
|
||||
array,
|
||||
std::ostream& out,
|
||||
bool full = false)
|
||||
"CoordinateSystem::GetData() now returns an "
|
||||
"UncertainArrayHandle.") inline void printSummary_ArrayHandle(const detail::CoordDataDepWrapper&
|
||||
array,
|
||||
std::ostream& out,
|
||||
bool full = false)
|
||||
{
|
||||
vtkm::cont::ArrayHandleVirtualCoordinates coordArray = array;
|
||||
vtkm::cont::printSummary_ArrayHandle(coordArray, out, full);
|
||||
@ -131,7 +133,7 @@ public:
|
||||
VTKM_CONT
|
||||
CoordinateSystem();
|
||||
|
||||
VTKM_CONT CoordinateSystem(std::string name, const vtkm::cont::VariantArrayHandleCommon& data);
|
||||
VTKM_CONT CoordinateSystem(std::string name, const vtkm::cont::UnknownArrayHandle& data);
|
||||
|
||||
template <typename T, typename Storage>
|
||||
VTKM_CONT CoordinateSystem(std::string name, const ArrayHandle<T, Storage>& data)
|
||||
@ -153,7 +155,8 @@ public:
|
||||
#ifndef VTKM_NO_DEPRECATED_VIRTUAL
|
||||
VTKM_CONT detail::CoordDataDepWrapper GetData() const;
|
||||
#else
|
||||
VTKM_CONT vtkm::cont::VariantArrayHandleBase<vtkm::TypeListFieldVec3> GetData() const;
|
||||
VTKM_CONT vtkm::cont::UncertainArrayHandle<vtkm::TypeListFieldVec3, VTKM_DEFAULT_STORAGE_LIST>
|
||||
GetData() const;
|
||||
#endif
|
||||
|
||||
private:
|
||||
@ -295,31 +298,15 @@ namespace mangled_diy_namespace
|
||||
template <>
|
||||
struct Serialization<vtkm::cont::detail::CoordDataDepWrapper>
|
||||
: public Serialization<
|
||||
vtkm::cont::VariantArrayHandleBase<vtkm::List<vtkm::Vec3f_32, vtkm::Vec3f_64>>>
|
||||
vtkm::cont::UncertainArrayHandle<vtkm::List<vtkm::Vec3f_32, vtkm::Vec3f_64>,
|
||||
VTKM_DEFAULT_STORAGE_LIST>>
|
||||
{
|
||||
};
|
||||
#endif //VTKM_NO_DEPRECATED_VIRTUAL
|
||||
|
||||
template <>
|
||||
struct Serialization<vtkm::cont::CoordinateSystem>
|
||||
struct Serialization<vtkm::cont::CoordinateSystem> : Serialization<vtkm::cont::Field>
|
||||
{
|
||||
using CoordinatesTypeList = vtkm::List<vtkm::Vec3f_32, vtkm::Vec3f_64>;
|
||||
|
||||
static VTKM_CONT void save(BinaryBuffer& bb, const vtkm::cont::CoordinateSystem& cs)
|
||||
{
|
||||
vtkmdiy::save(bb, cs.GetName());
|
||||
vtkmdiy::save(
|
||||
bb, static_cast<vtkm::cont::VariantArrayHandleBase<CoordinatesTypeList>>(cs.GetData()));
|
||||
}
|
||||
|
||||
static VTKM_CONT void load(BinaryBuffer& bb, vtkm::cont::CoordinateSystem& cs)
|
||||
{
|
||||
std::string name;
|
||||
vtkmdiy::load(bb, name);
|
||||
vtkm::cont::VariantArrayHandleBase<CoordinatesTypeList> data;
|
||||
vtkmdiy::load(bb, data);
|
||||
cs = vtkm::cont::CoordinateSystem(name, data);
|
||||
}
|
||||
};
|
||||
|
||||
} // diy
|
||||
|
@ -12,10 +12,19 @@
|
||||
|
||||
#include <vtkm/TypeList.h>
|
||||
|
||||
#include <vtkm/cont/ArrayHandleConstant.h>
|
||||
#include <vtkm/cont/ArrayHandleCounting.h>
|
||||
#include <vtkm/cont/ArrayHandleIndex.h>
|
||||
#include <vtkm/cont/UncertainArrayHandle.h>
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
using ComputeRangeTypes = vtkm::TypeListAll;
|
||||
using ComputeRangeStorage = vtkm::ListAppend<VTKM_DEFAULT_STORAGE_LIST,
|
||||
vtkm::List<vtkm::cont::StorageTagConstant,
|
||||
vtkm::cont::StorageTagCounting,
|
||||
vtkm::cont::StorageTagIndex>>;
|
||||
|
||||
struct ComputeRange
|
||||
{
|
||||
@ -115,13 +124,13 @@ Field::~Field() {}
|
||||
|
||||
|
||||
VTKM_CONT
|
||||
const vtkm::cont::VariantArrayHandle& Field::GetData() const
|
||||
const vtkm::cont::UnknownArrayHandle& Field::GetData() const
|
||||
{
|
||||
return this->Data;
|
||||
}
|
||||
|
||||
VTKM_CONT
|
||||
vtkm::cont::VariantArrayHandle& Field::GetData()
|
||||
vtkm::cont::UnknownArrayHandle& Field::GetData()
|
||||
{
|
||||
this->ModifiedFlag = true;
|
||||
return this->Data;
|
||||
@ -134,7 +143,7 @@ VTKM_CONT const vtkm::cont::ArrayHandle<vtkm::Range>& Field::GetRange() const
|
||||
if (this->ModifiedFlag)
|
||||
{
|
||||
vtkm::cont::CastAndCall(
|
||||
this->Data.ResetTypes(ComputeRangeTypes{}), ComputeRange{}, this->Range);
|
||||
this->Data.ResetTypes<ComputeRangeTypes, ComputeRangeStorage>(), ComputeRange{}, this->Range);
|
||||
this->ModifiedFlag = false;
|
||||
}
|
||||
|
||||
@ -151,5 +160,37 @@ VTKM_CONT void Field::GetRange(vtkm::Range* range) const
|
||||
range[i] = portal.Get(i);
|
||||
}
|
||||
}
|
||||
|
||||
VTKM_CONT void Field::SetData(const vtkm::cont::UnknownArrayHandle& newdata)
|
||||
{
|
||||
this->Data = newdata;
|
||||
this->ModifiedFlag = true;
|
||||
}
|
||||
}
|
||||
} // namespace vtkm::cont
|
||||
|
||||
namespace mangled_diy_namespace
|
||||
{
|
||||
|
||||
void Serialization<vtkm::cont::Field>::save(BinaryBuffer& bb, const vtkm::cont::Field& field)
|
||||
{
|
||||
vtkmdiy::save(bb, field.GetName());
|
||||
vtkmdiy::save(bb, static_cast<int>(field.GetAssociation()));
|
||||
vtkmdiy::save(bb, field.GetData());
|
||||
}
|
||||
|
||||
void Serialization<vtkm::cont::Field>::load(BinaryBuffer& bb, vtkm::cont::Field& field)
|
||||
{
|
||||
std::string name;
|
||||
vtkmdiy::load(bb, name);
|
||||
int assocVal = 0;
|
||||
vtkmdiy::load(bb, assocVal);
|
||||
|
||||
auto assoc = static_cast<vtkm::cont::Field::Association>(assocVal);
|
||||
vtkm::cont::UnknownArrayHandle data;
|
||||
vtkmdiy::load(bb, data);
|
||||
field = vtkm::cont::Field(name, assoc, data);
|
||||
}
|
||||
|
||||
|
||||
} // namespace diy
|
||||
|
@ -17,7 +17,7 @@
|
||||
|
||||
#include <vtkm/cont/ArrayHandle.h>
|
||||
#include <vtkm/cont/ArrayRangeCompute.h>
|
||||
#include <vtkm/cont/VariantArrayHandle.h>
|
||||
#include <vtkm/cont/UnknownArrayHandle.h>
|
||||
|
||||
namespace vtkm
|
||||
{
|
||||
@ -78,8 +78,8 @@ public:
|
||||
|
||||
VTKM_CONT const std::string& GetName() const { return this->Name; }
|
||||
VTKM_CONT Association GetAssociation() const { return this->FieldAssociation; }
|
||||
const vtkm::cont::VariantArrayHandle& GetData() const;
|
||||
vtkm::cont::VariantArrayHandle& GetData();
|
||||
const vtkm::cont::UnknownArrayHandle& GetData() const;
|
||||
vtkm::cont::UnknownArrayHandle& GetData();
|
||||
|
||||
VTKM_CONT bool IsFieldCell() const { return this->FieldAssociation == Association::CELL_SET; }
|
||||
VTKM_CONT bool IsFieldPoint() const { return this->FieldAssociation == Association::POINTS; }
|
||||
@ -113,18 +113,12 @@ public:
|
||||
|
||||
VTKM_CONT void GetRange(vtkm::Range* range) const;
|
||||
|
||||
VTKM_CONT void SetData(const vtkm::cont::UnknownArrayHandle& newdata);
|
||||
|
||||
template <typename T, typename StorageTag>
|
||||
VTKM_CONT void SetData(const vtkm::cont::ArrayHandle<T, StorageTag>& newdata)
|
||||
{
|
||||
this->Data = newdata;
|
||||
this->ModifiedFlag = true;
|
||||
}
|
||||
|
||||
template <typename TypeList>
|
||||
VTKM_CONT void SetData(const vtkm::cont::VariantArrayHandleBase<TypeList>& newdata)
|
||||
{
|
||||
this->Data = vtkm::cont::VariantArrayHandle(newdata);
|
||||
this->ModifiedFlag = true;
|
||||
this->SetData(vtkm::cont::UnknownArrayHandle(newdata));
|
||||
}
|
||||
|
||||
VTKM_CONT
|
||||
@ -141,7 +135,7 @@ private:
|
||||
std::string Name; ///< name of field
|
||||
|
||||
Association FieldAssociation = Association::ANY;
|
||||
vtkm::cont::VariantArrayHandle Data;
|
||||
vtkm::cont::UnknownArrayHandle Data;
|
||||
mutable vtkm::cont::ArrayHandle<vtkm::Range> Range;
|
||||
mutable bool ModifiedFlag = true;
|
||||
|
||||
@ -244,7 +238,7 @@ vtkm::cont::Field make_FieldPoint(std::string name, const vtkm::cont::ArrayHandl
|
||||
|
||||
/// Convenience function to build point fields from vtkm::cont::VariantArrayHandle
|
||||
inline vtkm::cont::Field make_FieldPoint(std::string name,
|
||||
const vtkm::cont::VariantArrayHandle& data)
|
||||
const vtkm::cont::UnknownArrayHandle& data)
|
||||
{
|
||||
return vtkm::cont::Field(name, vtkm::cont::Field::Association::POINTS, data);
|
||||
}
|
||||
@ -259,7 +253,7 @@ vtkm::cont::Field make_FieldCell(std::string name, const vtkm::cont::ArrayHandle
|
||||
|
||||
/// Convenience function to build cell fields from vtkm::cont::VariantArrayHandle
|
||||
inline vtkm::cont::Field make_FieldCell(std::string name,
|
||||
const vtkm::cont::VariantArrayHandle& data)
|
||||
const vtkm::cont::UnknownArrayHandle& data)
|
||||
{
|
||||
return vtkm::cont::Field(name, vtkm::cont::Field::Association::CELL_SET, data);
|
||||
}
|
||||
@ -291,7 +285,7 @@ namespace vtkm
|
||||
namespace cont
|
||||
{
|
||||
template <typename TypeList = VTKM_DEFAULT_TYPE_LIST>
|
||||
struct SerializableField
|
||||
struct VTKM_DEPRECATED(1.6, "You can now directly serialize Field.") SerializableField
|
||||
{
|
||||
SerializableField() = default;
|
||||
|
||||
@ -302,21 +296,21 @@ struct SerializableField
|
||||
|
||||
vtkm::cont::Field Field;
|
||||
};
|
||||
|
||||
// Cannot directly serialize fields with a vtkm::ListUniversal type list since there has to
|
||||
// be a finite number of types to serialize. Do the best possible by serializing all basic
|
||||
// VTK-m types.
|
||||
template <>
|
||||
struct SerializableField<vtkm::ListUniversal> : SerializableField<vtkm::TypeListAll>
|
||||
{
|
||||
using SerializableField<vtkm::TypeListAll>::SerializableField;
|
||||
};
|
||||
} // namespace cont
|
||||
} // namespace vtkm
|
||||
|
||||
namespace mangled_diy_namespace
|
||||
{
|
||||
|
||||
template <>
|
||||
struct VTKM_CONT_EXPORT Serialization<vtkm::cont::Field>
|
||||
{
|
||||
static VTKM_CONT void save(BinaryBuffer& bb, const vtkm::cont::Field& field);
|
||||
static VTKM_CONT void load(BinaryBuffer& bb, vtkm::cont::Field& field);
|
||||
};
|
||||
|
||||
// Implement deprecated code
|
||||
VTKM_DEPRECATED_SUPPRESS_BEGIN
|
||||
template <typename TypeList>
|
||||
struct Serialization<vtkm::cont::SerializableField<TypeList>>
|
||||
{
|
||||
@ -326,34 +320,15 @@ private:
|
||||
public:
|
||||
static VTKM_CONT void save(BinaryBuffer& bb, const Type& serializable)
|
||||
{
|
||||
const auto& field = serializable.Field;
|
||||
|
||||
vtkmdiy::save(bb, field.GetName());
|
||||
vtkmdiy::save(bb, static_cast<int>(field.GetAssociation()));
|
||||
vtkmdiy::save(bb, field.GetData().ResetTypes(TypeList{}));
|
||||
Serialization<vtkm::cont::Field>::save(bb, serializable.Field);
|
||||
}
|
||||
|
||||
static VTKM_CONT void load(BinaryBuffer& bb, Type& serializable)
|
||||
{
|
||||
auto& field = serializable.Field;
|
||||
|
||||
std::string name;
|
||||
vtkmdiy::load(bb, name);
|
||||
int assocVal = 0;
|
||||
vtkmdiy::load(bb, assocVal);
|
||||
|
||||
auto assoc = static_cast<vtkm::cont::Field::Association>(assocVal);
|
||||
vtkm::cont::VariantArrayHandleBase<TypeList> data;
|
||||
vtkmdiy::load(bb, data);
|
||||
field = vtkm::cont::Field(name, assoc, vtkm::cont::VariantArrayHandle(data));
|
||||
Serialization<vtkm::cont::Field>::load(bb, serializable.Field);
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct Serialization<vtkm::cont::SerializableField<vtkm::ListUniversal>>
|
||||
: Serialization<vtkm::cont::SerializableField<vtkm::TypeListAll>>
|
||||
{
|
||||
};
|
||||
VTKM_DEPRECATED_SUPPRESS_BEGIN
|
||||
|
||||
} // diy
|
||||
/// @endcond SERIALIZATION
|
||||
|
@ -451,6 +451,15 @@ public:
|
||||
NewValueTypeList = NewValueTypeList{},
|
||||
NewStorageTypeList = NewStorageTypeList{}) const;
|
||||
|
||||
template <typename NewValueTypeList>
|
||||
VTKM_DEPRECATED(1.6, "Specify both value types and storage types.")
|
||||
VTKM_CONT
|
||||
vtkm::cont::UncertainArrayHandle<NewValueTypeList, VTKM_DEFAULT_STORAGE_LIST> ResetTypes(
|
||||
NewValueTypeList = NewValueTypeList{}) const
|
||||
{
|
||||
return this->ResetTypes<NewValueTypeList, VTKM_DEFAULT_STORAGE_LIST>();
|
||||
}
|
||||
|
||||
/// \brief Returns the number of values in the array.
|
||||
///
|
||||
VTKM_CONT vtkm::Id GetNumberOfValues() const;
|
||||
@ -544,6 +553,32 @@ public:
|
||||
VTKM_DEPRECATED_SUPPRESS_END
|
||||
#endif
|
||||
|
||||
// For code still expecting a VariantArrayHandle
|
||||
template <typename ArrayHandleType>
|
||||
VTKM_DEPRECATED(1.6, "Use AsArrayHandle.")
|
||||
VTKM_CONT ArrayHandleType Cast() const
|
||||
{
|
||||
return this->AsArrayHandle<ArrayHandleType>();
|
||||
}
|
||||
template <typename ArrayHandleType>
|
||||
VTKM_DEPRECATED(1.6, "Use AsArrayHandle.")
|
||||
VTKM_CONT void CopyTo(ArrayHandleType& array) const
|
||||
{
|
||||
this->AsArrayHandle(array);
|
||||
}
|
||||
template <typename MultiplexerType>
|
||||
VTKM_DEPRECATED(1.6, "Use AsArrayHandle.")
|
||||
VTKM_CONT MultiplexerType AsMultiplexer() const
|
||||
{
|
||||
return this->AsArrayHandle<MultiplexerType>();
|
||||
}
|
||||
template <typename MultiplexerType>
|
||||
VTKM_DEPRECATED(1.6, "Use AsArrayHandle.")
|
||||
VTKM_CONT void AsMultiplexer(MultiplexerType& result) const
|
||||
{
|
||||
result = this->AsArrayHandle<MultiplexerType>();
|
||||
}
|
||||
|
||||
/// \brief Extract a component of the array.
|
||||
///
|
||||
/// This method returns an array that holds the data for a given flat component of the data.
|
||||
@ -679,6 +714,16 @@ public:
|
||||
template <typename Functor, typename... Args>
|
||||
VTKM_CONT void CastAndCallWithExtractedArray(Functor&& functor, Args&&... args) const;
|
||||
|
||||
template <typename FunctorOrStorageList, typename... Args>
|
||||
VTKM_CONT VTKM_DEPRECATED(1.6, "Use CastAndCallForTypes.") void CastAndCall(
|
||||
FunctorOrStorageList&& functorOrStorageList,
|
||||
Args&&... args) const
|
||||
{
|
||||
this->CastAndCallImpl(vtkm::internal::IsList<FunctorOrStorageList>{},
|
||||
std::forward<FunctorOrStorageList>(functorOrStorageList),
|
||||
std::forward<Args>(args)...);
|
||||
}
|
||||
|
||||
/// Releases any resources being used in the execution environment (that are
|
||||
/// not being shared by the control environment).
|
||||
///
|
||||
@ -689,6 +734,20 @@ public:
|
||||
VTKM_CONT void ReleaseResources() const;
|
||||
|
||||
VTKM_CONT void PrintSummary(std::ostream& out, bool full = false) const;
|
||||
|
||||
private:
|
||||
// Remove this when deprecated CastAndCall is removed.
|
||||
template <typename... Args>
|
||||
VTKM_CONT void CastAndCallImpl(std::false_type, Args&&... args) const
|
||||
{
|
||||
this->CastAndCallForTypes<VTKM_DEFAULT_TYPE_LIST, VTKM_DEFAULT_STORAGE_LIST>(
|
||||
std::forward<Args>(args)...);
|
||||
}
|
||||
template <typename StorageList, typename... Args>
|
||||
VTKM_CONT void CastAndCallImpl(std::true_type, StorageList, Args&&... args) const
|
||||
{
|
||||
this->CastAndCallForTypes<VTKM_DEFAULT_TYPE_LIST, StorageList>(std::forward<Args>(args)...);
|
||||
}
|
||||
};
|
||||
|
||||
//=============================================================================
|
||||
@ -867,6 +926,28 @@ inline void UnknownArrayHandle::CastAndCallForTypes(Functor&& f, Args&&... args)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//=============================================================================
|
||||
// Free function casting helpers
|
||||
|
||||
/// Returns true if \c variant matches the type of ArrayHandleType.
|
||||
///
|
||||
template <typename ArrayHandleType>
|
||||
VTKM_CONT inline bool IsType(const vtkm::cont::UnknownArrayHandle& array)
|
||||
{
|
||||
return array.template IsType<ArrayHandleType>();
|
||||
}
|
||||
|
||||
/// Returns \c variant cast to the given \c ArrayHandle type. Throws \c
|
||||
/// ErrorBadType if the cast does not work. Use \c IsType
|
||||
/// to check if the cast can happen.
|
||||
///
|
||||
template <typename ArrayHandleType>
|
||||
VTKM_CONT inline ArrayHandleType Cast(const vtkm::cont::UnknownArrayHandle& array)
|
||||
{
|
||||
return array.template AsArrayHandle<ArrayHandleType>();
|
||||
}
|
||||
|
||||
template <typename Functor, typename... Args>
|
||||
void CastAndCall(const UnknownArrayHandle& handle, Functor&& f, Args&&... args)
|
||||
{
|
||||
|
@ -284,14 +284,7 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
VTKM_CONT explicit VariantArrayHandleBase(const vtkm::cont::UnknownArrayHandle& src)
|
||||
: Superclass(src)
|
||||
{
|
||||
}
|
||||
|
||||
template <typename StorageList>
|
||||
VTKM_CONT VariantArrayHandleBase(
|
||||
const vtkm::cont::UncertainArrayHandle<TypeList, StorageList>& src)
|
||||
VTKM_CONT VariantArrayHandleBase(const vtkm::cont::UnknownArrayHandle& src)
|
||||
: Superclass(src)
|
||||
{
|
||||
}
|
||||
|
@ -471,6 +471,9 @@ private:
|
||||
|
||||
vtkm::cont::ArrayHandleConstant<ValueType> constant =
|
||||
vtkm::cont::make_ArrayHandleConstant(value, ARRAY_SIZE);
|
||||
|
||||
VTKM_TEST_ASSERT(constant.GetValue() == value);
|
||||
|
||||
vtkm::cont::ArrayHandle<ValueType> result;
|
||||
|
||||
vtkm::worklet::DispatcherMapField<PassThrough> dispatcher;
|
||||
|
@ -24,8 +24,7 @@
|
||||
#include <vtkm/cont/CellSetStructured.h>
|
||||
#include <vtkm/cont/CoordinateSystem.h>
|
||||
#include <vtkm/cont/DynamicCellSet.h>
|
||||
|
||||
#include <vtkm/cont/CellSetStructured.h>
|
||||
#include <vtkm/cont/UnknownArrayHandle.h>
|
||||
|
||||
namespace vtkm
|
||||
{
|
||||
@ -482,21 +481,21 @@ private:
|
||||
template <typename T, typename S>
|
||||
VTKM_CONT void operator()(const vtkm::cont::ArrayHandle<T, S>& coords,
|
||||
ExtractStructured& self,
|
||||
vtkm::cont::VariantArrayHandleCommon& output) const
|
||||
vtkm::cont::UnknownArrayHandle& output) const
|
||||
{
|
||||
output = self.ProcessPointField(coords);
|
||||
}
|
||||
|
||||
VTKM_CONT void operator()(const UniformCoordinatesArrayHandle::Superclass& coords,
|
||||
ExtractStructured& self,
|
||||
vtkm::cont::VariantArrayHandleCommon& output) const
|
||||
vtkm::cont::UnknownArrayHandle& output) const
|
||||
{
|
||||
output = self.MapCoordinatesUniform(coords);
|
||||
}
|
||||
|
||||
VTKM_CONT void operator()(const RectilinearCoordinatesArrayHandle::Superclass& coords,
|
||||
ExtractStructured& self,
|
||||
vtkm::cont::VariantArrayHandleCommon& output) const
|
||||
vtkm::cont::UnknownArrayHandle& output) const
|
||||
{
|
||||
output = self.MapCoordinatesRectilinear(coords);
|
||||
}
|
||||
@ -505,10 +504,9 @@ private:
|
||||
friend MapCoordinatesFunctor;
|
||||
|
||||
public:
|
||||
vtkm::cont::VariantArrayHandleCommon MapCoordinates(
|
||||
const vtkm::cont::CoordinateSystem& coordinates)
|
||||
vtkm::cont::UnknownArrayHandle MapCoordinates(const vtkm::cont::CoordinateSystem& coordinates)
|
||||
{
|
||||
vtkm::cont::VariantArrayHandleCommon output;
|
||||
vtkm::cont::UnknownArrayHandle output;
|
||||
vtkm::cont::CastAndCall(coordinates, MapCoordinatesFunctor{}, *this, output);
|
||||
return output;
|
||||
}
|
||||
|
@ -419,6 +419,30 @@ public:
|
||||
points = uniquePointCoordinates;
|
||||
}
|
||||
|
||||
template <typename TL, typename SL>
|
||||
VTKM_CONT void Run(
|
||||
vtkm::Float64 delta, // Distance to consider two points coincident
|
||||
bool fastCheck, // If true, approximate distances are used
|
||||
const vtkm::Bounds& bounds, // Bounds of points
|
||||
vtkm::cont::UncertainArrayHandle<TL, SL>& points) // coordinates, modified to merge close
|
||||
{
|
||||
// Get a cast to a concrete set of point coordiantes so that it can be modified in place
|
||||
vtkm::cont::ArrayHandle<vtkm::Vec3f> concretePoints;
|
||||
if (points.template IsType<decltype(concretePoints)>())
|
||||
{
|
||||
concretePoints = points.template Cast<decltype(concretePoints)>();
|
||||
}
|
||||
else
|
||||
{
|
||||
vtkm::cont::ArrayCopy(points, concretePoints);
|
||||
}
|
||||
|
||||
Run(delta, fastCheck, bounds, concretePoints);
|
||||
|
||||
// Make sure that the modified points are reflected back in the variant array.
|
||||
points = concretePoints;
|
||||
}
|
||||
|
||||
template <typename TL>
|
||||
VTKM_CONT void Run(
|
||||
vtkm::Float64 delta, // Distance to consider two points coincident
|
||||
@ -458,12 +482,12 @@ private:
|
||||
{
|
||||
template <typename T, typename S>
|
||||
VTKM_CONT void operator()(const vtkm::cont::ArrayHandle<T, S>& inArray,
|
||||
vtkm::cont::VariantArrayHandleCommon& outHolder,
|
||||
vtkm::cont::UnknownArrayHandle& outHolder,
|
||||
const PointMerge& self) const
|
||||
{
|
||||
vtkm::cont::ArrayHandle<T> outArray;
|
||||
self.MapPointField(inArray, outArray);
|
||||
outHolder = vtkm::cont::VariantArrayHandleCommon(outArray);
|
||||
outHolder = vtkm::cont::UnknownArrayHandle(outArray);
|
||||
}
|
||||
};
|
||||
|
||||
@ -484,11 +508,11 @@ public:
|
||||
return outArray;
|
||||
}
|
||||
|
||||
template <typename InTypes>
|
||||
VTKM_CONT vtkm::cont::VariantArrayHandleBase<InTypes> MapPointField(
|
||||
const vtkm::cont::VariantArrayHandleBase<InTypes>& inArray) const
|
||||
template <typename TL, typename SL>
|
||||
VTKM_CONT vtkm::cont::UncertainArrayHandle<TL, SL> MapPointField(
|
||||
const vtkm::cont::UncertainArrayHandle<TL, SL>& inArray) const
|
||||
{
|
||||
vtkm::cont::VariantArrayHandleBase<InTypes> outArray;
|
||||
vtkm::cont::UncertainArrayHandle<TL, SL> outArray;
|
||||
vtkm::cont::CastAndCall(inArray, MapPointFieldFunctor{}, outArray, *this);
|
||||
return outArray;
|
||||
}
|
||||
|
@ -212,6 +212,16 @@ private:
|
||||
self.MapPointFieldDeep(inArray, outArray);
|
||||
}
|
||||
|
||||
template <typename InT, typename InS>
|
||||
VTKM_CONT void operator()(const vtkm::cont::ArrayHandle<InT, InS>& inArray,
|
||||
vtkm::cont::UnknownArrayHandle& outHolder,
|
||||
const RemoveUnusedPoints& self) const
|
||||
{
|
||||
vtkm::cont::ArrayHandle<InT> outArray;
|
||||
(*this)(inArray, outArray, self);
|
||||
outHolder = vtkm::cont::UnknownArrayHandle{ outArray };
|
||||
}
|
||||
|
||||
template <typename InT, typename InS>
|
||||
VTKM_CONT void operator()(const vtkm::cont::ArrayHandle<InT, InS>& inArray,
|
||||
vtkm::cont::VariantArrayHandleCommon& outHolder,
|
||||
@ -251,6 +261,23 @@ public:
|
||||
return outArray;
|
||||
}
|
||||
|
||||
template <typename InValueTypes, typename InStorageTypes, typename OutArrayHandle>
|
||||
VTKM_CONT void MapPointFieldDeep(
|
||||
const vtkm::cont::UncertainArrayHandle<InValueTypes, InStorageTypes>& inArray,
|
||||
OutArrayHandle& outArray) const
|
||||
{
|
||||
vtkm::cont::CastAndCall(inArray, MapPointFieldDeepFunctor{}, outArray, *this);
|
||||
}
|
||||
|
||||
template <typename InValueTypes, typename InStorageTypes>
|
||||
VTKM_CONT vtkm::cont::UncertainArrayHandle<InValueTypes, InStorageTypes> MapPointFieldDeep(
|
||||
const vtkm::cont::UncertainArrayHandle<InValueTypes, InStorageTypes>& inArray) const
|
||||
{
|
||||
vtkm::cont::UncertainArrayHandle<InValueTypes, InStorageTypes> outArray;
|
||||
vtkm::cont::CastAndCall(inArray, MapPointFieldDeepFunctor{}, outArray, *this);
|
||||
return outArray;
|
||||
}
|
||||
|
||||
template <typename InArrayTypes, typename OutArrayHandle>
|
||||
VTKM_CONT void MapPointFieldDeep(const vtkm::cont::VariantArrayHandleBase<InArrayTypes>& inArray,
|
||||
OutArrayHandle& outArray) const
|
||||
|
@ -45,7 +45,9 @@ public:
|
||||
|
||||
vtkm::cont::ArrayHandle<vtkm::Id> component;
|
||||
vtkm::worklet::connectivity::ImageConnectivity().Run(
|
||||
data.GetCellSet().Cast<vtkm::cont::CellSetStructured<2>>(), colorField.GetData(), component);
|
||||
data.GetCellSet().Cast<vtkm::cont::CellSetStructured<2>>(),
|
||||
colorField.GetData().AsArrayHandle<vtkm::cont::ArrayHandle<vtkm::UInt8>>(),
|
||||
component);
|
||||
|
||||
std::vector<vtkm::Id> componentExpected = { 0, 1, 2, 1, 1, 3, 3, 4, 0, 1, 1, 1, 3, 3, 3, 4,
|
||||
1, 1, 3, 3, 3, 4, 3, 4, 1, 1, 3, 3, 4, 4, 4, 4 };
|
||||
@ -77,7 +79,9 @@ public:
|
||||
|
||||
vtkm::cont::ArrayHandle<vtkm::Id> component;
|
||||
vtkm::worklet::connectivity::ImageConnectivity().Run(
|
||||
data.GetCellSet().Cast<vtkm::cont::CellSetStructured<2>>(), colorField.GetData(), component);
|
||||
data.GetCellSet().Cast<vtkm::cont::CellSetStructured<2>>(),
|
||||
colorField.GetData().AsArrayHandle<vtkm::cont::ArrayHandle<vtkm::UInt8>>(),
|
||||
component);
|
||||
|
||||
std::vector<vtkm::UInt8> componentExpected = { 0, 1, 1, 1, 0, 1, 1, 2, 0, 0, 0, 1, 0, 1, 1, 2,
|
||||
0, 1, 1, 0, 0, 1, 1, 2, 0, 1, 0, 0, 0, 1, 1, 2,
|
||||
@ -114,7 +118,9 @@ public:
|
||||
|
||||
vtkm::cont::ArrayHandle<vtkm::Id> component;
|
||||
vtkm::worklet::connectivity::ImageConnectivity().Run(
|
||||
data.GetCellSet().Cast<vtkm::cont::CellSetStructured<2>>(), colorField.GetData(), component);
|
||||
data.GetCellSet().Cast<vtkm::cont::CellSetStructured<2>>(),
|
||||
colorField.GetData().AsArrayHandle<vtkm::cont::ArrayHandle<vtkm::UInt8>>(),
|
||||
component);
|
||||
|
||||
// clang-format off
|
||||
std::vector<vtkm::UInt8> componentExpected = {
|
||||
|
Loading…
Reference in New Issue
Block a user