// ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- int AttributeMatrix::readAttributeArraysFromHDF5(hid_t amGid, bool preflight, AttributeMatrixProxy& attrMatProxy) { int err = 0; QMap<QString, DataArrayProxy> dasToRead = attrMatProxy.dataArrays; QString classType; for (QMap<QString, DataArrayProxy>::iterator iter = dasToRead.begin(); iter != dasToRead.end(); ++iter) { //qDebug() << "Reading the " << iter->name << " Array from the " << m_Name << " Attribute Matrix \n"; if(iter->flag == DREAM3D::Unchecked) { continue; } QH5Lite::readStringAttribute(amGid, iter->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(amGid, iter->name, preflight); } else if(classType.compare("StringDataArray") == 0) { dPtr = H5DataArrayReader::ReadStringDataArray(amGid, iter->name, preflight); } else if(classType.compare("vector") == 0) { } else if(classType.compare("NeighborList<T>") == 0) { dPtr = H5DataArrayReader::ReadNeighborListData(amGid, iter->name, preflight); } else if(classType.compare("Statistics") == 0) { StatsDataArray::Pointer statsData = StatsDataArray::New(); statsData->setName(iter->name); statsData->readH5Data(amGid); dPtr = statsData; } // else if ( (iter->name).compare(DREAM3D::EnsembleData::Statistics) == 0) // { // StatsDataArray::Pointer statsData = StatsDataArray::New(); // statsData->setName(DREAM3D::EnsembleData::Statistics); // statsData->readH5Data(amGid); // dPtr = statsData; // } if (NULL != dPtr.get()) { addAttributeArray(dPtr->getName(), dPtr); } } H5Gclose(amGid); // Close the Cell Group return err; }
// ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- 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; }
// ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- StatsDataArray::Pointer StatsDataArray::CreateArray(size_t numTuples, int rank, size_t* dims, const QString& name, bool allocate) { if (name.isEmpty() == true) { return NullPointer(); } StatsDataArray::Pointer ptr = StatsDataArray::New(); ptr->setName(name); std::vector<unsigned int> phase_types(numTuples, DREAM3D::PhaseType::UnknownPhaseType); if(allocate) { ptr->fillArrayWithNewStatsData(numTuples, &(phase_types.front()) ); } return ptr; }
// ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- StatsDataArray::Pointer StatsDataArray::CreateArray(QVector<size_t> tDims, QVector<size_t> cDims, const QString& name, bool allocate) { if (name.isEmpty() == true) { return NullPointer(); } size_t numTuples = tDims[0]; qint32 size = tDims.size(); for(qint32 iter = 1; iter < size; iter++) { numTuples *= tDims[iter]; } StatsDataArray::Pointer ptr = StatsDataArray::New(); ptr->setName(name); std::vector<unsigned int> phase_types(numTuples, DREAM3D::PhaseType::UnknownPhaseType); if(allocate) { ptr->fillArrayWithNewStatsData(numTuples, &(phase_types.front()) ); } return ptr; }