From f6e3e26690ad56847c92b6427220a764f67fb792 Mon Sep 17 00:00:00 2001 From: tokusanya Date: Tue, 17 Sep 2024 19:07:02 -0600 Subject: [PATCH] IOSS: Update TextMesh to handle extended shell ordinals to the edges (#495) * IOSS: Update TextMesh to handle extended shell ordinals to the edges * Fix to make sure adjacency graph is limited to faces --- .../seacas/libraries/ioss/src/Ioss_Utils.C | 12 ++++++++---- .../seacas/libraries/ioss/src/Ioss_Utils.h | 2 ++ .../ioss/src/text_mesh/Iotm_TextMesh.C | 7 ++++++- .../text_mesh/Iotm_TextMeshAdjacencyGraph.h | 6 +++--- .../text_mesh/Iotm_TextMeshTopologyMapping.h | 19 ++++++++++++------- 5 files changed, 31 insertions(+), 15 deletions(-) diff --git a/packages/seacas/libraries/ioss/src/Ioss_Utils.C b/packages/seacas/libraries/ioss/src/Ioss_Utils.C index 9af126586e..abfe50f8a5 100644 --- a/packages/seacas/libraries/ioss/src/Ioss_Utils.C +++ b/packages/seacas/libraries/ioss/src/Ioss_Utils.C @@ -940,11 +940,8 @@ void Ioss::Utils::calculate_sideblock_membership(IntVector &face_is_ } } -int64_t Ioss::Utils::get_side_offset(const Ioss::SideBlock *sb) +int64_t Ioss::Utils::get_side_offset(const Ioss::ElementTopology * parent_topo, const Ioss::ElementTopology * side_topo) { - - const Ioss::ElementTopology *side_topo = sb->topology(); - const Ioss::ElementTopology *parent_topo = sb->parent_element_topology(); int64_t side_offset = 0; if ((side_topo != nullptr) && (parent_topo != nullptr)) { int side_topo_dim = side_topo->parametric_dimension(); @@ -958,6 +955,13 @@ int64_t Ioss::Utils::get_side_offset(const Ioss::SideBlock *sb) return side_offset; } +int64_t Ioss::Utils::get_side_offset(const Ioss::SideBlock *sb) +{ + const Ioss::ElementTopology *side_topo = sb->topology(); + const Ioss::ElementTopology *parent_topo = sb->parent_element_topology(); + return get_side_offset(parent_topo, side_topo); +} + std::string Ioss::Utils::shape_to_string(const Ioss::ElementShape &shape) { switch (shape) { diff --git a/packages/seacas/libraries/ioss/src/Ioss_Utils.h b/packages/seacas/libraries/ioss/src/Ioss_Utils.h index cb623ce1c1..a805262806 100644 --- a/packages/seacas/libraries/ioss/src/Ioss_Utils.h +++ b/packages/seacas/libraries/ioss/src/Ioss_Utils.h @@ -500,6 +500,8 @@ namespace Ioss { * \param[in] sb Compute the offset for element sides in this SideBlock * \returns The offset. */ + IOSS_NODISCARD static int64_t get_side_offset(const Ioss::ElementTopology * parent_topo, const Ioss::ElementTopology * side_topo); + IOSS_NODISCARD static int64_t get_side_offset(const Ioss::SideBlock *sb); IOSS_NODISCARD static unsigned int hash(const std::string &name); diff --git a/packages/seacas/libraries/ioss/src/text_mesh/Iotm_TextMesh.C b/packages/seacas/libraries/ioss/src/text_mesh/Iotm_TextMesh.C index 51d6490033..34b966e51f 100644 --- a/packages/seacas/libraries/ioss/src/text_mesh/Iotm_TextMesh.C +++ b/packages/seacas/libraries/ioss/src/text_mesh/Iotm_TextMesh.C @@ -880,6 +880,11 @@ namespace Iotm { return; SideBlockInfo info = sideset->get_side_block_info(sideBlockName); + Ioss::ElementTopology* topology = Ioss::ElementTopology::factory(info.elementTopology, true); + Ioss::ElementTopology* side_topology = Ioss::ElementTopology::factory(info.sideTopology, true); + + int sideOffset = Ioss::Utils::get_side_offset(topology, side_topology); + std::vector localSideIndex = sideset->get_sideblock_indices_local_to_proc(info, m_myProcessor); elemSides.resize(2 * localSideIndex.size()); @@ -892,7 +897,7 @@ namespace Iotm { int side = elemSidePair.second; elemSides[count++] = elemId; - elemSides[count++] = side; + elemSides[count++] = side - sideOffset; } } diff --git a/packages/seacas/libraries/ioss/src/text_mesh/Iotm_TextMeshAdjacencyGraph.h b/packages/seacas/libraries/ioss/src/text_mesh/Iotm_TextMeshAdjacencyGraph.h index 093cea5f08..1ef266eb32 100644 --- a/packages/seacas/libraries/ioss/src/text_mesh/Iotm_TextMeshAdjacencyGraph.h +++ b/packages/seacas/libraries/ioss/src/text_mesh/Iotm_TextMeshAdjacencyGraph.h @@ -364,7 +364,7 @@ namespace Iotm { std::vector sideNodes = get_sorted_side_nodes(adjacency.elementIndex, adjacency.side); - for (int otherSide = 1; otherSide <= get_element_topology(neighborElementIndex).num_sides(); + for (int otherSide = 1; otherSide <= get_element_topology(neighborElementIndex).num_face_sides(); ++otherSide) { std::vector otherSideNodes = get_sorted_side_nodes(neighborElementIndex, otherSide); @@ -738,7 +738,7 @@ namespace Iotm { initialize_side_connectivity_graph(elementIndices); for (size_t elementIndex : elementIndices) { - int numSides = get_element_topology(elementIndex).num_sides(); + int numSides = get_element_topology(elementIndex).num_face_sides(); for (int side = 1; side <= numSides; ++side) { if (m_indexGraph[elementIndex].sideReference[side - 1] == 0) { CurrentAdjacency adjacency(elementIndex, side); @@ -752,7 +752,7 @@ namespace Iotm { { for (size_t elementIndex : elementIndices) { m_indexGraph[elementIndex] = - FaceConnections(get_element_topology(elementIndex).num_sides()); + FaceConnections(get_element_topology(elementIndex).num_face_sides()); } } diff --git a/packages/seacas/libraries/ioss/src/text_mesh/Iotm_TextMeshTopologyMapping.h b/packages/seacas/libraries/ioss/src/text_mesh/Iotm_TextMeshTopologyMapping.h index 207b1dd70f..d005a7d24b 100644 --- a/packages/seacas/libraries/ioss/src/text_mesh/Iotm_TextMeshTopologyMapping.h +++ b/packages/seacas/libraries/ioss/src/text_mesh/Iotm_TextMeshTopologyMapping.h @@ -80,7 +80,7 @@ namespace Iotm { bool operator!=(const TopologyMapEntry &rhs) const { return !(*this == rhs); } - int num_sides() const + int num_face_sides() const { if (topology->is_shell()) { // Only interested in face boundaries, not edges @@ -92,6 +92,11 @@ namespace Iotm { return topology->number_boundaries(); } + int num_sides() const + { + return sideTopologies.size(); + } + // Side references are one-based bool valid_side(unsigned side) const { @@ -583,7 +588,7 @@ namespace Iotm { if (!entry.initialized) { entry.set_valid_spatial_dimensions({false, false, false, true}); - entry.set_side_topologies({tri_3_factory(), tri_3_factory()}); + entry.set_side_topologies({tri_3_factory(), tri_3_factory(), line_2_factory(), line_2_factory(), line_2_factory()}); entry.initialized = true; } @@ -596,7 +601,7 @@ namespace Iotm { if (!entry.initialized) { entry.set_valid_spatial_dimensions({false, false, false, true}); - entry.set_side_topologies({tri_4_factory(), tri_4_factory()}); + entry.set_side_topologies({tri_4_factory(), tri_4_factory(), line_2_factory(), line_2_factory(), line_2_factory()}); entry.initialized = true; } @@ -609,7 +614,7 @@ namespace Iotm { if (!entry.initialized) { entry.set_valid_spatial_dimensions({false, false, false, true}); - entry.set_side_topologies({tri_6_factory(), tri_6_factory()}); + entry.set_side_topologies({tri_6_factory(), tri_6_factory(), line_3_factory(), line_3_factory(), line_3_factory()}); entry.initialized = true; } @@ -627,7 +632,7 @@ namespace Iotm { if (!entry.initialized) { entry.set_valid_spatial_dimensions({false, false, false, true}); - entry.set_side_topologies({quad_4_factory(), quad_4_factory()}); + entry.set_side_topologies({quad_4_factory(), quad_4_factory(), line_2_factory(), line_2_factory(), line_2_factory(), line_2_factory()}); entry.initialized = true; } @@ -640,7 +645,7 @@ namespace Iotm { if (!entry.initialized) { entry.set_valid_spatial_dimensions({false, false, false, true}); - entry.set_side_topologies({quad_8_factory(), quad_8_factory()}); + entry.set_side_topologies({quad_8_factory(), quad_8_factory(), line_3_factory(), line_3_factory(), line_3_factory(), line_3_factory()}); entry.initialized = true; } @@ -653,7 +658,7 @@ namespace Iotm { if (!entry.initialized) { entry.set_valid_spatial_dimensions({false, false, false, true}); - entry.set_side_topologies({quad_9_factory(), quad_9_factory()}); + entry.set_side_topologies({quad_9_factory(), quad_9_factory(), line_3_factory(), line_3_factory(), line_3_factory(), line_3_factory()}); entry.initialized = true; }