// ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- int TriangleGeom::readGeometryFromHDF5(hid_t parentId, bool preflight) { herr_t err = 0; SharedVertexList::Pointer vertices = GeometryHelpers::GeomIO::ReadListFromHDF5<SharedVertexList>(DREAM3D::Geometry::SharedVertexList, parentId, preflight, err); SharedTriList::Pointer tris = GeometryHelpers::GeomIO::ReadListFromHDF5<SharedQuadList>(DREAM3D::Geometry::SharedTriList, parentId, preflight, err); if (tris.get() == NULL || vertices.get() == NULL) { return -1; } size_t numTris = tris->getNumberOfTuples(); size_t numVerts = vertices->getNumberOfTuples(); SharedEdgeList::Pointer edges = GeometryHelpers::GeomIO::ReadListFromHDF5<SharedEdgeList>(DREAM3D::Geometry::SharedEdgeList, parentId, preflight, err); if (err < 0 && err != -2) { return -1; } SharedEdgeList::Pointer bEdges = GeometryHelpers::GeomIO::ReadListFromHDF5<SharedEdgeList>(DREAM3D::Geometry::UnsharedEdgeList, parentId, preflight, err); if (err < 0 && err != -2) { return -1; } FloatArrayType::Pointer triCentroids = GeometryHelpers::GeomIO::ReadListFromHDF5<FloatArrayType>(DREAM3D::StringConstants::TriangleCentroids, parentId, preflight, err); if (err < 0 && err != -2) { return -1; } ElementDynamicList::Pointer triNeighbors = GeometryHelpers::GeomIO::ReadDynamicListFromHDF5<uint16_t, int64_t>(DREAM3D::StringConstants::TriangleNeighbors, parentId, numTris, preflight, err); if (err < 0 && err != -2) { return -1; } ElementDynamicList::Pointer trisContainingVert = GeometryHelpers::GeomIO::ReadDynamicListFromHDF5<uint16_t, int64_t>(DREAM3D::StringConstants::TrianglesContainingVert, parentId, numVerts, preflight, err); if (err < 0 && err != -2) { return -1; } setVertices(vertices); setEdges(edges); setUnsharedEdges(bEdges); setTriangles(tris); setElementCentroids(triCentroids); setElementNeighbors(triNeighbors); setElementsContainingVert(trisContainingVert); return 1; }
// ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- TriangleGeom::Pointer TriangleGeom::CreateGeometry(SharedTriList::Pointer triangles, SharedVertexList::Pointer vertices, const QString& name) { if (name.isEmpty() == true) { return NullPointer(); } if (vertices.get() == NULL) { return TriangleGeom::NullPointer(); } if (triangles.get() == NULL) { return TriangleGeom::NullPointer(); } TriangleGeom* d = new TriangleGeom(); d->setVertices(vertices); d->setTriangles(triangles); d->setName(name); Pointer ptr(d); return ptr; }