Commit 80c53e6a authored by Robert Maynard's avatar Robert Maynard
Browse files

Merge branch 'cleanup_indention_in_serial_adapter' into 'master'

Clean up indentation and remove dead code.

See merge request !51
parents d57c3986 49467f3c
......@@ -584,8 +584,8 @@ private:
//need too handle how we are going to add two numbers together
//based on the keyStates that they have
#if 1 // Make it work for parallel inclusive scan. Will end up with all start bits = 1
// the following logic should change if you use a different parallel scan algorithm.
// Make it work for parallel inclusive scan. Will end up with all start bits = 1
// the following logic should change if you use a different parallel scan algorithm.
if (!b.second.fStart) {
// if b is not START, then it's safe to sum a & b.
// Propagate a's start flag to b
......@@ -594,27 +594,6 @@ private:
ReduceKeySeriesStates(a.second.fStart, b.second.fEnd));
}
return b;
#else // Works only for sequencial scan
if(a.second == States::START && b.second == States::END)
{
return ReturnType(this->BinaryFunctor(a.first,
b.first),
States::START_AND_END); //with second type as START_AND_END
}
else if((a.second == States::START || a.second == States::MIDDLE) &&
(b.second == States::MIDDLE || b.second == States::END))
{
//note that we cant have START + END as that is handled above
//as a special use case
return ReturnType( this->BinaryFunctor(a.first,
b.first),
b.second); //with second type as b.second
}
else
{
return b;
}
#endif
}
};
......
......@@ -311,24 +311,24 @@ private:
vtkm::cont::ArrayHandle<Vout,StorageVout> &values_out
)
{
typedef typename vtkm::cont::ArrayHandle<Vin,StorageVin>
::template ExecutionTypes<Device>::PortalConst PortalVIn;
typedef typename vtkm::cont::ArrayHandle<I,StorageI>
::template ExecutionTypes<Device>::PortalConst PortalI;
typedef typename vtkm::cont::ArrayHandle<Vout,StorageVout>
::template ExecutionTypes<Device>::Portal PortalVout;
typedef typename vtkm::cont::ArrayHandle<Vin,StorageVin>
::template ExecutionTypes<Device>::PortalConst PortalVIn;
typedef typename vtkm::cont::ArrayHandle<I,StorageI>
::template ExecutionTypes<Device>::PortalConst PortalI;
typedef typename vtkm::cont::ArrayHandle<Vout,StorageVout>
::template ExecutionTypes<Device>::Portal PortalVout;
const vtkm::Id n = values.GetNumberOfValues();
VTKM_ASSERT_CONT(n == index.GetNumberOfValues() );
const vtkm::Id n = values.GetNumberOfValues();
VTKM_ASSERT_CONT(n == index.GetNumberOfValues() );
PortalVIn valuesPortal = values.PrepareForInput(Device());
PortalI indexPortal = index.PrepareForInput(Device());
PortalVout valuesOutPortal = values_out.PrepareForOutput(n, Device());
PortalVIn valuesPortal = values.PrepareForInput(Device());
PortalI indexPortal = index.PrepareForInput(Device());
PortalVout valuesOutPortal = values_out.PrepareForOutput(n, Device());
for (vtkm::Id i=0; i<n; i++)
{
valuesOutPortal.Set( i, valuesPortal.Get(indexPortal.Get(i)) );
}
for (vtkm::Id i=0; i<n; i++)
{
valuesOutPortal.Set( i, valuesPortal.Get(indexPortal.Get(i)) );
}
}
private:
......@@ -339,17 +339,17 @@ private:
vtkm::cont::ArrayHandle<U,StorageU> &values,
Compare comp)
{
//combine the keys and values into a ZipArrayHandle
//we than need to specify a custom compare function wrapper
//that only checks for key side of the pair, using the custom compare
//functor that the user passed in
typedef vtkm::cont::ArrayHandle<T,StorageT> KeyType;
typedef vtkm::cont::ArrayHandle<U,StorageU> ValueType;
typedef vtkm::cont::ArrayHandleZip<KeyType,ValueType> ZipHandleType;
ZipHandleType zipHandle =
vtkm::cont::make_ArrayHandleZip(keys,values);
Sort(zipHandle,KeyCompare<T,U,Compare>(comp));
//combine the keys and values into a ZipArrayHandle
//we than need to specify a custom compare function wrapper
//that only checks for key side of the pair, using the custom compare
//functor that the user passed in
typedef vtkm::cont::ArrayHandle<T,StorageT> KeyType;
typedef vtkm::cont::ArrayHandle<U,StorageU> ValueType;
typedef vtkm::cont::ArrayHandleZip<KeyType,ValueType> ZipHandleType;
ZipHandleType zipHandle =
vtkm::cont::make_ArrayHandleZip(keys,values);
Sort(zipHandle,KeyCompare<T,U,Compare>(comp));
}
public:
......@@ -358,7 +358,7 @@ public:
vtkm::cont::ArrayHandle<T,StorageT> &keys,
vtkm::cont::ArrayHandle<U,StorageU> &values)
{
SortByKey(keys, values, std::less<T>());
SortByKey(keys, values, std::less<T>());
}
template<typename T, typename U, class StorageT, class StorageU, class Less>
......@@ -368,22 +368,24 @@ public:
const Less &less)
{
internal::WrappedBinaryOperator<bool, Less > wrappedCompare( less );
if (sizeof(U) > sizeof(vtkm::Id)) {
/// More efficient sort:
/// Move value indexes when sorting and reorder the value array at last
typedef vtkm::cont::ArrayHandle<U,StorageU> ValueType;
typedef vtkm::cont::ArrayHandle<vtkm::Id,StorageU> IndexType;
IndexType indexArray;
ValueType valuesScattered;
Copy( make_ArrayHandleCounting(0, keys.GetNumberOfValues()), indexArray);
SortByKeyDirect(keys, indexArray, wrappedCompare);
Scatter(values, indexArray, valuesScattered);
Copy( valuesScattered, values );
} else
if (sizeof(U) > sizeof(vtkm::Id))
{
/// More efficient sort:
/// Move value indexes when sorting and reorder the value array at last
typedef vtkm::cont::ArrayHandle<U,StorageU> ValueType;
typedef vtkm::cont::ArrayHandle<vtkm::Id,StorageU> IndexType;
IndexType indexArray;
ValueType valuesScattered;
Copy( make_ArrayHandleCounting(0, keys.GetNumberOfValues()), indexArray);
SortByKeyDirect(keys, indexArray, wrappedCompare);
Scatter(values, indexArray, valuesScattered);
Copy( valuesScattered, values );
}
else
{
SortByKeyDirect(keys, values, wrappedCompare);
SortByKeyDirect(keys, values, wrappedCompare);
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment