// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
int EdgeGeom::readGeometryFromHDF5(hid_t parentId, bool preflight)
{
  herr_t err = 0;
  SharedVertexList::Pointer vertices = GeometryHelpers::GeomIO::ReadListFromHDF5<SharedVertexList>(DREAM3D::Geometry::SharedVertexList, parentId, preflight, err);
  SharedEdgeList::Pointer edges = GeometryHelpers::GeomIO::ReadListFromHDF5<SharedEdgeList>(DREAM3D::Geometry::SharedEdgeList, parentId, preflight, err);
  if (edges.get() == NULL || vertices.get() == NULL)
  {
    return -1;
  }
  size_t numEdges = edges->getNumberOfTuples();
  size_t numVerts = vertices->getNumberOfTuples();
  FloatArrayType::Pointer edgeCentroids = GeometryHelpers::GeomIO::ReadListFromHDF5<FloatArrayType>(DREAM3D::StringConstants::EdgeCentroids, parentId, preflight, err);
  if (err < 0 && err != -2)
  {
    return -1;
  }
  ElementDynamicList::Pointer edgeNeighbors = GeometryHelpers::GeomIO::ReadDynamicListFromHDF5<uint16_t, int64_t>(DREAM3D::StringConstants::EdgeNeighbors, parentId, numEdges, preflight, err);
  if (err < 0 && err != -2)
  {
    return -1;
  }
  ElementDynamicList::Pointer edgesContainingVert = GeometryHelpers::GeomIO::ReadDynamicListFromHDF5<uint16_t, int64_t>(DREAM3D::StringConstants::EdgesContainingVert, parentId, numVerts, preflight, err);
  if (err < 0 && err != -2)
  {
    return -1;
  }

  setVertices(vertices);
  setEdges(edges);
  setElementCentroids(edgeCentroids);
  setElementNeighbors(edgeNeighbors);
  setElementsContainingVert(edgesContainingVert);

  return 1;
}
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
void GEOM_CLASS_NAME::setVertices(SharedVertexList::Pointer vertices)
{
  if (vertices.get() != NULL)
  {
    if (vertices->getName().compare(DREAM3D::Geometry::SharedVertexList) != 0)
    {
      vertices->setName(DREAM3D::Geometry::SharedVertexList);
    }
  }
  m_VertexList = vertices;
}
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
int VertexGeom::readGeometryFromHDF5(hid_t parentId, bool preflight)
{
  herr_t err = 0;
  SharedVertexList::Pointer vertices = SharedVertexList::NullPointer();
  vertices = GeometryHelpers::GeomIO::ReadListFromHDF5<SharedVertexList>(DREAM3D::Geometry::SharedVertexList, parentId, preflight, err);
  if (vertices.get() == NULL)
  {
    return -1;
  }

  setVertices(vertices);

  return 1;
}
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
VertexGeom::Pointer VertexGeom::CreateGeometry(SharedVertexList::Pointer vertices, const QString& name)
{
  if (name.isEmpty() == true)
  {
    return VertexGeom::NullPointer();
  }
  if (vertices.get() == NULL)
  {
    return VertexGeom::NullPointer();
  }
  VertexGeom* d = new VertexGeom();
  d->setVertices(vertices);
  d->setName(name);
  Pointer ptr(d);
  return ptr;
}
Exemple #5
0
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
QuadGeom::Pointer QuadGeom::CreateGeometry(SharedQuadList::Pointer quads, SharedVertexList::Pointer vertices, const QString& name)
{
  if (name.isEmpty() == true)
  {
    return NullPointer();
  }
  if (vertices.get() == NULL)
  {
    return QuadGeom::NullPointer();
  }
  if (quads.get() == NULL)
  {
    return QuadGeom::NullPointer();
  }
  QuadGeom* d = new QuadGeom();
  d->setVertices(vertices);
  d->setQuads(quads);
  d->setName(name);
  Pointer ptr(d);
  return ptr;
}