Ejemplo n.º 1
0
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
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;
}
Ejemplo n.º 2
0
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
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;
}