mirror of
https://gitlab.kitware.com/vtk/vtk-m
synced 2024-09-08 13:23:51 +00:00
Simplify use of ControlArrayValid
Can allocate and set in one step to simplify the code.
This commit is contained in:
parent
acc9774f67
commit
594c73c06d
@ -749,8 +749,7 @@ protected:
|
||||
// There may be array portals that already have a reference to the flag. Those portals
|
||||
// will stay in an invalid state whereas new portals will go to a valid state. To
|
||||
// handle both conditions, drop the old reference and create a new one.
|
||||
this->ControlArrayValid.reset(new bool);
|
||||
*this->ControlArrayValid = true;
|
||||
this->ControlArrayValid.reset(new bool(true));
|
||||
}
|
||||
else // value == false and ControlArrayValid == true
|
||||
{
|
||||
|
@ -21,19 +21,17 @@ template <typename T, typename S>
|
||||
ArrayHandle<T, S>::InternalStruct::InternalStruct(
|
||||
const typename ArrayHandle<T, S>::StorageType& storage)
|
||||
: ControlArray(storage)
|
||||
, ControlArrayValid(new bool)
|
||||
, ControlArrayValid(new bool(true))
|
||||
, ExecutionArrayValid(false)
|
||||
{
|
||||
*this->ControlArrayValid = true;
|
||||
}
|
||||
|
||||
template <typename T, typename S>
|
||||
ArrayHandle<T, S>::InternalStruct::InternalStruct(typename ArrayHandle<T, S>::StorageType&& storage)
|
||||
: ControlArray(std::move(storage))
|
||||
, ControlArrayValid(new bool)
|
||||
, ControlArrayValid(new bool(true))
|
||||
, ExecutionArrayValid(false)
|
||||
{
|
||||
*this->ControlArrayValid = true;
|
||||
}
|
||||
|
||||
template <typename T, typename S>
|
||||
|
@ -226,29 +226,26 @@ struct VTKM_CONT_EXPORT ArrayHandleImpl
|
||||
|
||||
template <typename T>
|
||||
VTKM_CONT explicit InternalStruct(T)
|
||||
: ControlArrayValid(new bool)
|
||||
: ControlArrayValid(new bool(false))
|
||||
, ControlArray(new vtkm::cont::internal::Storage<T, vtkm::cont::StorageTagBasic>())
|
||||
{
|
||||
*this->ControlArrayValid = false;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
VTKM_CONT explicit InternalStruct(
|
||||
const vtkm::cont::internal::Storage<T, vtkm::cont::StorageTagBasic>& storage)
|
||||
: ControlArrayValid(new bool)
|
||||
: ControlArrayValid(new bool(true))
|
||||
, ControlArray(new vtkm::cont::internal::Storage<T, vtkm::cont::StorageTagBasic>(storage))
|
||||
{
|
||||
*this->ControlArrayValid = true;
|
||||
}
|
||||
|
||||
VTKM_CONT
|
||||
template <typename T>
|
||||
explicit InternalStruct(vtkm::cont::internal::Storage<T, vtkm::cont::StorageTagBasic>&& storage)
|
||||
: ControlArrayValid(new bool)
|
||||
: ControlArrayValid(new bool(true))
|
||||
, ControlArray(
|
||||
new vtkm::cont::internal::Storage<T, vtkm::cont::StorageTagBasic>(std::move(storage)))
|
||||
{
|
||||
*this->ControlArrayValid = true;
|
||||
}
|
||||
|
||||
~InternalStruct();
|
||||
|
Loading…
Reference in New Issue
Block a user