mirror of
https://gitlab.kitware.com/vtk/vtk-m
synced 2024-09-08 13:23:51 +00:00
Add Field::GetRange and CoordinateSystem::GetBounds to library
Following what was done with ArrayRangeCompute, the GetRange and GetBounds methods are embedded into the vtkm_cont library for the most common type lists. Also, and probably more importantly, the device adapter is no longer one of the arguments for either of these methods. It is no longer needed as ArrayRangeCompute no longer needs it.
This commit is contained in:
parent
c16236ce69
commit
6fdc7eb8c0
@ -23,11 +23,37 @@
|
||||
namespace vtkm {
|
||||
namespace cont {
|
||||
|
||||
VTKM_CONT
|
||||
void CoordinateSystem::PrintSummary(std::ostream &out) const
|
||||
{
|
||||
out << " Coordinate System ";
|
||||
this->Superclass::PrintSummary(out);
|
||||
}
|
||||
|
||||
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());
|
||||
}
|
||||
|
||||
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());
|
||||
}
|
||||
|
||||
VTKM_CONT
|
||||
vtkm::Bounds CoordinateSystem::GetBounds() const
|
||||
{
|
||||
return this->GetBounds(VTKM_DEFAULT_COORDINATE_SYSTEM_TYPE_LIST_TAG(),
|
||||
VTKM_DEFAULT_COORDINATE_SYSTEM_STORAGE_LIST_TAG());
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace vtkm::cont
|
||||
|
@ -142,105 +142,83 @@ public:
|
||||
this->Superclass::GetData());
|
||||
}
|
||||
|
||||
template<typename DeviceAdapterTag>
|
||||
VTKM_CONT
|
||||
void GetRange(vtkm::Range *range, DeviceAdapterTag) const
|
||||
{
|
||||
this->Superclass::GetRange(
|
||||
range,
|
||||
DeviceAdapterTag(),
|
||||
VTKM_DEFAULT_COORDINATE_SYSTEM_TYPE_LIST_TAG(),
|
||||
VTKM_DEFAULT_COORDINATE_SYSTEM_STORAGE_LIST_TAG());
|
||||
}
|
||||
void GetRange(vtkm::Range *range) const;
|
||||
|
||||
template<typename DeviceAdapterTag, typename TypeList>
|
||||
template<typename TypeList>
|
||||
VTKM_CONT
|
||||
void GetRange(vtkm::Range *range, DeviceAdapterTag, TypeList) const
|
||||
void GetRange(vtkm::Range *range, TypeList) const
|
||||
{
|
||||
this->Superclass::GetRange(
|
||||
range,
|
||||
DeviceAdapterTag(),
|
||||
TypeList(),
|
||||
VTKM_DEFAULT_COORDINATE_SYSTEM_STORAGE_LIST_TAG());
|
||||
}
|
||||
|
||||
template<typename DeviceAdapterTag, typename TypeList, typename StorageList>
|
||||
VTKM_CONT
|
||||
void GetRange(vtkm::Range *range, DeviceAdapterTag, TypeList, StorageList) const
|
||||
{
|
||||
this->Superclass::GetRange(
|
||||
range,
|
||||
DeviceAdapterTag(),
|
||||
TypeList(),
|
||||
StorageList());
|
||||
}
|
||||
|
||||
template<typename DeviceAdapterTag>
|
||||
VTKM_CONT
|
||||
const vtkm::cont::ArrayHandle<vtkm::Range>& GetRange(DeviceAdapterTag) const
|
||||
{
|
||||
return this->Superclass::GetRange(
|
||||
DeviceAdapterTag(),
|
||||
VTKM_DEFAULT_COORDINATE_SYSTEM_TYPE_LIST_TAG(),
|
||||
VTKM_DEFAULT_COORDINATE_SYSTEM_STORAGE_LIST_TAG());
|
||||
}
|
||||
|
||||
template<typename DeviceAdapterTag, typename TypeList>
|
||||
VTKM_CONT
|
||||
const vtkm::cont::ArrayHandle<vtkm::Range>& GetRange(DeviceAdapterTag,
|
||||
TypeList) const
|
||||
{
|
||||
return this->Superclass::GetRange(
|
||||
DeviceAdapterTag(),
|
||||
TypeList(),
|
||||
VTKM_DEFAULT_COORDINATE_SYSTEM_STORAGE_LIST_TAG());
|
||||
}
|
||||
|
||||
template<typename DeviceAdapterTag, typename TypeList, typename StorageList>
|
||||
VTKM_CONT
|
||||
const vtkm::cont::ArrayHandle<vtkm::Range>& GetRange(DeviceAdapterTag,
|
||||
TypeList,
|
||||
StorageList) const
|
||||
{
|
||||
return this->Superclass::GetRange(
|
||||
DeviceAdapterTag(),
|
||||
TypeList(),
|
||||
StorageList());
|
||||
}
|
||||
|
||||
template<typename DeviceAdapterTag>
|
||||
VTKM_CONT
|
||||
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
|
||||
vtkm::Bounds GetBounds(DeviceAdapterTag, TypeList) const
|
||||
{
|
||||
VTKM_IS_DEVICE_ADAPTER_TAG(DeviceAdapterTag);
|
||||
VTKM_IS_LIST_TAG(TypeList);
|
||||
|
||||
return this->GetBounds(DeviceAdapterTag(),
|
||||
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 DeviceAdapterTag, typename TypeList, typename StorageList>
|
||||
template<typename TypeList, typename StorageList>
|
||||
VTKM_CONT
|
||||
vtkm::Bounds GetBounds(DeviceAdapterTag, TypeList, StorageList) const
|
||||
vtkm::Bounds GetBounds(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());
|
||||
this->GetRange(TypeList(), StorageList());
|
||||
|
||||
VTKM_ASSERT(ranges.GetNumberOfValues() == 3);
|
||||
|
||||
|
@ -23,30 +23,56 @@
|
||||
namespace vtkm {
|
||||
namespace cont {
|
||||
|
||||
VTKM_CONT
|
||||
void Field::PrintSummary(std::ostream &out) const
|
||||
{
|
||||
out<<" "<<this->Name;
|
||||
out<<" assoc= ";
|
||||
switch (this->GetAssociation())
|
||||
{
|
||||
out<<" "<<this->Name;
|
||||
out<<" assoc= ";
|
||||
switch (this->GetAssociation())
|
||||
{
|
||||
case ASSOC_ANY: out<<"Any "; break;
|
||||
case ASSOC_WHOLE_MESH: out<<"Mesh "; break;
|
||||
case ASSOC_POINTS: out<<"Points "; break;
|
||||
case ASSOC_CELL_SET: out<<"Cells "; break;
|
||||
case ASSOC_LOGICAL_DIM: out<<"LogicalDim "; break;
|
||||
}
|
||||
this->Data.PrintSummary(out);
|
||||
}
|
||||
this->Data.PrintSummary(out);
|
||||
}
|
||||
|
||||
VTKM_CONT
|
||||
const vtkm::cont::ArrayHandle<vtkm::Range> &
|
||||
Field::GetRange() const
|
||||
{
|
||||
return this->GetRange(VTKM_DEFAULT_TYPE_LIST_TAG(),
|
||||
VTKM_DEFAULT_STORAGE_LIST_TAG());
|
||||
}
|
||||
|
||||
VTKM_CONT
|
||||
void Field::GetRange(vtkm::Range *range) const
|
||||
{
|
||||
this->GetRange(range,
|
||||
VTKM_DEFAULT_TYPE_LIST_TAG(),
|
||||
VTKM_DEFAULT_STORAGE_LIST_TAG());
|
||||
}
|
||||
|
||||
VTKM_CONT
|
||||
const vtkm::cont::DynamicArrayHandle &Field::GetData() const
|
||||
{
|
||||
return this->Data;
|
||||
return this->Data;
|
||||
}
|
||||
|
||||
VTKM_CONT
|
||||
vtkm::cont::DynamicArrayHandle &Field::GetData()
|
||||
{
|
||||
this->ModifiedFlag = true;
|
||||
return this->Data;
|
||||
this->ModifiedFlag = true;
|
||||
return this->Data;
|
||||
}
|
||||
|
||||
VTKM_CONT
|
||||
const vtkm::cont::ArrayHandle<vtkm::Range> &
|
||||
Field::GetRange(VTKM_DEFAULT_TYPE_LIST_TAG, VTKM_DEFAULT_STORAGE_LIST_TAG) const
|
||||
{
|
||||
return this->GetRangeImpl(VTKM_DEFAULT_TYPE_LIST_TAG(), VTKM_DEFAULT_STORAGE_LIST_TAG());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -22,27 +22,19 @@
|
||||
|
||||
#include <vtkm/cont/vtkm_cont_export.h>
|
||||
|
||||
#include <vtkm/Math.h>
|
||||
#include <vtkm/Range.h>
|
||||
#include <vtkm/Types.h>
|
||||
#include <vtkm/VecTraits.h>
|
||||
#include <vtkm/BinaryOperators.h>
|
||||
|
||||
#include <vtkm/cont/ArrayHandle.h>
|
||||
#include <vtkm/cont/ArrayHandleTransform.h>
|
||||
#include <vtkm/cont/ArrayHandleUniformPointCoordinates.h>
|
||||
#include <vtkm/cont/ArrayRangeCompute.h>
|
||||
#include <vtkm/cont/DeviceAdapterAlgorithm.h>
|
||||
#include <vtkm/cont/ArrayPortalToIterators.h>
|
||||
#include <vtkm/cont/DynamicArrayHandle.h>
|
||||
|
||||
#include <vtkm/cont/internal/ArrayPortalFromIterators.h>
|
||||
|
||||
namespace vtkm {
|
||||
namespace cont {
|
||||
|
||||
namespace internal {
|
||||
|
||||
template<typename DeviceAdapterTag>
|
||||
class ComputeRange
|
||||
{
|
||||
public:
|
||||
@ -320,30 +312,31 @@ public:
|
||||
return this->AssocLogicalDim;
|
||||
}
|
||||
|
||||
template<typename DeviceAdapterTag, typename TypeList, typename StorageList>
|
||||
template<typename TypeList, typename StorageList>
|
||||
VTKM_CONT
|
||||
const vtkm::cont::ArrayHandle<vtkm::Range>& GetRange(DeviceAdapterTag,
|
||||
TypeList,
|
||||
StorageList) const
|
||||
const vtkm::cont::ArrayHandle<vtkm::Range>&
|
||||
GetRange(TypeList, StorageList) const
|
||||
{
|
||||
if (this->ModifiedFlag)
|
||||
{
|
||||
internal::ComputeRange<DeviceAdapterTag> computeRange(this->Range);
|
||||
this->Data.ResetTypeAndStorageLists(TypeList(),StorageList()).CastAndCall(computeRange);
|
||||
this->ModifiedFlag = false;
|
||||
}
|
||||
VTKM_IS_LIST_TAG(TypeList);
|
||||
VTKM_IS_LIST_TAG(StorageList);
|
||||
|
||||
return this->Range;
|
||||
return this->GetRangeImpl(TypeList(), StorageList());
|
||||
}
|
||||
|
||||
template<typename DeviceAdapterTag, typename TypeList, typename StorageList>
|
||||
VTKM_CONT
|
||||
const vtkm::cont::ArrayHandle<vtkm::Range>&
|
||||
GetRange(VTKM_DEFAULT_TYPE_LIST_TAG, VTKM_DEFAULT_STORAGE_LIST_TAG) const;
|
||||
|
||||
template<typename TypeList, typename StorageList>
|
||||
VTKM_CONT
|
||||
void GetRange(vtkm::Range *range,
|
||||
DeviceAdapterTag,
|
||||
TypeList,
|
||||
StorageList) const
|
||||
{
|
||||
this->GetRange(DeviceAdapterTag(), TypeList(), StorageList());
|
||||
VTKM_IS_LIST_TAG(TypeList);
|
||||
VTKM_IS_LIST_TAG(StorageList);
|
||||
|
||||
this->GetRange(TypeList(), StorageList());
|
||||
|
||||
vtkm::Id length = this->Range.GetNumberOfValues();
|
||||
for (vtkm::Id i = 0; i < length; ++i)
|
||||
@ -352,44 +345,32 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
template<typename DeviceAdapterTag, typename TypeList>
|
||||
template<typename TypeList>
|
||||
VTKM_CONT
|
||||
const vtkm::cont::ArrayHandle<vtkm::Range>& GetRange(DeviceAdapterTag,
|
||||
TypeList) const
|
||||
const vtkm::cont::ArrayHandle<vtkm::Range>& GetRange(TypeList) const
|
||||
{
|
||||
return this->GetRange(DeviceAdapterTag(),
|
||||
TypeList(),
|
||||
VTKM_IS_LIST_TAG(TypeList);
|
||||
|
||||
return this->GetRange(TypeList(),
|
||||
VTKM_DEFAULT_STORAGE_LIST_TAG());
|
||||
}
|
||||
|
||||
template<typename DeviceAdapterTag, typename TypeList>
|
||||
template<typename TypeList>
|
||||
VTKM_CONT
|
||||
void GetRange(vtkm::Range *range, DeviceAdapterTag, TypeList) const
|
||||
void GetRange(vtkm::Range *range, TypeList) const
|
||||
{
|
||||
VTKM_IS_LIST_TAG(TypeList);
|
||||
|
||||
this->GetRange(range,
|
||||
DeviceAdapterTag(),
|
||||
TypeList(),
|
||||
VTKM_DEFAULT_STORAGE_LIST_TAG());
|
||||
}
|
||||
|
||||
template<typename DeviceAdapterTag>
|
||||
VTKM_CONT
|
||||
const vtkm::cont::ArrayHandle<vtkm::Range>& GetRange(DeviceAdapterTag) const
|
||||
{
|
||||
return this->GetRange(DeviceAdapterTag(),
|
||||
VTKM_DEFAULT_TYPE_LIST_TAG(),
|
||||
VTKM_DEFAULT_STORAGE_LIST_TAG());
|
||||
}
|
||||
const vtkm::cont::ArrayHandle<vtkm::Range>& GetRange() const;
|
||||
|
||||
template<typename DeviceAdapterTag>
|
||||
VTKM_CONT
|
||||
void GetRange(vtkm::Range *range, DeviceAdapterTag) const
|
||||
{
|
||||
this->GetRange(range,
|
||||
DeviceAdapterTag(),
|
||||
VTKM_DEFAULT_TYPE_LIST_TAG(),
|
||||
VTKM_DEFAULT_STORAGE_LIST_TAG());
|
||||
}
|
||||
void GetRange(vtkm::Range *range) const;
|
||||
|
||||
const vtkm::cont::DynamicArrayHandle &GetData() const;
|
||||
|
||||
@ -442,6 +423,24 @@ private:
|
||||
vtkm::cont::DynamicArrayHandle Data;
|
||||
mutable vtkm::cont::ArrayHandle<vtkm::Range> Range;
|
||||
mutable bool ModifiedFlag;
|
||||
|
||||
template<typename TypeList, typename StorageList>
|
||||
VTKM_CONT
|
||||
const vtkm::cont::ArrayHandle<vtkm::Range>&
|
||||
GetRangeImpl(TypeList, StorageList) const
|
||||
{
|
||||
VTKM_IS_LIST_TAG(TypeList);
|
||||
VTKM_IS_LIST_TAG(StorageList);
|
||||
|
||||
if (this->ModifiedFlag)
|
||||
{
|
||||
internal::ComputeRange computeRange(this->Range);
|
||||
this->Data.ResetTypeAndStorageLists(TypeList(),StorageList()).CastAndCall(computeRange);
|
||||
this->ModifiedFlag = false;
|
||||
}
|
||||
|
||||
return this->Range;
|
||||
}
|
||||
};
|
||||
|
||||
template<typename Functor>
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include <vtkm/Types.h>
|
||||
#include <vtkm/cont/CoordinateSystem.h>
|
||||
#include <vtkm/cont/Field.h>
|
||||
#include <vtkm/cont/RuntimeDeviceTracker.h>
|
||||
#include <vtkm/cont/testing/Testing.h>
|
||||
|
||||
// Required for implementation of ArrayRangeCompute for "odd" arrays
|
||||
@ -45,7 +46,7 @@ struct CustomTypeList : vtkm::ListTagBase<vtkm::Vec<Int32, 3>,
|
||||
vtkm::Vec<Float64, 9> >
|
||||
{};
|
||||
|
||||
template <typename DeviceAdapterTag>
|
||||
template<typename DeviceAdapterTag>
|
||||
class TestingComputeRange
|
||||
{
|
||||
private:
|
||||
@ -59,7 +60,7 @@ private:
|
||||
nvals);
|
||||
|
||||
vtkm::Range result;
|
||||
field.GetRange(&result, DeviceAdapterTag());
|
||||
field.GetRange(&result);
|
||||
|
||||
std::cout << result << std::endl;
|
||||
VTKM_TEST_ASSERT(
|
||||
@ -86,7 +87,6 @@ private:
|
||||
|
||||
vtkm::Range result[NumberOfComponents];
|
||||
field.GetRange(result,
|
||||
DeviceAdapterTag(),
|
||||
CustomTypeList(),
|
||||
VTKM_DEFAULT_STORAGE_LIST_TAG());
|
||||
|
||||
@ -106,7 +106,7 @@ private:
|
||||
vtkm::Vec<vtkm::FloatDefault,3>(0.0f,-5.0f,4.0f),
|
||||
vtkm::Vec<vtkm::FloatDefault,3>(1.0f,0.5f,2.0f));
|
||||
|
||||
vtkm::Bounds result = field.GetBounds(DeviceAdapterTag());
|
||||
vtkm::Bounds result = field.GetBounds();
|
||||
|
||||
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.");
|
||||
@ -155,6 +155,7 @@ private:
|
||||
public:
|
||||
static VTKM_CONT int Run()
|
||||
{
|
||||
vtkm::cont::GetGlobalRuntimeDeviceTracker().ForceDevice(DeviceAdapterTag());
|
||||
return vtkm::cont::testing::Testing::Run(TestAll());
|
||||
}
|
||||
};
|
||||
|
@ -31,7 +31,6 @@
|
||||
namespace DataSetBuilderExplicitNamespace {
|
||||
|
||||
typedef vtkm::cont::DeviceAdapterAlgorithm<VTKM_DEFAULT_DEVICE_ADAPTER_TAG> DFA;
|
||||
typedef VTKM_DEFAULT_DEVICE_ADAPTER_TAG DeviceAdapter;
|
||||
|
||||
template <typename T>
|
||||
vtkm::Bounds ComputeBounds(std::size_t numPoints, const T *coords)
|
||||
@ -83,8 +82,7 @@ void ValidateDataSet(const vtkm::cont::DataSet &ds,
|
||||
}
|
||||
|
||||
//Make sure bounds are correct.
|
||||
vtkm::Bounds computedBounds =
|
||||
ds.GetCoordinateSystem().GetBounds(DeviceAdapter());
|
||||
vtkm::Bounds computedBounds = ds.GetCoordinateSystem().GetBounds();
|
||||
VTKM_TEST_ASSERT(test_equal(bounds, computedBounds),
|
||||
"Bounds of coordinates do not match");
|
||||
}
|
||||
|
@ -22,7 +22,6 @@
|
||||
|
||||
#include <vtkm/cont/CellSetStructured.h>
|
||||
#include <vtkm/cont/DataSetBuilderRectilinear.h>
|
||||
#include <vtkm/cont/DeviceAdapterAlgorithm.h>
|
||||
#include <vtkm/cont/DynamicCellSet.h>
|
||||
#include <vtkm/cont/testing/MakeTestDataSet.h>
|
||||
#include <vtkm/cont/testing/Testing.h>
|
||||
@ -35,9 +34,6 @@ namespace DataSetBuilderRectilinearNamespace {
|
||||
|
||||
std::mt19937 g_RandomGenerator;
|
||||
|
||||
typedef vtkm::cont::DeviceAdapterAlgorithm<VTKM_DEFAULT_DEVICE_ADAPTER_TAG> DFA;
|
||||
typedef VTKM_DEFAULT_DEVICE_ADAPTER_TAG DeviceAdapter;
|
||||
|
||||
void ValidateDataSet(const vtkm::cont::DataSet &ds,
|
||||
int dim,
|
||||
vtkm::Id numPoints, vtkm::Id numCells,
|
||||
@ -75,7 +71,7 @@ void ValidateDataSet(const vtkm::cont::DataSet &ds,
|
||||
}
|
||||
|
||||
//Make sure the bounds are correct.
|
||||
vtkm::Bounds res = ds.GetCoordinateSystem().GetBounds(DeviceAdapter());
|
||||
vtkm::Bounds res = ds.GetCoordinateSystem().GetBounds();
|
||||
VTKM_TEST_ASSERT(test_equal(bounds, res),
|
||||
"Bounds of coordinates do not match");
|
||||
if (dim == 2)
|
||||
|
@ -22,7 +22,6 @@
|
||||
|
||||
#include <vtkm/cont/CellSetStructured.h>
|
||||
#include <vtkm/cont/DataSetBuilderUniform.h>
|
||||
#include <vtkm/cont/DeviceAdapterAlgorithm.h>
|
||||
#include <vtkm/cont/DynamicCellSet.h>
|
||||
#include <vtkm/cont/testing/MakeTestDataSet.h>
|
||||
#include <vtkm/cont/testing/Testing.h>
|
||||
@ -35,9 +34,6 @@ namespace DataSetBuilderUniformNamespace {
|
||||
|
||||
std::mt19937 g_RandomGenerator;
|
||||
|
||||
typedef vtkm::cont::DeviceAdapterAlgorithm<VTKM_DEFAULT_DEVICE_ADAPTER_TAG> DFA;
|
||||
typedef VTKM_DEFAULT_DEVICE_ADAPTER_TAG DeviceAdapter;
|
||||
|
||||
void ValidateDataSet(const vtkm::cont::DataSet &ds,
|
||||
int dim,
|
||||
vtkm::Id numPoints, vtkm::Id numCells,
|
||||
@ -75,7 +71,7 @@ void ValidateDataSet(const vtkm::cont::DataSet &ds,
|
||||
}
|
||||
|
||||
//Make sure bounds are correct.
|
||||
vtkm::Bounds res = ds.GetCoordinateSystem().GetBounds(DeviceAdapter());
|
||||
vtkm::Bounds res = ds.GetCoordinateSystem().GetBounds();
|
||||
VTKM_TEST_ASSERT(test_equal(bounds, res),
|
||||
"Bounds of coordinates do not match");
|
||||
if (dim == 1)
|
||||
|
@ -21,21 +21,6 @@
|
||||
namespace vtkm {
|
||||
namespace filter {
|
||||
|
||||
namespace
|
||||
{
|
||||
template<typename DerivedPolicy,
|
||||
typename DeviceAdapter>
|
||||
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;
|
||||
return coords.GetBounds(tag, TypeList(), StorageList());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
inline VTKM_CONT
|
||||
VertexClustering::VertexClustering():
|
||||
@ -59,7 +44,9 @@ vtkm::filter::ResultDataSet VertexClustering::DoExecute(const vtkm::cont::DataSe
|
||||
|
||||
//need to compute bounds first
|
||||
vtkm::Bounds bounds =
|
||||
compute_bounds(input.GetCoordinateSystem(), policy, tag);
|
||||
input.GetCoordinateSystem().GetBounds(
|
||||
typename DerivedPolicy::CoordinateTypeList(),
|
||||
typename DerivedPolicy::CoordinateStorageList());
|
||||
|
||||
vtkm::cont::DataSet outDataSet = clustering.Run(vtkm::filter::ApplyPolicyUnstructured(input.GetCellSet(), policy),
|
||||
vtkm::filter::ApplyPolicy(input.GetCoordinateSystem(), policy),
|
||||
|
@ -48,34 +48,6 @@ struct Actor::InternalsType
|
||||
{ }
|
||||
};
|
||||
|
||||
struct Actor::RangeFunctor
|
||||
{
|
||||
vtkm::rendering::Actor::InternalsType *Internals;
|
||||
const vtkm::cont::CoordinateSystem &Coordinates;
|
||||
const vtkm::cont::Field &ScalarField;
|
||||
|
||||
VTKM_CONT
|
||||
RangeFunctor(vtkm::rendering::Actor *self,
|
||||
const vtkm::cont::CoordinateSystem &coordinates,
|
||||
const vtkm::cont::Field &scalarField)
|
||||
: Internals(self->Internals.get()),
|
||||
Coordinates(coordinates),
|
||||
ScalarField(scalarField)
|
||||
{ }
|
||||
|
||||
template<typename Device>
|
||||
VTKM_CONT
|
||||
bool operator()(Device)
|
||||
{
|
||||
VTKM_IS_DEVICE_ADAPTER_TAG(Device);
|
||||
|
||||
this->ScalarField.GetRange(&this->Internals->ScalarRange, Device());
|
||||
this->Internals->SpatialBounds = this->Coordinates.GetBounds(Device());
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
Actor::Actor(const vtkm::cont::DynamicCellSet &cells,
|
||||
const vtkm::cont::CoordinateSystem &coordinates,
|
||||
const vtkm::cont::Field &scalarField,
|
||||
@ -84,8 +56,8 @@ Actor::Actor(const vtkm::cont::DynamicCellSet &cells,
|
||||
{
|
||||
VTKM_ASSERT(scalarField.GetData().GetNumberOfComponents() == 1);
|
||||
|
||||
RangeFunctor functor(this, coordinates, scalarField);
|
||||
vtkm::cont::TryExecute(functor);
|
||||
scalarField.GetRange(&this->Internals->ScalarRange);
|
||||
this->Internals->SpatialBounds = coordinates.GetBounds();
|
||||
}
|
||||
|
||||
void Actor::Render(vtkm::rendering::Mapper &mapper,
|
||||
|
@ -142,7 +142,7 @@ struct MapperRayTracer::RenderFunctor
|
||||
tracer->GetCamera().SetParameters(this->Camera,
|
||||
*this->Self->Internals->Canvas);
|
||||
|
||||
vtkm::Bounds dataBounds = this->Coordinates.GetBounds(Device());
|
||||
vtkm::Bounds dataBounds = this->Coordinates.GetBounds();
|
||||
|
||||
tracer->SetData(this->Coordinates.GetData(),
|
||||
this->TriangleIndices,
|
||||
|
@ -159,7 +159,7 @@ struct MapperVolume::RenderFunctor
|
||||
}
|
||||
|
||||
tracer->SetCompositeBackground(this->Self->Internals->CompositeBackground);
|
||||
vtkm::Bounds dataBounds = this->Coordinates.GetBounds(Device());
|
||||
vtkm::Bounds dataBounds = this->Coordinates.GetBounds();
|
||||
|
||||
tracer->SetData(this->Coordinates,
|
||||
this->ScalarField,
|
||||
|
@ -76,7 +76,7 @@ SetCamera<vtkm::rendering::View1D>(vtkm::rendering::Camera &camera,
|
||||
{
|
||||
vtkm::Bounds bounds;
|
||||
bounds.X = coordBounds.X;
|
||||
field.GetRange(&bounds.Y, VTKM_DEFAULT_DEVICE_ADAPTER_TAG());
|
||||
field.GetRange(&bounds.Y);
|
||||
|
||||
camera = vtkm::rendering::Camera(vtkm::rendering::Camera::MODE_2D);
|
||||
camera.ResetToBounds(bounds);
|
||||
@ -111,7 +111,7 @@ Render(const vtkm::cont::DataSet &ds,
|
||||
colorTable));
|
||||
vtkm::rendering::Camera camera;
|
||||
SetCamera<ViewType>(camera,
|
||||
ds.GetCoordinateSystem().GetBounds(VTKM_DEFAULT_DEVICE_ADAPTER_TAG()));
|
||||
ds.GetCoordinateSystem().GetBounds());
|
||||
ViewType view(scene, mapper, canvas, camera,
|
||||
vtkm::rendering::Color(0.2f, 0.2f, 0.2f, 1.0f));
|
||||
|
||||
@ -134,7 +134,7 @@ Render(const vtkm::cont::DataSet &ds,
|
||||
ds.GetField(fieldNm)));
|
||||
vtkm::rendering::Camera camera;
|
||||
SetCamera<ViewType>(camera,
|
||||
ds.GetCoordinateSystem().GetBounds(VTKM_DEFAULT_DEVICE_ADAPTER_TAG()),
|
||||
ds.GetCoordinateSystem().GetBounds(),
|
||||
ds.GetField(fieldNm));
|
||||
ViewType view(scene, mapper, canvas, camera,
|
||||
vtkm::rendering::Color(0.2f, 0.2f, 0.2f, 1.0f));
|
||||
|
@ -90,7 +90,7 @@ void RenderTests()
|
||||
ds[i].GetField(fldNames[i].c_str()),
|
||||
colorTable));
|
||||
vtkm::rendering::testing::SetCamera<View3DType>(camera[i],
|
||||
ds[i].GetCoordinateSystem().GetBounds(VTKM_DEFAULT_DEVICE_ADAPTER_TAG()));
|
||||
ds[i].GetCoordinateSystem().GetBounds());
|
||||
|
||||
}
|
||||
|
||||
|
@ -194,7 +194,7 @@ void TestExplicitGrid2D()
|
||||
std::cout << "Number of output vertices " << coordArray.GetNumberOfValues() << std::endl;
|
||||
std::cout << "Number of output components " << coordArray.GetNumberOfComponents() << std::endl;
|
||||
|
||||
vtkm::Bounds bounds = coordinates.GetBounds(DeviceAdapter());
|
||||
vtkm::Bounds bounds = coordinates.GetBounds();
|
||||
std::cout << "Bounds " << bounds << std::endl;
|
||||
|
||||
VTKM_TEST_ASSERT(test_equal(cellSet.GetNumberOfCells(), 14), "Wrong result for Triangulate filter");
|
||||
@ -232,7 +232,7 @@ void TestExplicitGrid3D()
|
||||
std::cout << "Number of output vertices " << coordArray.GetNumberOfValues() << std::endl;
|
||||
std::cout << "Number of output components " << coordArray.GetNumberOfComponents() << std::endl;
|
||||
|
||||
vtkm::Bounds bounds = coordinates.GetBounds(DeviceAdapter());
|
||||
vtkm::Bounds bounds = coordinates.GetBounds();
|
||||
std::cout << "Bounds " << bounds << std::endl;
|
||||
|
||||
VTKM_TEST_ASSERT(test_equal(cellSet.GetNumberOfCells(), 11), "Wrong result for Tetrahedralize filter");
|
||||
|
@ -121,7 +121,7 @@ void TestUniformGrid2D()
|
||||
std::cout << "Number of output vertices " << coordArray.GetNumberOfValues() << std::endl;
|
||||
std::cout << "Number of output components " << coordArray.GetNumberOfComponents() << std::endl;
|
||||
|
||||
vtkm::Bounds bounds = coordinates.GetBounds(DeviceAdapter());
|
||||
vtkm::Bounds bounds = coordinates.GetBounds();
|
||||
std::cout << "Bounds " << bounds << std::endl;
|
||||
|
||||
// Two triangles are created for every quad cell
|
||||
@ -169,7 +169,7 @@ void TestUniformGrid3D()
|
||||
std::cout << "Number of output vertices " << coordArray.GetNumberOfValues() << std::endl;
|
||||
std::cout << "Number of output components " << coordArray.GetNumberOfComponents() << std::endl;
|
||||
|
||||
vtkm::Bounds bounds = coordinates.GetBounds(DeviceAdapter());
|
||||
vtkm::Bounds bounds = coordinates.GetBounds();
|
||||
std::cout << "Bounds " << bounds << std::endl;
|
||||
|
||||
// Five tets are created for every hex cell
|
||||
|
@ -36,8 +36,7 @@ void TestVertexClustering()
|
||||
vtkm::cont::DataSet dataSet = maker.Make3DExplicitDataSetCowNose();
|
||||
|
||||
//compute the bounds before calling the algorithm
|
||||
vtkm::Bounds bounds =
|
||||
dataSet.GetCoordinateSystem().GetBounds(VTKM_DEFAULT_DEVICE_ADAPTER_TAG());
|
||||
vtkm::Bounds bounds = dataSet.GetCoordinateSystem().GetBounds();
|
||||
|
||||
// run
|
||||
vtkm::worklet::VertexClustering clustering;
|
||||
|
Loading…
Reference in New Issue
Block a user