当前位置: 首页>>代码示例>>C++>>正文


C++ Pointer::readDataContainersFromHDF5方法代码示例

本文整理汇总了C++中datacontainerarray::Pointer::readDataContainersFromHDF5方法的典型用法代码示例。如果您正苦于以下问题:C++ Pointer::readDataContainersFromHDF5方法的具体用法?C++ Pointer::readDataContainersFromHDF5怎么用?C++ Pointer::readDataContainersFromHDF5使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在datacontainerarray::Pointer的用法示例。


在下文中一共展示了Pointer::readDataContainersFromHDF5方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: readData

// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
void DataContainerReader::readData(bool preflight, DataContainerArrayProxy& proxy, DataContainerArray::Pointer dca)
{
  setErrorCondition(0);
  QString ss;
  int32_t err = 0;
  QString m_FileVersion;
  float fVersion = 0.0f;
  bool check = false;

  //  qDebug() << "DataContainerReader::readData() " << m_InputFile;

  // Read the Meta Data and Array names from the file
  hid_t fileId = QH5Utilities::openFile(m_InputFile, true); // Open the file Read Only
  if (fileId < 0)
  {
    ss = QObject::tr("Error opening input file '%1'").arg(m_InputFile);
    setErrorCondition(-150);
    notifyErrorMessage(getHumanLabel(), ss, getErrorCondition());
    return;
  }
  // This will make sure if we return early from this method that the HDF5 File is properly closed.
  HDF5ScopedFileSentinel scopedFileSentinel(&fileId, true);

  // Check to see if version of .dream3d file is prior to new data container names
  err = QH5Lite::readStringAttribute(fileId, "/", DREAM3D::HDF5::FileVersionName, m_FileVersion);
  fVersion = m_FileVersion.toFloat(&check);
  if (fVersion < 5.0 || err < 0)
  {
    QH5Utilities::closeFile(fileId);
    fileId = QH5Utilities::openFile(m_InputFile, false); // Re-Open the file as Read/Write
    err = H5Lmove(fileId, "VoxelDataContainer", fileId, DREAM3D::Defaults::DataContainerName.toLatin1().data(), H5P_DEFAULT, H5P_DEFAULT);
    err = H5Lmove(fileId, "SurfaceMeshDataContainer", fileId, DREAM3D::Defaults::DataContainerName.toLatin1().data(), H5P_DEFAULT, H5P_DEFAULT);
    err = QH5Lite::writeStringAttribute(fileId, "/", DREAM3D::HDF5::FileVersionName, "5.0");
    QH5Utilities::closeFile(fileId);
    fileId = QH5Utilities::openFile(m_InputFile, true); // Re-Open the file as Read Only
  }
  if (fVersion < 7.0)
  {
    ss = QObject::tr("File unable to be read - file structure older than 7.0");
    setErrorCondition(-250);
    notifyErrorMessage(getHumanLabel(), ss, getErrorCondition());
    return;
  }
  hid_t dcaGid = H5Gopen(fileId, DREAM3D::StringConstants::DataContainerGroupName.toLatin1().data(), 0);
  if (dcaGid < 0)
  {
    setErrorCondition(-1923123);
    QString ss = QObject::tr("Error attempting to open the HDF5 Group '%1'").arg(DREAM3D::StringConstants::DataContainerGroupName);
    notifyErrorMessage(getHumanLabel(), ss, getErrorCondition());
    return;
  }

  scopedFileSentinel.addGroupId(&dcaGid);

  err = dca->readDataContainersFromHDF5(preflight, dcaGid, proxy, this);
  if (err < 0)
  {
    setErrorCondition(err);
    QString ss = QObject::tr("Error trying to read the DataContainers from the file '%1'").arg(getInputFile());
    notifyErrorMessage(getHumanLabel(), ss, getErrorCondition());
  }
  err = H5Gclose(dcaGid);
  dcaGid = -1;

  err = readDataContainerBundles(fileId, dca);
  if (err < 0)
  {
    setErrorCondition(err);
    QString ss = QObject::tr("Error trying to read the DataContainerBundles from the file '%1'").arg(getInputFile());
    notifyErrorMessage(getHumanLabel(), ss, getErrorCondition());
  }

  if (!getInPreflight())
  {
    err = readExistingPipelineFromFile(fileId);
    if(err < 0)
    {
      setErrorCondition(err);
      QString ss = QObject::tr("Error trying to read the existing pipeline from the file '%1'").arg(getInputFile());
      notifyErrorMessage(getHumanLabel(), ss, getErrorCondition());
    }
  }
}
开发者ID:BlueQuartzSoftware,项目名称:SIMPL,代码行数:86,代码来源:DataContainerReader.cpp


注:本文中的datacontainerarray::Pointer::readDataContainersFromHDF5方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。