Skip to content
Snippets Groups Projects
Commit dcb032fc authored by Kenneth Moreland's avatar Kenneth Moreland
Browse files

Merge branch 'expose-storage' into 'master'

Expose storage in ArrayHandle, and Expose data array in StorageBasic.



See merge request !487
parents b50e18b3 2ade3ba8
No related branches found
No related tags found
1 merge request!487Expose storage in ArrayHandle, and Expose data array in StorageBasic.
Pipeline #
......@@ -232,10 +232,10 @@ template<
class ArrayHandle : public internal::ArrayHandleBase
{
private:
typedef vtkm::cont::internal::Storage<T,StorageTag_> StorageType;
typedef vtkm::cont::internal::ArrayHandleExecutionManagerBase<T,StorageTag_>
ExecutionManagerType;
public:
typedef vtkm::cont::internal::Storage<T,StorageTag_> StorageType;
typedef T ValueType;
typedef StorageTag_ StorageTag;
typedef typename StorageType::PortalType PortalControl;
......@@ -302,6 +302,38 @@ public:
return *this;
}
/// Get the storage.
///
VTKM_CONT_EXPORT StorageType& GetStorage()
{
this->SyncControlArray();
if (this->Internals->ControlArrayValid)
{
return this->Internals->ControlArray;
}
else
{
throw vtkm::cont::ErrorControlInternal(
"ArrayHandle::SyncControlArray did not make control array valid.");
}
}
/// Get the storage.
///
VTKM_CONT_EXPORT const StorageType& GetStorage() const
{
this->SyncControlArray();
if (this->Internals->ControlArrayValid)
{
return this->Internals->ControlArray;
}
else
{
throw vtkm::cont::ErrorControlInternal(
"ArrayHandle::SyncControlArray did not make control array valid.");
}
}
/// Get the array portal of the control array.
///
VTKM_CONT_EXPORT PortalControl GetPortalControl()
......
......@@ -322,6 +322,23 @@ public:
return PortalConstType(this->Array, this->Array + this->NumberOfValues);
}
/// \brief Get a pointer to the underlying data structure.
///
/// This method returns the pointer to the array held by this array. The
/// memory associated with this array still belongs to the Storage (i.e.
/// Storage will eventually deallocate the array).
///
VTKM_CONT_EXPORT
ValueType *GetArray()
{
return this->Array;
}
VTKM_CONT_EXPORT
const ValueType *GetArray() const
{
return this->Array;
}
/// \brief Take the reference away from this object.
///
/// This method returns the pointer to the array held by this array. It then
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment