本文整理汇总了C++中idataarray::Pointer::eraseTuples方法的典型用法代码示例。如果您正苦于以下问题:C++ Pointer::eraseTuples方法的具体用法?C++ Pointer::eraseTuples怎么用?C++ Pointer::eraseTuples使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类idataarray::Pointer
的用法示例。
在下文中一共展示了Pointer::eraseTuples方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: removeInactiveObjects
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
bool AttributeMatrix::removeInactiveObjects(QVector<bool> activeObjects, Int32ArrayType::Pointer Ids)
{
bool acceptableMatrix = false;
//Only valid for feature or ensemble type matrices
if(m_Type == DREAM3D::AttributeMatrixType::VertexFeature || m_Type == DREAM3D::AttributeMatrixType::VertexEnsemble ||
m_Type == DREAM3D::AttributeMatrixType::EdgeFeature || m_Type == DREAM3D::AttributeMatrixType::EdgeEnsemble ||
m_Type == DREAM3D::AttributeMatrixType::FaceFeature || m_Type == DREAM3D::AttributeMatrixType::FaceEnsemble ||
m_Type == DREAM3D::AttributeMatrixType::CellFeature || m_Type == DREAM3D::AttributeMatrixType::CellEnsemble)
{
acceptableMatrix = true;
}
size_t totalTuples = getNumTuples();
if( static_cast<size_t>(activeObjects.size()) == totalTuples && acceptableMatrix == true)
{
size_t goodcount = 1;
QVector<size_t> NewNames(totalTuples, 0);
QVector<size_t> RemoveList;
for(qint32 i = 1; i < activeObjects.size(); i++)
{
if(activeObjects[i] == false)
{
RemoveList.push_back(i);
NewNames[i] = 0;
}
else
{
NewNames[i] = goodcount;
goodcount++;
}
}
if(RemoveList.size() > 0)
{
QList<QString> headers = getAttributeArrayNames();
for (QList<QString>::iterator iter = headers.begin(); iter != headers.end(); ++iter)
{
IDataArray::Pointer p = getAttributeArray(*iter);
QString type = p->getTypeAsString();
if(type.compare("NeighborList<T>") == 0)
{
removeAttributeArray(*iter);
}
else
{
p->eraseTuples(RemoveList);
}
}
QVector<size_t> tDims(1, (totalTuples - RemoveList.size()));
setTupleDimensions(tDims);
// Loop over all the points and correct all the feature names
size_t totalPoints = Ids->getNumberOfTuples();
int32_t* id = Ids->getPointer(0);
for (size_t i = 0; i < totalPoints; i++)
{
if(id[i] >= 0 && id[i] < NewNames.size())
{
id[i] = static_cast<int32_t>( NewNames[id[i]] );
}
}
}
}
else
{
return false;
}
return true;
}