mirror of
https://gitlab.kitware.com/vtk/vtk-m
synced 2024-09-19 10:35:42 +00:00
Merge branch 'cuda-default-constructors' into 'master'
CUDA default constructors, destructors, and assignment operators Several classes exclusively work in the control environment. However, CUDA likes to add __device__ to constructors, destructors, and assignment operators it automatically creates. This in turn causes warnings about the __device__ function using host-only classes (like boost::shared_ptr). Solve this problem by adding explicit methods for all of these. See merge request !245
This commit is contained in:
commit
dc11d9a917
@ -117,6 +117,93 @@ struct ArrayHandleCheck
|
||||
|
||||
} // namespace internal
|
||||
|
||||
namespace detail {
|
||||
|
||||
template<typename T> struct GetTypeInParentheses;
|
||||
template<typename T>
|
||||
struct GetTypeInParentheses<void(T)>
|
||||
{
|
||||
typedef T type;
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
|
||||
// Implementation for VTKM_ARRAY_HANDLE_SUBCLASS macros
|
||||
#define VTK_M_ARRAY_HANDLE_SUBCLASS_IMPL(classname, fullclasstype, superclass, typename__) \
|
||||
typedef typename__ vtkm::cont::detail::GetTypeInParentheses<void fullclasstype>::type Thisclass;\
|
||||
typedef typename__ vtkm::cont::detail::GetTypeInParentheses<void superclass>::type Superclass;\
|
||||
\
|
||||
VTKM_IS_ARRAY_HANDLE(Superclass); \
|
||||
\
|
||||
VTKM_CONT_EXPORT \
|
||||
classname() : Superclass() { } \
|
||||
\
|
||||
VTKM_CONT_EXPORT \
|
||||
classname(const Thisclass &src) : Superclass(src) { } \
|
||||
\
|
||||
VTKM_CONT_EXPORT \
|
||||
classname(const vtkm::cont::ArrayHandle<typename__ Superclass::ValueType, typename__ Superclass::StorageTag> &src) : Superclass(src) { } \
|
||||
\
|
||||
VTKM_CONT_EXPORT \
|
||||
virtual ~classname() { } \
|
||||
\
|
||||
VTKM_CONT_EXPORT \
|
||||
Thisclass &operator=(const Thisclass &src) \
|
||||
{ \
|
||||
this->Superclass::operator=(src); \
|
||||
return *this; \
|
||||
} \
|
||||
\
|
||||
typedef typename__ Superclass::ValueType ValueType; \
|
||||
typedef typename__ Superclass::StorageTag StorageTag
|
||||
|
||||
/// \brief Macro to make default methods in ArrayHandle subclasses.
|
||||
///
|
||||
/// This macro defines the default constructors, destructors and assignment
|
||||
/// operators for ArrayHandle subclasses that are templates. The ArrayHandle
|
||||
/// subclasses are assumed to be empty convenience classes. The macro should be
|
||||
/// defined after a \c public: declaration.
|
||||
///
|
||||
/// This macro takes three arguments. The first argument is the classname.
|
||||
/// The second argument is the full class type. The third argument is the
|
||||
/// superclass type (either \c ArrayHandle or another sublcass). Because
|
||||
/// C macros do not handle template parameters very well (the preprocessor
|
||||
/// thinks the template commas are macro argument commas), the second and
|
||||
/// third arguments must be wrapped in parentheses.
|
||||
///
|
||||
/// This macro also defines a Superclass typedef as well as ValueType and
|
||||
/// StorageTag.
|
||||
///
|
||||
/// Note that this macor only works on ArrayHandle subclasses that are
|
||||
/// templated. For ArrayHandle sublcasses that are not templates, use
|
||||
/// VTKM_ARRAY_HANDLE_SUBCLASS_NT.
|
||||
///
|
||||
#define VTKM_ARRAY_HANDLE_SUBCLASS(classname, fullclasstype, superclass) \
|
||||
VTK_M_ARRAY_HANDLE_SUBCLASS_IMPL(classname, fullclasstype, superclass, typename)
|
||||
|
||||
/// \brief Macro to make default methods in ArrayHandle subclasses.
|
||||
///
|
||||
/// This macro defines the default constructors, destructors and assignment
|
||||
/// operators for ArrayHandle subclasses that are not templates. The
|
||||
/// ArrayHandle subclasses are assumed to be empty convenience classes. The
|
||||
/// macro should be defined after a \c public: declaration.
|
||||
///
|
||||
/// This macro takes two arguments. The first argument is the classname. The
|
||||
/// second argument is the superclass type (either \c ArrayHandle or another
|
||||
/// sublcass). Because C macros do not handle template parameters very well
|
||||
/// (the preprocessor thinks the template commas are macro argument commas),
|
||||
/// the second argument must be wrapped in parentheses.
|
||||
///
|
||||
/// This macro also defines a Superclass typedef as well as ValueType and
|
||||
/// StorageTag.
|
||||
///
|
||||
/// Note that this macor only works on ArrayHandle subclasses that are not
|
||||
/// templated. For ArrayHandle sublcasses that are are templates, use
|
||||
/// VTKM_ARRAY_HANDLE_SUBCLASS.
|
||||
///
|
||||
#define VTKM_ARRAY_HANDLE_SUBCLASS_NT(classname, superclass) \
|
||||
VTK_M_ARRAY_HANDLE_SUBCLASS_IMPL(classname, (classname), superclass, )
|
||||
|
||||
/// \brief Manages an array-worth of data.
|
||||
///
|
||||
/// \c ArrayHandle manages as array of data that can be manipulated by VTKm
|
||||
@ -170,6 +257,18 @@ public:
|
||||
this->Internals->ExecutionArrayValid = false;
|
||||
}
|
||||
|
||||
/// Copy constructor.
|
||||
///
|
||||
/// Implemented so that it is defined exclusively in the control environment.
|
||||
/// If there is a separate device for the execution environment (for example,
|
||||
/// with CUDA), then the automatically generated copy constructor could be
|
||||
/// created for all devices, and it would not be valid for all devices.
|
||||
///
|
||||
VTKM_CONT_EXPORT
|
||||
ArrayHandle(const vtkm::cont::ArrayHandle<ValueType,StorageTag> &src)
|
||||
: Internals(src.Internals)
|
||||
{ }
|
||||
|
||||
/// Special constructor for subclass specializations that need to set the
|
||||
/// initial state of the control array. When this constructor is used, it
|
||||
/// is assumed that the control array is valid.
|
||||
@ -182,6 +281,26 @@ public:
|
||||
this->Internals->ExecutionArrayValid = false;
|
||||
}
|
||||
|
||||
/// Destructs an empty ArrayHandle.
|
||||
///
|
||||
/// Implemented so that it is defined exclusively in the control environment.
|
||||
/// If there is a separate device for the execution environment (for example,
|
||||
/// with CUDA), then the automatically generated destructor could be
|
||||
/// created for all devices, and it would not be valid for all devices.
|
||||
///
|
||||
VTKM_CONT_EXPORT
|
||||
virtual ~ArrayHandle() { }
|
||||
|
||||
/// \brief Copies an ArrayHandle
|
||||
///
|
||||
VTKM_CONT_EXPORT
|
||||
vtkm::cont::ArrayHandle<ValueType,StorageTag> &
|
||||
operator=(const vtkm::cont::ArrayHandle<ValueType,StorageTag> &src)
|
||||
{
|
||||
this->Internals = src.Internals;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/// Get the array portal of the control array.
|
||||
///
|
||||
VTKM_CONT_EXPORT PortalControl GetPortalControl()
|
||||
@ -482,6 +601,7 @@ public:
|
||||
bool ExecutionArrayValid;
|
||||
};
|
||||
|
||||
VTKM_CONT_EXPORT
|
||||
ArrayHandle(boost::shared_ptr<InternalStruct> i)
|
||||
: Internals(i)
|
||||
{ }
|
||||
|
@ -48,33 +48,25 @@ struct Cast
|
||||
/// and a type, it creates a new handle that returns the elements of the array cast
|
||||
/// to the specified type.
|
||||
///
|
||||
template <typename ValueType, typename ArrayHandleType>
|
||||
template <typename T, typename ArrayHandleType>
|
||||
class ArrayHandleCast :
|
||||
public vtkm::cont::ArrayHandleTransform<
|
||||
ValueType,
|
||||
T,
|
||||
ArrayHandleType,
|
||||
internal::Cast<typename ArrayHandleType::ValueType, ValueType> >
|
||||
internal::Cast<typename ArrayHandleType::ValueType, T> >
|
||||
{
|
||||
public:
|
||||
typedef vtkm::cont::ArrayHandleTransform<
|
||||
ValueType,
|
||||
ArrayHandleType,
|
||||
internal::Cast<typename ArrayHandleType::ValueType, ValueType> > SuperClass;
|
||||
|
||||
typedef typename SuperClass::StorageTag StorageTag;
|
||||
|
||||
VTKM_CONT_EXPORT
|
||||
ArrayHandleCast() : SuperClass()
|
||||
{ }
|
||||
VTKM_ARRAY_HANDLE_SUBCLASS(
|
||||
ArrayHandleCast,
|
||||
(ArrayHandleCast<T, ArrayHandleType>),
|
||||
(vtkm::cont::ArrayHandleTransform<
|
||||
T,
|
||||
ArrayHandleType,
|
||||
internal::Cast<typename ArrayHandleType::ValueType, T> >));
|
||||
|
||||
VTKM_CONT_EXPORT
|
||||
ArrayHandleCast(const ArrayHandleType &handle)
|
||||
: SuperClass(handle)
|
||||
{ }
|
||||
|
||||
VTKM_CONT_EXPORT
|
||||
ArrayHandleCast(const vtkm::cont::ArrayHandle<ValueType, StorageTag> &src)
|
||||
: SuperClass(src)
|
||||
: Superclass(handle)
|
||||
{ }
|
||||
};
|
||||
|
||||
|
@ -278,6 +278,7 @@ struct ArrayHandleCompositeVectorTraits
|
||||
typedef typename vtkm::internal::FunctionInterface<SignatureWithArrays>::ResultType
|
||||
ValueType;
|
||||
typedef vtkm::cont::internal::Storage<ValueType, Tag> StorageType;
|
||||
typedef vtkm::cont::ArrayHandle<ValueType, Tag> Superclass;
|
||||
};
|
||||
|
||||
// It may seem weird that this specialization throws an exception for
|
||||
@ -482,9 +483,7 @@ private:
|
||||
///
|
||||
template<typename Signature>
|
||||
class ArrayHandleCompositeVector
|
||||
: public vtkm::cont::ArrayHandle<
|
||||
typename internal::ArrayHandleCompositeVectorTraits<Signature>::ValueType,
|
||||
typename internal::ArrayHandleCompositeVectorTraits<Signature>::Tag>
|
||||
: public internal::ArrayHandleCompositeVectorTraits<Signature>::Superclass
|
||||
{
|
||||
typedef typename internal::ArrayHandleCompositeVectorTraits<Signature>::StorageType
|
||||
StorageType;
|
||||
@ -492,15 +491,10 @@ class ArrayHandleCompositeVector
|
||||
ComponentMapType;
|
||||
|
||||
public:
|
||||
typedef vtkm::cont::ArrayHandle<
|
||||
typename internal::ArrayHandleCompositeVectorTraits<Signature>::ValueType,
|
||||
typename internal::ArrayHandleCompositeVectorTraits<Signature>::Tag>
|
||||
Superclass;
|
||||
typedef typename Superclass::ValueType ValueType;
|
||||
typedef typename Superclass::StorageTag StorageTag;
|
||||
|
||||
VTKM_CONT_EXPORT
|
||||
ArrayHandleCompositeVector() : Superclass() { }
|
||||
VTKM_ARRAY_HANDLE_SUBCLASS(
|
||||
ArrayHandleCompositeVector,
|
||||
(ArrayHandleCompositeVector<Signature>),
|
||||
(typename internal::ArrayHandleCompositeVectorTraits<Signature>::Superclass));
|
||||
|
||||
VTKM_CONT_EXPORT
|
||||
ArrayHandleCompositeVector(
|
||||
@ -509,12 +503,6 @@ public:
|
||||
: Superclass(StorageType(arrays, sourceComponents))
|
||||
{ }
|
||||
|
||||
VTKM_CONT_EXPORT
|
||||
ArrayHandleCompositeVector(
|
||||
const vtkm::cont::ArrayHandle<ValueType, StorageTag> &src)
|
||||
: Superclass(src)
|
||||
{ }
|
||||
|
||||
/// Template constructors for passing in types. You'll get weird compile
|
||||
/// errors if the argument types do not actually match the types in the
|
||||
/// signature.
|
||||
|
@ -59,25 +59,20 @@ template<typename T>
|
||||
class ArrayHandleConstant
|
||||
: public vtkm::cont::ArrayHandleImplicit<T, detail::ConstantFunctor<T> >
|
||||
{
|
||||
typedef vtkm::cont::ArrayHandleImplicit<T, detail::ConstantFunctor<T> >
|
||||
Superclass;
|
||||
|
||||
public:
|
||||
typedef typename Superclass::StorageTag StorageTag;
|
||||
VTKM_ARRAY_HANDLE_SUBCLASS(
|
||||
ArrayHandleConstant,
|
||||
(ArrayHandleConstant<T>),
|
||||
(vtkm::cont::ArrayHandleImplicit<T, detail::ConstantFunctor<T> >));
|
||||
|
||||
VTKM_CONT_EXPORT
|
||||
ArrayHandleConstant(T value = T(), vtkm::Id numberOfValues = 0)
|
||||
ArrayHandleConstant(T value, vtkm::Id numberOfValues = 0)
|
||||
: Superclass(detail::ConstantFunctor<T>(value), numberOfValues) { }
|
||||
|
||||
VTKM_CONT_EXPORT
|
||||
ArrayHandleConstant(const vtkm::cont::ArrayHandle<T,StorageTag> &src)
|
||||
: Superclass(src)
|
||||
{ }
|
||||
};
|
||||
|
||||
/// make_ArrayHandleImplicit is convenience function to generate an
|
||||
/// ArrayHandleImplicit. It takes a functor and the virtual length of the
|
||||
/// arry.
|
||||
/// array.
|
||||
///
|
||||
template<typename T>
|
||||
vtkm::cont::ArrayHandleConstant<T>
|
||||
|
@ -109,13 +109,14 @@ class ArrayHandleCounting
|
||||
typename internal::ArrayHandleCountingTraits<CountingValueType>::Tag
|
||||
>
|
||||
{
|
||||
typedef vtkm::cont::ArrayHandle <
|
||||
CountingValueType,
|
||||
typename internal::ArrayHandleCountingTraits<CountingValueType>::Tag
|
||||
> Superclass;
|
||||
public:
|
||||
typedef typename Superclass::ValueType ValueType;
|
||||
typedef typename Superclass::StorageTag StorageTag;
|
||||
VTKM_ARRAY_HANDLE_SUBCLASS(
|
||||
ArrayHandleCounting,
|
||||
(ArrayHandleCounting<CountingValueType>),
|
||||
(vtkm::cont::ArrayHandle<
|
||||
CountingValueType,
|
||||
typename internal::ArrayHandleCountingTraits<CountingValueType>::Tag
|
||||
>));
|
||||
|
||||
VTKM_CONT_EXPORT
|
||||
ArrayHandleCounting(CountingValueType start,
|
||||
@ -124,13 +125,6 @@ public:
|
||||
:Superclass(typename Superclass::PortalConstControl(start, step, length))
|
||||
{
|
||||
}
|
||||
|
||||
VTKM_CONT_EXPORT
|
||||
ArrayHandleCounting():Superclass() {}
|
||||
|
||||
VTKM_CONT_EXPORT
|
||||
ArrayHandleCounting(const vtkm::cont::ArrayHandle<ValueType,StorageTag> &src)
|
||||
: Superclass(src) { }
|
||||
};
|
||||
|
||||
/// A convenience function for creating an ArrayHandleCounting. It takes the
|
||||
|
@ -326,28 +326,23 @@ class ArrayHandleGroupVec
|
||||
VTKM_IS_ARRAY_HANDLE(SourceArrayHandleType);
|
||||
|
||||
public:
|
||||
typedef vtkm::cont::internal::StorageTagGroupVec<
|
||||
SourceArrayHandleType, NUM_COMPONENTS> StorageTag;
|
||||
VTKM_ARRAY_HANDLE_SUBCLASS(
|
||||
ArrayHandleGroupVec,
|
||||
(ArrayHandleGroupVec<SourceArrayHandleType, NUM_COMPONENTS>),
|
||||
(vtkm::cont::ArrayHandle<
|
||||
vtkm::Vec<typename SourceArrayHandleType::ValueType, NUM_COMPONENTS>,
|
||||
vtkm::cont::internal::StorageTagGroupVec<
|
||||
SourceArrayHandleType, NUM_COMPONENTS> >));
|
||||
|
||||
typedef typename SourceArrayHandleType::ValueType ComponentType;
|
||||
typedef vtkm::cont::ArrayHandle<
|
||||
vtkm::Vec<ComponentType,NUM_COMPONENTS>, StorageTag> Superclass;
|
||||
typedef typename Superclass::ValueType ValueType;
|
||||
|
||||
private:
|
||||
typedef vtkm::cont::internal::Storage<ValueType, StorageTag> StorageType;
|
||||
|
||||
public:
|
||||
VTKM_CONT_EXPORT
|
||||
ArrayHandleGroupVec() { }
|
||||
|
||||
VTKM_CONT_EXPORT
|
||||
ArrayHandleGroupVec(const SourceArrayHandleType &sourceArray)
|
||||
: Superclass(StorageType(sourceArray)) { }
|
||||
|
||||
VTKM_CONT_EXPORT
|
||||
ArrayHandleGroupVec(
|
||||
const vtkm::cont::ArrayHandle<ValueType,StorageTag> &source)
|
||||
: Superclass(source) { }
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -85,6 +85,7 @@ struct ArrayHandleImplicitTraits
|
||||
typedef vtkm::cont::StorageTagImplicit<
|
||||
vtkm::cont::detail::ArrayPortalImplicit<ValueType,
|
||||
FunctorType> > StorageTag;
|
||||
typedef vtkm::cont::ArrayHandle<ValueType,StorageTag> Superclass;
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
@ -97,36 +98,24 @@ struct ArrayHandleImplicitTraits
|
||||
/// The functor returns the result of the functor as the value of this
|
||||
/// array at that position.
|
||||
///
|
||||
template <typename ValueType,
|
||||
template <typename T,
|
||||
class FunctorType>
|
||||
class ArrayHandleImplicit
|
||||
: public vtkm::cont::ArrayHandle <
|
||||
ValueType,
|
||||
typename detail::ArrayHandleImplicitTraits<ValueType,
|
||||
FunctorType>::StorageTag >
|
||||
: public detail::ArrayHandleImplicitTraits<T,FunctorType>::Superclass
|
||||
{
|
||||
private:
|
||||
typedef typename detail::ArrayHandleImplicitTraits<ValueType,
|
||||
FunctorType> ArrayTraits;
|
||||
typedef typename detail::ArrayHandleImplicitTraits<T,FunctorType> ArrayTraits;
|
||||
|
||||
public:
|
||||
typedef typename ArrayTraits::StorageTag StorageTag;
|
||||
|
||||
typedef vtkm::cont::ArrayHandle<ValueType,StorageTag> Superclass;
|
||||
|
||||
VTKM_CONT_EXPORT
|
||||
ArrayHandleImplicit()
|
||||
: Superclass(typename Superclass::PortalConstControl(FunctorType(),0)) { }
|
||||
VTKM_ARRAY_HANDLE_SUBCLASS(
|
||||
ArrayHandleImplicit,
|
||||
(ArrayHandleImplicit<T,FunctorType>),
|
||||
(typename ArrayTraits::Superclass));
|
||||
|
||||
VTKM_CONT_EXPORT
|
||||
ArrayHandleImplicit(FunctorType functor, vtkm::Id length)
|
||||
: Superclass(typename Superclass::PortalConstControl(functor,length))
|
||||
{ }
|
||||
|
||||
VTKM_CONT_EXPORT
|
||||
ArrayHandleImplicit(const vtkm::cont::ArrayHandle<ValueType,StorageTag> &src)
|
||||
: Superclass(src)
|
||||
{ }
|
||||
};
|
||||
|
||||
/// make_ArrayHandleImplicit is convenience function to generate an
|
||||
|
@ -45,18 +45,14 @@ struct IndexFunctor {
|
||||
class ArrayHandleIndex
|
||||
: public vtkm::cont::ArrayHandleImplicit<vtkm::Id, detail::IndexFunctor>
|
||||
{
|
||||
typedef vtkm::cont::ArrayHandleImplicit<vtkm::Id, detail::IndexFunctor>
|
||||
Superclass;
|
||||
|
||||
public:
|
||||
typedef Superclass::ValueType ValueType;
|
||||
typedef Superclass::StorageTag StorageTag;
|
||||
VTKM_ARRAY_HANDLE_SUBCLASS_NT(
|
||||
ArrayHandleIndex,
|
||||
(vtkm::cont::ArrayHandleImplicit<vtkm::Id, detail::IndexFunctor>));
|
||||
|
||||
ArrayHandleIndex(vtkm::Id length = 0)
|
||||
VTKM_CONT_EXPORT
|
||||
ArrayHandleIndex(vtkm::Id length)
|
||||
: Superclass(detail::IndexFunctor(), length) { }
|
||||
|
||||
ArrayHandleIndex(const vtkm::cont::ArrayHandle<ValueType,StorageTag> &src)
|
||||
: Superclass(src) { }
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -370,25 +370,23 @@ class ArrayHandlePermutation
|
||||
VTKM_IS_ARRAY_HANDLE(ValueArrayHandleType);
|
||||
|
||||
public:
|
||||
typedef typename ValueArrayHandleType::ValueType ValueType;
|
||||
VTKM_ARRAY_HANDLE_SUBCLASS(
|
||||
ArrayHandlePermutation,
|
||||
(ArrayHandlePermutation<IndexArrayHandleType,ValueArrayHandleType>),
|
||||
(vtkm::cont::ArrayHandle<
|
||||
typename ValueArrayHandleType::ValueType,
|
||||
internal::StorageTagPermutation<
|
||||
IndexArrayHandleType,ValueArrayHandleType> >));
|
||||
|
||||
typedef internal::StorageTagPermutation<IndexArrayHandleType, ValueArrayHandleType>
|
||||
StorageTag;
|
||||
private:
|
||||
typedef vtkm::cont::internal::Storage<ValueType, StorageTag>
|
||||
StorageType;
|
||||
|
||||
public:
|
||||
typedef vtkm::cont::ArrayHandle<ValueType, StorageTag> Superclass;
|
||||
|
||||
ArrayHandlePermutation() : Superclass( ) { }
|
||||
|
||||
VTKM_CONT_EXPORT
|
||||
ArrayHandlePermutation(const IndexArrayHandleType &indexArray,
|
||||
const ValueArrayHandleType &valueArray)
|
||||
: Superclass(StorageType(indexArray, valueArray)) { }
|
||||
|
||||
ArrayHandlePermutation(
|
||||
const vtkm::cont::ArrayHandle<ValueType,StorageTag> &src)
|
||||
: Superclass(src) { }
|
||||
};
|
||||
|
||||
/// make_ArrayHandleTransform is convenience function to generate an
|
||||
|
@ -308,39 +308,32 @@ private:
|
||||
/// the functor operator should work in both the control and execution
|
||||
/// environments.
|
||||
///
|
||||
template <typename ValueType,
|
||||
template <typename T,
|
||||
typename ArrayHandleType,
|
||||
typename FunctorType>
|
||||
class ArrayHandleTransform
|
||||
: public vtkm::cont::ArrayHandle<
|
||||
ValueType,
|
||||
internal::StorageTagTransform<ValueType, ArrayHandleType, FunctorType> >
|
||||
T, internal::StorageTagTransform<T, ArrayHandleType, FunctorType> >
|
||||
{
|
||||
// If the following line gives a compile error, then the ArrayHandleType
|
||||
// template argument is not a valid ArrayHandle type.
|
||||
VTKM_IS_ARRAY_HANDLE(ArrayHandleType);
|
||||
|
||||
public:
|
||||
typedef internal::StorageTagTransform<ValueType, ArrayHandleType, FunctorType>
|
||||
StorageTag;
|
||||
VTKM_ARRAY_HANDLE_SUBCLASS(
|
||||
ArrayHandleTransform,
|
||||
(ArrayHandleTransform<T,ArrayHandleType,FunctorType>),
|
||||
(vtkm::cont::ArrayHandle<
|
||||
T, internal::StorageTagTransform<T, ArrayHandleType, FunctorType> >));
|
||||
|
||||
private:
|
||||
typedef vtkm::cont::internal::Storage<ValueType, StorageTag> StorageType;
|
||||
|
||||
public:
|
||||
typedef vtkm::cont::ArrayHandle<ValueType, StorageTag> Superclass;
|
||||
|
||||
VTKM_CONT_EXPORT
|
||||
ArrayHandleTransform() : Superclass( ) { }
|
||||
|
||||
public:
|
||||
VTKM_CONT_EXPORT
|
||||
ArrayHandleTransform(const ArrayHandleType &handle,
|
||||
const FunctorType &functor = FunctorType())
|
||||
: Superclass(StorageType(handle, functor)) { }
|
||||
|
||||
VTKM_CONT_EXPORT
|
||||
ArrayHandleTransform(const vtkm::cont::ArrayHandle<ValueType,StorageTag> &src)
|
||||
: Superclass(src) { }
|
||||
};
|
||||
|
||||
/// make_ArrayHandleTransform is convenience function to generate an
|
||||
|
@ -39,19 +39,17 @@ class ArrayHandleUniformPointCoordinates
|
||||
vtkm::internal::ArrayPortalUniformPointCoordinates> >
|
||||
{
|
||||
public:
|
||||
typedef vtkm::Vec<vtkm::FloatDefault,3> ValueType;
|
||||
typedef vtkm::cont::StorageTagImplicit<
|
||||
vtkm::internal::ArrayPortalUniformPointCoordinates> StorageTag;
|
||||
|
||||
typedef vtkm::cont::ArrayHandle<ValueType, StorageTag> Superclass;
|
||||
VTKM_ARRAY_HANDLE_SUBCLASS_NT(
|
||||
ArrayHandleUniformPointCoordinates,
|
||||
(vtkm::cont::ArrayHandle<
|
||||
vtkm::Vec<vtkm::FloatDefault,3>,
|
||||
vtkm::cont::StorageTagImplicit<
|
||||
vtkm::internal::ArrayPortalUniformPointCoordinates> >));
|
||||
|
||||
private:
|
||||
typedef vtkm::cont::internal::Storage<ValueType, StorageTag> StorageType;
|
||||
|
||||
public:
|
||||
VTKM_CONT_EXPORT
|
||||
ArrayHandleUniformPointCoordinates() : Superclass() { }
|
||||
|
||||
VTKM_CONT_EXPORT
|
||||
ArrayHandleUniformPointCoordinates(
|
||||
vtkm::Id3 dimensions,
|
||||
@ -61,12 +59,6 @@ public:
|
||||
StorageType(vtkm::internal::ArrayPortalUniformPointCoordinates(
|
||||
dimensions, origin, spacing)))
|
||||
{ }
|
||||
|
||||
VTKM_CONT_EXPORT
|
||||
ArrayHandleUniformPointCoordinates(
|
||||
const vtkm::cont::ArrayHandle<ValueType,StorageTag> &src)
|
||||
: Superclass(src)
|
||||
{ }
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -170,6 +170,10 @@ struct ArrayHandleZipTraits {
|
||||
/// The appropriately templated tag.
|
||||
///
|
||||
typedef StorageTagZip<FirstHandleType,SecondHandleType> Tag;
|
||||
|
||||
/// The superclass for ArrayHandleZip.
|
||||
///
|
||||
typedef vtkm::cont::ArrayHandle<ValueType,Tag> Superclass;
|
||||
};
|
||||
|
||||
|
||||
@ -348,10 +352,7 @@ private:
|
||||
template<typename FirstHandleType,
|
||||
typename SecondHandleType>
|
||||
class ArrayHandleZip
|
||||
: public vtkm::cont::ArrayHandle<
|
||||
typename internal::ArrayHandleZipTraits<FirstHandleType,SecondHandleType>::ValueType,
|
||||
typename internal::ArrayHandleZipTraits<FirstHandleType,SecondHandleType>::Tag
|
||||
>
|
||||
: public internal::ArrayHandleZipTraits<FirstHandleType,SecondHandleType>::Superclass
|
||||
{
|
||||
// If the following line gives a compile error, then the FirstHandleType
|
||||
// template argument is not a valid ArrayHandle type.
|
||||
@ -362,25 +363,20 @@ class ArrayHandleZip
|
||||
VTKM_IS_ARRAY_HANDLE(SecondHandleType);
|
||||
|
||||
public:
|
||||
typedef typename internal::ArrayHandleZipTraits<FirstHandleType,
|
||||
SecondHandleType>::ValueType ValueType;
|
||||
typedef typename internal::ArrayHandleZipTraits<FirstHandleType,
|
||||
SecondHandleType>::Tag StorageTag;
|
||||
|
||||
typedef vtkm::cont::ArrayHandle<ValueType, StorageTag> Superclass;
|
||||
VTKM_ARRAY_HANDLE_SUBCLASS(
|
||||
ArrayHandleZip,
|
||||
(ArrayHandleZip<FirstHandleType,SecondHandleType>),
|
||||
(typename internal::ArrayHandleZipTraits<
|
||||
FirstHandleType,SecondHandleType>::Superclass));
|
||||
|
||||
private:
|
||||
typedef vtkm::cont::internal::Storage<ValueType, StorageTag> StorageType;
|
||||
|
||||
public:
|
||||
ArrayHandleZip() : Superclass( ) { }
|
||||
|
||||
VTKM_CONT_EXPORT
|
||||
ArrayHandleZip(const FirstHandleType &firstArray,
|
||||
const SecondHandleType &secondArray)
|
||||
: Superclass( StorageType( firstArray, secondArray ) ) { }
|
||||
|
||||
ArrayHandleZip(const vtkm::cont::ArrayHandle<ValueType, StorageTag> &src)
|
||||
: Superclass(src) { }
|
||||
};
|
||||
|
||||
/// A convenience function for creating an ArrayHandleZip. It takes the two
|
||||
|
@ -44,6 +44,22 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
VTKM_CONT_EXPORT
|
||||
CellSet(const vtkm::cont::CellSet &src)
|
||||
: Name(src.Name),
|
||||
Dimensionality(src.Dimensionality),
|
||||
LogicalStructure(src.LogicalStructure)
|
||||
{ }
|
||||
|
||||
VTKM_CONT_EXPORT
|
||||
CellSet &operator=(const vtkm::cont::CellSet &src)
|
||||
{
|
||||
this->Name = src.Name;
|
||||
this->Dimensionality = src.Dimensionality;
|
||||
this->LogicalStructure = src.LogicalStructure;
|
||||
return *this;
|
||||
}
|
||||
|
||||
virtual ~CellSet()
|
||||
{
|
||||
}
|
||||
|
@ -66,15 +66,16 @@ template<typename ShapeStorageTag = VTKM_DEFAULT_SHAPE_STORAGE_TAG,
|
||||
typename OffsetsStorageTag = VTKM_DEFAULT_OFFSETS_STORAGE_TAG >
|
||||
class CellSetExplicit : public CellSet
|
||||
{
|
||||
typedef CellSetExplicit< ShapeStorageTag,
|
||||
NumIndicesStorageTag,
|
||||
ConnectivityStorageTag,
|
||||
OffsetsStorageTag > Thisclass;
|
||||
|
||||
template<typename FromTopology, typename ToTopology>
|
||||
struct ConnectivityChooser
|
||||
{
|
||||
typedef CellSetExplicit< ShapeStorageTag,
|
||||
NumIndicesStorageTag,
|
||||
ConnectivityStorageTag,
|
||||
OffsetsStorageTag > CellSetExplicitType;
|
||||
typedef typename detail::CellSetExplicitConnectivityChooser<
|
||||
CellSetExplicitType,
|
||||
Thisclass,
|
||||
FromTopology,
|
||||
ToTopology>::ConnectivityType ConnectivityType;
|
||||
|
||||
@ -118,6 +119,30 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
VTKM_CONT_EXPORT
|
||||
CellSetExplicit(const Thisclass &src)
|
||||
: CellSet(src),
|
||||
PointToCell(src.PointToCell),
|
||||
CellToPoint(src.CellToPoint),
|
||||
ConnectivityLength(src.ConnectivityLength),
|
||||
NumberOfCells(src.NumberOfCells),
|
||||
NumberOfPoints(src.NumberOfPoints)
|
||||
{ }
|
||||
|
||||
VTKM_CONT_EXPORT
|
||||
Thisclass &operator=(const Thisclass &src)
|
||||
{
|
||||
this->CellSet::operator=(src);
|
||||
this->PointToCell = src.PointToCell;
|
||||
this->CellToPoint = src.CellToPoint;
|
||||
this->ConnectivityLength = src.ConnectivityLength;
|
||||
this->NumberOfCells = src.NumberOfCells;
|
||||
this->NumberOfPoints = src.NumberOfPoints;
|
||||
return *this;
|
||||
}
|
||||
|
||||
virtual ~CellSetExplicit() { }
|
||||
|
||||
virtual vtkm::Id GetNumberOfCells() const
|
||||
{
|
||||
return this->PointToCell.GetNumberOfElements();
|
||||
|
@ -70,6 +70,9 @@ template< typename ValidCellArrayHandleType,
|
||||
typename OriginalCellSet >
|
||||
class CellSetPermutation : public CellSet
|
||||
{
|
||||
typedef vtkm::cont::CellSetPermutation<
|
||||
ValidCellArrayHandleType,OriginalCellSet> Thisclass;
|
||||
|
||||
public:
|
||||
typedef typename vtkm::cont::internal::CellSetPermutationTraits<
|
||||
ValidCellArrayHandleType,OriginalCellSet>::PermutedCellSetType PermutedCellSetType;
|
||||
@ -100,6 +103,24 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
VTKM_CONT_EXPORT
|
||||
CellSetPermutation(const Thisclass &src)
|
||||
: CellSet(src),
|
||||
ValidCellIds(src.ValidCellIds),
|
||||
PermutedCellSet(src.PermutedCellSet)
|
||||
{ }
|
||||
|
||||
VTKM_CONT_EXPORT
|
||||
Thisclass &operator=(const Thisclass &src)
|
||||
{
|
||||
this->CellSet::operator=(src);
|
||||
this->ValidCellIds = src.ValidCellIds;
|
||||
this->PermutedCellSet = src.PermutedCellSet;
|
||||
return *this;
|
||||
}
|
||||
|
||||
virtual ~CellSetPermutation() { }
|
||||
|
||||
//This is the way you can fill the memory from another system without copying
|
||||
VTKM_CONT_EXPORT
|
||||
void Fill(const ValidCellArrayHandleType &validCellIds,
|
||||
|
@ -45,6 +45,7 @@ class CellSetSingleType :
|
||||
typename vtkm::cont::ArrayHandleCounting<vtkm::Id>::StorageTag //IndexOffsetStorageTag
|
||||
>
|
||||
{
|
||||
typedef vtkm::cont::CellSetSingleType<ConnectivityStorageTag> Thisclass;
|
||||
typedef vtkm::cont::CellSetExplicit<
|
||||
typename vtkm::cont::ArrayHandleConstant<vtkm::UInt8>::StorageTag,
|
||||
typename vtkm::cont::ArrayHandleConstant<vtkm::IdComponent>::StorageTag,
|
||||
@ -67,6 +68,21 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
VTKM_CONT_EXPORT
|
||||
CellSetSingleType(const Thisclass &src)
|
||||
: Superclass(src), CellTypeAsId(src.CellTypeAsId)
|
||||
{ }
|
||||
|
||||
VTKM_CONT_EXPORT
|
||||
Thisclass &operator=(const Thisclass &src)
|
||||
{
|
||||
this->Superclass::operator=(src);
|
||||
this->CellTypeAsId = src.CellTypeAsId;
|
||||
return *this;
|
||||
}
|
||||
|
||||
virtual ~CellSetSingleType() { }
|
||||
|
||||
/// First method to add cells -- one at a time.
|
||||
VTKM_CONT_EXPORT
|
||||
void PrepareToAddCells(vtkm::Id numShapes, vtkm::Id connectivityMaxLen)
|
||||
|
@ -35,6 +35,7 @@ template<vtkm::IdComponent DIMENSION>
|
||||
class CellSetStructured : public CellSet
|
||||
{
|
||||
private:
|
||||
typedef vtkm::cont::CellSetStructured<DIMENSION> Thisclass;
|
||||
typedef vtkm::internal::ConnectivityStructuredInternals<DIMENSION>
|
||||
InternalsType;
|
||||
|
||||
@ -49,6 +50,20 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
VTKM_CONT_EXPORT
|
||||
CellSetStructured(const Thisclass &src)
|
||||
: CellSet(src), Structure(src.Structure)
|
||||
{ }
|
||||
|
||||
VTKM_CONT_EXPORT
|
||||
Thisclass &operator=(const Thisclass &src)
|
||||
{
|
||||
this->CellSet::operator=(src);
|
||||
this->Structure = src.Structure;
|
||||
return *this;
|
||||
}
|
||||
|
||||
virtual ~CellSetStructured() { }
|
||||
|
||||
virtual vtkm::Id GetNumberOfCells() const
|
||||
{
|
||||
|
@ -183,6 +183,17 @@ public:
|
||||
detail::DynamicArrayHandleCopyHelper::GetArrayHandleContainer(src))
|
||||
{ }
|
||||
|
||||
VTKM_CONT_EXPORT
|
||||
~DynamicArrayHandleBase() { }
|
||||
|
||||
VTKM_CONT_EXPORT
|
||||
vtkm::cont::DynamicArrayHandleBase<TypeList,StorageList> &
|
||||
operator=(const vtkm::cont::DynamicArrayHandleBase<TypeList,StorageList> &src)
|
||||
{
|
||||
this->ArrayContainer = src.ArrayContainer;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/// Returns true if this array is of the provided type and uses the provided
|
||||
/// storage.
|
||||
///
|
||||
|
@ -117,6 +117,17 @@ public:
|
||||
detail::DynamicCellSetCopyHelper::GetCellSetContainer(src))
|
||||
{ }
|
||||
|
||||
VTKM_CONT_EXPORT
|
||||
~DynamicCellSetBase() { }
|
||||
|
||||
VTKM_CONT_EXPORT
|
||||
vtkm::cont::DynamicCellSetBase<CellSetList> &
|
||||
operator=(const vtkm::cont::DynamicCellSetBase<CellSetList> &src)
|
||||
{
|
||||
this->CellSetContainer = src.CellSetContainer;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/// Returns true if this cell set is of the provided type.
|
||||
///
|
||||
template<typename CellSetType>
|
||||
|
@ -80,6 +80,7 @@ void SetParameter(ParameterContainer<FunctionSignature> ¶meters,
|
||||
|
||||
template<vtkm::IdComponent NumToCopy, vtkm::IdComponent ParameterIndex = 1>
|
||||
struct FunctionInterfaceCopyParameters {
|
||||
VTKM_SUPPRESS_EXEC_WARNINGS
|
||||
template<typename DestSignature, typename SrcSignature>
|
||||
static
|
||||
VTKM_EXEC_CONT_EXPORT
|
||||
|
Loading…
Reference in New Issue
Block a user