// ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- int AttributeMatrix::addAttributeArrayFromHDF5Path(hid_t gid, QString name, bool preflight) { int err = 0; QString classType; QH5Lite::readStringAttribute(gid, name, DREAM3D::HDF5::ObjectType, classType); // qDebug() << groupName << " Array: " << *iter << " with C++ ClassType of " << classType << "\n"; IDataArray::Pointer dPtr = IDataArray::NullPointer(); if(classType.startsWith("DataArray") == true) { dPtr = H5DataArrayReader::ReadIDataArray(gid, name, preflight); if(preflight == true) { dPtr->resize(getNumTuples()); } } else if(classType.compare("StringDataArray") == 0) { dPtr = H5DataArrayReader::ReadStringDataArray(gid, name, preflight); if (preflight == true) { dPtr->resize(getNumTuples()); } } else if(classType.compare("vector") == 0) { } else if(classType.compare("NeighborList<T>") == 0) { dPtr = H5DataArrayReader::ReadNeighborListData(gid, name, preflight); if (preflight == true) { dPtr->resize(getNumTuples()); } } else if ( name.compare(DREAM3D::EnsembleData::Statistics) == 0) { StatsDataArray::Pointer statsData = StatsDataArray::New(); statsData->setName(DREAM3D::EnsembleData::Statistics); statsData->readH5Data(gid); dPtr = statsData; if (preflight == true) { dPtr->resize(getNumTuples()); } } if (NULL != dPtr.get()) { addAttributeArray(dPtr->getName(), dPtr); } return err; }
// ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- int AttributeMatrix::addAttributeArray(const QString& name, IDataArray::Pointer data) { if (data->getName().compare(name) != 0) { qDebug() << "Adding Attribute Array with different array name than key name" << "\n"; qDebug() << "Key name: " << name << "\n"; qDebug() << "Array Name:" << data->getName() << "\n"; data->setName(name); } if(getNumTuples() != data->getNumberOfTuples()) { qDebug() << "AttributeMatrix::Name: " << getName() << " dataArray::name: " << data->getName() << " Type: " << data->getTypeAsString(); qDebug() << "getNumTuples(): " << getNumTuples() << " data->getNumberOfTuples(): " << data->getNumberOfTuples(); } Q_ASSERT(getNumTuples() == data->getNumberOfTuples()); m_AttributeArrays[name] = data; return 0; }
// implementations char * serializeTableInfo(RM_TableData *rel) { VarString *result; MAKE_VARSTRING(result); APPEND(result, "TABLE <%s> with <%i> tuples:\n", rel->name, getNumTuples(rel)); APPEND_STRING(result, serializeSchema(rel->schema)); RETURN_STRING(result); }
ExDupSqlBuffer::ExDupSqlBuffer(UInt32 nBuffers, UInt32 bufferSize, UInt32 nReserve, UInt32 tupleSize, NAMemory* heap) #if defined(NA_HAS_ANSI_CPP_CASTS) : ExSimpleSQLBuffer(static_cast<Int32>(nBuffers), static_cast<Int32>(bufferSize), static_cast<Int32>(tupleSize), heap), #else : ExSimpleSQLBuffer((Int32) nBuffers, (Int32) bufferSize, (Int32) tupleSize, heap), #endif dupCurrent_(NULL), dupHead_(NULL), dupTail_(NULL), maxDups_(0), nDups_(0) { #if defined(NA_HAS_ANSI_CPP_CASTS) UInt32 nTuples = static_cast<UInt32>(getNumTuples()); #else UInt32 nTuples = (UInt32) getNumTuples(); #endif if (nTuples > nReserve) { maxDups_ = nTuples - nReserve; } }
// ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- bool AttributeMatrix::validateAttributeArraySizes() { int64_t arraySize = 0; int64_t matrixSize = getNumTuples(); for(QMap<QString, IDataArray::Pointer>::iterator iter = m_AttributeArrays.begin(); iter != m_AttributeArrays.end(); ++iter) { IDataArray::Pointer d = iter.value(); arraySize = d->getNumberOfTuples(); if(arraySize != matrixSize) { return false; } } return true; }
// scans RC startScan (RM_TableData *rel, RM_ScanHandle *scan, Expr *cond){ tuples=getNumTuples(scan->rel); count=0; condition=cond; scan->rel=rel; recordInfo *a_info=(recordInfo *)malloc(sizeof(recordInfo)); Record *record=malloc(sizeof(Record)); record->data=calloc(slotSize, sizeof(char)); //initialize the record to store the first tuple in the table record->id.page=1; record->id.slot=-1; a_info->count=0; a_info->record=record; scan->mgmtData=a_info; return RC_OK; }
// ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- 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; }