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


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

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


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

示例1: getName

    /**
     * @brief readH5Data
     * @param parentId
     * @return
     */
    virtual int readH5Data(hid_t parentId)
    {
      int err = 0;
      this->resize(0);
      std::vector<std::string> strings;
      err = H5Lite::readVectorOfStringDataset(parentId, getName().toStdString(), strings);

      m_Array.resize(strings.size());
      for(std::vector<QString>::size_type i = 0; i < strings.size(); i++)
      {
        m_Array[i] = QString::fromStdString(strings[i]);
      }
#if 0
      IDataArray::Pointer p = H5DataArrayReader::ReadStringDataArray(parentId, getName());
      if (p.get() == NULL)
      {
        return -1;
      }
      StringDataArray* srcPtr = StringDataArray::SafePointerDownCast(p.get());
      size_t count = srcPtr->getNumberOfTuples();
      for (size_t i = 0; i < count; ++i)
      {
        m_Array.push_back( srcPtr->getValue(i) );
      }
#endif
      return err;
    }
开发者ID:BlueQuartzSoftware,项目名称:SIMPL,代码行数:32,代码来源:StringDataArray.hpp

示例2: dataCheck

// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
void FlattenImage::dataCheck(bool preflight, size_t voxels, size_t fields, size_t ensembles)
{
  setErrorCondition(0);
  std::stringstream ss;
  VoxelDataContainer* m = getVoxelDataContainer();
  //int err = 0;

  int numImageComp = 1;
  IDataArray::Pointer iDataArray = m->getCellData(m_ImageDataArrayName);
  if(NULL != iDataArray.get())
  {
    UInt8ArrayType* imageDataPtr = UInt8ArrayType::SafePointerDownCast(iDataArray.get());
    if (NULL != imageDataPtr)
    {
      numImageComp = imageDataPtr->GetNumberOfComponents();
    }
  }

  GET_PREREQ_DATA(m, DREAM3D, CellData, ImageData, ss, -301, unsigned char, UCharArrayType, voxels, numImageComp)
//  if(err == -301)
//  {
//    setErrorCondition(0);
//    err = 0;
//    GET_PREREQ_DATA(m, DREAM3D, CellData, ImageData, ss, -302, unsigned char, UCharArrayType, voxels, 3)
//  }

  CREATE_NON_PREREQ_DATA(m, DREAM3D, CellData, FlatImageData, ss, int32_t, Int32ArrayType, 0, voxels, 1)
}
开发者ID:chongbingbao,项目名称:DREAM3D,代码行数:31,代码来源:FlattenImage.cpp

示例3: dataCheck

// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
void FlattenImage::dataCheck()
{
  setErrorCondition(0);

  DataArrayPath tempPath;
  int32_t numImageComp = 1;

  IDataArray::Pointer iDataArray = getDataContainerArray()->getPrereqIDataArrayFromPath<IDataArray, AbstractFilter>(this, getImageDataArrayPath());
  if (getErrorCondition() < 0) { return; }
  if (NULL != iDataArray.get())
  {
    numImageComp = iDataArray->getNumberOfComponents();
  }

  QVector<size_t> cDims(1, numImageComp);
  m_ImageDataPtr = getDataContainerArray()->getPrereqArrayFromPath<DataArray<uint8_t>, AbstractFilter>(this, getImageDataArrayPath(), cDims); /* Assigns the shared_ptr<> to an instance variable that is a weak_ptr<> */
  if( NULL != m_ImageDataPtr.lock().get() ) /* Validate the Weak Pointer wraps a non-NULL pointer to a DataArray<T> object */
  { m_ImageData = m_ImageDataPtr.lock()->getPointer(0); } /* Now assign the raw pointer to data from the DataArray<T> object */

  cDims[0] = 1;
  tempPath.update(m_ImageDataArrayPath.getDataContainerName(), m_ImageDataArrayPath.getAttributeMatrixName(), getFlatImageDataArrayName() );
  m_FlatImageDataPtr = getDataContainerArray()->createNonPrereqArrayFromPath<DataArray<uint8_t>, AbstractFilter, uint8_t>(this, tempPath, 0, cDims); /* Assigns the shared_ptr<> to an instance variable that is a weak_ptr<> */
  if( NULL != m_FlatImageDataPtr.lock().get() ) /* Validate the Weak Pointer wraps a non-NULL pointer to a DataArray<T> object */
  { m_FlatImageData = m_FlatImageDataPtr.lock()->getPointer(0); } /* Now assign the raw pointer to data from the DataArray<T> object */
}
开发者ID:kglowins,项目名称:DREAM3D,代码行数:28,代码来源:FlattenImage.cpp

示例4: writePointScalarData

void writePointScalarData(DataContainer::Pointer dc, const QString& vertexAttributeMatrixName, const QString& dataName, const QString& dataType,
                          bool writeBinaryData, FILE* vtkFile, int nT)
{
  IDataArray::Pointer data = dc->getAttributeMatrix(vertexAttributeMatrixName)->getAttributeArray(dataName);
  QString ss;
  if (NULL != data.get())
  {
    T* m = reinterpret_cast<T*>(data->getVoidPointer(0));
    fprintf(vtkFile, "\n");
    fprintf(vtkFile, "SCALARS %s %s\n", dataName.toLatin1().data(), dataType.toLatin1().data());
    fprintf(vtkFile, "LOOKUP_TABLE default\n");
    for(int i = 0; i < nT; ++i)
    {
      T swapped = 0x00;
      if(writeBinaryData == true)
      {
        swapped = static_cast<T>(m[i]);
        SIMPLib::Endian::FromSystemToBig::convert(swapped);
        fwrite(&swapped, sizeof(T), 1, vtkFile);
      }
      else
      {

        ss = QString::number(m[i]) + " ";
        fprintf(vtkFile, "%s ", ss.toLatin1().data());
        //if (i%50 == 0)
        { fprintf(vtkFile, "\n"); }
      }

    }
  }
}
开发者ID:BlueQuartzSoftware,项目名称:DREAM3D,代码行数:32,代码来源:SurfaceMeshToNonconformalVtk.cpp

示例5: findHistogram

void findHistogram(IDataArray::Pointer inputData, int32_t* ensembleArray, int32_t* eIds, int NumberOfBins, bool removeBiasedFeatures, bool* biasedFeatures)
{
  DataArray<T>* featureArray = DataArray<T>::SafePointerDownCast(inputData.get());
  if (NULL == featureArray)
  {
    return;
  }

  T* fPtr = featureArray->getPointer(0);
  size_t numfeatures = featureArray->getNumberOfTuples();

  int32_t bin;
  int32_t ensemble;
  float min = 1000000.0f;
  float max = 0.0f;
  float value;
  for (size_t i = 1; i < numfeatures; i++)
  {
    value = fPtr[i];
    if(value > max) { max = value; }
    if(value < min) { min = value; }
  }
  float stepsize = (max - min) / NumberOfBins;

  for (size_t i = 1; i < numfeatures; i++)
  {
    if(removeBiasedFeatures == false || biasedFeatures[i] == false)
    {
      ensemble = eIds[i];
      bin = (fPtr[i] - min) / stepsize;
      if(bin >= NumberOfBins) { bin = NumberOfBins - 1; }
      ensembleArray[(NumberOfBins * ensemble) + bin]++;
    }
  }
}
开发者ID:BlueQuartzSoftware,项目名称:DREAM3D,代码行数:35,代码来源:FindFeatureHistogram.cpp

示例6: resize

    /**
     * @brief
     * @param parentId
     * @return
     */
    virtual int readH5Data(hid_t parentId)
    {
      int err = 0;

      resize(0);
      IDataArray::Pointer p = H5DataArrayReader::ReadIDataArray(parentId, getName());
      if (p.get() == NULL)
      {
        return -1;
      }
      m_Array = reinterpret_cast<T*>(p->getVoidPointer(0));
      m_Size = p->getSize();
      m_OwnsData = true;
      m_MaxId = (m_Size == 0) ? 0 : m_Size - 1;
      m_IsAllocated = true;
      m_Name = p->getName();
      m_NumTuples = p->getNumberOfTuples();
      m_CompDims = p->getComponentDimensions();
      m_NumComponents = p->getNumberOfComponents();

      // Tell the intermediate DataArray to release ownership of the data as we are going to be responsible
      // for deleting the memory
      p->releaseOwnership();
      return err;
    }
开发者ID:kglowins,项目名称:DREAM3D,代码行数:30,代码来源:DataArray.hpp

示例7: writeCellScalarData

void writeCellScalarData(DataContainer::Pointer dc, const QString& faceAttributeMatrixName, const QString& dataName, const QString& dataType,
                         bool writeBinaryData, FILE* vtkFile, QMap<int32_t, int32_t>& featureIds, int32_t* m_SurfaceMeshFaceLabels)
{
  TriangleGeom::Pointer triangleGeom = dc->getGeometryAs<TriangleGeom>();

  int64_t numTriangles = triangleGeom->getNumberOfTris();
  IDataArray::Pointer data = dc->getAttributeMatrix(faceAttributeMatrixName)->getAttributeArray(dataName);

  QString ss;
  if (NULL != data.get())
  {
    int32_t totalCellsWritten = 0;

    T* m = reinterpret_cast<T*>(data->getVoidPointer(0));
    fprintf(vtkFile, "\n");
    fprintf(vtkFile, "SCALARS %s %s 1\n", dataName.toLatin1().data(), dataType.toLatin1().data());
    fprintf(vtkFile, "LOOKUP_TABLE default\n");
    // Loop over all the features
    for(QMap<int32_t, int32_t>::iterator featureIter = featureIds.begin(); featureIter != featureIds.end(); ++featureIter)
    {
      int32_t gid = featureIter.key(); // The current Feature Id
      size_t size = featureIter.value(); // The number of triangles for this feature id
      std::vector<T> buffer(size, 0);
      totalCellsWritten += size;
      size_t index = 0;

      for (int j = 0; j < numTriangles; j++)
      {
        if (m_SurfaceMeshFaceLabels[j * 2] != gid && m_SurfaceMeshFaceLabels[j * 2 + 1] != gid) { continue; }
        // Get the data
        T s0 = static_cast<T>(m[j]);
        if (m_SurfaceMeshFaceLabels[j * 2 + 1] == gid)
        { s0 = s0 * -1; }


        // Write the values to the buffer after an Endian swap.
        if(writeBinaryData == true)
        {
          SIMPLib::Endian::FromSystemToBig::convert(s0);
          buffer[index] = s0;
          ++index;
        }
        else
        {

          ss = QString::number(s0);
          fprintf(vtkFile, "%s\n", ss.toLatin1().data());
        }
      }

      // Write the Buffer
      if(writeBinaryData == true)
      {
        fwrite(&(buffer.front()), sizeof(T), size, vtkFile);
      }
    }
  }

}
开发者ID:BlueQuartzSoftware,项目名称:DREAM3D,代码行数:59,代码来源:SurfaceMeshToNonconformalVtk.cpp

示例8: writeCellNormalData

void writeCellNormalData(DataContainer::Pointer dc, const QString& faceAttributeMatrixName, const QString& dataName, const QString& dataType,
                         bool writeBinaryData, bool writeConformalMesh,
                         FILE* vtkFile, int nT)
{
  IDataArray::Pointer data = dc->getAttributeMatrix(faceAttributeMatrixName)->getAttributeArray(dataName);
  QString buf;
  QTextStream ss(&buf);
  if (NULL != data.get())
  {
    T* m = reinterpret_cast<T*>(data->getVoidPointer(0));
    fprintf(vtkFile, "\n");
    fprintf(vtkFile, "NORMALS %s %s\n", dataName.toLatin1().data(), dataType.toLatin1().data());
    for(int i = 0; i < nT; ++i)
    {
      T s0 = 0x00;
      T s1 = 0x00;
      T s2 = 0x00;
      if(writeBinaryData == true)
      {
        s0 = static_cast<T>(m[i * 3 + 0]);
        s1 = static_cast<T>(m[i * 3 + 1]);
        s2 = static_cast<T>(m[i * 3 + 2]);
        SIMPLib::Endian::FromSystemToBig::convert(s0);
        SIMPLib::Endian::FromSystemToBig::convert(s1);
        SIMPLib::Endian::FromSystemToBig::convert(s2);
        fwrite(&s0, sizeof(T), 1, vtkFile);
        fwrite(&s1, sizeof(T), 1, vtkFile);
        fwrite(&s2, sizeof(T), 1, vtkFile);
        if(false == writeConformalMesh)
        {
          s0 = static_cast<T>(m[i * 3 + 0]) * -1.0;
          s1 = static_cast<T>(m[i * 3 + 1]) * -1.0;
          s2 = static_cast<T>(m[i * 3 + 2]) * -1.0;
          SIMPLib::Endian::FromSystemToBig::convert(s0);
          SIMPLib::Endian::FromSystemToBig::convert(s1);
          SIMPLib::Endian::FromSystemToBig::convert(s2);
          fwrite(&s0, sizeof(T), 1, vtkFile);
          fwrite(&s1, sizeof(T), 1, vtkFile);
          fwrite(&s2, sizeof(T), 1, vtkFile);
        }
      }
      else
      {

        ss << m[i * 3 + 0] << " " << m[i * 3 + 1] << " " << m[i * 3 + 2] << " ";
        if(false == writeConformalMesh)
        {
          ss << -1.0 * m[i * 3 + 0] << " " << -1.0 * m[i * 3 + 1] << " " << -1.0 * m[i * 3 + 2] << " ";
        }
        fprintf(vtkFile, "%s ", buf.toLatin1().data());
        buf.clear();
        if (i % 50 == 0) { fprintf(vtkFile, "\n"); }
      }
    }
  }
}
开发者ID:kglowins,项目名称:DREAM3D,代码行数:56,代码来源:SurfaceMeshToVtk.cpp

示例9: if

// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
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;
}
开发者ID:BlueQuartzSoftware,项目名称:SIMPL,代码行数:59,代码来源:AttributeMatrix.cpp

示例10: dataCheck

// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
void VisualizeGBCDPoleFigure::dataCheck()
{
  setErrorCondition(0);

  getDataContainerArray()->getPrereqGeometryFromDataContainer<TriangleGeom, AbstractFilter>(this, getGBCDArrayPath().getDataContainerName());

  if (getOutputFile().isEmpty() == true)
  {
    QString ss = QObject::tr( "The output file must be set");
    setErrorCondition(-1000);
    notifyErrorMessage(getHumanLabel(), ss, getErrorCondition());
  }

  QFileInfo fi(getOutputFile());
  QDir parentPath = fi.path();
  if (parentPath.exists() == false && getInPreflight())
  {
    QString ss = QObject::tr( "The directory path for the output file does not exist. DREAM.3D will attempt to create this path during execution of the filter");
    notifyWarningMessage(getHumanLabel(), ss, -1);
  }

  if (fi.suffix().compare("") == 0)
  {
    setOutputFile(getOutputFile().append(".vtk"));
  }

  QVector<size_t> cDims(1, 1);
  m_CrystalStructuresPtr = getDataContainerArray()->getPrereqArrayFromPath<DataArray<unsigned int>, AbstractFilter>(this, getCrystalStructuresArrayPath(), cDims); /* Assigns the shared_ptr<> to an instance variable that is a weak_ptr<> */
  if (NULL != m_CrystalStructuresPtr.lock().get()) /* Validate the Weak Pointer wraps a non-NULL pointer to a DataArray<T> object */
  {
    m_CrystalStructures = m_CrystalStructuresPtr.lock()->getPointer(0);
  } /* Now assign the raw pointer to data from the DataArray<T> object */

  IDataArray::Pointer tmpGBCDPtr = getDataContainerArray()->getPrereqIDataArrayFromPath<IDataArray, AbstractFilter>(this, getGBCDArrayPath());
  if(getErrorCondition() < 0) { return; }

  if (NULL != tmpGBCDPtr.get())
  {
    QVector<size_t> cDims = tmpGBCDPtr->getComponentDimensions();
    m_GBCDPtr = getDataContainerArray()->getPrereqArrayFromPath<DataArray<double>, AbstractFilter>(this, getGBCDArrayPath(), cDims); /* Assigns the shared_ptr<> to an instance variable that is a weak_ptr<> */
    if( NULL != m_GBCDPtr.lock().get() ) /* Validate the Weak Pointer wraps a non-NULL pointer to a DataArray<T> object */
    { m_GBCD = m_GBCDPtr.lock()->getPointer(0); } /* Now assign the raw pointer to data from the DataArray<T> object */
  }

  if (NULL != m_GBCDPtr.lock().get() && getPhaseOfInterest() >= m_GBCDPtr.lock()->getNumberOfTuples())
  {
    QString ss = QObject::tr("The phase index is larger than the number of Ensembles").arg(ClassName());
    setErrorCondition(-1);
    notifyErrorMessage(getHumanLabel(), ss, getErrorCondition());
  }
}
开发者ID:BlueQuartzSoftware,项目名称:DREAM3D,代码行数:54,代码来源:VisualizeGBCDPoleFigure.cpp

示例11: dataCheck

// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
void LinkFieldMapToCellArray::dataCheck(bool preflight, size_t voxels, size_t fields, size_t ensembles)
{
  setErrorCondition(0);
  std::stringstream ss;
  VoxelDataContainer* m = getVoxelDataContainer();

  IDataArray::Pointer data = m->getCellData(m_SelectedCellDataArrayName);
  if (NULL == data.get())
  {
    ss.str("");
    ss << "Selected array '" << m_SelectedCellDataArrayName << "' does not exist in the Voxel Data Container. Was it spelled correctly?";
    setErrorCondition(-11001);
    addErrorMessage(getHumanLabel(),ss.str(),getErrorCondition());
    return;
  }

  std::string dType = data->getTypeAsString();
  IDataArray::Pointer p = IDataArray::NullPointer();
  if (dType.compare("int32_t") == 0)
  {
    DataArray<int32_t>* field = DataArray<int32_t>::SafePointerDownCast(data.get());
    m_SelectedCellData = field->GetPointer(0);
  }
  else
  {
    ss.str("");
    ss << "Selected array '" << m_SelectedCellDataArrayName << "' is not an Integer array. Is this the array you want to use?";
    setErrorCondition(-11001);
    addErrorMessage(getHumanLabel(),ss.str(),getErrorCondition());
    return;
  }

  m->clearFieldData();
  BoolArrayType::Pointer active = BoolArrayType::CreateArray(fields, 1, DREAM3D::FieldData::Active);
  // bool* mActive = m_Active->GetPointer(0);
  m->addFieldData(DREAM3D::FieldData::Active, active);

}
开发者ID:mahendra-ramajayam,项目名称:DREAM3D,代码行数:41,代码来源:LinkFieldMapToCellArray.cpp

示例12: if

// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
std::vector<int32_t> TriangleOps::findAdjacentTriangles(SurfaceMeshDataContainer* sm,
                                                        int32_t triangleIndex,
                                                        int32_t label)
{
  std::vector<int32_t> adjacentTris;
  // Get the master list of triangles for the mesh
  DREAM3D::SurfaceMesh::FaceList_t::Pointer facesPtr = sm->getFaces();
//  DREAM3D::SurfaceMesh::Face_t* faces = facesPtr->GetPointer(0);
  IDataArray::Pointer flPtr = sm->getFaceData(DREAM3D::FaceData::SurfaceMeshFaceLabels);
  DataArray<int32_t>* faceLabelsPtr = DataArray<int32_t>::SafePointerDownCast(flPtr.get());
  int32_t* faceLabels = faceLabelsPtr->GetPointer(0);

  // Get the Triangle Neighbor Structure
  MeshFaceNeighbors::Pointer triNeighbors = sm->getMeshFaceNeighborLists();

  // For the specific triangle that was passed, get its neighbor list
  uint16_t count = triNeighbors->getNumberOfFaces(triangleIndex);
  int32_t* nList = triNeighbors->getNeighborListPointer(triangleIndex);

  if (count < 3)
  {
    std::cout << "Triangle Neighbor List had only " << count << " neighbors. Must be at least 3." << std::endl;
    BOOST_ASSERT(false);
  }
  else if (count == 3) // This triangle only has 3 neighbors so we are assuming all three have the same label set.
  {
    for (uint16_t n = 0; n < count; ++n)
    {
      adjacentTris.push_back(nList[n]);
    }
  }
  else
  {
    // Iterate over the indices to find triangles that match the label and are NOT the current triangle index
    for (uint16_t n = 0; n < count; ++n)
    {
      int32_t fl_0 = faceLabels[nList[n]*2];
      int32_t fl_1 = faceLabels[nList[n]*2 + 1];
      if ( (fl_0 == label || fl_1 == label)  && (nList[n] != triangleIndex) )
      {
        //  std::cout << "    Found Adjacent Triangle: " << t->tIndex << std::endl;
        adjacentTris.push_back(nList[n]);
        // ++index;
      }
    }
  }
  return adjacentTris;
}
开发者ID:chongbingbao,项目名称:DREAM3D,代码行数:51,代码来源:TriangleOps.cpp

示例13: copyData

    /**
     * @brief copyData This method copies all data from the <b>sourceArray</b> into
     * the current array starting at the target destination tuple offset value.
     *
     * For example if the DataArray has 10 tuples and the destTupleOffset = 5 then
     * then source data will be copied into the destination array starting at
     * destination tuple 5. In psuedo code it would be the following:
     * @code
     *  destArray[5] = sourceArray[0];
     *  destArray[6] = sourceArray[1];
     *  .....
     * @endcode
     * @param destTupleOffset
     * @param sourceArray
     * @return
     */
    bool copyData(size_t destTupleOffset, IDataArray::Pointer sourceArray)
    {

      if(destTupleOffset >= m_Array.size()) { return false; }
      if(!sourceArray->isAllocated()) { return false; }
      if(sourceArray->getNumberOfComponents() != getNumberOfComponents()) { return false; }

      Self* source = dynamic_cast<Self*>(sourceArray.get());
      size_t sourceNTuples = source->getNumberOfTuples();

      for(size_t i = 0; i < sourceNTuples; i++)
      {
        m_Array[destTupleOffset + i] = source->getValue(i);
      }
      return true;
    }
开发者ID:BlueQuartzSoftware,项目名称:SIMPL,代码行数:32,代码来源:StringDataArray.hpp

示例14: GetName

    /**
     * @brief
     * @param parentId
     * @return
     */
    virtual int readH5Data(hid_t parentId)
    {
      int err = 0;

      this->Resize(0);
      IDataArray::Pointer p = H5DataArrayReader::readIDataArray(parentId, GetName());
      if (p.get() == NULL)
      {
        return -1;
      }
      this->NumberOfComponents = p->GetNumberOfComponents();
      this->Size = p->GetSize();
      this->MaxId = (Size == 0) ? 0 : Size -1;
      this->Array = reinterpret_cast<T*>(p->GetVoidPointer(0));
      p->releaseOwnership();

      return err;
    }
开发者ID:tuks188,项目名称:DREAM3D,代码行数:23,代码来源:DataArray.hpp

示例15: writeCellVectorData

void writeCellVectorData(DataContainer::Pointer dc, const QString& faceAttributeMatrixName, const QString& dataName, const QString& dataType,
                         bool writeBinaryData, const QString& vtkAttributeType,
                         FILE* vtkFile, QMap<int32_t, int32_t>& featureIds)
{
  TriangleGeom::Pointer triangleGeom = dc->getGeometryAs<TriangleGeom>();

  int64_t numTriangles = triangleGeom->getNumberOfTris();

  IDataArray::Pointer data = dc->getAttributeMatrix(faceAttributeMatrixName)->getAttributeArray(dataName);
  QString ss;
  if (NULL != data.get())
  {
    T* m = reinterpret_cast<T*>(data->getVoidPointer(0));
    fprintf(vtkFile, "\n");
    fprintf(vtkFile, "%s %s %s\n", vtkAttributeType.toLatin1().data(), dataName.toLatin1().data(), dataType.toLatin1().data());
    for(int i = 0; i < numTriangles; ++i)
    {
      T s0 = 0x00;
      T s1 = 0x00;
      T s2 = 0x00;
      if(writeBinaryData == true)
      {
        s0 = static_cast<T>(m[i * 3 + 0]);
        s1 = static_cast<T>(m[i * 3 + 1]);
        s2 = static_cast<T>(m[i * 3 + 2]);
        SIMPLib::Endian::FromSystemToBig::convert(s0);
        SIMPLib::Endian::FromSystemToBig::convert(s1);
        SIMPLib::Endian::FromSystemToBig::convert(s2);
        fwrite(&s0, sizeof(T), 1, vtkFile);
        fwrite(&s1, sizeof(T), 1, vtkFile);
        fwrite(&s2, sizeof(T), 1, vtkFile);

      }
      else
      {

        ss << m[i * 3 + 0] << " " << m[i * 3 + 1] << " " << m[i * 3 + 2] << " ";

        fprintf(vtkFile, "%s ", ss.toLatin1().data());
        if (i % 25 == 0) { fprintf(vtkFile, "\n"); }
      }
    }
  }
}
开发者ID:BlueQuartzSoftware,项目名称:DREAM3D,代码行数:44,代码来源:SurfaceMeshToNonconformalVtk.cpp


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