Skip to content

Commit

Permalink
ENH: Remove support for Unshared lists from Node Geometries.
Browse files Browse the repository at this point in the history
- Remove Unshared Edge List from Triangle and Quad
- Remove Unshared Face List from Hex and Tet

Signed-off-by: Michael Jackson <[email protected]>
  • Loading branch information
imikejackson committed Oct 29, 2024
1 parent 9bee9ce commit 74ae788
Show file tree
Hide file tree
Showing 23 changed files with 63 additions and 330 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
"TriangleDataContainer/Vertex Data",
"TriangleDataContainer/Face Data/FaceLabels",
"TriangleDataContainer/Vertex Data/NodeType",
"TriangleDataContainer/Edge List",
"TriangleDataContainer/SharedEdgeList",
"TriangleDataContainer/Face Data/FaceAreas",
"TriangleDataContainer/Face Data/FaceNormals",
"TriangleDataContainer/Face Data/FaceDihedralAngles",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"DataContainer/Cell Feature Data/SlipSystems",
"DataContainer/Cell Feature Data/SurfaceAreaVolumeRatio",
"TriangleDataContainer",
"TriangleDataContainer/SharedTriList",
"TriangleDataContainer/SharedFaceList",
"TriangleDataContainer/SharedVertexList",
"TriangleDataContainer/Face Data",
"TriangleDataContainer/Vertex Data",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,14 @@
"DataContainer/Cell Feature Data/SlipSystems",
"DataContainer/Cell Feature Data/SurfaceAreaVolumeRatio",
"TriangleDataContainer",
"TriangleDataContainer/SharedTriList",
"TriangleDataContainer/SharedFaceList",
"TriangleDataContainer/SharedVertexList",
"TriangleDataContainer/Face Data",
"TriangleDataContainer/Vertex Data",
"TriangleDataContainer/Vertex Data/NodeType",
"TriangleDataContainer/Face Data/FaceLabels",
"TriangleDataContainer/QM Face Feature Data",
"TriangleDataContainer/Edge List"
"TriangleDataContainer/SharedEdgeList"
],
"file_path": "Data/Output/SurfaceMesh/SmallIN100_Smoothed.dream3d"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,14 @@
"DataContainer/Cell Feature Data/SlipSystems",
"DataContainer/Cell Feature Data/SurfaceAreaVolumeRatio",
"TriangleDataContainer",
"TriangleDataContainer/SharedTriList",
"TriangleDataContainer/SharedFaceList",
"TriangleDataContainer/SharedVertexList",
"TriangleDataContainer/Face Data",
"TriangleDataContainer/Vertex Data",
"TriangleDataContainer/Vertex Data/NodeType",
"TriangleDataContainer/Face Data/FaceLabels",
"TriangleDataContainer/QM Face Feature Data",
"TriangleDataContainer/Edge List",
"TriangleDataContainer/SharedEdgeList",
"TriangleDataContainer/Face Data/FaceAreas",
"TriangleDataContainer/Face Data/FaceNormals",
"TriangleDataContainer/Face Data/FaceDihedralAngles",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,14 @@
"DataContainer/Cell Feature Data/SlipSystems",
"DataContainer/Cell Feature Data/SurfaceAreaVolumeRatio",
"TriangleDataContainer",
"TriangleDataContainer/SharedTriList",
"TriangleDataContainer/SharedFaceList",
"TriangleDataContainer/SharedVertexList",
"TriangleDataContainer/Face Data",
"TriangleDataContainer/Vertex Data",
"TriangleDataContainer/Vertex Data/NodeType",
"TriangleDataContainer/Face Data/FaceLabels",
"TriangleDataContainer/QM Face Feature Data",
"TriangleDataContainer/Edge List",
"TriangleDataContainer/SharedEdgeList",
"TriangleDataContainer/Face Data/FaceAreas",
"TriangleDataContainer/Face Data/FaceNormals",
"TriangleDataContainer/Face Data/FaceDihedralAngles",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ TEST_CASE("SimplnxCore::QuickSurfaceMeshFilter", "[SimplnxCore][QuickSurfaceMesh
REQUIRE(vertices->getNumberOfTuples() == 28894);

// Compare the shift values
CompareArrays<IGeometry::MeshIndexType>(dataStructure, triangleGeometryPath.createChildPath("SharedTriList"), DataPath({exemplarGeometryPath, "SharedTriList"}));
CompareArrays<IGeometry::MeshIndexType>(dataStructure, triangleGeometryPath.createChildPath("SharedFaceList"), DataPath({exemplarGeometryPath, "SharedTriList"}));
CompareArrays<float32>(dataStructure, triangleGeometryPath.createChildPath("SharedVertexList"), DataPath({exemplarGeometryPath, "SharedVertexList"}));
}

Expand Down
4 changes: 2 additions & 2 deletions src/Plugins/SimplnxCore/test/SurfaceNetsTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ TEST_CASE("SimplnxCore::SurfaceNetsFilter: NO Smoothing", "[SimplnxCore][Surface
REQUIRE(verticesPtr->getNumberOfTuples() == 28894);

// Compare the shift values
CompareArrays<IGeometry::MeshIndexType>(dataStructure, triangleGeometryPath.createChildPath("SharedTriList"), DataPath({exemplarGeometryPath, "SharedTriList"}));
CompareArrays<IGeometry::MeshIndexType>(dataStructure, triangleGeometryPath.createChildPath("SharedFaceList"), DataPath({exemplarGeometryPath, "SharedTriList"}));
CompareArrays<float32>(dataStructure, triangleGeometryPath.createChildPath("SharedVertexList"), DataPath({exemplarGeometryPath, "SharedVertexList"}));
}

Expand Down Expand Up @@ -155,7 +155,7 @@ TEST_CASE("SimplnxCore::SurfaceNetsFilter: With Smoothing", "[SimplnxCore][Surfa
REQUIRE(verticesPtr->getNumberOfTuples() == 28894);

// Compare the shift values
CompareArrays<IGeometry::MeshIndexType>(dataStructure, triangleGeometryPath.createChildPath("SharedTriList"), DataPath({exemplarGeometryPath, "SharedTriList"}));
CompareArrays<IGeometry::MeshIndexType>(dataStructure, triangleGeometryPath.createChildPath("SharedFaceList"), DataPath({exemplarGeometryPath, "SharedTriList"}));
CompareArrays<float32>(dataStructure, triangleGeometryPath.createChildPath("SharedVertexList"), DataPath({exemplarGeometryPath, "SharedVertexList"}));
}

Expand Down
16 changes: 6 additions & 10 deletions src/simplnx/DataStructure/Geometry/HexahedralGeom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -159,19 +159,13 @@ std::shared_ptr<DataObject> HexahedralGeom::deepCopy(const DataPath& copyPath)
{
copy->m_CellCentroidsDataArrayId = eltCentroidsCopy->getId();
}
if(const auto unsharedEdgesCopy = dataStruct.getDataAs<DataArray<MeshIndexType>>(copyPath.createChildPath(k_UnsharedEdges)); unsharedEdgesCopy != nullptr)
{
copy->m_UnsharedEdgeListId = unsharedEdgesCopy->getId();
}
if(const auto edgesCopy = dataStruct.getDataAs<DataArray<MeshIndexType>>(copyPath.createChildPath(INodeGeometry2D::k_Edges)); edgesCopy != nullptr)

if(const auto edgesCopy = dataStruct.getDataAs<DataArray<MeshIndexType>>(copyPath.createChildPath(INodeGeometry2D::k_SharedEdgeList)); edgesCopy != nullptr)
{
copy->m_EdgeDataArrayId = edgesCopy->getId();
}
if(const auto unsharedFacesCopy = dataStruct.getDataAs<DataArray<MeshIndexType>>(copyPath.createChildPath(k_UnsharedFaces)); unsharedFacesCopy != nullptr)
{
copy->m_UnsharedFaceListId = unsharedFacesCopy->getId();
}
if(const auto facesCopy = dataStruct.getDataAs<DataArray<MeshIndexType>>(copyPath.createChildPath(INodeGeometry3D::k_QuadFaceList)); facesCopy != nullptr)

if(const auto facesCopy = dataStruct.getDataAs<DataArray<MeshIndexType>>(copyPath.createChildPath(INodeGeometry3D::k_SharedFaceList)); facesCopy != nullptr)
{
copy->m_FaceListId = facesCopy->getId();
}
Expand Down Expand Up @@ -377,6 +371,7 @@ IGeometry::StatusCode HexahedralGeom::findFaces(bool recalculate)
return 1;
}

#if 0
IGeometry::StatusCode HexahedralGeom::findUnsharedEdges(bool recalculate)
{
auto* unsharedEdgeList = getDataStructureRef().getDataAsUnsafe<DataArray<MeshIndexType>>(m_UnsharedEdgeListId);
Expand Down Expand Up @@ -420,3 +415,4 @@ IGeometry::StatusCode HexahedralGeom::findUnsharedFaces(bool recalculate)
m_UnsharedFaceListId = unsharedQuadList->getId();
return 1;
}
#endif
14 changes: 0 additions & 14 deletions src/simplnx/DataStructure/Geometry/HexahedralGeom.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ class SIMPLNX_EXPORT HexahedralGeom : public INodeGeometry3D
static inline constexpr StringLiteral k_EltsContainingVert = "Hex Containing Vertices";
static inline constexpr StringLiteral k_EltNeighbors = "Hex Neighbors";
static inline constexpr StringLiteral k_EltCentroids = "Hex Centroids";
static inline constexpr StringLiteral k_UnsharedEdges = "Unshared Edge List";
static inline constexpr StringLiteral k_UnsharedFaces = "Unshared Face List";
static inline constexpr StringLiteral k_TypeName = "HexahedralGeom";

/**
Expand Down Expand Up @@ -169,18 +167,6 @@ class SIMPLNX_EXPORT HexahedralGeom : public INodeGeometry3D
*/
StatusCode findFaces(bool recalculate) override;

/**
* @brief
* @return StatusCode
*/
StatusCode findUnsharedEdges(bool recalculate) override;

/**
* @brief
* @return StatusCode
*/
StatusCode findUnsharedFaces(bool recalculate) override;

protected:
/**
* @brief
Expand Down
23 changes: 1 addition & 22 deletions src/simplnx/DataStructure/Geometry/INodeGeometry2D.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,27 +127,6 @@ void INodeGeometry2D::deleteEdges()
m_EdgeDataArrayId.reset();
}

const std::optional<INodeGeometry2D::IdType>& INodeGeometry2D::getUnsharedEdgesId() const
{
return m_UnsharedEdgeListId;
}

void INodeGeometry2D::setUnsharedEdgesId(const OptionalId& unsharedEdgesId)
{
m_UnsharedEdgeListId = unsharedEdgesId;
}

const INodeGeometry2D::SharedEdgeList* INodeGeometry2D::getUnsharedEdges() const
{
return getDataStructureRef().getDataAs<SharedEdgeList>(m_UnsharedEdgeListId);
}

void INodeGeometry2D::deleteUnsharedEdges()
{
getDataStructureRef().removeData(m_UnsharedEdgeListId);
m_UnsharedEdgeListId.reset();
}

const std::optional<INodeGeometry2D::IdType>& INodeGeometry2D::getFaceAttributeMatrixId() const
{
return m_FaceAttributeMatrixId;
Expand Down Expand Up @@ -208,7 +187,7 @@ void INodeGeometry2D::setFaceAttributeMatrix(const AttributeMatrix& attributeMat
INodeGeometry2D::SharedEdgeList* INodeGeometry2D::createSharedEdgeList(usize numEdges)
{
auto dataStore = std::make_unique<DataStore<MeshIndexType>>(std::vector<usize>{numEdges}, std::vector<usize>{2}, 0);
SharedEdgeList* edges = DataArray<MeshIndexType>::Create(*getDataStructure(), k_Edges, std::move(dataStore), getId());
SharedEdgeList* edges = DataArray<MeshIndexType>::Create(*getDataStructure(), k_SharedEdgeList, std::move(dataStore), getId());
return edges;
}

Expand Down
28 changes: 1 addition & 27 deletions src/simplnx/DataStructure/Geometry/INodeGeometry2D.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class SIMPLNX_EXPORT INodeGeometry2D : public INodeGeometry1D
{
public:
static inline constexpr StringLiteral k_FaceDataName = "Face Data";
static inline constexpr StringLiteral k_Edges = "Shared Edge List";
static inline constexpr StringLiteral k_SharedEdgeList = "SharedEdgeList";
static inline constexpr StringLiteral k_TypeName = "INodeGeometry2D";

INodeGeometry2D() = delete;
Expand Down Expand Up @@ -114,32 +114,6 @@ class SIMPLNX_EXPORT INodeGeometry2D : public INodeGeometry1D
*/
void deleteEdges();

/**
* @brief
* @return
*/
const std::optional<IdType>& getUnsharedEdgesId() const;

void setUnsharedEdgesId(const OptionalId& unsharedEdgesId);

/**
* @brief
* @return StatusCode
*/
virtual StatusCode findUnsharedEdges(bool recalculate) = 0;

/**
* @brief Returns a const pointer to the unshared edge list. Returns nullptr
* if no unshared edge list could be found.
* @return const SharedEdgeList*
*/
const SharedEdgeList* getUnsharedEdges() const;

/**
* @brief Deletes the unshared edge list and removes it from the DataStructure.
*/
void deleteUnsharedEdges();

/****************************************************************************
* These functions get values related to where the Vertex Coordinates are
* stored in the DataStructure
Expand Down
25 changes: 2 additions & 23 deletions src/simplnx/DataStructure/Geometry/INodeGeometry3D.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,27 +130,6 @@ void INodeGeometry3D::deleteFaces()
m_FaceListId.reset();
}

const std::optional<INodeGeometry3D::IdType>& INodeGeometry3D::getUnsharedFacesId() const
{
return m_UnsharedFaceListId;
}

void INodeGeometry3D::setUnsharedFacedId(const OptionalId& id)
{
m_UnsharedFaceListId = id;
}

const INodeGeometry3D::SharedFaceList* INodeGeometry3D::getUnsharedFaces() const
{
return getDataStructureRef().getDataAs<SharedFaceList>(m_UnsharedFaceListId);
}

void INodeGeometry3D::deleteUnsharedFaces()
{
getDataStructureRef().removeData(m_UnsharedFaceListId);
m_UnsharedFaceListId.reset();
}

const std::optional<INodeGeometry3D::IdType>& INodeGeometry3D::getPolyhedraAttributeMatrixId() const
{
return m_PolyhedronAttributeMatrixId;
Expand Down Expand Up @@ -211,14 +190,14 @@ void INodeGeometry3D::setPolyhedraAttributeMatrix(const AttributeMatrix& attribu
INodeGeometry3D::SharedQuadList* INodeGeometry3D::createSharedQuadList(usize numQuads)
{
auto dataStore = std::make_unique<DataStore<MeshIndexType>>(std::vector<usize>{numQuads}, std::vector<usize>{4}, 0);
SharedQuadList* quads = DataArray<MeshIndexType>::Create(*getDataStructure(), k_QuadFaceList, std::move(dataStore), getId());
SharedQuadList* quads = DataArray<MeshIndexType>::Create(*getDataStructure(), k_SharedFaceList, std::move(dataStore), getId());
return quads;
}

INodeGeometry3D::SharedTriList* INodeGeometry3D::createSharedTriList(usize numTris)
{
auto dataStore = std::make_unique<DataStore<MeshIndexType>>(std::vector<usize>{numTris}, std::vector<usize>{3}, 0);
SharedTriList* triangles = DataArray<MeshIndexType>::Create(*getDataStructure(), k_TriangleFaceList, std::move(dataStore), getId());
SharedTriList* triangles = DataArray<MeshIndexType>::Create(*getDataStructure(), k_SharedFaceList, std::move(dataStore), getId());
return triangles;
}

Expand Down
31 changes: 1 addition & 30 deletions src/simplnx/DataStructure/Geometry/INodeGeometry3D.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@ class SIMPLNX_EXPORT INodeGeometry3D : public INodeGeometry2D
{
public:
static inline constexpr StringLiteral k_PolyhedronDataName = "Polyhedron Data";
static inline constexpr StringLiteral k_TriangleFaceList = "Shared Tri List";
static inline constexpr StringLiteral k_QuadFaceList = "Shared Quad List";
static inline constexpr StringLiteral k_TypeName = "INodeGeometry3D";
static inline constexpr StringLiteral k_SharedFaceList = "SharedFaceList";

INodeGeometry3D() = delete;
INodeGeometry3D(const INodeGeometry3D&) = default;
Expand Down Expand Up @@ -78,34 +77,6 @@ class SIMPLNX_EXPORT INodeGeometry3D : public INodeGeometry2D
*/
void deleteFaces();

/**
* @brief
* @return
*/
const std::optional<IdType>& getUnsharedFacesId() const;

/**
* @brief
* @return
*/
void setUnsharedFacedId(const OptionalId& id);

/**
* @brief Creates and assigns the unshared face list array for the current values.
*/
virtual StatusCode findUnsharedFaces(bool recalculate) = 0;

/**
* @brief Returns a pointer to the unshared face list array.
* @return
*/
const SharedFaceList* getUnsharedFaces() const;

/**
* @brief Deletes the current unshared face list array.
*/
void deleteUnsharedFaces();

/**
* @brief Returns the number of vertices in the cell.
* @return
Expand Down
26 changes: 2 additions & 24 deletions src/simplnx/DataStructure/Geometry/QuadGeom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,11 +145,11 @@ std::shared_ptr<DataObject> QuadGeom::deepCopy(const DataPath& copyPath)
{
copy->m_CellCentroidsDataArrayId = eltCentroidsCopy->getId();
}
if(const auto unsharedEdgesCopy = dataStruct.getDataAs<DataArray<MeshIndexType>>(copyPath.createChildPath(k_UnsharedEdges)); unsharedEdgesCopy != nullptr)
if(const auto unsharedEdgesCopy = dataStruct.getDataAs<DataArray<MeshIndexType>>(copyPath.createChildPath(k_SharedEdgeList)); unsharedEdgesCopy != nullptr)
{
copy->m_UnsharedEdgeListId = unsharedEdgesCopy->getId();
}
if(const auto edgesCopy = dataStruct.getDataAs<DataArray<MeshIndexType>>(copyPath.createChildPath(INodeGeometry2D::k_Edges)); edgesCopy != nullptr)
if(const auto edgesCopy = dataStruct.getDataAs<DataArray<MeshIndexType>>(copyPath.createChildPath(INodeGeometry2D::k_SharedEdgeList)); edgesCopy != nullptr)
{
copy->m_EdgeDataArrayId = edgesCopy->getId();
}
Expand Down Expand Up @@ -310,25 +310,3 @@ IGeometry::StatusCode QuadGeom::findEdges(bool recalculate)
m_EdgeDataArrayId = edgeList->getId();
return 1;
}

IGeometry::StatusCode QuadGeom::findUnsharedEdges(bool recalculate)
{
auto* unsharedEdgeList = getDataStructureRef().getDataAsUnsafe<DataArray<MeshIndexType>>(m_UnsharedEdgeListId);
if(unsharedEdgeList != nullptr && !recalculate)
{
return 0;
}
if(unsharedEdgeList == nullptr)
{
auto dataStore = std::make_unique<DataStore<MeshIndexType>>(std::vector<usize>{0}, std::vector<usize>{2}, 0);
unsharedEdgeList = DataArray<MeshIndexType>::Create(*getDataStructure(), k_UnsharedEdges, std::move(dataStore), getId());
}
if(unsharedEdgeList == nullptr)
{
m_UnsharedEdgeListId.reset();
return -1;
}
GeometryHelpers::Connectivity::Find2DUnsharedEdges<MeshIndexType>(getFaces(), unsharedEdgeList);
m_UnsharedEdgeListId = unsharedEdgeList->getId();
return 1;
}
8 changes: 1 addition & 7 deletions src/simplnx/DataStructure/Geometry/QuadGeom.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ class SIMPLNX_EXPORT QuadGeom : public INodeGeometry2D
static inline constexpr StringLiteral k_EltsContainingVert = "Quads Containing Vert";
static inline constexpr StringLiteral k_EltNeighbors = "Quad Neighbors";
static inline constexpr StringLiteral k_EltCentroids = "Quad Centroids";
static inline constexpr StringLiteral k_UnsharedEdges = "Unshared Edge List";
static inline constexpr StringLiteral k_TypeName = "QuadGeom";

/**
* @brief
* @param dataStructure
Expand Down Expand Up @@ -156,12 +156,6 @@ class SIMPLNX_EXPORT QuadGeom : public INodeGeometry2D
*/
StatusCode findEdges(bool recalculate) override;

/**
* @brief
* @return StatusCode
*/
StatusCode findUnsharedEdges(bool recalculate) override;

protected:
/**
* @brief
Expand Down
Loading

0 comments on commit 74ae788

Please sign in to comment.