mirror of
https://gitlab.kitware.com/vtk/vtk-m
synced 2024-09-08 13:23:51 +00:00
Remove warning. Add BoundsMap methods.
Fix compiler warnings...... Kick the dashboards.......... Kick the dashboards..... use lambda instead of functor, remove unused code ArrayHandle::StorageType should be public StorageType is public in vtkm::cont::ArrayHandle, but some subclasses re-declare it as private. Having it public provides a convenient way to get the storage type of an ArrayHandle, otherwise it is quite verbose. Addresses: #314 Tetrahedralize and Triangulate filters check if input is already triangulated 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. ci,crusher: changed fs to orion ci,osx,macos: fix value of GIT_CLONE_PATH
This commit is contained in:
parent
a4b4bf6563
commit
1ce2922d15
@ -1,9 +1,9 @@
|
||||
# Ad-hoc build that runs in the ECP Hardware, concretely in OLCF Spock.
|
||||
.crusher_gcc_hip:
|
||||
variables:
|
||||
CCACHE_BASEDIR: "/gpfs/alpine/csc331/scratch/"
|
||||
CCACHE_DIR: "/gpfs/alpine/csc331/scratch/vbolea/ci/vtk-m/ccache"
|
||||
CUSTOM_CI_BUILDS_DIR: "/gpfs/alpine/csc331/scratch/vbolea/ci/vtk-m/runtime"
|
||||
CCACHE_BASEDIR: "/lustre/orion/csc331/scratch/"
|
||||
CCACHE_DIR: "/lustre/orion/csc331/scratch/vbolea/ci/vtk-m/ccache"
|
||||
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
|
||||
CCACHE_IGNOREOPTIONS: "-isystem=*"
|
||||
@ -14,6 +14,9 @@
|
||||
CMAKE_GENERATOR: "Ninja"
|
||||
CMAKE_PREFIX_PATH: "$CI_BUILDS_DIR/kokkos_install"
|
||||
|
||||
# We do not want to use the user's ~/.gitconfig
|
||||
GIT_CONFIG_GLOBAL: "true"
|
||||
|
||||
KOKKOS_OPTS: >-
|
||||
-DCMAKE_INSTALL_PREFIX:PATH=$CI_BUILDS_DIR/kokkos_install
|
||||
-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
|
||||
JOB_MODULES: >-
|
||||
DefApps/default
|
||||
craype-accel-amd-gfx90a
|
||||
rocm/4.5.0
|
||||
gcc/12
|
||||
|
@ -25,6 +25,7 @@ test:macos_xcode13:
|
||||
CC: gcc
|
||||
CXX: g++
|
||||
DEVELOPER_DIR: "/Applications/Xcode-13.3.app/Contents/Developer"
|
||||
GIT_CLONE_PATH: "$CI_BUILDS_DIR/vtk-m-ci"
|
||||
VTKM_SETTINGS: "64bit_floats+shared+ccache"
|
||||
|
||||
.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 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.
|
||||
///
|
||||
|
@ -344,10 +344,6 @@ public:
|
||||
SecondHandleType,
|
||||
ThirdHandleType>::Superclass));
|
||||
|
||||
private:
|
||||
using StorageType = vtkm::cont::internal::Storage<ValueType, StorageTag>;
|
||||
|
||||
public:
|
||||
VTKM_CONT
|
||||
ArrayHandleCartesianProduct(const FirstHandleType& firstArray,
|
||||
const SecondHandleType& secondArray,
|
||||
|
@ -188,7 +188,6 @@ struct CompositeVectorTraits
|
||||
|
||||
using ValueType = typename vtkm::internal::compvec::GetValueType<ArrayTs...>::ValueType;
|
||||
using StorageTag = vtkm::cont::StorageTagCompositeVec<typename ArrayTs::StorageTag...>;
|
||||
using StorageType = Storage<ValueType, StorageTag>;
|
||||
using Superclass = ArrayHandle<ValueType, StorageTag>;
|
||||
};
|
||||
|
||||
@ -400,14 +399,10 @@ class ArrayHandleCompositeVector
|
||||
: public ArrayHandle<typename internal::CompositeVectorTraits<ArrayTs...>::ValueType,
|
||||
typename internal::CompositeVectorTraits<ArrayTs...>::StorageTag>
|
||||
{
|
||||
private:
|
||||
using Traits = internal::CompositeVectorTraits<ArrayTs...>;
|
||||
using StorageType = typename Traits::StorageType;
|
||||
|
||||
public:
|
||||
VTKM_ARRAY_HANDLE_SUBCLASS(ArrayHandleCompositeVector,
|
||||
(ArrayHandleCompositeVector<ArrayTs...>),
|
||||
(typename Traits::Superclass));
|
||||
(typename internal::CompositeVectorTraits<ArrayTs...>::Superclass));
|
||||
|
||||
VTKM_CONT
|
||||
ArrayHandleCompositeVector(const ArrayTs&... arrays)
|
||||
|
@ -251,10 +251,6 @@ public:
|
||||
StorageTagConcatenate<typename ArrayHandleType1::StorageTag,
|
||||
typename ArrayHandleType2::StorageTag>>));
|
||||
|
||||
protected:
|
||||
using StorageType = vtkm::cont::internal::Storage<ValueType, StorageTag>;
|
||||
|
||||
public:
|
||||
VTKM_CONT
|
||||
ArrayHandleConcatenate(const ArrayHandleType1& array1, const ArrayHandleType2& array2)
|
||||
: Superclass(StorageType::CreateBuffers(array1, array2))
|
||||
|
@ -565,7 +565,6 @@ struct DecoratorHandleTraits
|
||||
using StorageTraits = decor::DecoratorStorageTraits<DecoratorImplT, ArrayTs...>;
|
||||
using ValueType = typename StorageTraits::ValueType;
|
||||
using StorageTag = StorageTagDecorator<DecoratorImplT, ArrayTs...>;
|
||||
using StorageType = vtkm::cont::internal::Storage<ValueType, StorageTag>;
|
||||
using Superclass = vtkm::cont::ArrayHandle<ValueType, StorageTag>;
|
||||
};
|
||||
|
||||
@ -651,7 +650,6 @@ class ArrayHandleDecorator
|
||||
private:
|
||||
using Traits = internal::DecoratorHandleTraits<typename std::decay<DecoratorImplT>::type,
|
||||
typename std::decay<ArrayTs>::type...>;
|
||||
using StorageType = typename Traits::StorageType;
|
||||
|
||||
public:
|
||||
VTKM_ARRAY_HANDLE_SUBCLASS(ArrayHandleDecorator,
|
||||
|
@ -94,8 +94,7 @@ class Storage<typename vtkm::VecTraits<typename ArrayHandleType::ValueType>::Com
|
||||
{
|
||||
using SourceValueType = typename ArrayHandleType::ValueType;
|
||||
using ValueType = typename vtkm::VecTraits<SourceValueType>::ComponentType;
|
||||
using SourceStorageTag = typename ArrayHandleType::StorageTag;
|
||||
using SourceStorage = vtkm::cont::internal::Storage<SourceValueType, SourceStorageTag>;
|
||||
using SourceStorage = typename ArrayHandleType::StorageType;
|
||||
|
||||
public:
|
||||
VTKM_CONT static vtkm::IdComponent ComponentIndex(
|
||||
@ -198,10 +197,6 @@ public:
|
||||
typename vtkm::VecTraits<typename ArrayHandleType::ValueType>::ComponentType,
|
||||
StorageTagExtractComponent<ArrayHandleType>>));
|
||||
|
||||
protected:
|
||||
using StorageType = vtkm::cont::internal::Storage<ValueType, StorageTag>;
|
||||
|
||||
public:
|
||||
VTKM_CONT
|
||||
ArrayHandleExtractComponent(const ArrayHandleType& array, vtkm::IdComponent component)
|
||||
: Superclass(StorageType::CreateBuffers(component, array))
|
||||
|
@ -285,10 +285,6 @@ public:
|
||||
|
||||
using ComponentType = typename ComponentsArrayHandleType::ValueType;
|
||||
|
||||
private:
|
||||
using StorageType = vtkm::cont::internal::Storage<ValueType, StorageTag>;
|
||||
|
||||
public:
|
||||
VTKM_CONT
|
||||
ArrayHandleGroupVecVariable(const ComponentsArrayHandleType& componentsArray,
|
||||
const OffsetsArrayHandleType& offsetsArray)
|
||||
|
@ -158,7 +158,6 @@ struct ArrayHandleImplicitTraits
|
||||
using PortalType = vtkm::internal::ArrayPortalImplicit<FunctorType>;
|
||||
using StorageTag = vtkm::cont::StorageTagImplicit<PortalType>;
|
||||
using Superclass = vtkm::cont::ArrayHandle<ValueType, StorageTag>;
|
||||
using StorageType = vtkm::cont::internal::Storage<ValueType, StorageTag>;
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
|
@ -408,10 +408,6 @@ public:
|
||||
(ArrayHandleMultiplexer<ArrayHandleTypes...>),
|
||||
(vtkm::cont::ArrayHandle<typename Traits::ValueType, typename Traits::StorageTag>));
|
||||
|
||||
private:
|
||||
using StorageType = vtkm::cont::internal::Storage<ValueType, StorageTag>;
|
||||
|
||||
public:
|
||||
template <typename RealStorageTag>
|
||||
VTKM_CONT ArrayHandleMultiplexer(const vtkm::cont::ArrayHandle<ValueType, RealStorageTag>& src)
|
||||
: Superclass(StorageType::CreateBuffers(src))
|
||||
|
@ -248,10 +248,6 @@ public:
|
||||
vtkm::cont::StorageTagPermutation<typename IndexArrayHandleType::StorageTag,
|
||||
typename ValueArrayHandleType::StorageTag>>));
|
||||
|
||||
private:
|
||||
using StorageType = vtkm::cont::internal::Storage<ValueType, StorageTag>;
|
||||
|
||||
public:
|
||||
VTKM_CONT
|
||||
ArrayHandlePermutation(const IndexArrayHandleType& indexArray,
|
||||
const ValueArrayHandleType& valueArray)
|
||||
|
@ -604,10 +604,6 @@ public:
|
||||
(vtkm::cont::ArrayHandle<internal::detail::RecombinedValueType<ComponentType>,
|
||||
vtkm::cont::internal::StorageTagRecombineVec>));
|
||||
|
||||
private:
|
||||
using StorageType = vtkm::cont::internal::Storage<ValueType, StorageTag>;
|
||||
|
||||
public:
|
||||
vtkm::IdComponent GetNumberOfComponents() const
|
||||
{
|
||||
return StorageType::GetNumberOfComponents(this->GetBuffers());
|
||||
|
@ -156,7 +156,6 @@ public:
|
||||
(vtkm::cont::ArrayHandle<typename ArrayHandleType::ValueType,
|
||||
StorageTagReverse<typename ArrayHandleType::StorageTag>>));
|
||||
|
||||
public:
|
||||
ArrayHandleReverse(const ArrayHandleType& handle)
|
||||
: Superclass(handle.GetBuffers())
|
||||
{
|
||||
|
@ -327,7 +327,6 @@ public:
|
||||
vtkm::cont::StorageTagRuntimeVec>));
|
||||
|
||||
private:
|
||||
using StorageType = vtkm::cont::internal::Storage<ValueType, StorageTag>;
|
||||
using ComponentsArrayType = vtkm::cont::ArrayHandle<ComponentType, StorageTagBasic>;
|
||||
|
||||
public:
|
||||
|
@ -246,8 +246,6 @@ class ArrayHandleSOA : public ArrayHandle<T, vtkm::cont::StorageTagSOA>
|
||||
using ComponentType = typename vtkm::VecTraits<T>::ComponentType;
|
||||
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>;
|
||||
|
||||
public:
|
||||
|
@ -333,10 +333,6 @@ public:
|
||||
(ArrayHandleStride<T>),
|
||||
(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)
|
||||
: Superclass(StorageType::CreateBuffers(
|
||||
vtkm::cont::internal::Buffer{},
|
||||
|
@ -246,8 +246,7 @@ class Storage<typename StorageTagTransform<ArrayHandleType, FunctorType>::ValueT
|
||||
using FunctorManager = TransformFunctorManager<FunctorType>;
|
||||
using ValueType = typename StorageTagTransform<ArrayHandleType, FunctorType>::ValueType;
|
||||
|
||||
using SourceStorage =
|
||||
Storage<typename ArrayHandleType::ValueType, typename ArrayHandleType::StorageTag>;
|
||||
using SourceStorage = typename ArrayHandleType::StorageType;
|
||||
|
||||
static std::vector<vtkm::cont::internal::Buffer> SourceBuffers(
|
||||
const std::vector<vtkm::cont::internal::Buffer>& buffers)
|
||||
@ -323,8 +322,7 @@ class Storage<
|
||||
using InverseFunctorManager = TransformFunctorManager<InverseFunctorType>;
|
||||
using ValueType = typename StorageTagTransform<ArrayHandleType, FunctorType>::ValueType;
|
||||
|
||||
using SourceStorage =
|
||||
Storage<typename ArrayHandleType::ValueType, typename ArrayHandleType::StorageTag>;
|
||||
using SourceStorage = typename ArrayHandleType::StorageType;
|
||||
|
||||
static std::vector<vtkm::cont::internal::Buffer> SourceBuffers(
|
||||
const std::vector<vtkm::cont::internal::Buffer>& buffers)
|
||||
@ -454,10 +452,6 @@ public:
|
||||
typename internal::StorageTagTransform<ArrayHandleType, FunctorType>::ValueType,
|
||||
internal::StorageTagTransform<ArrayHandleType, FunctorType>>));
|
||||
|
||||
private:
|
||||
using StorageType = vtkm::cont::internal::Storage<ValueType, StorageTag>;
|
||||
|
||||
public:
|
||||
VTKM_CONT
|
||||
ArrayHandleTransform(const ArrayHandleType& handle,
|
||||
const FunctorType& functor = FunctorType{},
|
||||
@ -498,10 +492,6 @@ public:
|
||||
ValueType,
|
||||
internal::StorageTagTransform<ArrayHandleType, FunctorType, InverseFunctorType>>));
|
||||
|
||||
private:
|
||||
using StorageType = vtkm::cont::internal::Storage<ValueType, StorageTag>;
|
||||
|
||||
public:
|
||||
ArrayHandleTransform(const ArrayHandleType& handle,
|
||||
const FunctorType& functor = FunctorType(),
|
||||
const InverseFunctorType& inverseFunctor = InverseFunctorType())
|
||||
|
@ -51,10 +51,6 @@ public:
|
||||
ArrayHandleUniformPointCoordinates,
|
||||
(vtkm::cont::ArrayHandle<vtkm::Vec3f, vtkm::cont::StorageTagUniformPoints>));
|
||||
|
||||
private:
|
||||
using StorageType = vtkm::cont::internal::Storage<ValueType, StorageTag>;
|
||||
|
||||
public:
|
||||
VTKM_CONT
|
||||
ArrayHandleUniformPointCoordinates(vtkm::Id3 dimensions,
|
||||
ValueType origin = ValueType(0.0f, 0.0f, 0.0f),
|
||||
|
@ -197,10 +197,6 @@ public:
|
||||
(vtkm::cont::ArrayHandle<typename ArrayHandleType::ValueType,
|
||||
StorageTagView<typename ArrayHandleType::StorageTag>>));
|
||||
|
||||
private:
|
||||
using StorageType = vtkm::cont::internal::Storage<ValueType, StorageTag>;
|
||||
|
||||
public:
|
||||
VTKM_CONT
|
||||
ArrayHandleView(const ArrayHandleType& array, vtkm::Id startIndex, vtkm::Id numValues)
|
||||
: Superclass(StorageType::CreateBuffers(startIndex, numValues, array))
|
||||
|
@ -291,10 +291,6 @@ public:
|
||||
(ArrayHandleXGCCoordinates<T>),
|
||||
(vtkm::cont::ArrayHandle<vtkm::Vec<T, 3>, vtkm::cont::StorageTagXGCCoordinates>));
|
||||
|
||||
private:
|
||||
using StorageType = vtkm::cont::internal::Storage<ValueType, StorageTag>;
|
||||
|
||||
public:
|
||||
VTKM_CONT
|
||||
ArrayHandleXGCCoordinates(const OriginalType& array,
|
||||
vtkm::Id numberOfPlanes,
|
||||
|
@ -129,10 +129,6 @@ struct ArrayHandleZipTraits
|
||||
using Tag =
|
||||
StorageTagZip<typename FirstHandleType::StorageTag, typename SecondHandleType::StorageTag>;
|
||||
|
||||
/// The storage type.
|
||||
///
|
||||
using Storage = vtkm::cont::internal::Storage<ValueType, Tag>;
|
||||
|
||||
/// The superclass for ArrayHandleZip.
|
||||
///
|
||||
using Superclass = vtkm::cont::ArrayHandle<ValueType, Tag>;
|
||||
@ -259,9 +255,6 @@ class ArrayHandleZip
|
||||
// template argument is not a valid ArrayHandle type.
|
||||
VTKM_IS_ARRAY_HANDLE(SecondHandleType);
|
||||
|
||||
using StorageType =
|
||||
typename internal::ArrayHandleZipTraits<FirstHandleType, SecondHandleType>::Storage;
|
||||
|
||||
public:
|
||||
VTKM_ARRAY_HANDLE_SUBCLASS(
|
||||
ArrayHandleZip,
|
||||
|
@ -27,12 +27,7 @@ template <typename ValueType>
|
||||
struct TemplatedTests
|
||||
{
|
||||
using ArrayHandleType = vtkm::cont::ArrayHandleCounting<ValueType>;
|
||||
|
||||
using ArrayHandleType2 = vtkm::cont::ArrayHandle<ValueType, vtkm::cont::StorageTagCounting>;
|
||||
|
||||
using PortalType =
|
||||
typename vtkm::cont::internal::Storage<ValueType,
|
||||
typename ArrayHandleType::StorageTag>::ReadPortalType;
|
||||
using PortalType = typename ArrayHandleType::ReadPortalType;
|
||||
|
||||
void operator()(const ValueType& startingValue, const ValueType& step)
|
||||
{
|
||||
@ -41,7 +36,8 @@ struct TemplatedTests
|
||||
ArrayHandleType arrayMake =
|
||||
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,
|
||||
"Counting array using constructor has wrong size.");
|
||||
|
@ -137,8 +137,8 @@ protected:
|
||||
if (!this->UseAsynchronousCommunication)
|
||||
{
|
||||
VTKM_LOG_S(vtkm::cont::LogLevel::Info,
|
||||
"Synchronous communication not supported for AdvectAlgorithmThreaded. Forcing "
|
||||
"asynchronous communication.");
|
||||
"Synchronous communication not supported for AdvectAlgorithmThreaded."
|
||||
"Forcing asynchronous communication.");
|
||||
}
|
||||
|
||||
bool useAsync = true;
|
||||
|
@ -61,6 +61,15 @@ public:
|
||||
this->Init(pds.GetPartitions(), blockIds);
|
||||
}
|
||||
|
||||
vtkm::Bounds GetGlobalBounds() const { return this->GlobalBounds; }
|
||||
|
||||
vtkm::Bounds GetBlockBounds(vtkm::Id idx) const
|
||||
{
|
||||
VTKM_ASSERT(idx >= 0 && static_cast<std::size_t>(idx) < this->BlockBounds.size());
|
||||
|
||||
return this->BlockBounds[static_cast<std::size_t>(idx)];
|
||||
}
|
||||
|
||||
vtkm::Id GetLocalBlockId(vtkm::Id idx) const
|
||||
{
|
||||
VTKM_ASSERT(idx >= 0 && idx < this->LocalNumBlocks);
|
||||
@ -138,7 +147,7 @@ private:
|
||||
|
||||
//note: there might be duplicates...
|
||||
vtkm::Id globalNumBlocks =
|
||||
std::accumulate(globalBlockCounts.begin(), globalBlockCounts.end(), 0);
|
||||
std::accumulate(globalBlockCounts.begin(), globalBlockCounts.end(), vtkm::Id{ 0 });
|
||||
|
||||
//3. given the counts per rank, calc offset for this rank.
|
||||
vtkm::Id offset = 0;
|
||||
|
@ -74,15 +74,16 @@ public:
|
||||
|
||||
void Validate(vtkm::Id num)
|
||||
{
|
||||
#ifndef NDEBUG
|
||||
//Make sure we didn't miss anything. Every particle goes into a single bucket.
|
||||
VTKM_ASSERT(static_cast<std::size_t>(num) ==
|
||||
(this->InBounds.Particles.size() + this->OutOfBounds.Particles.size() +
|
||||
this->TermIdx.size()));
|
||||
VTKM_ASSERT(this->InBounds.Particles.size() == this->InBounds.BlockIDs.size());
|
||||
VTKM_ASSERT(this->OutOfBounds.Particles.size() == this->OutOfBounds.BlockIDs.size());
|
||||
VTKM_ASSERT(this->TermIdx.size() == this->TermID.size());
|
||||
#endif
|
||||
if ((static_cast<std::size_t>(num) !=
|
||||
(this->InBounds.Particles.size() + this->OutOfBounds.Particles.size() +
|
||||
this->TermIdx.size())) ||
|
||||
(this->InBounds.Particles.size() != this->InBounds.BlockIDs.size()) ||
|
||||
(this->OutOfBounds.Particles.size() != this->OutOfBounds.BlockIDs.size()) ||
|
||||
(this->TermIdx.size() != this->TermID.size()))
|
||||
{
|
||||
throw vtkm::cont::ErrorFilterExecution("Particle count mismatch after classification");
|
||||
}
|
||||
}
|
||||
|
||||
void AddTerminated(vtkm::Id idx, vtkm::Id pID)
|
||||
|
@ -115,10 +115,10 @@ void SetFilter(FilterType& filter,
|
||||
filter.SetSeeds(seedArray);
|
||||
filter.SetActiveField(fieldName);
|
||||
filter.SetUseThreadedAlgorithm(useThreaded);
|
||||
// if (useAsyncComm)
|
||||
// filter.SetUseAsynchronousCommunication();
|
||||
// else
|
||||
// filter.SetUseSynchronousCommunication();
|
||||
if (useAsyncComm)
|
||||
filter.SetUseAsynchronousCommunication();
|
||||
else
|
||||
filter.SetUseSynchronousCommunication();
|
||||
|
||||
if (useBlockIds)
|
||||
filter.SetBlockIDs(blockIds);
|
||||
|
@ -8,6 +8,7 @@
|
||||
// PURPOSE. See the above copyright notice for more information.
|
||||
//============================================================================
|
||||
|
||||
#include <vtkm/cont/Algorithm.h>
|
||||
#include <vtkm/filter/MapFieldPermutation.h>
|
||||
#include <vtkm/filter/geometry_refinement/Tetrahedralize.h>
|
||||
#include <vtkm/filter/geometry_refinement/worklet/Tetrahedralize.h>
|
||||
@ -41,6 +42,18 @@ VTKM_CONT bool DoMapField(vtkm::cont::DataSet& result,
|
||||
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
|
||||
|
||||
namespace vtkm
|
||||
@ -53,14 +66,58 @@ VTKM_CONT vtkm::cont::DataSet Tetrahedralize::DoExecute(const vtkm::cont::DataSe
|
||||
{
|
||||
const vtkm::cont::UnknownCellSet& inCellSet = input.GetCellSet();
|
||||
|
||||
vtkm::cont::CellSetSingleType<> outCellSet;
|
||||
vtkm::worklet::Tetrahedralize worklet;
|
||||
vtkm::cont::CastAndCall(inCellSet,
|
||||
[&](const auto& concrete) { outCellSet = worklet.Run(concrete); });
|
||||
// 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::CellShapeTagTetra::Id)
|
||||
{
|
||||
return input;
|
||||
}
|
||||
|
||||
auto mapper = [&](auto& result, const auto& f) { DoMapField(result, f, worklet); };
|
||||
// create the output dataset (without a CoordinateSystem).
|
||||
vtkm::cont::DataSet output = this->CreateResult(input, outCellSet, mapper);
|
||||
vtkm::cont::CellSetSingleType<> outCellSet;
|
||||
vtkm::cont::DataSet output;
|
||||
|
||||
// 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
|
||||
// of input dataset to output dataset.
|
||||
|
@ -8,6 +8,7 @@
|
||||
// PURPOSE. See the above copyright notice for more information.
|
||||
//============================================================================
|
||||
|
||||
#include <vtkm/cont/Algorithm.h>
|
||||
#include <vtkm/filter/MapFieldPermutation.h>
|
||||
#include <vtkm/filter/geometry_refinement/Triangulate.h>
|
||||
#include <vtkm/filter/geometry_refinement/worklet/Triangulate.h>
|
||||
@ -42,6 +43,18 @@ VTKM_CONT bool DoMapField(vtkm::cont::DataSet& result,
|
||||
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
|
||||
|
||||
namespace vtkm
|
||||
@ -54,15 +67,57 @@ VTKM_CONT vtkm::cont::DataSet Triangulate::DoExecute(const vtkm::cont::DataSet&
|
||||
{
|
||||
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::worklet::Triangulate worklet;
|
||||
vtkm::cont::DataSet output;
|
||||
|
||||
vtkm::cont::CastAndCall(inCellSet,
|
||||
[&](const auto& concrete) { outCellSet = worklet.Run(concrete); });
|
||||
// Optimization in case we only have triangles in the CellSet
|
||||
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); };
|
||||
// create the output dataset (without a CoordinateSystem).
|
||||
vtkm::cont::DataSet output = this->CreateResult(input, outCellSet, mapper);
|
||||
auto shapeArray = inCellSetExplicit.GetShapesArray(vtkm::TopologyElementTagCell(),
|
||||
vtkm::TopologyElementTagPoint());
|
||||
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
|
||||
// of input dataset to output dataset.
|
||||
|
@ -8,6 +8,7 @@
|
||||
// PURPOSE. See the above copyright notice for more information.
|
||||
//============================================================================
|
||||
|
||||
#include <vtkm/cont/DataSetBuilderExplicit.h>
|
||||
#include <vtkm/cont/testing/MakeTestDataSet.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");
|
||||
}
|
||||
|
||||
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
|
||||
{
|
||||
this->TestStructured();
|
||||
this->TestExplicit();
|
||||
this->TestCellSetSingleTypeTetra();
|
||||
this->TestCellSetExplicitTetra();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -8,6 +8,7 @@
|
||||
// PURPOSE. See the above copyright notice for more information.
|
||||
//============================================================================
|
||||
|
||||
#include <vtkm/cont/DataSetBuilderExplicit.h>
|
||||
#include <vtkm/cont/testing/MakeTestDataSet.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");
|
||||
}
|
||||
|
||||
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
|
||||
{
|
||||
this->TestStructured();
|
||||
this->TestExplicit();
|
||||
this->TestCellSetSingleTypeTriangle();
|
||||
this->TestCellSetExplicitTriangle();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -11,7 +11,6 @@
|
||||
|
||||
#include <iostream>
|
||||
#include <math.h>
|
||||
#include <stdio.h>
|
||||
#include <vtkm/cont/ArrayHandleCartesianProduct.h>
|
||||
#include <vtkm/cont/ArrayHandleCounting.h>
|
||||
#include <vtkm/cont/ArrayHandleUniformPointCoordinates.h>
|
||||
@ -20,7 +19,6 @@
|
||||
#include <vtkm/cont/ErrorBadValue.h>
|
||||
#include <vtkm/cont/Timer.h>
|
||||
#include <vtkm/cont/TryExecute.h>
|
||||
#include <vtkm/rendering/raytracing/Camera.h>
|
||||
#include <vtkm/rendering/raytracing/Logger.h>
|
||||
#include <vtkm/rendering/raytracing/Ray.h>
|
||||
#include <vtkm/rendering/raytracing/RayTracingTypeDefs.h>
|
||||
@ -33,6 +31,9 @@ namespace rendering
|
||||
{
|
||||
namespace raytracing
|
||||
{
|
||||
using DefaultHandle = vtkm::cont::ArrayHandle<vtkm::FloatDefault>;
|
||||
using CartesianArrayHandle =
|
||||
vtkm::cont::ArrayHandleCartesianProduct<DefaultHandle, DefaultHandle, DefaultHandle>;
|
||||
|
||||
namespace
|
||||
{
|
||||
@ -41,9 +42,6 @@ template <typename Device>
|
||||
class RectilinearLocator
|
||||
{
|
||||
protected:
|
||||
using DefaultHandle = vtkm::cont::ArrayHandle<vtkm::FloatDefault>;
|
||||
using CartesianArrayHandle =
|
||||
vtkm::cont::ArrayHandleCartesianProduct<DefaultHandle, DefaultHandle, DefaultHandle>;
|
||||
using DefaultConstHandle = typename DefaultHandle::ReadPortalType;
|
||||
using CartesianConstPortal = typename CartesianArrayHandle::ReadPortalType;
|
||||
|
||||
@ -728,13 +726,6 @@ public:
|
||||
}
|
||||
}; //class CalcRayStart
|
||||
|
||||
VolumeRendererStructured::VolumeRendererStructured()
|
||||
{
|
||||
IsSceneDirty = false;
|
||||
IsUniformDataSet = true;
|
||||
SampleDistance = -1.f;
|
||||
}
|
||||
|
||||
void VolumeRendererStructured::SetColorMap(const vtkm::cont::ArrayHandle<vtkm::Vec4f_32>& colorMap)
|
||||
{
|
||||
ColorMap = colorMap;
|
||||
@ -754,35 +745,15 @@ void VolumeRendererStructured::SetData(const vtkm::cont::CoordinateSystem& coord
|
||||
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)
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -25,19 +25,6 @@ namespace raytracing
|
||||
class VTKM_RENDERING_EXPORT VolumeRendererStructured
|
||||
{
|
||||
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
|
||||
void SetColorMap(const vtkm::cont::ArrayHandle<vtkm::Vec4f_32>& colorMap);
|
||||
|
||||
@ -60,17 +47,15 @@ public:
|
||||
protected:
|
||||
template <typename Precision, typename Device>
|
||||
VTKM_CONT void RenderOnDevice(vtkm::rendering::raytracing::Ray<Precision>& rays, Device);
|
||||
template <typename Precision>
|
||||
struct RenderFunctor;
|
||||
|
||||
bool IsSceneDirty;
|
||||
bool IsUniformDataSet;
|
||||
bool IsSceneDirty = false;
|
||||
bool IsUniformDataSet = true;
|
||||
vtkm::Bounds SpatialExtent;
|
||||
vtkm::cont::CoordinateSystem Coordinates;
|
||||
vtkm::cont::CellSetStructured<3> Cellset;
|
||||
const vtkm::cont::Field* ScalarField;
|
||||
vtkm::cont::ArrayHandle<vtkm::Vec4f_32> ColorMap;
|
||||
vtkm::Float32 SampleDistance;
|
||||
vtkm::Float32 SampleDistance = -1.f;
|
||||
vtkm::Range ScalarRange;
|
||||
};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user