Merge topic 'all_array_portals_have_set'

629271bc Make sure all ArrayPortals have a Set method.

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !676
This commit is contained in:
Robert Maynard 2017-02-01 09:08:51 -05:00 committed by Kitware Robot
commit 6e4e07b378
9 changed files with 54 additions and 5 deletions

@ -213,6 +213,17 @@ public:
return localPortals.GetReturnValue();
}
VTKM_SUPPRESS_EXEC_WARNINGS
VTKM_EXEC_CONT
void Set(vtkm::Id vtkmNotUsed(index),
const ValueType &vtkmNotUsed(value)) const
{
// There is no technical reason why this cannot be implemented. As of this
// writing no one has needed to write to a composite vector yet.
VTKM_ASSERT(false && "Set not yet implemented for composite vector. Do you volunteer to implement it?");
}
private:
PortalTypes Portals;
ComponentMapType SourceComponents;

@ -82,6 +82,13 @@ public:
this->Step*ValueType(static_cast<ComponentType>(index)));
}
VTKM_EXEC_CONT
void Set(vtkm::Id vtkmNotUsed(index),
const ValueType &vtkmNotUsed(value)) const
{
VTKM_ASSERT(false && "Cannot write to read-only counting array.");
}
private:
ValueType Start;
ValueType Step;

@ -60,9 +60,17 @@ public:
VTKM_EXEC_CONT
vtkm::Id GetNumberOfValues() const { return this->NumberOfValues; }
VTKM_SUPPRESS_EXEC_WARNINGS
VTKM_EXEC_CONT
ValueType Get(vtkm::Id index) const { return this->Functor(index); }
VTKM_EXEC_CONT
void Set(vtkm::Id vtkmNotUsed(index),
const ValueType &vtkmNotUsed(value)) const
{
VTKM_ASSERT(false && "Cannot write to read-only implicit array.");
}
typedef vtkm::cont::internal::IteratorFromArrayPortal<
ArrayPortalImplicit<ValueType,FunctorType> > IteratorType;

@ -88,6 +88,14 @@ public:
return this->Functor(this->Portal.Get(index));
}
VTKM_SUPPRESS_EXEC_WARNINGS
VTKM_EXEC_CONT
void Set(vtkm::Id vtkmNotUsed(index),
const ValueType &vtkmNotUsed(value)) const
{
VTKM_ASSERT(false && "Cannot write to read-only transform array. (No inverse transform given.)");
}
VTKM_SUPPRESS_EXEC_WARNINGS
VTKM_EXEC_CONT
const PortalType &GetPortal() const { return this->Portal; }

@ -72,8 +72,9 @@ public:
VTKM_CONT
ValueType Get(vtkm::Id index) const;
/// Sets a value in the array. This function may not exist for an ArrayPortal
/// pointing to a const array.
/// Sets a value in the array. If it is not possible to set a value in the
/// array, this method may error out (for example with a VTKM_ASSERT). In
/// this case the behavior is undefined.
///
VTKM_CONT
void Set(vtkm::Id index, const ValueType &value) const;

@ -87,6 +87,13 @@ public:
"ArrayHandleCuda only provides access to the device pointer.");
}
VTKM_CONT
void Set(vtkm::Id vtkmNotUsed(index), T vtkmNotUsed(value)) const
{
throw vtkm::cont::ErrorControlBadType(
"ArrayHandleCuda only provides access to the device pointer.");
}
VTKM_CONT
DevicePointer GetDevicePointer() const
{

@ -181,6 +181,13 @@ public:
return *this->IteratorAt(index);
}
VTKM_SUPPRESS_EXEC_WARNINGS
VTKM_EXEC_CONT
void Set(vtkm::Id vtkmNotUsed(index), const ValueType& vtkmNotUsed(value)) const
{
VTKM_ASSERT(false && "Attempted to write to constant array.");
}
VTKM_SUPPRESS_EXEC_WARNINGS
VTKM_EXEC_CONT
IteratorT GetIteratorBegin() const {

@ -303,7 +303,7 @@ private:
{
vtkm::Id implicitLen = length - start_pos;
vtkm::Id basicLen = start_pos;
// make an implicit array
ValueHandleType implicit =
vtkm::cont::make_ArrayHandleImplicit<ValueType>(functor,

@ -346,8 +346,8 @@ public:
__host__ __device__
void Set(vtkm::Id index, ValueType value) const {
*(this->BeginIterator + index) = value;
void Set(vtkm::Id vtkmNotUsed(index), ValueType vtkmNotUsed(value)) const {
VTKM_ASSERT("Cannot set to const array.");
}
VTKM_EXEC_CONT