Simplify use of ControlArrayValid

Can allocate and set in one step to simplify the code.
This commit is contained in:
Kenneth Moreland 2020-03-16 11:19:23 -06:00
parent acc9774f67
commit 594c73c06d
3 changed files with 6 additions and 12 deletions

@ -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();