mirror of
https://gitlab.kitware.com/vtk/vtk-m
synced 2024-09-16 17:22:55 +00:00
Change Field and related methods to use Range and Bounds
First, be more explicit when we mean a range of values in a field or a spacial bounds. Use the Range and Bounds structs in Field and CoordinateSystem to make all of this more clear (and reduce a bit of code as well).
This commit is contained in:
parent
d75857d0bc
commit
b5415169e2
@ -50,11 +50,16 @@ struct Bounds
|
||||
const vtkm::Range &zRange)
|
||||
: X(xRange), Y(yRange), Z(zRange) { }
|
||||
|
||||
template<typename T>
|
||||
template<typename T1,
|
||||
typename T2,
|
||||
typename T3,
|
||||
typename T4,
|
||||
typename T5,
|
||||
typename T6>
|
||||
VTKM_EXEC_CONT_EXPORT
|
||||
Bounds(const T &minX, const T &maxX,
|
||||
const T &minY, const T &maxY,
|
||||
const T &minZ, const T &maxZ)
|
||||
Bounds(const T1 &minX, const T2 &maxX,
|
||||
const T3 &minY, const T4 &maxY,
|
||||
const T5 &minZ, const T6 &maxZ)
|
||||
: X(vtkm::Range(minX, maxX)),
|
||||
Y(vtkm::Range(minY, maxY)),
|
||||
Z(vtkm::Range(minZ, maxZ))
|
||||
@ -116,6 +121,19 @@ struct Bounds
|
||||
this->Z.Contains(point[2]));
|
||||
}
|
||||
|
||||
/// \b Returns the center of the range.
|
||||
///
|
||||
/// \c Center computes the point at the middle of the bounds. If the bounds
|
||||
/// are empty, the results are undefined.
|
||||
///
|
||||
VTKM_EXEC_CONT_EXPORT
|
||||
vtkm::Vec<vtkm::Float64,3> Center() const
|
||||
{
|
||||
return vtkm::Vec<vtkm::Float64,3>(this->X.Center(),
|
||||
this->Y.Center(),
|
||||
this->Z.Center());
|
||||
}
|
||||
|
||||
/// \b Expand bounds to include a point.
|
||||
///
|
||||
/// This version of \c Include expands the bounds just enough to include the
|
||||
@ -183,4 +201,14 @@ struct Bounds
|
||||
|
||||
} // namespace vtkm
|
||||
|
||||
/// Helper function for printing bounds during testing
|
||||
///
|
||||
VTKM_CONT_EXPORT
|
||||
std::ostream &operator<<(std::ostream &stream, const vtkm::Bounds &bounds)
|
||||
{
|
||||
return stream << "{ X:" << bounds.X
|
||||
<< ", Y:" << bounds.Y
|
||||
<< ", Z:" << bounds.Z << " }";
|
||||
}
|
||||
|
||||
#endif //vtk_m_Bounds_h
|
||||
|
44
vtkm/Range.h
44
vtkm/Range.h
@ -87,6 +87,42 @@ struct Range
|
||||
(this->Max >= static_cast<vtkm::Float64>(value)));
|
||||
}
|
||||
|
||||
/// \b Returns the length of the range.
|
||||
///
|
||||
/// \c Length computes the distance between the min and max. If the range
|
||||
/// is empty, 0 is returned.
|
||||
///
|
||||
VTKM_EXEC_CONT_EXPORT
|
||||
vtkm::Float64 Length() const
|
||||
{
|
||||
if (this->IsNonEmpty())
|
||||
{
|
||||
return (this->Max - this->Min);
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0.0;
|
||||
}
|
||||
}
|
||||
|
||||
/// \b Returns the center of the range.
|
||||
///
|
||||
/// \c Center computes the middle value of the range. If the range is empty,
|
||||
/// NaN is returned.
|
||||
///
|
||||
VTKM_EXEC_CONT_EXPORT
|
||||
vtkm::Float64 Center() const
|
||||
{
|
||||
if (this->IsNonEmpty())
|
||||
{
|
||||
return 0.5*(this->Max + this->Min);
|
||||
}
|
||||
else
|
||||
{
|
||||
return vtkm::Nan64();
|
||||
}
|
||||
}
|
||||
|
||||
/// \b Expand range to include a value.
|
||||
///
|
||||
/// This version of \c Include expands the range just enough to include the
|
||||
@ -148,4 +184,12 @@ struct Range
|
||||
|
||||
} // namespace vtkm
|
||||
|
||||
/// Helper function for printing ranges during testing
|
||||
///
|
||||
VTKM_CONT_EXPORT
|
||||
std::ostream &operator<<(std::ostream &stream, const vtkm::Range &range)
|
||||
{
|
||||
return stream << "[" << range.Min << ".." << range.Max << "]";
|
||||
}
|
||||
|
||||
#endif //vtk_m_Range_h
|
||||
|
@ -20,6 +20,8 @@
|
||||
#ifndef vtk_m_cont_CoordinateSystem_h
|
||||
#define vtk_m_cont_CoordinateSystem_h
|
||||
|
||||
#include <vtkm/Bounds.h>
|
||||
|
||||
#include <vtkm/cont/ArrayHandleUniformPointCoordinates.h>
|
||||
#include <vtkm/cont/ArrayHandleCompositeVector.h>
|
||||
#include <vtkm/cont/ArrayHandleCartesianProduct.h>
|
||||
@ -136,10 +138,10 @@ public:
|
||||
|
||||
template<typename DeviceAdapterTag>
|
||||
VTKM_CONT_EXPORT
|
||||
void GetBounds(vtkm::Float64 *bounds, DeviceAdapterTag) const
|
||||
void GetRange(vtkm::Range *range, DeviceAdapterTag) const
|
||||
{
|
||||
this->Superclass::GetBounds(
|
||||
bounds,
|
||||
this->Superclass::GetRange(
|
||||
range,
|
||||
DeviceAdapterTag(),
|
||||
VTKM_DEFAULT_COORDINATE_SYSTEM_TYPE_LIST_TAG(),
|
||||
VTKM_DEFAULT_COORDINATE_SYSTEM_STORAGE_LIST_TAG());
|
||||
@ -147,10 +149,10 @@ public:
|
||||
|
||||
template<typename DeviceAdapterTag, typename TypeList>
|
||||
VTKM_CONT_EXPORT
|
||||
void GetBounds(vtkm::Float64 *bounds, DeviceAdapterTag, TypeList) const
|
||||
void GetRange(vtkm::Range *range, DeviceAdapterTag, TypeList) const
|
||||
{
|
||||
this->Superclass::GetBounds(
|
||||
bounds,
|
||||
this->Superclass::GetRange(
|
||||
range,
|
||||
DeviceAdapterTag(),
|
||||
TypeList(),
|
||||
VTKM_DEFAULT_COORDINATE_SYSTEM_STORAGE_LIST_TAG());
|
||||
@ -158,10 +160,10 @@ public:
|
||||
|
||||
template<typename DeviceAdapterTag, typename TypeList, typename StorageList>
|
||||
VTKM_CONT_EXPORT
|
||||
void GetBounds(vtkm::Float64 *bounds, DeviceAdapterTag, TypeList, StorageList) const
|
||||
void GetRange(vtkm::Range *range, DeviceAdapterTag, TypeList, StorageList) const
|
||||
{
|
||||
this->Superclass::GetBounds(
|
||||
bounds,
|
||||
this->Superclass::GetRange(
|
||||
range,
|
||||
DeviceAdapterTag(),
|
||||
TypeList(),
|
||||
StorageList());
|
||||
@ -169,9 +171,9 @@ public:
|
||||
|
||||
template<typename DeviceAdapterTag>
|
||||
VTKM_CONT_EXPORT
|
||||
const vtkm::cont::ArrayHandle<vtkm::Float64>& GetBounds(DeviceAdapterTag) const
|
||||
const vtkm::cont::ArrayHandle<vtkm::Range>& GetRange(DeviceAdapterTag) const
|
||||
{
|
||||
return this->Superclass::GetBounds(
|
||||
return this->Superclass::GetRange(
|
||||
DeviceAdapterTag(),
|
||||
VTKM_DEFAULT_COORDINATE_SYSTEM_TYPE_LIST_TAG(),
|
||||
VTKM_DEFAULT_COORDINATE_SYSTEM_STORAGE_LIST_TAG());
|
||||
@ -179,10 +181,10 @@ public:
|
||||
|
||||
template<typename DeviceAdapterTag, typename TypeList>
|
||||
VTKM_CONT_EXPORT
|
||||
const vtkm::cont::ArrayHandle<vtkm::Float64>& GetBounds(DeviceAdapterTag,
|
||||
const vtkm::cont::ArrayHandle<vtkm::Range>& GetRange(DeviceAdapterTag,
|
||||
TypeList) const
|
||||
{
|
||||
return this->Superclass::GetBounds(
|
||||
return this->Superclass::GetRange(
|
||||
DeviceAdapterTag(),
|
||||
TypeList(),
|
||||
VTKM_DEFAULT_COORDINATE_SYSTEM_STORAGE_LIST_TAG());
|
||||
@ -190,16 +192,59 @@ public:
|
||||
|
||||
template<typename DeviceAdapterTag, typename TypeList, typename StorageList>
|
||||
VTKM_CONT_EXPORT
|
||||
const vtkm::cont::ArrayHandle<vtkm::Float64>& GetBounds(DeviceAdapterTag,
|
||||
const vtkm::cont::ArrayHandle<vtkm::Range>& GetRange(DeviceAdapterTag,
|
||||
TypeList,
|
||||
StorageList) const
|
||||
{
|
||||
return this->Superclass::GetBounds(
|
||||
return this->Superclass::GetRange(
|
||||
DeviceAdapterTag(),
|
||||
TypeList(),
|
||||
StorageList());
|
||||
}
|
||||
|
||||
template<typename DeviceAdapterTag>
|
||||
VTKM_CONT_EXPORT
|
||||
vtkm::Bounds GetBounds(DeviceAdapterTag) const
|
||||
{
|
||||
VTKM_IS_DEVICE_ADAPTER_TAG(DeviceAdapterTag);
|
||||
|
||||
return this->GetBounds(DeviceAdapterTag(),
|
||||
VTKM_DEFAULT_COORDINATE_SYSTEM_TYPE_LIST_TAG(),
|
||||
VTKM_DEFAULT_COORDINATE_SYSTEM_STORAGE_LIST_TAG());
|
||||
}
|
||||
|
||||
template<typename DeviceAdapterTag, typename TypeList>
|
||||
VTKM_CONT_EXPORT
|
||||
vtkm::Bounds GetBounds(DeviceAdapterTag, TypeList) const
|
||||
{
|
||||
VTKM_IS_DEVICE_ADAPTER_TAG(DeviceAdapterTag);
|
||||
VTKM_IS_LIST_TAG(TypeList);
|
||||
|
||||
return this->GetBounds(DeviceAdapterTag(),
|
||||
TypeList(),
|
||||
VTKM_DEFAULT_COORDINATE_SYSTEM_STORAGE_LIST_TAG());
|
||||
}
|
||||
|
||||
template<typename DeviceAdapterTag, typename TypeList, typename StorageList>
|
||||
VTKM_CONT_EXPORT
|
||||
vtkm::Bounds GetBounds(DeviceAdapterTag, TypeList, StorageList) const
|
||||
{
|
||||
VTKM_IS_DEVICE_ADAPTER_TAG(DeviceAdapterTag);
|
||||
VTKM_IS_LIST_TAG(TypeList);
|
||||
VTKM_IS_LIST_TAG(StorageList);
|
||||
|
||||
vtkm::cont::ArrayHandle<vtkm::Range> ranges =
|
||||
this->GetRange(DeviceAdapterTag(), 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));
|
||||
}
|
||||
|
||||
|
||||
VTKM_CONT_EXPORT
|
||||
|
@ -20,8 +20,9 @@
|
||||
#ifndef vtk_m_cont_Field_h
|
||||
#define vtk_m_cont_Field_h
|
||||
|
||||
#include <vtkm/Types.h>
|
||||
#include <vtkm/Math.h>
|
||||
#include <vtkm/Range.h>
|
||||
#include <vtkm/Types.h>
|
||||
#include <vtkm/VecTraits.h>
|
||||
|
||||
#include <vtkm/cont/ArrayHandle.h>
|
||||
@ -37,13 +38,13 @@ namespace cont {
|
||||
|
||||
namespace internal {
|
||||
|
||||
struct BoundsMin
|
||||
struct RangeMin
|
||||
{
|
||||
template<typename T>
|
||||
T operator()(const T& a, const T& b)const { return vtkm::Min(a,b); }
|
||||
};
|
||||
|
||||
struct BoundsMax
|
||||
struct RangeMax
|
||||
{
|
||||
template<typename T>
|
||||
T operator()(const T& a, const T& b)const { return vtkm::Max(a,b); }
|
||||
@ -51,10 +52,10 @@ struct BoundsMax
|
||||
|
||||
|
||||
template<typename DeviceAdapterTag>
|
||||
class ComputeBounds
|
||||
class ComputeRange
|
||||
{
|
||||
public:
|
||||
ComputeBounds(ArrayHandle<vtkm::Float64>& bounds) : Bounds(&bounds) {}
|
||||
ComputeRange(ArrayHandle<vtkm::Range>& range) : Range(&range) {}
|
||||
|
||||
template<typename ArrayHandleType>
|
||||
void operator()(const ArrayHandleType &input) const
|
||||
@ -70,16 +71,15 @@ public:
|
||||
ValueType initialMin = input.GetPortalConstControl().Get(0);
|
||||
ValueType initialMax = initialMin;
|
||||
|
||||
ValueType minResult = Algorithm::Reduce(input, initialMin, BoundsMin());
|
||||
ValueType maxResult = Algorithm::Reduce(input, initialMax, BoundsMax());
|
||||
ValueType minResult = Algorithm::Reduce(input, initialMin, RangeMin());
|
||||
ValueType maxResult = Algorithm::Reduce(input, initialMax, RangeMax());
|
||||
|
||||
this->Bounds->Allocate(NumberOfComponents * 2);
|
||||
this->Range->Allocate(NumberOfComponents);
|
||||
for (vtkm::IdComponent i = 0; i < NumberOfComponents; ++i)
|
||||
{
|
||||
this->Bounds->GetPortalControl().Set(i * 2,
|
||||
static_cast<vtkm::Float64>(VecType::GetComponent(minResult, i) ) );
|
||||
this->Bounds->GetPortalControl().Set(i * 2 + 1,
|
||||
static_cast<vtkm::Float64>(VecType::GetComponent(maxResult, i) ) );
|
||||
this->Range->GetPortalControl().Set(
|
||||
i, vtkm::Range(VecType::GetComponent(minResult, i),
|
||||
VecType::GetComponent(maxResult, i)));
|
||||
}
|
||||
}
|
||||
|
||||
@ -99,19 +99,16 @@ public:
|
||||
vtkm::Vec<vtkm::FloatDefault,3> maximum =
|
||||
portal.Get(portal.GetNumberOfValues()-1);
|
||||
|
||||
this->Bounds->Allocate(6);
|
||||
vtkm::cont::ArrayHandle<vtkm::Float64>::PortalControl outPortal =
|
||||
this->Bounds->GetPortalControl();
|
||||
outPortal.Set(0, minimum[0]);
|
||||
outPortal.Set(1, maximum[0]);
|
||||
outPortal.Set(2, minimum[1]);
|
||||
outPortal.Set(3, maximum[1]);
|
||||
outPortal.Set(4, minimum[2]);
|
||||
outPortal.Set(5, maximum[2]);
|
||||
this->Range->Allocate(3);
|
||||
vtkm::cont::ArrayHandle<vtkm::Range>::PortalControl outPortal =
|
||||
this->Range->GetPortalControl();
|
||||
outPortal.Set(0, vtkm::Range(minimum[0], maximum[0]));
|
||||
outPortal.Set(1, vtkm::Range(minimum[1], maximum[1]));
|
||||
outPortal.Set(2, vtkm::Range(minimum[2], maximum[2]));
|
||||
}
|
||||
|
||||
private:
|
||||
vtkm::cont::ArrayHandle<vtkm::Float64> *Bounds;
|
||||
vtkm::cont::ArrayHandle<vtkm::Range> *Range;
|
||||
};
|
||||
|
||||
} // namespace internal
|
||||
@ -143,7 +140,7 @@ public:
|
||||
AssocCellSetName(),
|
||||
AssocLogicalDim(-1),
|
||||
Data(data),
|
||||
Bounds(),
|
||||
Range(),
|
||||
ModifiedFlag(true)
|
||||
{
|
||||
VTKM_ASSERT(this->Association == ASSOC_WHOLE_MESH ||
|
||||
@ -160,7 +157,7 @@ public:
|
||||
AssocCellSetName(),
|
||||
AssocLogicalDim(-1),
|
||||
Data(data),
|
||||
Bounds(),
|
||||
Range(),
|
||||
ModifiedFlag(true)
|
||||
{
|
||||
VTKM_ASSERT((this->Association == ASSOC_WHOLE_MESH) ||
|
||||
@ -176,7 +173,7 @@ public:
|
||||
Association(association),
|
||||
AssocCellSetName(),
|
||||
AssocLogicalDim(-1),
|
||||
Bounds(),
|
||||
Range(),
|
||||
ModifiedFlag(true)
|
||||
{
|
||||
VTKM_ASSERT((this->Association == ASSOC_WHOLE_MESH) ||
|
||||
@ -194,7 +191,7 @@ public:
|
||||
Association(association),
|
||||
AssocCellSetName(),
|
||||
AssocLogicalDim(-1),
|
||||
Bounds(),
|
||||
Range(),
|
||||
ModifiedFlag(true)
|
||||
{
|
||||
VTKM_ASSERT((this->Association == ASSOC_WHOLE_MESH) ||
|
||||
@ -213,7 +210,7 @@ public:
|
||||
AssocCellSetName(cellSetName),
|
||||
AssocLogicalDim(-1),
|
||||
Data(data),
|
||||
Bounds(),
|
||||
Range(),
|
||||
ModifiedFlag(true)
|
||||
{
|
||||
VTKM_ASSERT(this->Association == ASSOC_CELL_SET);
|
||||
@ -230,7 +227,7 @@ public:
|
||||
AssocCellSetName(cellSetName),
|
||||
AssocLogicalDim(-1),
|
||||
Data(data),
|
||||
Bounds(),
|
||||
Range(),
|
||||
ModifiedFlag(true)
|
||||
{
|
||||
VTKM_ASSERT(this->Association == ASSOC_CELL_SET);
|
||||
@ -246,7 +243,7 @@ public:
|
||||
Association(association),
|
||||
AssocCellSetName(cellSetName),
|
||||
AssocLogicalDim(-1),
|
||||
Bounds(),
|
||||
Range(),
|
||||
ModifiedFlag(true)
|
||||
{
|
||||
VTKM_ASSERT(this->Association == ASSOC_CELL_SET);
|
||||
@ -264,7 +261,7 @@ public:
|
||||
Association(association),
|
||||
AssocCellSetName(cellSetName),
|
||||
AssocLogicalDim(-1),
|
||||
Bounds(),
|
||||
Range(),
|
||||
ModifiedFlag(true)
|
||||
{
|
||||
VTKM_ASSERT(this->Association == ASSOC_CELL_SET);
|
||||
@ -282,7 +279,7 @@ public:
|
||||
AssocCellSetName(),
|
||||
AssocLogicalDim(logicalDim),
|
||||
Data(data),
|
||||
Bounds(),
|
||||
Range(),
|
||||
ModifiedFlag(true)
|
||||
{
|
||||
VTKM_ASSERT(this->Association == ASSOC_LOGICAL_DIM);
|
||||
@ -298,7 +295,7 @@ public:
|
||||
Association(association),
|
||||
AssocLogicalDim(logicalDim),
|
||||
Data(data),
|
||||
Bounds(),
|
||||
Range(),
|
||||
ModifiedFlag(true)
|
||||
{
|
||||
VTKM_ASSERT(this->Association == ASSOC_LOGICAL_DIM);
|
||||
@ -313,7 +310,7 @@ public:
|
||||
: Name(name),
|
||||
Association(association),
|
||||
AssocLogicalDim(logicalDim),
|
||||
Bounds(),
|
||||
Range(),
|
||||
ModifiedFlag(true)
|
||||
{
|
||||
VTKM_ASSERT(this->Association == ASSOC_LOGICAL_DIM);
|
||||
@ -329,7 +326,7 @@ public:
|
||||
: Name(name),
|
||||
Association(association),
|
||||
AssocLogicalDim(logicalDim),
|
||||
Bounds(),
|
||||
Range(),
|
||||
ModifiedFlag(true)
|
||||
{
|
||||
VTKM_ASSERT(this->Association == ASSOC_LOGICAL_DIM);
|
||||
@ -343,7 +340,7 @@ public:
|
||||
AssocCellSetName(),
|
||||
AssocLogicalDim(),
|
||||
Data(),
|
||||
Bounds(),
|
||||
Range(),
|
||||
ModifiedFlag(true)
|
||||
{
|
||||
//Generate an empty field
|
||||
@ -375,66 +372,72 @@ public:
|
||||
|
||||
template<typename DeviceAdapterTag, typename TypeList, typename StorageList>
|
||||
VTKM_CONT_EXPORT
|
||||
const vtkm::cont::ArrayHandle<vtkm::Float64>& GetBounds(DeviceAdapterTag,
|
||||
const vtkm::cont::ArrayHandle<vtkm::Range>& GetRange(DeviceAdapterTag,
|
||||
TypeList,
|
||||
StorageList) const
|
||||
{
|
||||
if (this->ModifiedFlag)
|
||||
{
|
||||
internal::ComputeBounds<DeviceAdapterTag> computeBounds(this->Bounds);
|
||||
this->Data.ResetTypeAndStorageLists(TypeList(),StorageList()).CastAndCall(computeBounds);
|
||||
internal::ComputeRange<DeviceAdapterTag> computeRange(this->Range);
|
||||
this->Data.ResetTypeAndStorageLists(TypeList(),StorageList()).CastAndCall(computeRange);
|
||||
this->ModifiedFlag = false;
|
||||
}
|
||||
|
||||
return this->Bounds;
|
||||
return this->Range;
|
||||
}
|
||||
|
||||
template<typename DeviceAdapterTag, typename TypeList, typename StorageList>
|
||||
VTKM_CONT_EXPORT
|
||||
void GetBounds(vtkm::Float64 *bounds,
|
||||
void GetRange(vtkm::Range *range,
|
||||
DeviceAdapterTag,
|
||||
TypeList,
|
||||
StorageList) const
|
||||
{
|
||||
this->GetBounds(DeviceAdapterTag(), TypeList(), StorageList());
|
||||
this->GetRange(DeviceAdapterTag(), TypeList(), StorageList());
|
||||
|
||||
vtkm::Id length = this->Bounds.GetNumberOfValues();
|
||||
vtkm::Id length = this->Range.GetNumberOfValues();
|
||||
for (vtkm::Id i = 0; i < length; ++i)
|
||||
{
|
||||
bounds[i] = this->Bounds.GetPortalConstControl().Get(i);
|
||||
range[i] = this->Range.GetPortalConstControl().Get(i);
|
||||
}
|
||||
}
|
||||
|
||||
template<typename DeviceAdapterTag, typename TypeList>
|
||||
VTKM_CONT_EXPORT
|
||||
const vtkm::cont::ArrayHandle<vtkm::Float64>& GetBounds(DeviceAdapterTag,
|
||||
const vtkm::cont::ArrayHandle<vtkm::Range>& GetRange(DeviceAdapterTag,
|
||||
TypeList) const
|
||||
{
|
||||
return this->GetBounds(DeviceAdapterTag(), TypeList(),
|
||||
return this->GetRange(DeviceAdapterTag(),
|
||||
TypeList(),
|
||||
VTKM_DEFAULT_STORAGE_LIST_TAG());
|
||||
}
|
||||
|
||||
template<typename DeviceAdapterTag, typename TypeList>
|
||||
VTKM_CONT_EXPORT
|
||||
void GetBounds(vtkm::Float64 *bounds, DeviceAdapterTag, TypeList) const
|
||||
void GetRange(vtkm::Range *range, DeviceAdapterTag, TypeList) const
|
||||
{
|
||||
this->GetBounds(bounds, DeviceAdapterTag(), TypeList(),
|
||||
this->GetRange(range,
|
||||
DeviceAdapterTag(),
|
||||
TypeList(),
|
||||
VTKM_DEFAULT_STORAGE_LIST_TAG());
|
||||
}
|
||||
|
||||
template<typename DeviceAdapterTag>
|
||||
VTKM_CONT_EXPORT
|
||||
const vtkm::cont::ArrayHandle<vtkm::Float64>& GetBounds(DeviceAdapterTag) const
|
||||
const vtkm::cont::ArrayHandle<vtkm::Range>& GetRange(DeviceAdapterTag) const
|
||||
{
|
||||
return this->GetBounds(DeviceAdapterTag(), VTKM_DEFAULT_TYPE_LIST_TAG(),
|
||||
return this->GetRange(DeviceAdapterTag(),
|
||||
VTKM_DEFAULT_TYPE_LIST_TAG(),
|
||||
VTKM_DEFAULT_STORAGE_LIST_TAG());
|
||||
}
|
||||
|
||||
template<typename DeviceAdapterTag>
|
||||
VTKM_CONT_EXPORT
|
||||
void GetBounds(vtkm::Float64 *bounds, DeviceAdapterTag) const
|
||||
void GetRange(vtkm::Range *range, DeviceAdapterTag) const
|
||||
{
|
||||
this->GetBounds(bounds, DeviceAdapterTag(), VTKM_DEFAULT_TYPE_LIST_TAG(),
|
||||
this->GetRange(range,
|
||||
DeviceAdapterTag(),
|
||||
VTKM_DEFAULT_TYPE_LIST_TAG(),
|
||||
VTKM_DEFAULT_STORAGE_LIST_TAG());
|
||||
}
|
||||
|
||||
@ -509,7 +512,7 @@ private:
|
||||
vtkm::IdComponent AssocLogicalDim; ///< only populate if assoc is logical dim
|
||||
|
||||
vtkm::cont::DynamicArrayHandle Data;
|
||||
mutable vtkm::cont::ArrayHandle<vtkm::Float64> Bounds;
|
||||
mutable vtkm::cont::ArrayHandle<vtkm::Range> Range;
|
||||
mutable bool ModifiedFlag;
|
||||
};
|
||||
|
||||
|
@ -19,7 +19,7 @@
|
||||
##============================================================================
|
||||
|
||||
set(unit_tests
|
||||
UnitTestComputeBoundsCuda.cu
|
||||
UnitTestComputeRangeCuda.cu
|
||||
UnitTestCudaArrayHandle.cu
|
||||
UnitTestCudaArrayHandleFancy.cu
|
||||
UnitTestCudaDataSetExplicit.cu
|
||||
|
@ -22,11 +22,11 @@
|
||||
#include <vtkm/cont/cuda/DeviceAdapterCuda.h>
|
||||
|
||||
#include <vtkm/cont/cuda/internal/testing/Testing.h>
|
||||
#include <vtkm/cont/testing/TestingComputeBounds.h>
|
||||
#include <vtkm/cont/testing/TestingComputeRange.h>
|
||||
|
||||
int UnitTestComputeBoundsCuda(int, char *[])
|
||||
int UnitTestComputeRangeCuda(int, char *[])
|
||||
{
|
||||
int result = vtkm::cont::testing::TestingComputeBounds
|
||||
int result = vtkm::cont::testing::TestingComputeRange
|
||||
<vtkm::cont::DeviceAdapterTagCuda>::Run();
|
||||
return vtkm::cont::cuda::internal::Testing::CheckCudaBeforeExit(result);
|
||||
}
|
@ -19,7 +19,7 @@
|
||||
##============================================================================
|
||||
|
||||
set(unit_tests
|
||||
UnitTestComputeBoundsTBB.cxx
|
||||
UnitTestComputeRangeTBB.cxx
|
||||
UnitTestDataSetExplicitTBB.cxx
|
||||
UnitTestDataSetSingleTypeTBB.cxx
|
||||
UnitTestDeviceAdapterTBB.cxx
|
||||
|
@ -20,10 +20,10 @@
|
||||
|
||||
#include <vtkm/cont/tbb/DeviceAdapterTBB.h>
|
||||
|
||||
#include <vtkm/cont/testing/TestingComputeBounds.h>
|
||||
#include <vtkm/cont/testing/TestingComputeRange.h>
|
||||
|
||||
int UnitTestComputeBoundsTBB(int, char *[])
|
||||
int UnitTestComputeRangeTBB(int, char *[])
|
||||
{
|
||||
return vtkm::cont::testing::TestingComputeBounds
|
||||
return vtkm::cont::testing::TestingComputeRange
|
||||
<vtkm::cont::DeviceAdapterTagTBB>::Run();
|
||||
}
|
@ -23,7 +23,7 @@ set(headers
|
||||
MakeTestDataSet.h
|
||||
Testing.h
|
||||
TestingArrayHandles.h
|
||||
TestingComputeBounds.h
|
||||
TestingComputeRange.h
|
||||
TestingDeviceAdapter.h
|
||||
TestingDataSetExplicit.h
|
||||
TestingDataSetSingleType.h
|
||||
@ -45,7 +45,7 @@ set(unit_tests
|
||||
UnitTestArrayHandleUniformPointCoordinates.cxx
|
||||
UnitTestArrayPortalToIterators.cxx
|
||||
UnitTestContTesting.cxx
|
||||
UnitTestComputeBoundsSerial.cxx
|
||||
UnitTestComputeRangeSerial.cxx
|
||||
UnitTestDataSetBuilderExplicit.cxx
|
||||
UnitTestDataSetBuilderRectilinear.cxx
|
||||
UnitTestDataSetBuilderUniform.cxx
|
||||
|
@ -17,8 +17,8 @@
|
||||
// Laboratory (LANL), the U.S. Government retains certain rights in
|
||||
// this software.
|
||||
//============================================================================
|
||||
#ifndef vtk_m_cont_testing_TestingComputeBounds_h
|
||||
#define vtk_m_cont_testing_TestingComputeBounds_h
|
||||
#ifndef vtk_m_cont_testing_TestingComputeRange_h
|
||||
#define vtk_m_cont_testing_TestingComputeRange_h
|
||||
|
||||
#include <vtkm/Types.h>
|
||||
#include <vtkm/cont/CoordinateSystem.h>
|
||||
@ -45,7 +45,7 @@ struct CustomTypeList : vtkm::ListTagBase<vtkm::Vec<Int32, 3>,
|
||||
{};
|
||||
|
||||
template <typename DeviceAdapterTag>
|
||||
class TestingComputeBounds
|
||||
class TestingComputeRange
|
||||
{
|
||||
private:
|
||||
template <typename T>
|
||||
@ -57,19 +57,13 @@ private:
|
||||
vtkm::cont::Field field("TestField", vtkm::cont::Field::ASSOC_POINTS, data,
|
||||
nvals);
|
||||
|
||||
vtkm::Float64 result[2];
|
||||
field.GetBounds(result, DeviceAdapterTag());
|
||||
vtkm::Range result;
|
||||
field.GetRange(&result, DeviceAdapterTag());
|
||||
|
||||
if (result[0] == -5.0 && result[1] == 5.0)
|
||||
{
|
||||
std::cout << "Success" << std::endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cout << "Expected: -5.0, 5.0; Got: " << result[0] << ", " << result[1]
|
||||
<< std::endl;
|
||||
VTKM_TEST_FAIL("Failed");
|
||||
}
|
||||
std::cout << result << std::endl;
|
||||
VTKM_TEST_ASSERT(
|
||||
(test_equal(result.Min, -5.0) && test_equal(result.Max, 5.0)),
|
||||
"Unexpected scalar field range.");
|
||||
}
|
||||
|
||||
template <typename T, vtkm::Id NumberOfComponents>
|
||||
@ -89,38 +83,17 @@ private:
|
||||
vtkm::cont::Field field("TestField", vtkm::cont::Field::ASSOC_POINTS, fieldData,
|
||||
nvals);
|
||||
|
||||
vtkm::Float64 result[NumberOfComponents * 2];
|
||||
field.GetBounds(result, DeviceAdapterTag(), CustomTypeList(),
|
||||
vtkm::Range result[NumberOfComponents];
|
||||
field.GetRange(result,
|
||||
DeviceAdapterTag(),
|
||||
CustomTypeList(),
|
||||
VTKM_DEFAULT_STORAGE_LIST_TAG());
|
||||
|
||||
bool success = true;
|
||||
for (vtkm::IdComponent i = 0; i < NumberOfComponents; ++i)
|
||||
{
|
||||
if (result[i * 2] != -5.0 || result[i * 2 + 1] != 5.0)
|
||||
{
|
||||
success = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (success)
|
||||
{
|
||||
std::cout << "Success" << std::endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cout << "Expected: -5.0s and 5.0s; Got: ";
|
||||
for (vtkm::IdComponent i = 0; i < NumberOfComponents; ++i)
|
||||
{
|
||||
std::cout << result[i * 2] << ",";
|
||||
}
|
||||
std::cout << " and ";
|
||||
for (vtkm::IdComponent i = 0; i < NumberOfComponents; ++i)
|
||||
{
|
||||
std::cout << result[i * 2 + 1] << ",";
|
||||
}
|
||||
std::cout << std::endl;
|
||||
VTKM_TEST_FAIL("Failed");
|
||||
VTKM_TEST_ASSERT(
|
||||
(test_equal(result[i].Min, -5.0) && test_equal(result[i].Max, 5.0)),
|
||||
"Unexpected vector field range.");
|
||||
}
|
||||
}
|
||||
|
||||
@ -132,15 +105,14 @@ private:
|
||||
vtkm::Vec<vtkm::FloatDefault,3>(0.0f,-5.0f,4.0f),
|
||||
vtkm::Vec<vtkm::FloatDefault,3>(1.0f,0.5f,2.0f));
|
||||
|
||||
vtkm::Float64 result[6];
|
||||
field.GetBounds(result, DeviceAdapterTag());
|
||||
vtkm::Bounds result = field.GetBounds(DeviceAdapterTag());
|
||||
|
||||
VTKM_TEST_ASSERT(test_equal(result[0], 0.0), "Min x wrong.");
|
||||
VTKM_TEST_ASSERT(test_equal(result[1], 9.0), "Max x wrong.");
|
||||
VTKM_TEST_ASSERT(test_equal(result[2], -5.0), "Min y wrong.");
|
||||
VTKM_TEST_ASSERT(test_equal(result[3], 4.5), "Max y wrong.");
|
||||
VTKM_TEST_ASSERT(test_equal(result[4], 4.0), "Min z wrong.");
|
||||
VTKM_TEST_ASSERT(test_equal(result[5], 12.0), "Max z wrong.");
|
||||
VTKM_TEST_ASSERT(test_equal(result.X.Min, 0.0), "Min x wrong.");
|
||||
VTKM_TEST_ASSERT(test_equal(result.X.Max, 9.0), "Max x wrong.");
|
||||
VTKM_TEST_ASSERT(test_equal(result.Y.Min, -5.0), "Min y wrong.");
|
||||
VTKM_TEST_ASSERT(test_equal(result.Y.Max, 4.5), "Max y wrong.");
|
||||
VTKM_TEST_ASSERT(test_equal(result.Z.Min, 4.0), "Min z wrong.");
|
||||
VTKM_TEST_ASSERT(test_equal(result.Z.Max, 12.0), "Max z wrong.");
|
||||
}
|
||||
|
||||
struct TestAll
|
||||
@ -148,34 +120,34 @@ private:
|
||||
VTKM_CONT_EXPORT void operator()() const
|
||||
{
|
||||
std::cout << "Testing (Int32, 1)..." << std::endl;
|
||||
TestingComputeBounds::TestScalarField<vtkm::Int32>();
|
||||
TestingComputeRange::TestScalarField<vtkm::Int32>();
|
||||
std::cout << "Testing (Int64, 1)..." << std::endl;
|
||||
TestingComputeBounds::TestScalarField<vtkm::Int64>();
|
||||
TestingComputeRange::TestScalarField<vtkm::Int64>();
|
||||
std::cout << "Testing (Float32, 1)..." << std::endl;
|
||||
TestingComputeBounds::TestScalarField<vtkm::Float32>();
|
||||
TestingComputeRange::TestScalarField<vtkm::Float32>();
|
||||
std::cout << "Testing (Float64, 1)..." << std::endl;
|
||||
TestingComputeBounds::TestScalarField<vtkm::Float64>();
|
||||
TestingComputeRange::TestScalarField<vtkm::Float64>();
|
||||
|
||||
std::cout << "Testing (Int32, 3)..." << std::endl;
|
||||
TestingComputeBounds::TestVecField<vtkm::Int32, 3>();
|
||||
TestingComputeRange::TestVecField<vtkm::Int32, 3>();
|
||||
std::cout << "Testing (Int64, 3)..." << std::endl;
|
||||
TestingComputeBounds::TestVecField<vtkm::Int64, 3>();
|
||||
TestingComputeRange::TestVecField<vtkm::Int64, 3>();
|
||||
std::cout << "Testing (Float32, 3)..." << std::endl;
|
||||
TestingComputeBounds::TestVecField<vtkm::Float32, 3>();
|
||||
TestingComputeRange::TestVecField<vtkm::Float32, 3>();
|
||||
std::cout << "Testing (Float64, 3)..." << std::endl;
|
||||
TestingComputeBounds::TestVecField<vtkm::Float64, 3>();
|
||||
TestingComputeRange::TestVecField<vtkm::Float64, 3>();
|
||||
|
||||
std::cout << "Testing (Int32, 9)..." << std::endl;
|
||||
TestingComputeBounds::TestVecField<vtkm::Int32, 9>();
|
||||
TestingComputeRange::TestVecField<vtkm::Int32, 9>();
|
||||
std::cout << "Testing (Int64, 9)..." << std::endl;
|
||||
TestingComputeBounds::TestVecField<vtkm::Int64, 9>();
|
||||
TestingComputeRange::TestVecField<vtkm::Int64, 9>();
|
||||
std::cout << "Testing (Float32, 9)..." << std::endl;
|
||||
TestingComputeBounds::TestVecField<vtkm::Float32, 9>();
|
||||
TestingComputeRange::TestVecField<vtkm::Float32, 9>();
|
||||
std::cout << "Testing (Float64, 9)..." << std::endl;
|
||||
TestingComputeBounds::TestVecField<vtkm::Float64, 9>();
|
||||
TestingComputeRange::TestVecField<vtkm::Float64, 9>();
|
||||
|
||||
std::cout << "Testing UniformPointCoords..." << std::endl;
|
||||
TestingComputeBounds::TestUniformCoordinateField();
|
||||
TestingComputeRange::TestUniformCoordinateField();
|
||||
}
|
||||
};
|
||||
|
||||
@ -190,4 +162,4 @@ public:
|
||||
}
|
||||
} // namespace vtkm::cont::testing
|
||||
|
||||
#endif //vtk_m_cont_testing_TestingComputeBounds_h
|
||||
#endif //vtk_m_cont_testing_TestingComputeRange_h
|
6
vtkm/cont/testing/UnitTestComputeBoundsSerial.cxx → vtkm/cont/testing/UnitTestComputeRangeSerial.cxx
6
vtkm/cont/testing/UnitTestComputeBoundsSerial.cxx → vtkm/cont/testing/UnitTestComputeRangeSerial.cxx
@ -20,10 +20,10 @@
|
||||
|
||||
#include <vtkm/cont/DeviceAdapterSerial.h>
|
||||
|
||||
#include <vtkm/cont/testing/TestingComputeBounds.h>
|
||||
#include <vtkm/cont/testing/TestingComputeRange.h>
|
||||
|
||||
int UnitTestComputeBoundsSerial(int, char *[])
|
||||
int UnitTestComputeRangeSerial(int, char *[])
|
||||
{
|
||||
return vtkm::cont::testing::TestingComputeBounds
|
||||
return vtkm::cont::testing::TestingComputeRange
|
||||
<vtkm::cont::DeviceAdapterTagSerial>::Run();
|
||||
}
|
@ -33,27 +33,22 @@ typedef vtkm::cont::DeviceAdapterAlgorithm<VTKM_DEFAULT_DEVICE_ADAPTER_TAG> DFA;
|
||||
typedef VTKM_DEFAULT_DEVICE_ADAPTER_TAG DeviceAdapter;
|
||||
|
||||
template <typename T>
|
||||
void ComputeBounds(std::size_t numPoints, const T *coords,
|
||||
vtkm::Float64 *bounds)
|
||||
vtkm::Bounds ComputeBounds(std::size_t numPoints, const T *coords)
|
||||
{
|
||||
bounds[0] = bounds[1] = coords[0*3 +0];
|
||||
bounds[2] = bounds[3] = coords[0*3 +1];
|
||||
bounds[4] = bounds[5] = coords[0*3 +2];
|
||||
vtkm::Bounds bounds;
|
||||
|
||||
for (std::size_t i = 0; i < numPoints; i++)
|
||||
{
|
||||
bounds[0] = std::min(bounds[0], static_cast<vtkm::Float64>(coords[i*3+0]));
|
||||
bounds[1] = std::max(bounds[1], static_cast<vtkm::Float64>(coords[i*3+0]));
|
||||
bounds[2] = std::min(bounds[2], static_cast<vtkm::Float64>(coords[i*3+1]));
|
||||
bounds[3] = std::max(bounds[3], static_cast<vtkm::Float64>(coords[i*3+1]));
|
||||
bounds[4] = std::min(bounds[4], static_cast<vtkm::Float64>(coords[i*3+2]));
|
||||
bounds[5] = std::max(bounds[5], static_cast<vtkm::Float64>(coords[i*3+2]));
|
||||
bounds.Include(vtkm::Vec<T,3>(coords[i*3+0],coords[i*3+1],coords[i*3+2]));
|
||||
}
|
||||
|
||||
return bounds;
|
||||
}
|
||||
|
||||
void ValidateDataSet(const vtkm::cont::DataSet &ds,
|
||||
vtkm::Id numPoints, vtkm::Id numCells,
|
||||
vtkm::Float64 *bounds)
|
||||
vtkm::Id numPoints,
|
||||
vtkm::Id numCells,
|
||||
const vtkm::Bounds &bounds)
|
||||
{
|
||||
//Verify basics..
|
||||
VTKM_TEST_ASSERT(ds.GetNumberOfCellSets() == 1,
|
||||
@ -68,11 +63,9 @@ void ValidateDataSet(const vtkm::cont::DataSet &ds,
|
||||
"Wrong number of cells.");
|
||||
|
||||
//Make sure bounds are correct.
|
||||
vtkm::Float64 res[6];
|
||||
ds.GetCoordinateSystem().GetBounds(res, DeviceAdapter());
|
||||
VTKM_TEST_ASSERT(test_equal(bounds[0], res[0]) && test_equal(bounds[1], res[1]) &&
|
||||
test_equal(bounds[2], res[2]) && test_equal(bounds[3], res[3]) &&
|
||||
test_equal(bounds[4], res[4]) && test_equal(bounds[5], res[5]),
|
||||
vtkm::Bounds computedBounds =
|
||||
ds.GetCoordinateSystem().GetBounds(DeviceAdapter());
|
||||
VTKM_TEST_ASSERT(test_equal(bounds, computedBounds),
|
||||
"Bounds of coordinates do not match");
|
||||
}
|
||||
|
||||
@ -203,27 +196,27 @@ TestDataSetBuilderExplicit()
|
||||
{
|
||||
vtkm::cont::DataSetBuilderExplicit dsb;
|
||||
vtkm::cont::DataSet ds;
|
||||
vtkm::Float64 bounds[6];
|
||||
vtkm::Bounds bounds;
|
||||
|
||||
//Iterate over organization of coordinates.
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
//Test ExplicitData0
|
||||
ComputeBounds(TEST_BOUNDS(0), bounds);
|
||||
bounds = ComputeBounds(TEST_BOUNDS(0));
|
||||
ds = CreateDataSetArr(i==0,TEST_DATA(0));
|
||||
ValidateDataSet(ds, TEST_NUMS(0), bounds);
|
||||
ds = CreateDataSetVec(i==0, TEST_DATA(0));
|
||||
ValidateDataSet(ds, TEST_NUMS(0), bounds);
|
||||
|
||||
//Test ExplicitData1
|
||||
ComputeBounds(TEST_BOUNDS(1), bounds);
|
||||
bounds = ComputeBounds(TEST_BOUNDS(1));
|
||||
ds = CreateDataSetArr(i==0,TEST_DATA(1));
|
||||
ValidateDataSet(ds, TEST_NUMS(1), bounds);
|
||||
ds = CreateDataSetVec(i==0, TEST_DATA(1));
|
||||
ValidateDataSet(ds, TEST_NUMS(1), bounds);
|
||||
|
||||
//Test ExplicitData2
|
||||
ComputeBounds(TEST_BOUNDS(2), bounds);
|
||||
bounds = ComputeBounds(TEST_BOUNDS(2));
|
||||
ds = CreateDataSetArr(i==0,TEST_DATA(2));
|
||||
ValidateDataSet(ds, TEST_NUMS(2), bounds);
|
||||
ds = CreateDataSetVec(i==0, TEST_DATA(2));
|
||||
|
@ -47,7 +47,7 @@ typedef VTKM_DEFAULT_DEVICE_ADAPTER_TAG DeviceAdapter;
|
||||
void ValidateDataSet(const vtkm::cont::DataSet &ds,
|
||||
int dim,
|
||||
vtkm::Id numPoints, vtkm::Id numCells,
|
||||
vtkm::Float64 *bounds)
|
||||
const vtkm::Bounds &bounds)
|
||||
{
|
||||
//Verify basics..
|
||||
VTKM_TEST_ASSERT(ds.GetNumberOfCellSets() == 1,
|
||||
@ -62,11 +62,8 @@ void ValidateDataSet(const vtkm::cont::DataSet &ds,
|
||||
"Wrong number of cells.");
|
||||
|
||||
//Make sure the bounds are correct.
|
||||
vtkm::Float64 res[6];
|
||||
ds.GetCoordinateSystem().GetBounds(res, DeviceAdapter());
|
||||
VTKM_TEST_ASSERT(test_equal(bounds[0], res[0]) && test_equal(bounds[1], res[1]) &&
|
||||
test_equal(bounds[2], res[2]) && test_equal(bounds[3], res[3]) &&
|
||||
test_equal(bounds[4], res[4]) && test_equal(bounds[5], res[5]),
|
||||
vtkm::Bounds res = ds.GetCoordinateSystem().GetBounds(DeviceAdapter());
|
||||
VTKM_TEST_ASSERT(test_equal(bounds, res),
|
||||
"Bounds of coordinates do not match");
|
||||
if (dim == 2)
|
||||
{
|
||||
@ -150,11 +147,9 @@ RectilinearTests()
|
||||
std::cout << "2D cases" << std::endl;
|
||||
vtkm::Id numPoints = dimensions[0]*dimensions[1];
|
||||
vtkm::Id numCells = (dimensions[0]-1)*(dimensions[1]-1);
|
||||
vtkm::Float64 bounds[6] = {
|
||||
xCoordinates.front(), xCoordinates.back(),
|
||||
vtkm::Bounds bounds(xCoordinates.front(), xCoordinates.back(),
|
||||
yCoordinates.front(), yCoordinates.back(),
|
||||
0.0, 0.0
|
||||
};
|
||||
0.0, 0.0);
|
||||
|
||||
std::cout << " Create with std::vector" << std::endl;
|
||||
dataSet = dataSetBuilder.Create(xCoordinates, yCoordinates);
|
||||
@ -175,8 +170,7 @@ RectilinearTests()
|
||||
std::cout << "3D cases" << std::endl;
|
||||
numPoints *= dimensions[2];
|
||||
numCells *= dimensions[2]-1;
|
||||
bounds[4] = zCoordinates.front();
|
||||
bounds[5] = zCoordinates.back();
|
||||
bounds.Z = vtkm::Range(zCoordinates.front(), zCoordinates.back());
|
||||
|
||||
std::cout << " Create with std::vector" << std::endl;
|
||||
dataSet = dataSetBuilder.Create(xCoordinates, yCoordinates, zCoordinates);
|
||||
|
@ -47,7 +47,7 @@ typedef VTKM_DEFAULT_DEVICE_ADAPTER_TAG DeviceAdapter;
|
||||
void ValidateDataSet(const vtkm::cont::DataSet &ds,
|
||||
int dim,
|
||||
vtkm::Id numPoints, vtkm::Id numCells,
|
||||
vtkm::Float64 *bounds)
|
||||
vtkm::Bounds bounds)
|
||||
{
|
||||
//Verify basics..
|
||||
VTKM_TEST_ASSERT(ds.GetNumberOfCellSets() == 1,
|
||||
@ -63,11 +63,8 @@ void ValidateDataSet(const vtkm::cont::DataSet &ds,
|
||||
|
||||
|
||||
//Make sure bounds are correct.
|
||||
vtkm::Float64 res[6];
|
||||
ds.GetCoordinateSystem().GetBounds(res, DeviceAdapter());
|
||||
VTKM_TEST_ASSERT(test_equal(bounds[0], res[0]) && test_equal(bounds[1], res[1]) &&
|
||||
test_equal(bounds[2], res[2]) && test_equal(bounds[3], res[3]) &&
|
||||
test_equal(bounds[4], res[4]) && test_equal(bounds[5], res[5]),
|
||||
vtkm::Bounds res = ds.GetCoordinateSystem().GetBounds(DeviceAdapter());
|
||||
VTKM_TEST_ASSERT(test_equal(bounds, res),
|
||||
"Bounds of coordinates do not match");
|
||||
|
||||
if (dim == 2)
|
||||
@ -87,12 +84,10 @@ void ValidateDataSet(const vtkm::cont::DataSet &ds,
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void FillMethod(vtkm::IdComponent method,
|
||||
vtkm::Range FillMethod(vtkm::IdComponent method,
|
||||
vtkm::Id dimensionSize,
|
||||
T &origin,
|
||||
T &spacing,
|
||||
vtkm::Float64 &boundsMin,
|
||||
vtkm::Float64 &boundsMax)
|
||||
T &spacing)
|
||||
{
|
||||
switch (method)
|
||||
{
|
||||
@ -122,8 +117,7 @@ void FillMethod(vtkm::IdComponent method,
|
||||
break;
|
||||
}
|
||||
|
||||
boundsMin = static_cast<vtkm::Float64>(origin);
|
||||
boundsMax = static_cast<vtkm::Float64>(origin + static_cast<T>(dimensionSize-1)*spacing);
|
||||
return vtkm::Range(origin, origin + static_cast<T>(dimensionSize-1)*spacing);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
@ -161,25 +155,19 @@ UniformTests()
|
||||
|
||||
vtkm::Vec<T,3> origin;
|
||||
vtkm::Vec<T,3> spacing;
|
||||
vtkm::Float64 bounds[6];
|
||||
FillMethod(fillMethodX,
|
||||
vtkm::Bounds bounds;
|
||||
bounds.X = FillMethod(fillMethodX,
|
||||
dimensions[0],
|
||||
origin[0],
|
||||
spacing[0],
|
||||
bounds[0],
|
||||
bounds[1]);
|
||||
FillMethod(fillMethodY,
|
||||
spacing[0]);
|
||||
bounds.Y = FillMethod(fillMethodY,
|
||||
dimensions[1],
|
||||
origin[1],
|
||||
spacing[1],
|
||||
bounds[2],
|
||||
bounds[3]);
|
||||
FillMethod(fillMethodZ,
|
||||
spacing[1]);
|
||||
bounds.Z = FillMethod(fillMethodZ,
|
||||
dimensions[2],
|
||||
origin[2],
|
||||
spacing[2],
|
||||
bounds[4],
|
||||
bounds[5]);
|
||||
spacing[2]);
|
||||
|
||||
std::cout << "3D case" << std::endl;
|
||||
vtkm::Id numPoints = dimensions[0]*dimensions[1]*dimensions[2];
|
||||
@ -190,7 +178,7 @@ UniformTests()
|
||||
std::cout << "2D case" << std::endl;
|
||||
numPoints = dimensions[0]*dimensions[1];
|
||||
numCells = (dimensions[0]-1)*(dimensions[1]-1);
|
||||
bounds[4] = bounds[5] = 0.0;
|
||||
bounds.Z = vtkm::Range(0, 0);
|
||||
dataSet = dataSetBuilder.Create(vtkm::Id2(dimensions[0], dimensions[1]),
|
||||
vtkm::Vec<T,2>(origin[0], origin[1]),
|
||||
vtkm::Vec<T,2>(spacing[0], spacing[1]));
|
||||
|
@ -25,14 +25,13 @@ namespace
|
||||
{
|
||||
template<typename DerivedPolicy,
|
||||
typename DeviceAdapter>
|
||||
void compute_bounds(const vtkm::cont::CoordinateSystem& coords,
|
||||
vtkm::Float64 *bounds,
|
||||
vtkm::Bounds compute_bounds(const vtkm::cont::CoordinateSystem& coords,
|
||||
const vtkm::filter::PolicyBase<DerivedPolicy>&,
|
||||
const DeviceAdapter& tag)
|
||||
{
|
||||
typedef typename DerivedPolicy::CoordinateTypeList TypeList;
|
||||
typedef typename DerivedPolicy::CoordinateStorageList StorageList;
|
||||
coords.GetBounds(bounds, tag, TypeList(), StorageList());
|
||||
return coords.GetBounds(tag, TypeList(), StorageList());
|
||||
}
|
||||
|
||||
}
|
||||
@ -57,8 +56,8 @@ vtkm::filter::ResultDataSet VertexClustering::DoExecute(const vtkm::cont::DataSe
|
||||
vtkm::worklet::VertexClustering clustering;
|
||||
|
||||
//need to compute bounds first
|
||||
vtkm::Float64 bounds[6];
|
||||
compute_bounds(input.GetCoordinateSystem(), bounds, policy, tag);
|
||||
vtkm::Bounds bounds =
|
||||
compute_bounds(input.GetCoordinateSystem(), policy, tag);
|
||||
|
||||
vtkm::cont::DataSet outDataSet = clustering.Run(vtkm::filter::ApplyPolicyUnstructured(input.GetCellSet(), policy),
|
||||
vtkm::filter::ApplyPolicy(input.GetCoordinateSystem(), policy),
|
||||
|
@ -20,9 +20,11 @@
|
||||
#ifndef vtk_m_testing_Testing_h
|
||||
#define vtk_m_testing_Testing_h
|
||||
|
||||
#include <vtkm/Bounds.h>
|
||||
#include <vtkm/CellShape.h>
|
||||
#include <vtkm/Math.h>
|
||||
#include <vtkm/Pair.h>
|
||||
#include <vtkm/Range.h>
|
||||
#include <vtkm/TypeListTag.h>
|
||||
#include <vtkm/Types.h>
|
||||
#include <vtkm/TypeTraits.h>
|
||||
@ -398,6 +400,29 @@ bool test_equal(const vtkm::Pair<T1,T2> &pair1,
|
||||
}
|
||||
|
||||
|
||||
/// Special implementation of test_equal for Ranges.
|
||||
///
|
||||
VTKM_EXEC_CONT_EXPORT
|
||||
bool test_equal(const vtkm::Range &range1,
|
||||
const vtkm::Range &range2,
|
||||
vtkm::Float64 tolerance = 0.0001)
|
||||
{
|
||||
return (test_equal(range1.Min, range2.Min, tolerance) &&
|
||||
test_equal(range1.Max, range2.Max, tolerance));
|
||||
}
|
||||
|
||||
/// Special implementation of test_equal for Bounds.
|
||||
///
|
||||
VTKM_EXEC_CONT_EXPORT
|
||||
bool test_equal(const vtkm::Bounds &bounds1,
|
||||
const vtkm::Bounds &bounds2,
|
||||
vtkm::Float64 tolerance = 0.0001)
|
||||
{
|
||||
return (test_equal(bounds1.X, bounds2.X, tolerance) &&
|
||||
test_equal(bounds1.Y, bounds2.Y, tolerance) &&
|
||||
test_equal(bounds1.Z, bounds2.Z, tolerance));
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
VTKM_EXEC_CONT_EXPORT
|
||||
T TestValue(vtkm::Id index, T, vtkm::TypeTraitsIntegerTag)
|
||||
|
@ -35,6 +35,7 @@ void TestBounds()
|
||||
std::cout << "Single value bounds." << std::endl;
|
||||
vtkm::Bounds singleValueBounds(1.0, 1.0, 2.0, 2.0, 3.0, 3.0);
|
||||
VTKM_TEST_ASSERT(singleValueBounds.IsNonEmpty(), "Empty?");
|
||||
VTKM_TEST_ASSERT(test_equal(singleValueBounds.Center(), Vec3(1,2,3)), "Bad center");
|
||||
VTKM_TEST_ASSERT(singleValueBounds.Contains(Vec3(1,2,3)), "Contains fail");
|
||||
VTKM_TEST_ASSERT(!singleValueBounds.Contains(Vec3(0,0,0)), "Contains fail");
|
||||
VTKM_TEST_ASSERT(!singleValueBounds.Contains(Vec3(2,2,2)), "contains fail");
|
||||
@ -42,6 +43,7 @@ void TestBounds()
|
||||
|
||||
vtkm::Bounds unionBounds = emptyBounds + singleValueBounds;
|
||||
VTKM_TEST_ASSERT(unionBounds.IsNonEmpty(), "Empty?");
|
||||
VTKM_TEST_ASSERT(test_equal(unionBounds.Center(), Vec3(1,2,3)), "Bad center");
|
||||
VTKM_TEST_ASSERT(unionBounds.Contains(Vec3(1,2,3)), "Contains fail");
|
||||
VTKM_TEST_ASSERT(!unionBounds.Contains(Vec3(0,0,0)), "Contains fail");
|
||||
VTKM_TEST_ASSERT(!unionBounds.Contains(Vec3(2,2,2)), "contains fail");
|
||||
@ -51,6 +53,7 @@ void TestBounds()
|
||||
std::cout << "Low bounds." << std::endl;
|
||||
vtkm::Bounds lowBounds(Vec3(-10,-5,-1), Vec3(-5, -2, 0));
|
||||
VTKM_TEST_ASSERT(lowBounds.IsNonEmpty(), "Empty?");
|
||||
VTKM_TEST_ASSERT(test_equal(lowBounds.Center(), Vec3(-7.5,-3.5,-0.5)), "Bad center");
|
||||
VTKM_TEST_ASSERT(!lowBounds.Contains(Vec3(-20)), "Contains fail");
|
||||
VTKM_TEST_ASSERT(!lowBounds.Contains(Vec3(-2)), "Contains fail");
|
||||
VTKM_TEST_ASSERT(lowBounds.Contains(Vec3(-7,-2,-0.5)), "Contains fail");
|
||||
|
@ -29,25 +29,32 @@ void TestRange()
|
||||
std::cout << "Empty range." << std::endl;
|
||||
vtkm::Range emptyRange;
|
||||
VTKM_TEST_ASSERT(!emptyRange.IsNonEmpty(), "Non empty range not empty.");
|
||||
VTKM_TEST_ASSERT(test_equal(emptyRange.Length(), 0.0), "Bad length.");
|
||||
|
||||
std::cout << "Single value range." << std::endl;
|
||||
vtkm::Range singleValueRange(5.0, 5.0);
|
||||
VTKM_TEST_ASSERT(singleValueRange.IsNonEmpty(), "Empty?");
|
||||
VTKM_TEST_ASSERT(test_equal(singleValueRange.Length(), 0.0), "Bad length.");
|
||||
VTKM_TEST_ASSERT(test_equal(singleValueRange.Center(), 5), "Bad center.");
|
||||
VTKM_TEST_ASSERT(singleValueRange.Contains(5.0), "Does not contain value");
|
||||
VTKM_TEST_ASSERT(!singleValueRange.Contains(0.0), "Contains outside");
|
||||
VTKM_TEST_ASSERT(!singleValueRange.Contains(10), "Contains outside");
|
||||
|
||||
vtkm::Range unionRange = emptyRange + singleValueRange;
|
||||
VTKM_TEST_ASSERT(unionRange.IsNonEmpty(), "Empty?");
|
||||
VTKM_TEST_ASSERT(test_equal(unionRange.Length(), 0.0), "Bad length.");
|
||||
VTKM_TEST_ASSERT(test_equal(unionRange.Center(), 5), "Bad center.");
|
||||
VTKM_TEST_ASSERT(unionRange.Contains(5.0), "Does not contain value");
|
||||
VTKM_TEST_ASSERT(!unionRange.Contains(0.0), "Contains outside");
|
||||
VTKM_TEST_ASSERT(!unionRange.Contains(10), "Contains outside");
|
||||
VTKM_TEST_ASSERT(singleValueRange == unionRange, "Union not equal");
|
||||
VTKM_TEST_ASSERT(!(singleValueRange == unionRange), "Union not equal");
|
||||
VTKM_TEST_ASSERT(!(singleValueRange != unionRange), "Union not equal");
|
||||
|
||||
std::cout << "Low range." << std::endl;
|
||||
vtkm::Range lowRange(-10.0, -5.0);
|
||||
VTKM_TEST_ASSERT(lowRange.IsNonEmpty(), "Empty?");
|
||||
VTKM_TEST_ASSERT(test_equal(lowRange.Length(), 5.0), "Bad length.");
|
||||
VTKM_TEST_ASSERT(test_equal(lowRange.Center(), -7.5), "Bad center.");
|
||||
VTKM_TEST_ASSERT(!lowRange.Contains(-20), "Contains fail");
|
||||
VTKM_TEST_ASSERT(lowRange.Contains(-7), "Contains fail");
|
||||
VTKM_TEST_ASSERT(!lowRange.Contains(0), "Contains fail");
|
||||
@ -55,6 +62,8 @@ void TestRange()
|
||||
|
||||
unionRange = singleValueRange + lowRange;
|
||||
VTKM_TEST_ASSERT(unionRange.IsNonEmpty(), "Empty?");
|
||||
VTKM_TEST_ASSERT(test_equal(unionRange.Length(), 15.0), "Bad length.");
|
||||
VTKM_TEST_ASSERT(test_equal(unionRange.Center(), -2.5), "Bad center.");
|
||||
VTKM_TEST_ASSERT(!unionRange.Contains(-20), "Contains fail");
|
||||
VTKM_TEST_ASSERT(unionRange.Contains(-7), "Contains fail");
|
||||
VTKM_TEST_ASSERT(unionRange.Contains(0), "Contains fail");
|
||||
@ -63,6 +72,8 @@ void TestRange()
|
||||
std::cout << "High range." << std::endl;
|
||||
vtkm::Range highRange(15.0, 20.0);
|
||||
VTKM_TEST_ASSERT(highRange.IsNonEmpty(), "Empty?");
|
||||
VTKM_TEST_ASSERT(test_equal(highRange.Length(), 5.0), "Bad length.");
|
||||
VTKM_TEST_ASSERT(test_equal(highRange.Center(), 17.5), "Bad center.");
|
||||
VTKM_TEST_ASSERT(!highRange.Contains(-20), "Contains fail");
|
||||
VTKM_TEST_ASSERT(!highRange.Contains(-7), "Contains fail");
|
||||
VTKM_TEST_ASSERT(!highRange.Contains(0), "Contains fail");
|
||||
@ -72,6 +83,8 @@ void TestRange()
|
||||
|
||||
unionRange = highRange.Union(singleValueRange);
|
||||
VTKM_TEST_ASSERT(unionRange.IsNonEmpty(), "Empty?");
|
||||
VTKM_TEST_ASSERT(test_equal(unionRange.Length(), 15.0), "Bad length.");
|
||||
VTKM_TEST_ASSERT(test_equal(unionRange.Center(), 12.5), "Bad center.");
|
||||
VTKM_TEST_ASSERT(!unionRange.Contains(-20), "Contains fail");
|
||||
VTKM_TEST_ASSERT(!unionRange.Contains(-7), "Contains fail");
|
||||
VTKM_TEST_ASSERT(!unionRange.Contains(0), "Contains fail");
|
||||
@ -81,6 +94,8 @@ void TestRange()
|
||||
|
||||
unionRange.Include(-1);
|
||||
VTKM_TEST_ASSERT(unionRange.IsNonEmpty(), "Empty?");
|
||||
VTKM_TEST_ASSERT(test_equal(unionRange.Length(), 21.0), "Bad length.");
|
||||
VTKM_TEST_ASSERT(test_equal(unionRange.Center(), 9.5), "Bad center.");
|
||||
VTKM_TEST_ASSERT(!unionRange.Contains(-20), "Contains fail");
|
||||
VTKM_TEST_ASSERT(!unionRange.Contains(-7), "Contains fail");
|
||||
VTKM_TEST_ASSERT(unionRange.Contains(0), "Contains fail");
|
||||
@ -90,6 +105,8 @@ void TestRange()
|
||||
|
||||
unionRange.Include(lowRange);
|
||||
VTKM_TEST_ASSERT(unionRange.IsNonEmpty(), "Empty?");
|
||||
VTKM_TEST_ASSERT(test_equal(unionRange.Length(), 30.0), "Bad length.");
|
||||
VTKM_TEST_ASSERT(test_equal(unionRange.Center(), 5), "Bad center.");
|
||||
VTKM_TEST_ASSERT(!unionRange.Contains(-20), "Contains fail");
|
||||
VTKM_TEST_ASSERT(unionRange.Contains(-7), "Contains fail");
|
||||
VTKM_TEST_ASSERT(unionRange.Contains(0), "Contains fail");
|
||||
|
@ -316,7 +316,7 @@ public:
|
||||
typename DeviceAdapter>
|
||||
vtkm::cont::DataSet Run(const DynamicCellSetType &cellSet,
|
||||
const DynamicCoordinateHandleType &coordinates,
|
||||
vtkm::Float64 *bounds,
|
||||
const vtkm::Bounds &bounds,
|
||||
const vtkm::Id3& nDivisions,
|
||||
DeviceAdapter)
|
||||
{
|
||||
@ -325,24 +325,24 @@ public:
|
||||
/// determine grid resolution for clustering
|
||||
GridInfo gridInfo;
|
||||
{
|
||||
vtkm::Float64 res[3];
|
||||
for (vtkm::IdComponent i=0; i<3; i++)
|
||||
{
|
||||
res[i] = (bounds[i*2+1]-bounds[i*2])/static_cast<vtkm::Float64>(nDivisions[i]);
|
||||
}
|
||||
vtkm::Vec<vtkm::Float64,3> res(
|
||||
bounds.X.Length()/static_cast<vtkm::Float64>(nDivisions[0]),
|
||||
bounds.Y.Length()/static_cast<vtkm::Float64>(nDivisions[1]),
|
||||
bounds.Z.Length()/static_cast<vtkm::Float64>(nDivisions[2]));
|
||||
gridInfo.grid_width = vtkm::Max(res[0], vtkm::Max(res[1], res[2]));
|
||||
|
||||
vtkm::Float64 inv_grid_width = gridInfo.inv_grid_width = vtkm::Float64(1) / gridInfo.grid_width;
|
||||
|
||||
//printf("Bounds: %lf, %lf, %lf, %lf, %lf, %lf\n", bounds[0], bounds[1], bounds[2], bounds[3], bounds[4], bounds[5]);
|
||||
gridInfo.dim[0] = vtkm::Min((vtkm::Id)vtkm::Ceil((bounds[1]-bounds[0])*inv_grid_width), nDivisions[0]);
|
||||
gridInfo.dim[1] = vtkm::Min((vtkm::Id)vtkm::Ceil((bounds[3]-bounds[2])*inv_grid_width), nDivisions[1]);
|
||||
gridInfo.dim[2] = vtkm::Min((vtkm::Id)vtkm::Ceil((bounds[5]-bounds[4])*inv_grid_width), nDivisions[2]);
|
||||
gridInfo.dim[0] = vtkm::Min((vtkm::Id)vtkm::Ceil((bounds.X.Length())*inv_grid_width), nDivisions[0]);
|
||||
gridInfo.dim[1] = vtkm::Min((vtkm::Id)vtkm::Ceil((bounds.Y.Length())*inv_grid_width), nDivisions[1]);
|
||||
gridInfo.dim[2] = vtkm::Min((vtkm::Id)vtkm::Ceil((bounds.Z.Length())*inv_grid_width), nDivisions[2]);
|
||||
|
||||
// center the mesh in the grids
|
||||
gridInfo.origin[0] = (bounds[1]+bounds[0])*0.5 - gridInfo.grid_width*static_cast<vtkm::Float64>(gridInfo.dim[0])*.5;
|
||||
gridInfo.origin[1] = (bounds[3]+bounds[2])*0.5 - gridInfo.grid_width*static_cast<vtkm::Float64>(gridInfo.dim[1])*.5;
|
||||
gridInfo.origin[2] = (bounds[5]+bounds[4])*0.5 - gridInfo.grid_width*static_cast<vtkm::Float64>(gridInfo.dim[2])*.5;
|
||||
vtkm::Vec<vtkm::Float64,3> center = bounds.Center();
|
||||
gridInfo.origin[0] = center[0] - gridInfo.grid_width*static_cast<vtkm::Float64>(gridInfo.dim[0])*.5;
|
||||
gridInfo.origin[1] = center[1] - gridInfo.grid_width*static_cast<vtkm::Float64>(gridInfo.dim[1])*.5;
|
||||
gridInfo.origin[2] = center[2] - gridInfo.grid_width*static_cast<vtkm::Float64>(gridInfo.dim[2])*.5;
|
||||
}
|
||||
|
||||
//construct the scheduler that will execute all the worklets
|
||||
|
@ -194,10 +194,8 @@ void TestExplicitGrid2D()
|
||||
std::cout << "Number of output vertices " << coordArray.GetNumberOfValues() << std::endl;
|
||||
std::cout << "Number of output components " << coordArray.GetNumberOfComponents() << std::endl;
|
||||
|
||||
vtkm::cont::ArrayHandle<vtkm::Float64> bounds = coordinates.GetBounds(DeviceAdapter());
|
||||
std::cout << "Bounds ("
|
||||
<< bounds.GetPortalControl().Get(0) << "," << bounds.GetPortalControl().Get(1) << ") ("
|
||||
<< bounds.GetPortalControl().Get(2) << "," << bounds.GetPortalControl().Get(3) << ")" << std::endl;
|
||||
vtkm::Bounds bounds = coordinates.GetBounds(DeviceAdapter());
|
||||
std::cout << "Bounds " << bounds << std::endl;
|
||||
|
||||
VTKM_TEST_ASSERT(test_equal(cellSet.GetNumberOfCells(), 14), "Wrong result for Triangulate filter");
|
||||
}
|
||||
@ -234,11 +232,8 @@ void TestExplicitGrid3D()
|
||||
std::cout << "Number of output vertices " << coordArray.GetNumberOfValues() << std::endl;
|
||||
std::cout << "Number of output components " << coordArray.GetNumberOfComponents() << std::endl;
|
||||
|
||||
vtkm::cont::ArrayHandle<vtkm::Float64> bounds = coordinates.GetBounds(DeviceAdapter());
|
||||
std::cout << "Bounds ("
|
||||
<< bounds.GetPortalControl().Get(0) << "," << bounds.GetPortalControl().Get(1) << ") ("
|
||||
<< bounds.GetPortalControl().Get(2) << "," << bounds.GetPortalControl().Get(3) << ") ("
|
||||
<< bounds.GetPortalControl().Get(4) << "," << bounds.GetPortalControl().Get(5) << ")" << std::endl;
|
||||
vtkm::Bounds bounds = coordinates.GetBounds(DeviceAdapter());
|
||||
std::cout << "Bounds " << bounds << std::endl;
|
||||
|
||||
VTKM_TEST_ASSERT(test_equal(cellSet.GetNumberOfCells(), 11), "Wrong result for Tetrahedralize filter");
|
||||
}
|
||||
|
@ -121,11 +121,8 @@ void TestUniformGrid2D()
|
||||
std::cout << "Number of output vertices " << coordArray.GetNumberOfValues() << std::endl;
|
||||
std::cout << "Number of output components " << coordArray.GetNumberOfComponents() << std::endl;
|
||||
|
||||
vtkm::cont::ArrayHandle<vtkm::Float64> bounds = coordinates.GetBounds(DeviceAdapter());
|
||||
std::cout << "Bounds ("
|
||||
<< bounds.GetPortalControl().Get(0) << "," << bounds.GetPortalControl().Get(1) << ") ("
|
||||
<< bounds.GetPortalControl().Get(2) << "," << bounds.GetPortalControl().Get(3) << ") ("
|
||||
<< bounds.GetPortalControl().Get(4) << "," << bounds.GetPortalControl().Get(5) << ")" << std::endl;
|
||||
vtkm::Bounds bounds = coordinates.GetBounds(DeviceAdapter());
|
||||
std::cout << "Bounds " << bounds << std::endl;
|
||||
|
||||
// Two triangles are created for every quad cell
|
||||
VTKM_TEST_ASSERT(test_equal(cellSet.GetNumberOfCells(), numberOfCells * 2),
|
||||
@ -172,11 +169,8 @@ void TestUniformGrid3D()
|
||||
std::cout << "Number of output vertices " << coordArray.GetNumberOfValues() << std::endl;
|
||||
std::cout << "Number of output components " << coordArray.GetNumberOfComponents() << std::endl;
|
||||
|
||||
vtkm::cont::ArrayHandle<vtkm::Float64> bounds = coordinates.GetBounds(DeviceAdapter());
|
||||
std::cout << "Bounds ("
|
||||
<< bounds.GetPortalControl().Get(0) << "," << bounds.GetPortalControl().Get(1) << ") ("
|
||||
<< bounds.GetPortalControl().Get(2) << "," << bounds.GetPortalControl().Get(3) << ") ("
|
||||
<< bounds.GetPortalControl().Get(4) << "," << bounds.GetPortalControl().Get(5) << ")" << std::endl;
|
||||
vtkm::Bounds bounds = coordinates.GetBounds(DeviceAdapter());
|
||||
std::cout << "Bounds " << bounds << std::endl;
|
||||
|
||||
// Five tets are created for every hex cell
|
||||
VTKM_TEST_ASSERT(test_equal(cellSet.GetNumberOfCells(), numberOfCells * 5),
|
||||
|
@ -36,8 +36,8 @@ void TestVertexClustering()
|
||||
vtkm::cont::DataSet dataSet = maker.Make3DExplicitDataSetCowNose();
|
||||
|
||||
//compute the bounds before calling the algorithm
|
||||
vtkm::Float64 bounds[6];
|
||||
dataSet.GetCoordinateSystem().GetBounds(bounds, VTKM_DEFAULT_DEVICE_ADAPTER_TAG());
|
||||
vtkm::Bounds bounds =
|
||||
dataSet.GetCoordinateSystem().GetBounds(VTKM_DEFAULT_DEVICE_ADAPTER_TAG());
|
||||
|
||||
// run
|
||||
vtkm::worklet::VertexClustering clustering;
|
||||
|
Loading…
Reference in New Issue
Block a user