本文整理汇总了C++中datacontainer::Pointer::getPrereqAttributeMatrix方法的典型用法代码示例。如果您正苦于以下问题:C++ Pointer::getPrereqAttributeMatrix方法的具体用法?C++ Pointer::getPrereqAttributeMatrix怎么用?C++ Pointer::getPrereqAttributeMatrix使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类datacontainer::Pointer
的用法示例。
在下文中一共展示了Pointer::getPrereqAttributeMatrix方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: dataCheck
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
void CombineAttributeMatrices::dataCheck()
{
setErrorCondition(0);
DataArrayPath tempPath;
DataContainer::Pointer m = getDataContainerArray()->getPrereqDataContainer<AbstractFilter>(this, getFirstAttributeMatrixPath().getDataContainerName(), false);
if (getErrorCondition() < 0 || NULL == m.get()) { return; }
if (getFirstAttributeMatrixPath().getDataContainerName().compare(getSecondAttributeMatrixPath().getDataContainerName()) != 0)
{
QString ss = QObject::tr("The selected attribute matrices must be in the same data container and currently are not");
setErrorCondition(-5557);
notifyErrorMessage(getHumanLabel(), ss, getErrorCondition());
}
if (getFirstAttributeMatrixPath().getAttributeMatrixName().compare(getSecondAttributeMatrixPath().getAttributeMatrixName()) == 0)
{
QString ss = QObject::tr("The selected attribute matrices must be different and currently are the same");
setErrorCondition(-5558);
notifyErrorMessage(getHumanLabel(), ss, getErrorCondition());
}
AttributeMatrix::Pointer firstAttrMat = m->getPrereqAttributeMatrix(this, getFirstAttributeMatrixPath().getAttributeMatrixName(), -301);
AttributeMatrix::Pointer secondAttrMat = m->getPrereqAttributeMatrix(this, getSecondAttributeMatrixPath().getAttributeMatrixName(), -301);
if (getErrorCondition() < 0) { return; }
if (firstAttrMat->getType() != secondAttrMat->getType())
{
QString ss = QObject::tr("The selected attribute matrices must be of the same type (ie Feature) and currently are not");
setErrorCondition(-5559);
notifyErrorMessage(getHumanLabel(), ss, getErrorCondition());
}
if (getErrorCondition() < 0) { return; }
//Note that the minus 1 in the totalTuples calculation is to account for the fact that the zeroth tuple in the two attribute matrices should only be counted once, not twice.
//All Feature or Ensemble AMs should start from 1 and the zeroth tuple can be combined in the two AMs
size_t totalTuples = firstAttrMat->getNumTuples() + secondAttrMat->getNumTuples() - 1;
QVector<size_t> tDims(1, totalTuples);
m->createNonPrereqAttributeMatrix<AbstractFilter>(this, getCombinedAttributeMatrixName(), tDims, firstAttrMat->getType());
if (getErrorCondition() < 0) { return; }
AttributeMatrix::Pointer combinedAttrMat = m->getAttributeMatrix(getCombinedAttributeMatrixName());
QVector<size_t> cDims(1, 1);
m_FirstIndexPtr = getDataContainerArray()->getPrereqArrayFromPath<DataArray<int32_t>, AbstractFilter>(this, getFirstIndexArrayPath(), cDims); /* Assigns the shared_ptr<> to an instance variable that is a weak_ptr<> */
if (NULL != m_FirstIndexPtr.lock().get()) /* Validate the Weak Pointer wraps a non-NULL pointer to a DataArray<T> object */
{
m_FirstIndex = m_FirstIndexPtr.lock()->getPointer(0);
} /* Now assign the raw pointer to data from the DataArray<T> object */
if (getErrorCondition() < 0) { return; }
m_SecondIndexPtr = getDataContainerArray()->getPrereqArrayFromPath<DataArray<int32_t>, AbstractFilter>(this, getSecondIndexArrayPath(), cDims); /* Assigns the shared_ptr<> to an instance variable that is a weak_ptr<> */
if (NULL != m_SecondIndexPtr.lock().get()) /* Validate the Weak Pointer wraps a non-NULL pointer to a DataArray<T> object */
{
m_SecondIndex = m_SecondIndexPtr.lock()->getPointer(0);
} /* Now assign the raw pointer to data from the DataArray<T> object */
if (getErrorCondition() < 0) { return; }
// Create arrays on the reference grid to hold data present on the sampling grid
QList<QString> fArrayNames = firstAttrMat->getAttributeArrayNames();
for (QList<QString>::iterator iter = fArrayNames.begin(); iter != fArrayNames.end(); ++iter)
{
tempPath.update(getFirstAttributeMatrixPath().getDataContainerName(), getCombinedAttributeMatrixName(), *iter);
IDataArray::Pointer tmpDataArray = firstAttrMat->getPrereqIDataArray<IDataArray, AbstractFilter>(this, *iter, -90001);
if (getErrorCondition() >= 0)
{
QVector<size_t> cDims = tmpDataArray->getComponentDimensions();
TemplateHelpers::CreateNonPrereqArrayFromArrayType()(this, tempPath, cDims, tmpDataArray);
}
}
QList<QString> sArrayNames = secondAttrMat->getAttributeArrayNames();
for (QList<QString>::iterator iter = sArrayNames.begin(); iter != sArrayNames.end(); ++iter)
{
tempPath.update(getSecondAttributeMatrixPath().getDataContainerName(), getCombinedAttributeMatrixName(), *iter);
IDataArray::Pointer tmpDataArray = secondAttrMat->getPrereqIDataArray<IDataArray, AbstractFilter>(this, *iter, -90001);
if (getErrorCondition() >= 0)
{
if (fArrayNames.contains(*iter) == false)
{
QVector<size_t> cDims = tmpDataArray->getComponentDimensions();
TemplateHelpers::CreateNonPrereqArrayFromArrayType()(this, tempPath, cDims, tmpDataArray);
}
}
}
tempPath.update(getFirstIndexArrayPath().getDataContainerName(), getFirstIndexArrayPath().getAttributeMatrixName(), getNewIndexArrayName());
m_NewIndexPtr = getDataContainerArray()->createNonPrereqArrayFromPath<DataArray<int32_t>, AbstractFilter, int32_t>(this, tempPath, 0, cDims); /* Assigns the shared_ptr<> to an instance variable that is a weak_ptr<> */
if (NULL != m_NewIndexPtr.lock().get()) /* Validate the Weak Pointer wraps a non-NULL pointer to a DataArray<T> object */
{
m_NewIndex = m_NewIndexPtr.lock()->getPointer(0);
} /* Now assign the raw pointer to data from the DataArray<T> object */
if (getErrorCondition() < 0) { return; }
}