mirror of
https://gitlab.kitware.com/vtk/vtk-m
synced 2024-09-16 17:22:55 +00:00
Merge branch 'master' of https://gitlab.kitware.com/vtk/vtk-m into add_get_block_to_boundsmap
This commit is contained in:
commit
b9a684fda1
@ -1,9 +1,9 @@
|
|||||||
# Ad-hoc build that runs in the ECP Hardware, concretely in OLCF Spock.
|
# Ad-hoc build that runs in the ECP Hardware, concretely in OLCF Spock.
|
||||||
.crusher_gcc_hip:
|
.crusher_gcc_hip:
|
||||||
variables:
|
variables:
|
||||||
CCACHE_BASEDIR: "/gpfs/alpine/csc331/scratch/"
|
CCACHE_BASEDIR: "/lustre/orion/csc331/scratch/"
|
||||||
CCACHE_DIR: "/gpfs/alpine/csc331/scratch/vbolea/ci/vtk-m/ccache"
|
CCACHE_DIR: "/lustre/orion/csc331/scratch/vbolea/ci/vtk-m/ccache"
|
||||||
CUSTOM_CI_BUILDS_DIR: "/gpfs/alpine/csc331/scratch/vbolea/ci/vtk-m/runtime"
|
CUSTOM_CI_BUILDS_DIR: "/lustre/orion/csc331/scratch/vbolea/ci/vtk-m/runtime"
|
||||||
|
|
||||||
# -isystem= is not affected by CCACHE_BASEDIR, thus we must ignore it
|
# -isystem= is not affected by CCACHE_BASEDIR, thus we must ignore it
|
||||||
CCACHE_IGNOREOPTIONS: "-isystem=*"
|
CCACHE_IGNOREOPTIONS: "-isystem=*"
|
||||||
@ -14,6 +14,9 @@
|
|||||||
CMAKE_GENERATOR: "Ninja"
|
CMAKE_GENERATOR: "Ninja"
|
||||||
CMAKE_PREFIX_PATH: "$CI_BUILDS_DIR/kokkos_install"
|
CMAKE_PREFIX_PATH: "$CI_BUILDS_DIR/kokkos_install"
|
||||||
|
|
||||||
|
# We do not want to use the user's ~/.gitconfig
|
||||||
|
GIT_CONFIG_GLOBAL: "true"
|
||||||
|
|
||||||
KOKKOS_OPTS: >-
|
KOKKOS_OPTS: >-
|
||||||
-DCMAKE_INSTALL_PREFIX:PATH=$CI_BUILDS_DIR/kokkos_install
|
-DCMAKE_INSTALL_PREFIX:PATH=$CI_BUILDS_DIR/kokkos_install
|
||||||
-DCMAKE_CXX_COMPILER:FILEPATH=/opt/rocm-4.5.0/hip/bin/hipcc
|
-DCMAKE_CXX_COMPILER:FILEPATH=/opt/rocm-4.5.0/hip/bin/hipcc
|
||||||
@ -21,7 +24,6 @@
|
|||||||
|
|
||||||
# DefApps/default;craype;rocm;gcc should be loaded first
|
# DefApps/default;craype;rocm;gcc should be loaded first
|
||||||
JOB_MODULES: >-
|
JOB_MODULES: >-
|
||||||
DefApps/default
|
|
||||||
craype-accel-amd-gfx90a
|
craype-accel-amd-gfx90a
|
||||||
rocm/4.5.0
|
rocm/4.5.0
|
||||||
gcc/12
|
gcc/12
|
||||||
|
@ -25,6 +25,7 @@ test:macos_xcode13:
|
|||||||
CC: gcc
|
CC: gcc
|
||||||
CXX: g++
|
CXX: g++
|
||||||
DEVELOPER_DIR: "/Applications/Xcode-13.3.app/Contents/Developer"
|
DEVELOPER_DIR: "/Applications/Xcode-13.3.app/Contents/Developer"
|
||||||
|
GIT_CLONE_PATH: "$CI_BUILDS_DIR/vtk-m-ci"
|
||||||
VTKM_SETTINGS: "64bit_floats+shared+ccache"
|
VTKM_SETTINGS: "64bit_floats+shared+ccache"
|
||||||
|
|
||||||
.cmake_build_macos:
|
.cmake_build_macos:
|
||||||
|
3
docs/changelog/tetrahedralize-triangulate-check.md
Normal file
3
docs/changelog/tetrahedralize-triangulate-check.md
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
# Tetrahedralize and Triangulate filters now check if the input is already tetrahedral/triangular
|
||||||
|
|
||||||
|
Previously, tetrahedralize/triangulate would blindly convert all the cells to tetrahedra/triangles, even when they were already. Now, the dataset is directly returned if the CellSet is a CellSetSingleType of tetras/triangles, and no further processing is done in the worklets for CellSetExplicit when all shapes are tetras or triangles.
|
@ -200,7 +200,10 @@ struct GetTypeInParentheses<void(T)>
|
|||||||
} \
|
} \
|
||||||
\
|
\
|
||||||
using ValueType = typename__ Superclass::ValueType; \
|
using ValueType = typename__ Superclass::ValueType; \
|
||||||
using StorageTag = typename__ Superclass::StorageTag
|
using StorageTag = typename__ Superclass::StorageTag; \
|
||||||
|
using StorageType = typename__ Superclass::StorageType; \
|
||||||
|
using ReadPortalType = typename__ Superclass::ReadPortalType; \
|
||||||
|
using WritePortalType = typename__ Superclass::WritePortalType
|
||||||
|
|
||||||
/// \brief Macro to make default methods in ArrayHandle subclasses.
|
/// \brief Macro to make default methods in ArrayHandle subclasses.
|
||||||
///
|
///
|
||||||
|
@ -344,10 +344,6 @@ public:
|
|||||||
SecondHandleType,
|
SecondHandleType,
|
||||||
ThirdHandleType>::Superclass));
|
ThirdHandleType>::Superclass));
|
||||||
|
|
||||||
private:
|
|
||||||
using StorageType = vtkm::cont::internal::Storage<ValueType, StorageTag>;
|
|
||||||
|
|
||||||
public:
|
|
||||||
VTKM_CONT
|
VTKM_CONT
|
||||||
ArrayHandleCartesianProduct(const FirstHandleType& firstArray,
|
ArrayHandleCartesianProduct(const FirstHandleType& firstArray,
|
||||||
const SecondHandleType& secondArray,
|
const SecondHandleType& secondArray,
|
||||||
|
@ -188,7 +188,6 @@ struct CompositeVectorTraits
|
|||||||
|
|
||||||
using ValueType = typename vtkm::internal::compvec::GetValueType<ArrayTs...>::ValueType;
|
using ValueType = typename vtkm::internal::compvec::GetValueType<ArrayTs...>::ValueType;
|
||||||
using StorageTag = vtkm::cont::StorageTagCompositeVec<typename ArrayTs::StorageTag...>;
|
using StorageTag = vtkm::cont::StorageTagCompositeVec<typename ArrayTs::StorageTag...>;
|
||||||
using StorageType = Storage<ValueType, StorageTag>;
|
|
||||||
using Superclass = ArrayHandle<ValueType, StorageTag>;
|
using Superclass = ArrayHandle<ValueType, StorageTag>;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -400,14 +399,10 @@ class ArrayHandleCompositeVector
|
|||||||
: public ArrayHandle<typename internal::CompositeVectorTraits<ArrayTs...>::ValueType,
|
: public ArrayHandle<typename internal::CompositeVectorTraits<ArrayTs...>::ValueType,
|
||||||
typename internal::CompositeVectorTraits<ArrayTs...>::StorageTag>
|
typename internal::CompositeVectorTraits<ArrayTs...>::StorageTag>
|
||||||
{
|
{
|
||||||
private:
|
|
||||||
using Traits = internal::CompositeVectorTraits<ArrayTs...>;
|
|
||||||
using StorageType = typename Traits::StorageType;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
VTKM_ARRAY_HANDLE_SUBCLASS(ArrayHandleCompositeVector,
|
VTKM_ARRAY_HANDLE_SUBCLASS(ArrayHandleCompositeVector,
|
||||||
(ArrayHandleCompositeVector<ArrayTs...>),
|
(ArrayHandleCompositeVector<ArrayTs...>),
|
||||||
(typename Traits::Superclass));
|
(typename internal::CompositeVectorTraits<ArrayTs...>::Superclass));
|
||||||
|
|
||||||
VTKM_CONT
|
VTKM_CONT
|
||||||
ArrayHandleCompositeVector(const ArrayTs&... arrays)
|
ArrayHandleCompositeVector(const ArrayTs&... arrays)
|
||||||
|
@ -251,10 +251,6 @@ public:
|
|||||||
StorageTagConcatenate<typename ArrayHandleType1::StorageTag,
|
StorageTagConcatenate<typename ArrayHandleType1::StorageTag,
|
||||||
typename ArrayHandleType2::StorageTag>>));
|
typename ArrayHandleType2::StorageTag>>));
|
||||||
|
|
||||||
protected:
|
|
||||||
using StorageType = vtkm::cont::internal::Storage<ValueType, StorageTag>;
|
|
||||||
|
|
||||||
public:
|
|
||||||
VTKM_CONT
|
VTKM_CONT
|
||||||
ArrayHandleConcatenate(const ArrayHandleType1& array1, const ArrayHandleType2& array2)
|
ArrayHandleConcatenate(const ArrayHandleType1& array1, const ArrayHandleType2& array2)
|
||||||
: Superclass(StorageType::CreateBuffers(array1, array2))
|
: Superclass(StorageType::CreateBuffers(array1, array2))
|
||||||
|
@ -565,7 +565,6 @@ struct DecoratorHandleTraits
|
|||||||
using StorageTraits = decor::DecoratorStorageTraits<DecoratorImplT, ArrayTs...>;
|
using StorageTraits = decor::DecoratorStorageTraits<DecoratorImplT, ArrayTs...>;
|
||||||
using ValueType = typename StorageTraits::ValueType;
|
using ValueType = typename StorageTraits::ValueType;
|
||||||
using StorageTag = StorageTagDecorator<DecoratorImplT, ArrayTs...>;
|
using StorageTag = StorageTagDecorator<DecoratorImplT, ArrayTs...>;
|
||||||
using StorageType = vtkm::cont::internal::Storage<ValueType, StorageTag>;
|
|
||||||
using Superclass = vtkm::cont::ArrayHandle<ValueType, StorageTag>;
|
using Superclass = vtkm::cont::ArrayHandle<ValueType, StorageTag>;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -651,7 +650,6 @@ class ArrayHandleDecorator
|
|||||||
private:
|
private:
|
||||||
using Traits = internal::DecoratorHandleTraits<typename std::decay<DecoratorImplT>::type,
|
using Traits = internal::DecoratorHandleTraits<typename std::decay<DecoratorImplT>::type,
|
||||||
typename std::decay<ArrayTs>::type...>;
|
typename std::decay<ArrayTs>::type...>;
|
||||||
using StorageType = typename Traits::StorageType;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
VTKM_ARRAY_HANDLE_SUBCLASS(ArrayHandleDecorator,
|
VTKM_ARRAY_HANDLE_SUBCLASS(ArrayHandleDecorator,
|
||||||
|
@ -94,8 +94,7 @@ class Storage<typename vtkm::VecTraits<typename ArrayHandleType::ValueType>::Com
|
|||||||
{
|
{
|
||||||
using SourceValueType = typename ArrayHandleType::ValueType;
|
using SourceValueType = typename ArrayHandleType::ValueType;
|
||||||
using ValueType = typename vtkm::VecTraits<SourceValueType>::ComponentType;
|
using ValueType = typename vtkm::VecTraits<SourceValueType>::ComponentType;
|
||||||
using SourceStorageTag = typename ArrayHandleType::StorageTag;
|
using SourceStorage = typename ArrayHandleType::StorageType;
|
||||||
using SourceStorage = vtkm::cont::internal::Storage<SourceValueType, SourceStorageTag>;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
VTKM_CONT static vtkm::IdComponent ComponentIndex(
|
VTKM_CONT static vtkm::IdComponent ComponentIndex(
|
||||||
@ -198,10 +197,6 @@ public:
|
|||||||
typename vtkm::VecTraits<typename ArrayHandleType::ValueType>::ComponentType,
|
typename vtkm::VecTraits<typename ArrayHandleType::ValueType>::ComponentType,
|
||||||
StorageTagExtractComponent<ArrayHandleType>>));
|
StorageTagExtractComponent<ArrayHandleType>>));
|
||||||
|
|
||||||
protected:
|
|
||||||
using StorageType = vtkm::cont::internal::Storage<ValueType, StorageTag>;
|
|
||||||
|
|
||||||
public:
|
|
||||||
VTKM_CONT
|
VTKM_CONT
|
||||||
ArrayHandleExtractComponent(const ArrayHandleType& array, vtkm::IdComponent component)
|
ArrayHandleExtractComponent(const ArrayHandleType& array, vtkm::IdComponent component)
|
||||||
: Superclass(StorageType::CreateBuffers(component, array))
|
: Superclass(StorageType::CreateBuffers(component, array))
|
||||||
|
@ -285,10 +285,6 @@ public:
|
|||||||
|
|
||||||
using ComponentType = typename ComponentsArrayHandleType::ValueType;
|
using ComponentType = typename ComponentsArrayHandleType::ValueType;
|
||||||
|
|
||||||
private:
|
|
||||||
using StorageType = vtkm::cont::internal::Storage<ValueType, StorageTag>;
|
|
||||||
|
|
||||||
public:
|
|
||||||
VTKM_CONT
|
VTKM_CONT
|
||||||
ArrayHandleGroupVecVariable(const ComponentsArrayHandleType& componentsArray,
|
ArrayHandleGroupVecVariable(const ComponentsArrayHandleType& componentsArray,
|
||||||
const OffsetsArrayHandleType& offsetsArray)
|
const OffsetsArrayHandleType& offsetsArray)
|
||||||
|
@ -158,7 +158,6 @@ struct ArrayHandleImplicitTraits
|
|||||||
using PortalType = vtkm::internal::ArrayPortalImplicit<FunctorType>;
|
using PortalType = vtkm::internal::ArrayPortalImplicit<FunctorType>;
|
||||||
using StorageTag = vtkm::cont::StorageTagImplicit<PortalType>;
|
using StorageTag = vtkm::cont::StorageTagImplicit<PortalType>;
|
||||||
using Superclass = vtkm::cont::ArrayHandle<ValueType, StorageTag>;
|
using Superclass = vtkm::cont::ArrayHandle<ValueType, StorageTag>;
|
||||||
using StorageType = vtkm::cont::internal::Storage<ValueType, StorageTag>;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace detail
|
} // namespace detail
|
||||||
|
@ -408,10 +408,6 @@ public:
|
|||||||
(ArrayHandleMultiplexer<ArrayHandleTypes...>),
|
(ArrayHandleMultiplexer<ArrayHandleTypes...>),
|
||||||
(vtkm::cont::ArrayHandle<typename Traits::ValueType, typename Traits::StorageTag>));
|
(vtkm::cont::ArrayHandle<typename Traits::ValueType, typename Traits::StorageTag>));
|
||||||
|
|
||||||
private:
|
|
||||||
using StorageType = vtkm::cont::internal::Storage<ValueType, StorageTag>;
|
|
||||||
|
|
||||||
public:
|
|
||||||
template <typename RealStorageTag>
|
template <typename RealStorageTag>
|
||||||
VTKM_CONT ArrayHandleMultiplexer(const vtkm::cont::ArrayHandle<ValueType, RealStorageTag>& src)
|
VTKM_CONT ArrayHandleMultiplexer(const vtkm::cont::ArrayHandle<ValueType, RealStorageTag>& src)
|
||||||
: Superclass(StorageType::CreateBuffers(src))
|
: Superclass(StorageType::CreateBuffers(src))
|
||||||
|
@ -248,10 +248,6 @@ public:
|
|||||||
vtkm::cont::StorageTagPermutation<typename IndexArrayHandleType::StorageTag,
|
vtkm::cont::StorageTagPermutation<typename IndexArrayHandleType::StorageTag,
|
||||||
typename ValueArrayHandleType::StorageTag>>));
|
typename ValueArrayHandleType::StorageTag>>));
|
||||||
|
|
||||||
private:
|
|
||||||
using StorageType = vtkm::cont::internal::Storage<ValueType, StorageTag>;
|
|
||||||
|
|
||||||
public:
|
|
||||||
VTKM_CONT
|
VTKM_CONT
|
||||||
ArrayHandlePermutation(const IndexArrayHandleType& indexArray,
|
ArrayHandlePermutation(const IndexArrayHandleType& indexArray,
|
||||||
const ValueArrayHandleType& valueArray)
|
const ValueArrayHandleType& valueArray)
|
||||||
|
@ -604,10 +604,6 @@ public:
|
|||||||
(vtkm::cont::ArrayHandle<internal::detail::RecombinedValueType<ComponentType>,
|
(vtkm::cont::ArrayHandle<internal::detail::RecombinedValueType<ComponentType>,
|
||||||
vtkm::cont::internal::StorageTagRecombineVec>));
|
vtkm::cont::internal::StorageTagRecombineVec>));
|
||||||
|
|
||||||
private:
|
|
||||||
using StorageType = vtkm::cont::internal::Storage<ValueType, StorageTag>;
|
|
||||||
|
|
||||||
public:
|
|
||||||
vtkm::IdComponent GetNumberOfComponents() const
|
vtkm::IdComponent GetNumberOfComponents() const
|
||||||
{
|
{
|
||||||
return StorageType::GetNumberOfComponents(this->GetBuffers());
|
return StorageType::GetNumberOfComponents(this->GetBuffers());
|
||||||
|
@ -156,7 +156,6 @@ public:
|
|||||||
(vtkm::cont::ArrayHandle<typename ArrayHandleType::ValueType,
|
(vtkm::cont::ArrayHandle<typename ArrayHandleType::ValueType,
|
||||||
StorageTagReverse<typename ArrayHandleType::StorageTag>>));
|
StorageTagReverse<typename ArrayHandleType::StorageTag>>));
|
||||||
|
|
||||||
public:
|
|
||||||
ArrayHandleReverse(const ArrayHandleType& handle)
|
ArrayHandleReverse(const ArrayHandleType& handle)
|
||||||
: Superclass(handle.GetBuffers())
|
: Superclass(handle.GetBuffers())
|
||||||
{
|
{
|
||||||
|
@ -327,7 +327,6 @@ public:
|
|||||||
vtkm::cont::StorageTagRuntimeVec>));
|
vtkm::cont::StorageTagRuntimeVec>));
|
||||||
|
|
||||||
private:
|
private:
|
||||||
using StorageType = vtkm::cont::internal::Storage<ValueType, StorageTag>;
|
|
||||||
using ComponentsArrayType = vtkm::cont::ArrayHandle<ComponentType, StorageTagBasic>;
|
using ComponentsArrayType = vtkm::cont::ArrayHandle<ComponentType, StorageTagBasic>;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -246,8 +246,6 @@ class ArrayHandleSOA : public ArrayHandle<T, vtkm::cont::StorageTagSOA>
|
|||||||
using ComponentType = typename vtkm::VecTraits<T>::ComponentType;
|
using ComponentType = typename vtkm::VecTraits<T>::ComponentType;
|
||||||
static constexpr vtkm::IdComponent NUM_COMPONENTS = vtkm::VecTraits<T>::NUM_COMPONENTS;
|
static constexpr vtkm::IdComponent NUM_COMPONENTS = vtkm::VecTraits<T>::NUM_COMPONENTS;
|
||||||
|
|
||||||
using StorageType = vtkm::cont::internal::Storage<T, vtkm::cont::StorageTagSOA>;
|
|
||||||
|
|
||||||
using ComponentArrayType = vtkm::cont::ArrayHandle<ComponentType, vtkm::cont::StorageTagBasic>;
|
using ComponentArrayType = vtkm::cont::ArrayHandle<ComponentType, vtkm::cont::StorageTagBasic>;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -333,10 +333,6 @@ public:
|
|||||||
(ArrayHandleStride<T>),
|
(ArrayHandleStride<T>),
|
||||||
(ArrayHandle<T, vtkm::cont::StorageTagStride>));
|
(ArrayHandle<T, vtkm::cont::StorageTagStride>));
|
||||||
|
|
||||||
private:
|
|
||||||
using StorageType = vtkm::cont::internal::Storage<ValueType, StorageTag>;
|
|
||||||
|
|
||||||
public:
|
|
||||||
ArrayHandleStride(vtkm::Id stride, vtkm::Id offset, vtkm::Id modulo = 0, vtkm::Id divisor = 1)
|
ArrayHandleStride(vtkm::Id stride, vtkm::Id offset, vtkm::Id modulo = 0, vtkm::Id divisor = 1)
|
||||||
: Superclass(StorageType::CreateBuffers(
|
: Superclass(StorageType::CreateBuffers(
|
||||||
vtkm::cont::internal::Buffer{},
|
vtkm::cont::internal::Buffer{},
|
||||||
|
@ -246,8 +246,7 @@ class Storage<typename StorageTagTransform<ArrayHandleType, FunctorType>::ValueT
|
|||||||
using FunctorManager = TransformFunctorManager<FunctorType>;
|
using FunctorManager = TransformFunctorManager<FunctorType>;
|
||||||
using ValueType = typename StorageTagTransform<ArrayHandleType, FunctorType>::ValueType;
|
using ValueType = typename StorageTagTransform<ArrayHandleType, FunctorType>::ValueType;
|
||||||
|
|
||||||
using SourceStorage =
|
using SourceStorage = typename ArrayHandleType::StorageType;
|
||||||
Storage<typename ArrayHandleType::ValueType, typename ArrayHandleType::StorageTag>;
|
|
||||||
|
|
||||||
static std::vector<vtkm::cont::internal::Buffer> SourceBuffers(
|
static std::vector<vtkm::cont::internal::Buffer> SourceBuffers(
|
||||||
const std::vector<vtkm::cont::internal::Buffer>& buffers)
|
const std::vector<vtkm::cont::internal::Buffer>& buffers)
|
||||||
@ -323,8 +322,7 @@ class Storage<
|
|||||||
using InverseFunctorManager = TransformFunctorManager<InverseFunctorType>;
|
using InverseFunctorManager = TransformFunctorManager<InverseFunctorType>;
|
||||||
using ValueType = typename StorageTagTransform<ArrayHandleType, FunctorType>::ValueType;
|
using ValueType = typename StorageTagTransform<ArrayHandleType, FunctorType>::ValueType;
|
||||||
|
|
||||||
using SourceStorage =
|
using SourceStorage = typename ArrayHandleType::StorageType;
|
||||||
Storage<typename ArrayHandleType::ValueType, typename ArrayHandleType::StorageTag>;
|
|
||||||
|
|
||||||
static std::vector<vtkm::cont::internal::Buffer> SourceBuffers(
|
static std::vector<vtkm::cont::internal::Buffer> SourceBuffers(
|
||||||
const std::vector<vtkm::cont::internal::Buffer>& buffers)
|
const std::vector<vtkm::cont::internal::Buffer>& buffers)
|
||||||
@ -454,10 +452,6 @@ public:
|
|||||||
typename internal::StorageTagTransform<ArrayHandleType, FunctorType>::ValueType,
|
typename internal::StorageTagTransform<ArrayHandleType, FunctorType>::ValueType,
|
||||||
internal::StorageTagTransform<ArrayHandleType, FunctorType>>));
|
internal::StorageTagTransform<ArrayHandleType, FunctorType>>));
|
||||||
|
|
||||||
private:
|
|
||||||
using StorageType = vtkm::cont::internal::Storage<ValueType, StorageTag>;
|
|
||||||
|
|
||||||
public:
|
|
||||||
VTKM_CONT
|
VTKM_CONT
|
||||||
ArrayHandleTransform(const ArrayHandleType& handle,
|
ArrayHandleTransform(const ArrayHandleType& handle,
|
||||||
const FunctorType& functor = FunctorType{},
|
const FunctorType& functor = FunctorType{},
|
||||||
@ -498,10 +492,6 @@ public:
|
|||||||
ValueType,
|
ValueType,
|
||||||
internal::StorageTagTransform<ArrayHandleType, FunctorType, InverseFunctorType>>));
|
internal::StorageTagTransform<ArrayHandleType, FunctorType, InverseFunctorType>>));
|
||||||
|
|
||||||
private:
|
|
||||||
using StorageType = vtkm::cont::internal::Storage<ValueType, StorageTag>;
|
|
||||||
|
|
||||||
public:
|
|
||||||
ArrayHandleTransform(const ArrayHandleType& handle,
|
ArrayHandleTransform(const ArrayHandleType& handle,
|
||||||
const FunctorType& functor = FunctorType(),
|
const FunctorType& functor = FunctorType(),
|
||||||
const InverseFunctorType& inverseFunctor = InverseFunctorType())
|
const InverseFunctorType& inverseFunctor = InverseFunctorType())
|
||||||
|
@ -51,10 +51,6 @@ public:
|
|||||||
ArrayHandleUniformPointCoordinates,
|
ArrayHandleUniformPointCoordinates,
|
||||||
(vtkm::cont::ArrayHandle<vtkm::Vec3f, vtkm::cont::StorageTagUniformPoints>));
|
(vtkm::cont::ArrayHandle<vtkm::Vec3f, vtkm::cont::StorageTagUniformPoints>));
|
||||||
|
|
||||||
private:
|
|
||||||
using StorageType = vtkm::cont::internal::Storage<ValueType, StorageTag>;
|
|
||||||
|
|
||||||
public:
|
|
||||||
VTKM_CONT
|
VTKM_CONT
|
||||||
ArrayHandleUniformPointCoordinates(vtkm::Id3 dimensions,
|
ArrayHandleUniformPointCoordinates(vtkm::Id3 dimensions,
|
||||||
ValueType origin = ValueType(0.0f, 0.0f, 0.0f),
|
ValueType origin = ValueType(0.0f, 0.0f, 0.0f),
|
||||||
|
@ -197,10 +197,6 @@ public:
|
|||||||
(vtkm::cont::ArrayHandle<typename ArrayHandleType::ValueType,
|
(vtkm::cont::ArrayHandle<typename ArrayHandleType::ValueType,
|
||||||
StorageTagView<typename ArrayHandleType::StorageTag>>));
|
StorageTagView<typename ArrayHandleType::StorageTag>>));
|
||||||
|
|
||||||
private:
|
|
||||||
using StorageType = vtkm::cont::internal::Storage<ValueType, StorageTag>;
|
|
||||||
|
|
||||||
public:
|
|
||||||
VTKM_CONT
|
VTKM_CONT
|
||||||
ArrayHandleView(const ArrayHandleType& array, vtkm::Id startIndex, vtkm::Id numValues)
|
ArrayHandleView(const ArrayHandleType& array, vtkm::Id startIndex, vtkm::Id numValues)
|
||||||
: Superclass(StorageType::CreateBuffers(startIndex, numValues, array))
|
: Superclass(StorageType::CreateBuffers(startIndex, numValues, array))
|
||||||
|
@ -291,10 +291,6 @@ public:
|
|||||||
(ArrayHandleXGCCoordinates<T>),
|
(ArrayHandleXGCCoordinates<T>),
|
||||||
(vtkm::cont::ArrayHandle<vtkm::Vec<T, 3>, vtkm::cont::StorageTagXGCCoordinates>));
|
(vtkm::cont::ArrayHandle<vtkm::Vec<T, 3>, vtkm::cont::StorageTagXGCCoordinates>));
|
||||||
|
|
||||||
private:
|
|
||||||
using StorageType = vtkm::cont::internal::Storage<ValueType, StorageTag>;
|
|
||||||
|
|
||||||
public:
|
|
||||||
VTKM_CONT
|
VTKM_CONT
|
||||||
ArrayHandleXGCCoordinates(const OriginalType& array,
|
ArrayHandleXGCCoordinates(const OriginalType& array,
|
||||||
vtkm::Id numberOfPlanes,
|
vtkm::Id numberOfPlanes,
|
||||||
|
@ -129,10 +129,6 @@ struct ArrayHandleZipTraits
|
|||||||
using Tag =
|
using Tag =
|
||||||
StorageTagZip<typename FirstHandleType::StorageTag, typename SecondHandleType::StorageTag>;
|
StorageTagZip<typename FirstHandleType::StorageTag, typename SecondHandleType::StorageTag>;
|
||||||
|
|
||||||
/// The storage type.
|
|
||||||
///
|
|
||||||
using Storage = vtkm::cont::internal::Storage<ValueType, Tag>;
|
|
||||||
|
|
||||||
/// The superclass for ArrayHandleZip.
|
/// The superclass for ArrayHandleZip.
|
||||||
///
|
///
|
||||||
using Superclass = vtkm::cont::ArrayHandle<ValueType, Tag>;
|
using Superclass = vtkm::cont::ArrayHandle<ValueType, Tag>;
|
||||||
@ -259,9 +255,6 @@ class ArrayHandleZip
|
|||||||
// template argument is not a valid ArrayHandle type.
|
// template argument is not a valid ArrayHandle type.
|
||||||
VTKM_IS_ARRAY_HANDLE(SecondHandleType);
|
VTKM_IS_ARRAY_HANDLE(SecondHandleType);
|
||||||
|
|
||||||
using StorageType =
|
|
||||||
typename internal::ArrayHandleZipTraits<FirstHandleType, SecondHandleType>::Storage;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
VTKM_ARRAY_HANDLE_SUBCLASS(
|
VTKM_ARRAY_HANDLE_SUBCLASS(
|
||||||
ArrayHandleZip,
|
ArrayHandleZip,
|
||||||
|
@ -27,12 +27,7 @@ template <typename ValueType>
|
|||||||
struct TemplatedTests
|
struct TemplatedTests
|
||||||
{
|
{
|
||||||
using ArrayHandleType = vtkm::cont::ArrayHandleCounting<ValueType>;
|
using ArrayHandleType = vtkm::cont::ArrayHandleCounting<ValueType>;
|
||||||
|
using PortalType = typename ArrayHandleType::ReadPortalType;
|
||||||
using ArrayHandleType2 = vtkm::cont::ArrayHandle<ValueType, vtkm::cont::StorageTagCounting>;
|
|
||||||
|
|
||||||
using PortalType =
|
|
||||||
typename vtkm::cont::internal::Storage<ValueType,
|
|
||||||
typename ArrayHandleType::StorageTag>::ReadPortalType;
|
|
||||||
|
|
||||||
void operator()(const ValueType& startingValue, const ValueType& step)
|
void operator()(const ValueType& startingValue, const ValueType& step)
|
||||||
{
|
{
|
||||||
@ -41,7 +36,8 @@ struct TemplatedTests
|
|||||||
ArrayHandleType arrayMake =
|
ArrayHandleType arrayMake =
|
||||||
vtkm::cont::make_ArrayHandleCounting(startingValue, step, ARRAY_SIZE);
|
vtkm::cont::make_ArrayHandleCounting(startingValue, step, ARRAY_SIZE);
|
||||||
|
|
||||||
ArrayHandleType2 arrayHandle = ArrayHandleType(startingValue, step, ARRAY_SIZE);
|
typename ArrayHandleType::Superclass arrayHandle =
|
||||||
|
ArrayHandleType(startingValue, step, ARRAY_SIZE);
|
||||||
|
|
||||||
VTKM_TEST_ASSERT(arrayConst.GetNumberOfValues() == ARRAY_SIZE,
|
VTKM_TEST_ASSERT(arrayConst.GetNumberOfValues() == ARRAY_SIZE,
|
||||||
"Counting array using constructor has wrong size.");
|
"Counting array using constructor has wrong size.");
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
// PURPOSE. See the above copyright notice for more information.
|
// PURPOSE. See the above copyright notice for more information.
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
|
||||||
|
#include <vtkm/cont/Algorithm.h>
|
||||||
#include <vtkm/filter/MapFieldPermutation.h>
|
#include <vtkm/filter/MapFieldPermutation.h>
|
||||||
#include <vtkm/filter/geometry_refinement/Tetrahedralize.h>
|
#include <vtkm/filter/geometry_refinement/Tetrahedralize.h>
|
||||||
#include <vtkm/filter/geometry_refinement/worklet/Tetrahedralize.h>
|
#include <vtkm/filter/geometry_refinement/worklet/Tetrahedralize.h>
|
||||||
@ -41,6 +42,18 @@ VTKM_CONT bool DoMapField(vtkm::cont::DataSet& result,
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct IsShapeTetra
|
||||||
|
{
|
||||||
|
VTKM_EXEC_CONT
|
||||||
|
bool operator()(vtkm::UInt8 shape) const { return shape == vtkm::CELL_SHAPE_TETRA; }
|
||||||
|
};
|
||||||
|
|
||||||
|
struct BinaryAnd
|
||||||
|
{
|
||||||
|
VTKM_EXEC_CONT
|
||||||
|
bool operator()(bool u, bool v) const { return u && v; }
|
||||||
|
};
|
||||||
} // anonymous namespace
|
} // anonymous namespace
|
||||||
|
|
||||||
namespace vtkm
|
namespace vtkm
|
||||||
@ -53,14 +66,58 @@ VTKM_CONT vtkm::cont::DataSet Tetrahedralize::DoExecute(const vtkm::cont::DataSe
|
|||||||
{
|
{
|
||||||
const vtkm::cont::UnknownCellSet& inCellSet = input.GetCellSet();
|
const vtkm::cont::UnknownCellSet& inCellSet = input.GetCellSet();
|
||||||
|
|
||||||
vtkm::cont::CellSetSingleType<> outCellSet;
|
// In case we already have a CellSetSingleType of tetras,
|
||||||
vtkm::worklet::Tetrahedralize worklet;
|
// don't call the worklet and return the input DataSet directly
|
||||||
vtkm::cont::CastAndCall(inCellSet,
|
if (inCellSet.CanConvert<vtkm::cont::CellSetSingleType<>>() &&
|
||||||
[&](const auto& concrete) { outCellSet = worklet.Run(concrete); });
|
inCellSet.AsCellSet<vtkm::cont::CellSetSingleType<>>().GetCellShapeAsId() ==
|
||||||
|
vtkm::CellShapeTagTetra::Id)
|
||||||
|
{
|
||||||
|
return input;
|
||||||
|
}
|
||||||
|
|
||||||
auto mapper = [&](auto& result, const auto& f) { DoMapField(result, f, worklet); };
|
vtkm::cont::CellSetSingleType<> outCellSet;
|
||||||
// create the output dataset (without a CoordinateSystem).
|
vtkm::cont::DataSet output;
|
||||||
vtkm::cont::DataSet output = this->CreateResult(input, outCellSet, mapper);
|
|
||||||
|
// Optimization in case we only have tetras in the CellSet
|
||||||
|
bool allTetras = false;
|
||||||
|
if (inCellSet.CanConvert<vtkm::cont::CellSetExplicit<>>())
|
||||||
|
{
|
||||||
|
vtkm::cont::CellSetExplicit<> inCellSetExplicit =
|
||||||
|
inCellSet.AsCellSet<vtkm::cont::CellSetExplicit<>>();
|
||||||
|
|
||||||
|
auto shapeArray = inCellSetExplicit.GetShapesArray(vtkm::TopologyElementTagCell(),
|
||||||
|
vtkm::TopologyElementTagPoint());
|
||||||
|
auto isCellTetraArray = vtkm::cont::make_ArrayHandleTransform(shapeArray, IsShapeTetra{});
|
||||||
|
|
||||||
|
allTetras = vtkm::cont::Algorithm::Reduce(isCellTetraArray, true, BinaryAnd{});
|
||||||
|
|
||||||
|
if (allTetras)
|
||||||
|
{
|
||||||
|
// Reuse the input's connectivity array
|
||||||
|
outCellSet.Fill(inCellSet.GetNumberOfPoints(),
|
||||||
|
vtkm::CellShapeTagTetra::Id,
|
||||||
|
4,
|
||||||
|
inCellSetExplicit.GetConnectivityArray(vtkm::TopologyElementTagCell(),
|
||||||
|
vtkm::TopologyElementTagPoint()));
|
||||||
|
|
||||||
|
// Copy all fields from the input
|
||||||
|
output = this->CreateResult(input, outCellSet, [&](auto& result, const auto& f) {
|
||||||
|
result.AddField(f);
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!allTetras)
|
||||||
|
{
|
||||||
|
vtkm::worklet::Tetrahedralize worklet;
|
||||||
|
vtkm::cont::CastAndCall(inCellSet,
|
||||||
|
[&](const auto& concrete) { outCellSet = worklet.Run(concrete); });
|
||||||
|
|
||||||
|
auto mapper = [&](auto& result, const auto& f) { DoMapField(result, f, worklet); };
|
||||||
|
// create the output dataset (without a CoordinateSystem).
|
||||||
|
output = this->CreateResult(input, outCellSet, mapper);
|
||||||
|
}
|
||||||
|
|
||||||
// We did not change the geometry of the input dataset at all. Just attach coordinate system
|
// We did not change the geometry of the input dataset at all. Just attach coordinate system
|
||||||
// of input dataset to output dataset.
|
// of input dataset to output dataset.
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
// PURPOSE. See the above copyright notice for more information.
|
// PURPOSE. See the above copyright notice for more information.
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
|
||||||
|
#include <vtkm/cont/Algorithm.h>
|
||||||
#include <vtkm/filter/MapFieldPermutation.h>
|
#include <vtkm/filter/MapFieldPermutation.h>
|
||||||
#include <vtkm/filter/geometry_refinement/Triangulate.h>
|
#include <vtkm/filter/geometry_refinement/Triangulate.h>
|
||||||
#include <vtkm/filter/geometry_refinement/worklet/Triangulate.h>
|
#include <vtkm/filter/geometry_refinement/worklet/Triangulate.h>
|
||||||
@ -42,6 +43,18 @@ VTKM_CONT bool DoMapField(vtkm::cont::DataSet& result,
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct IsShapeTriangle
|
||||||
|
{
|
||||||
|
VTKM_EXEC_CONT
|
||||||
|
bool operator()(vtkm::UInt8 shape) const { return shape == vtkm::CELL_SHAPE_TRIANGLE; }
|
||||||
|
};
|
||||||
|
|
||||||
|
struct BinaryAnd
|
||||||
|
{
|
||||||
|
VTKM_EXEC_CONT
|
||||||
|
bool operator()(bool u, bool v) const { return u && v; }
|
||||||
|
};
|
||||||
} // anonymous namespace
|
} // anonymous namespace
|
||||||
|
|
||||||
namespace vtkm
|
namespace vtkm
|
||||||
@ -54,15 +67,57 @@ VTKM_CONT vtkm::cont::DataSet Triangulate::DoExecute(const vtkm::cont::DataSet&
|
|||||||
{
|
{
|
||||||
const vtkm::cont::UnknownCellSet& inCellSet = input.GetCellSet();
|
const vtkm::cont::UnknownCellSet& inCellSet = input.GetCellSet();
|
||||||
|
|
||||||
|
// In case we already have a CellSetSingleType of tetras,
|
||||||
|
// don't call the worklet and return the input DataSet directly
|
||||||
|
if (inCellSet.CanConvert<vtkm::cont::CellSetSingleType<>>() &&
|
||||||
|
inCellSet.AsCellSet<vtkm::cont::CellSetSingleType<>>().GetCellShapeAsId() ==
|
||||||
|
vtkm::CellShapeTagTriangle::Id)
|
||||||
|
{
|
||||||
|
return input;
|
||||||
|
}
|
||||||
|
|
||||||
vtkm::cont::CellSetSingleType<> outCellSet;
|
vtkm::cont::CellSetSingleType<> outCellSet;
|
||||||
vtkm::worklet::Triangulate worklet;
|
vtkm::cont::DataSet output;
|
||||||
|
|
||||||
vtkm::cont::CastAndCall(inCellSet,
|
// Optimization in case we only have triangles in the CellSet
|
||||||
[&](const auto& concrete) { outCellSet = worklet.Run(concrete); });
|
bool allTriangles = false;
|
||||||
|
if (inCellSet.CanConvert<vtkm::cont::CellSetExplicit<>>())
|
||||||
|
{
|
||||||
|
vtkm::cont::CellSetExplicit<> inCellSetExplicit =
|
||||||
|
inCellSet.AsCellSet<vtkm::cont::CellSetExplicit<>>();
|
||||||
|
|
||||||
auto mapper = [&](auto& result, const auto& f) { DoMapField(result, f, worklet); };
|
auto shapeArray = inCellSetExplicit.GetShapesArray(vtkm::TopologyElementTagCell(),
|
||||||
// create the output dataset (without a CoordinateSystem).
|
vtkm::TopologyElementTagPoint());
|
||||||
vtkm::cont::DataSet output = this->CreateResult(input, outCellSet, mapper);
|
auto isCellTriangleArray = vtkm::cont::make_ArrayHandleTransform(shapeArray, IsShapeTriangle{});
|
||||||
|
allTriangles = vtkm::cont::Algorithm::Reduce(isCellTriangleArray, true, BinaryAnd{});
|
||||||
|
|
||||||
|
if (allTriangles)
|
||||||
|
{
|
||||||
|
// Reuse the input's connectivity array
|
||||||
|
outCellSet.Fill(inCellSet.GetNumberOfPoints(),
|
||||||
|
vtkm::CellShapeTagTriangle::Id,
|
||||||
|
3,
|
||||||
|
inCellSetExplicit.GetConnectivityArray(vtkm::TopologyElementTagCell(),
|
||||||
|
vtkm::TopologyElementTagPoint()));
|
||||||
|
|
||||||
|
// Copy all fields from the input
|
||||||
|
output = this->CreateResult(input, outCellSet, [&](auto& result, const auto& f) {
|
||||||
|
result.AddField(f);
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!allTriangles)
|
||||||
|
{
|
||||||
|
vtkm::worklet::Triangulate worklet;
|
||||||
|
vtkm::cont::CastAndCall(inCellSet,
|
||||||
|
[&](const auto& concrete) { outCellSet = worklet.Run(concrete); });
|
||||||
|
|
||||||
|
auto mapper = [&](auto& result, const auto& f) { DoMapField(result, f, worklet); };
|
||||||
|
// create the output dataset (without a CoordinateSystem).
|
||||||
|
output = this->CreateResult(input, outCellSet, mapper);
|
||||||
|
}
|
||||||
|
|
||||||
// We did not change the geometry of the input dataset at all. Just attach coordinate system
|
// We did not change the geometry of the input dataset at all. Just attach coordinate system
|
||||||
// of input dataset to output dataset.
|
// of input dataset to output dataset.
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
// PURPOSE. See the above copyright notice for more information.
|
// PURPOSE. See the above copyright notice for more information.
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
|
||||||
|
#include <vtkm/cont/DataSetBuilderExplicit.h>
|
||||||
#include <vtkm/cont/testing/MakeTestDataSet.h>
|
#include <vtkm/cont/testing/MakeTestDataSet.h>
|
||||||
#include <vtkm/cont/testing/Testing.h>
|
#include <vtkm/cont/testing/Testing.h>
|
||||||
|
|
||||||
@ -67,10 +68,56 @@ public:
|
|||||||
VTKM_TEST_ASSERT(outData.ReadPortal().Get(10) == 130.5f, "Wrong cell field data");
|
VTKM_TEST_ASSERT(outData.ReadPortal().Get(10) == 130.5f, "Wrong cell field data");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TestCellSetSingleTypeTetra() const
|
||||||
|
{
|
||||||
|
vtkm::cont::DataSet dataset;
|
||||||
|
vtkm::cont::CellSetSingleType<> cellSet;
|
||||||
|
|
||||||
|
auto connectivity = vtkm::cont::make_ArrayHandle<vtkm::Id>({ 0, 1, 2, 3, 3, 2, 1, 4 });
|
||||||
|
cellSet.Fill(5, vtkm::CELL_SHAPE_TETRA, 4, connectivity);
|
||||||
|
|
||||||
|
dataset.SetCellSet(cellSet);
|
||||||
|
|
||||||
|
vtkm::filter::geometry_refinement::Tetrahedralize tetrahedralize;
|
||||||
|
vtkm::cont::DataSet output = tetrahedralize.Execute(dataset);
|
||||||
|
|
||||||
|
VTKM_TEST_ASSERT(dataset.GetCellSet().GetCellSetBase() == output.GetCellSet().GetCellSetBase(),
|
||||||
|
"Pointer to the CellSetSingleType has changed.");
|
||||||
|
}
|
||||||
|
|
||||||
|
void TestCellSetExplicitTetra() const
|
||||||
|
{
|
||||||
|
std::vector<vtkm::Vec3f_32> coords{
|
||||||
|
vtkm::Vec3f_32(0.0f, 0.0f, 0.0f), vtkm::Vec3f_32(2.0f, 0.0f, 0.0f),
|
||||||
|
vtkm::Vec3f_32(2.0f, 4.0f, 0.0f), vtkm::Vec3f_32(0.0f, 4.0f, 0.0f),
|
||||||
|
vtkm::Vec3f_32(1.0f, 0.0f, 3.0f),
|
||||||
|
};
|
||||||
|
std::vector<vtkm::UInt8> shapes{ vtkm::CELL_SHAPE_TETRA, vtkm::CELL_SHAPE_TETRA };
|
||||||
|
std::vector<vtkm::IdComponent> indices{ 4, 4 };
|
||||||
|
std::vector<vtkm::Id> connectivity{ 0, 1, 2, 3, 1, 2, 3, 4 };
|
||||||
|
|
||||||
|
vtkm::cont::DataSetBuilderExplicit dsb;
|
||||||
|
vtkm::cont::DataSet dataset = dsb.Create(coords, shapes, indices, connectivity);
|
||||||
|
|
||||||
|
vtkm::filter::geometry_refinement::Tetrahedralize tetrahedralize;
|
||||||
|
vtkm::cont::DataSet output = tetrahedralize.Execute(dataset);
|
||||||
|
vtkm::cont::UnknownCellSet outputCellSet = output.GetCellSet();
|
||||||
|
|
||||||
|
VTKM_TEST_ASSERT(outputCellSet.IsType<vtkm::cont::CellSetSingleType<>>(),
|
||||||
|
"Output CellSet is not CellSetSingleType");
|
||||||
|
VTKM_TEST_ASSERT(output.GetNumberOfCells() == 2, "Wrong number of cells");
|
||||||
|
VTKM_TEST_ASSERT(outputCellSet.GetCellShape(0) == vtkm::CellShapeTagTetra::Id,
|
||||||
|
"Cell is not tetra");
|
||||||
|
VTKM_TEST_ASSERT(outputCellSet.GetCellShape(1) == vtkm::CellShapeTagTetra::Id,
|
||||||
|
"Cell is not tetra");
|
||||||
|
}
|
||||||
|
|
||||||
void operator()() const
|
void operator()() const
|
||||||
{
|
{
|
||||||
this->TestStructured();
|
this->TestStructured();
|
||||||
this->TestExplicit();
|
this->TestExplicit();
|
||||||
|
this->TestCellSetSingleTypeTetra();
|
||||||
|
this->TestCellSetExplicitTetra();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
// PURPOSE. See the above copyright notice for more information.
|
// PURPOSE. See the above copyright notice for more information.
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
|
||||||
|
#include <vtkm/cont/DataSetBuilderExplicit.h>
|
||||||
#include <vtkm/cont/testing/MakeTestDataSet.h>
|
#include <vtkm/cont/testing/MakeTestDataSet.h>
|
||||||
#include <vtkm/cont/testing/Testing.h>
|
#include <vtkm/cont/testing/Testing.h>
|
||||||
|
|
||||||
@ -61,10 +62,55 @@ public:
|
|||||||
VTKM_TEST_ASSERT(outData.ReadPortal().Get(6) == 3.f, "Wrong cell field data");
|
VTKM_TEST_ASSERT(outData.ReadPortal().Get(6) == 3.f, "Wrong cell field data");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TestCellSetSingleTypeTriangle() const
|
||||||
|
{
|
||||||
|
vtkm::cont::DataSet dataset;
|
||||||
|
vtkm::cont::CellSetSingleType<> cellSet;
|
||||||
|
|
||||||
|
auto connectivity = vtkm::cont::make_ArrayHandle<vtkm::Id>({ 0, 1, 2, 1, 2, 3 });
|
||||||
|
cellSet.Fill(4, vtkm::CELL_SHAPE_TRIANGLE, 3, connectivity);
|
||||||
|
|
||||||
|
dataset.SetCellSet(cellSet);
|
||||||
|
|
||||||
|
vtkm::filter::geometry_refinement::Triangulate triangulate;
|
||||||
|
vtkm::cont::DataSet output = triangulate.Execute(dataset);
|
||||||
|
|
||||||
|
VTKM_TEST_ASSERT(dataset.GetCellSet().GetCellSetBase() == output.GetCellSet().GetCellSetBase(),
|
||||||
|
"Pointer to the CellSetSingleType has changed.");
|
||||||
|
}
|
||||||
|
|
||||||
|
void TestCellSetExplicitTriangle() const
|
||||||
|
{
|
||||||
|
std::vector<vtkm::Vec3f_32> coords{ vtkm::Vec3f_32(0.0f, 0.0f, 0.0f),
|
||||||
|
vtkm::Vec3f_32(2.0f, 0.0f, 0.0f),
|
||||||
|
vtkm::Vec3f_32(2.0f, 4.0f, 0.0f),
|
||||||
|
vtkm::Vec3f_32(0.0f, 4.0f, 0.0f) };
|
||||||
|
std::vector<vtkm::UInt8> shapes{ vtkm::CELL_SHAPE_TRIANGLE, vtkm::CELL_SHAPE_TRIANGLE };
|
||||||
|
std::vector<vtkm::IdComponent> indices{ 3, 3 };
|
||||||
|
std::vector<vtkm::Id> connectivity{ 0, 1, 2, 1, 2, 3 };
|
||||||
|
|
||||||
|
vtkm::cont::DataSetBuilderExplicit dsb;
|
||||||
|
vtkm::cont::DataSet dataset = dsb.Create(coords, shapes, indices, connectivity);
|
||||||
|
|
||||||
|
vtkm::filter::geometry_refinement::Triangulate triangulate;
|
||||||
|
vtkm::cont::DataSet output = triangulate.Execute(dataset);
|
||||||
|
vtkm::cont::UnknownCellSet outputCellSet = output.GetCellSet();
|
||||||
|
|
||||||
|
VTKM_TEST_ASSERT(outputCellSet.IsType<vtkm::cont::CellSetSingleType<>>(),
|
||||||
|
"Output CellSet is not CellSetSingleType");
|
||||||
|
VTKM_TEST_ASSERT(output.GetNumberOfCells() == 2, "Wrong number of cells");
|
||||||
|
VTKM_TEST_ASSERT(outputCellSet.GetCellShape(0) == vtkm::CellShapeTagTriangle::Id,
|
||||||
|
"Cell is not triangular");
|
||||||
|
VTKM_TEST_ASSERT(outputCellSet.GetCellShape(1) == vtkm::CellShapeTagTriangle::Id,
|
||||||
|
"Cell is not triangular");
|
||||||
|
}
|
||||||
|
|
||||||
void operator()() const
|
void operator()() const
|
||||||
{
|
{
|
||||||
this->TestStructured();
|
this->TestStructured();
|
||||||
this->TestExplicit();
|
this->TestExplicit();
|
||||||
|
this->TestCellSetSingleTypeTriangle();
|
||||||
|
this->TestCellSetExplicitTriangle();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,6 @@
|
|||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <stdio.h>
|
|
||||||
#include <vtkm/cont/ArrayHandleCartesianProduct.h>
|
#include <vtkm/cont/ArrayHandleCartesianProduct.h>
|
||||||
#include <vtkm/cont/ArrayHandleCounting.h>
|
#include <vtkm/cont/ArrayHandleCounting.h>
|
||||||
#include <vtkm/cont/ArrayHandleUniformPointCoordinates.h>
|
#include <vtkm/cont/ArrayHandleUniformPointCoordinates.h>
|
||||||
@ -20,7 +19,6 @@
|
|||||||
#include <vtkm/cont/ErrorBadValue.h>
|
#include <vtkm/cont/ErrorBadValue.h>
|
||||||
#include <vtkm/cont/Timer.h>
|
#include <vtkm/cont/Timer.h>
|
||||||
#include <vtkm/cont/TryExecute.h>
|
#include <vtkm/cont/TryExecute.h>
|
||||||
#include <vtkm/rendering/raytracing/Camera.h>
|
|
||||||
#include <vtkm/rendering/raytracing/Logger.h>
|
#include <vtkm/rendering/raytracing/Logger.h>
|
||||||
#include <vtkm/rendering/raytracing/Ray.h>
|
#include <vtkm/rendering/raytracing/Ray.h>
|
||||||
#include <vtkm/rendering/raytracing/RayTracingTypeDefs.h>
|
#include <vtkm/rendering/raytracing/RayTracingTypeDefs.h>
|
||||||
@ -33,6 +31,9 @@ namespace rendering
|
|||||||
{
|
{
|
||||||
namespace raytracing
|
namespace raytracing
|
||||||
{
|
{
|
||||||
|
using DefaultHandle = vtkm::cont::ArrayHandle<vtkm::FloatDefault>;
|
||||||
|
using CartesianArrayHandle =
|
||||||
|
vtkm::cont::ArrayHandleCartesianProduct<DefaultHandle, DefaultHandle, DefaultHandle>;
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
@ -41,9 +42,6 @@ template <typename Device>
|
|||||||
class RectilinearLocator
|
class RectilinearLocator
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
using DefaultHandle = vtkm::cont::ArrayHandle<vtkm::FloatDefault>;
|
|
||||||
using CartesianArrayHandle =
|
|
||||||
vtkm::cont::ArrayHandleCartesianProduct<DefaultHandle, DefaultHandle, DefaultHandle>;
|
|
||||||
using DefaultConstHandle = typename DefaultHandle::ReadPortalType;
|
using DefaultConstHandle = typename DefaultHandle::ReadPortalType;
|
||||||
using CartesianConstPortal = typename CartesianArrayHandle::ReadPortalType;
|
using CartesianConstPortal = typename CartesianArrayHandle::ReadPortalType;
|
||||||
|
|
||||||
@ -728,13 +726,6 @@ public:
|
|||||||
}
|
}
|
||||||
}; //class CalcRayStart
|
}; //class CalcRayStart
|
||||||
|
|
||||||
VolumeRendererStructured::VolumeRendererStructured()
|
|
||||||
{
|
|
||||||
IsSceneDirty = false;
|
|
||||||
IsUniformDataSet = true;
|
|
||||||
SampleDistance = -1.f;
|
|
||||||
}
|
|
||||||
|
|
||||||
void VolumeRendererStructured::SetColorMap(const vtkm::cont::ArrayHandle<vtkm::Vec4f_32>& colorMap)
|
void VolumeRendererStructured::SetColorMap(const vtkm::cont::ArrayHandle<vtkm::Vec4f_32>& colorMap)
|
||||||
{
|
{
|
||||||
ColorMap = colorMap;
|
ColorMap = colorMap;
|
||||||
@ -754,35 +745,15 @@ void VolumeRendererStructured::SetData(const vtkm::cont::CoordinateSystem& coord
|
|||||||
ScalarRange = scalarRange;
|
ScalarRange = scalarRange;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Precision>
|
|
||||||
struct VolumeRendererStructured::RenderFunctor
|
|
||||||
{
|
|
||||||
protected:
|
|
||||||
vtkm::rendering::raytracing::VolumeRendererStructured* Self;
|
|
||||||
vtkm::rendering::raytracing::Ray<Precision>& Rays;
|
|
||||||
|
|
||||||
public:
|
|
||||||
VTKM_CONT
|
|
||||||
RenderFunctor(vtkm::rendering::raytracing::VolumeRendererStructured* self,
|
|
||||||
vtkm::rendering::raytracing::Ray<Precision>& rays)
|
|
||||||
: Self(self)
|
|
||||||
, Rays(rays)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename Device>
|
|
||||||
VTKM_CONT bool operator()(Device)
|
|
||||||
{
|
|
||||||
VTKM_IS_DEVICE_ADAPTER_TAG(Device);
|
|
||||||
|
|
||||||
this->Self->RenderOnDevice(this->Rays, Device());
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
void VolumeRendererStructured::Render(vtkm::rendering::raytracing::Ray<vtkm::Float32>& rays)
|
void VolumeRendererStructured::Render(vtkm::rendering::raytracing::Ray<vtkm::Float32>& rays)
|
||||||
{
|
{
|
||||||
RenderFunctor<vtkm::Float32> functor(this, rays);
|
auto functor = [&](auto device) {
|
||||||
|
using Device = typename std::decay_t<decltype(device)>;
|
||||||
|
VTKM_IS_DEVICE_ADAPTER_TAG(Device);
|
||||||
|
|
||||||
|
this->RenderOnDevice(rays, device);
|
||||||
|
return true;
|
||||||
|
};
|
||||||
vtkm::cont::TryExecute(functor);
|
vtkm::cont::TryExecute(functor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,19 +25,6 @@ namespace raytracing
|
|||||||
class VTKM_RENDERING_EXPORT VolumeRendererStructured
|
class VTKM_RENDERING_EXPORT VolumeRendererStructured
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
using DefaultHandle = vtkm::cont::ArrayHandle<vtkm::FloatDefault>;
|
|
||||||
using CartesianArrayHandle =
|
|
||||||
vtkm::cont::ArrayHandleCartesianProduct<DefaultHandle, DefaultHandle, DefaultHandle>;
|
|
||||||
|
|
||||||
VTKM_CONT
|
|
||||||
VolumeRendererStructured();
|
|
||||||
|
|
||||||
VTKM_CONT
|
|
||||||
void EnableCompositeBackground();
|
|
||||||
|
|
||||||
VTKM_CONT
|
|
||||||
void DisableCompositeBackground();
|
|
||||||
|
|
||||||
VTKM_CONT
|
VTKM_CONT
|
||||||
void SetColorMap(const vtkm::cont::ArrayHandle<vtkm::Vec4f_32>& colorMap);
|
void SetColorMap(const vtkm::cont::ArrayHandle<vtkm::Vec4f_32>& colorMap);
|
||||||
|
|
||||||
@ -60,17 +47,15 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
template <typename Precision, typename Device>
|
template <typename Precision, typename Device>
|
||||||
VTKM_CONT void RenderOnDevice(vtkm::rendering::raytracing::Ray<Precision>& rays, Device);
|
VTKM_CONT void RenderOnDevice(vtkm::rendering::raytracing::Ray<Precision>& rays, Device);
|
||||||
template <typename Precision>
|
|
||||||
struct RenderFunctor;
|
|
||||||
|
|
||||||
bool IsSceneDirty;
|
bool IsSceneDirty = false;
|
||||||
bool IsUniformDataSet;
|
bool IsUniformDataSet = true;
|
||||||
vtkm::Bounds SpatialExtent;
|
vtkm::Bounds SpatialExtent;
|
||||||
vtkm::cont::CoordinateSystem Coordinates;
|
vtkm::cont::CoordinateSystem Coordinates;
|
||||||
vtkm::cont::CellSetStructured<3> Cellset;
|
vtkm::cont::CellSetStructured<3> Cellset;
|
||||||
const vtkm::cont::Field* ScalarField;
|
const vtkm::cont::Field* ScalarField;
|
||||||
vtkm::cont::ArrayHandle<vtkm::Vec4f_32> ColorMap;
|
vtkm::cont::ArrayHandle<vtkm::Vec4f_32> ColorMap;
|
||||||
vtkm::Float32 SampleDistance;
|
vtkm::Float32 SampleDistance = -1.f;
|
||||||
vtkm::Range ScalarRange;
|
vtkm::Range ScalarRange;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user