Esempio n. 1
0
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
IDataArray::Pointer StatsDataArray::deepCopy(bool forceNoAllocate)
{
  StatsDataArray::Pointer daCopyPtr = StatsDataArray::New();
  if(forceNoAllocate == false)
  {
    daCopyPtr->resize(getNumberOfTuples());
    StatsDataArray& daCopy = *daCopyPtr;
    for(size_t i = 0; i < getNumberOfTuples(); i++)
    {
      daCopy[i] = m_StatsDataArray[i];
    }
  }
  return daCopyPtr;
}
Esempio n. 2
0
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
IDataArray::Pointer StatsDataArray::reorderCopy(QVector<size_t> newOrderMap)
{
  if( static_cast<size_t>(newOrderMap.size()) != getNumberOfTuples())
  {
    return IDataArray::Pointer();
  }
  StatsDataArray::Pointer daCopyPtr = StatsDataArray::New();
  daCopyPtr->resize(getNumberOfTuples());
  daCopyPtr->initializeWithZeros();
  StatsDataArray& daCopy = *daCopyPtr;
  for(size_t i = 0; i < getNumberOfTuples(); i++)
  {
    daCopy[newOrderMap[i]] = m_StatsDataArray[i];
  }

  return daCopyPtr;
}