Correct issues found in code review.

This commit is contained in:
Robert Maynard 2015-09-25 11:45:09 -04:00
parent 82b977da0e
commit dbed882709
2 changed files with 20 additions and 14 deletions

@ -215,19 +215,23 @@ public:
this->PointToCell.ElementsValid = true;
if(offsets.size() == cellTypes.size())
{
{
this->PointToCell.IndexOffsets.Allocate( static_cast<vtkm::Id>(offsets.size()) );
std::copy(offsets.begin(), offsets.end(),
vtkm::cont::ArrayPortalToIteratorBegin(
this->PointToCell.IndexOffsets.GetPortalControl()));
this->PointToCell.IndexOffsetsValid = true;
}
}
else
{
{
this->PointToCell.IndexOffsetsValid = false;
if (offsets.size() != 0)
{
throw vtkm::cont::ErrorControlBadValue(
"Explicit cell offsets array unexpected size. "
"Use an empty array to automatically generate.");
}
this->PointToCell.IndexOffsetsValid = false;
}
}
/// Second method to add cells -- all at once.
@ -246,14 +250,20 @@ public:
this->PointToCell.ElementsValid = true;
if(offsets.GetNumberOfValues() == cellTypes.GetNumberOfValues())
{
{
this->PointToCell.IndexOffsets = offsets;
this->PointToCell.IndexOffsetsValid = true;
}
}
else
{
{
this->PointToCell.IndexOffsetsValid = false;
if (offsets.GetNumberOfValues() != 0)
{
throw vtkm::cont::ErrorControlBadValue(
"Explicit cell offsets array unexpected size. "
"Use an empty array to automatically generate.");
}
}
}
template <typename DeviceAdapter, typename FromTopology, typename ToTopology>

@ -25,10 +25,6 @@
#include <vtkm/cont/Assert.h>
#include <vtkm/cont/DeviceAdapterAlgorithm.h>
VTKM_THIRDPARTY_PRE_INCLUDE
#include <boost/utility/enable_if.hpp>
VTKM_THIRDPARTY_POST_INCLUDE
namespace vtkm {
namespace cont {
namespace internal {
@ -111,12 +107,12 @@ struct ConnectivityExplicitInternals
VTKM_ASSERT_CONT(this->ElementsValid);
if(!this->IndexOffsetsValid)
{
{
buildIndexOffsets(this->NumIndices,
this->IndexOffsets,
Device());
this->IndexOffsetsValid = true;
}
}
}
VTKM_CONT_EXPORT