* Fix #16013

* Fix #16013
This commit is contained in:
bgbsww
2024-09-02 12:00:47 -04:00
committed by GitHub
parent 24bb499c1f
commit 3a6f70946a
2 changed files with 55 additions and 19 deletions

View File

@@ -1676,11 +1676,21 @@ TEST_F(TopoShapeExpansionTest, makeElementRuledSurfaceEdges)
EXPECT_FLOAT_EQ(getArea(topoShape.getShape()), 20);
// Assert that we're creating a correct element map
EXPECT_TRUE(topoShape.getMappedChildElements().empty());
// TODO: Revisit these when resetElementMap() is fully worked through. Suspect that last loop
// of makeElementRuledSurface is dependent on this to create elementMaps.
// EXPECT_EQ(elements.size(), 24);
// EXPECT_EQ(elements.count(IndexedName("Edge", 1)), 1);
// EXPECT_EQ(elements[IndexedName("Edge", 1)], MappedName("Vertex1;:G;PSH;:H2:7,E"));
EXPECT_EQ(elements.size(), 9);
EXPECT_EQ(elements.count(IndexedName("Edge", 1)), 1);
EXPECT_TRUE(allElementsMatch(
topoShape,
{
"Edge1",
"Edge1;:L(Edge1;D1|Vertex1;:L(Vertex1;D1);RSF|Vertex2;:L(Vertex2;D1);RSF);RSF",
"Edge1;D1",
"Vertex1",
"Vertex1;:L(Vertex1;D1);RSF",
"Vertex1;D1",
"Vertex2",
"Vertex2;:L(Vertex2;D1);RSF",
"Vertex2;D1",
}));
}
TEST_F(TopoShapeExpansionTest, makeElementRuledSurfaceWires)
@@ -1690,18 +1700,44 @@ TEST_F(TopoShapeExpansionTest, makeElementRuledSurfaceWires)
TopoShape cube1TS {cube1, 1L};
std::vector<TopoShape> subWires = cube1TS.getSubTopoShapes(TopAbs_WIRE);
// Act
cube1TS.makeElementRuledSurface({subWires[0], subWires[1]}, 0); // TODO: orientation as enum?
auto elements = elementMap(cube1TS);
auto surface = cube1TS.makeElementRuledSurface({subWires[0], subWires[1]},
0); // TODO: orientation as enum?
auto elements = elementMap(surface);
// Assert
EXPECT_EQ(cube1TS.countSubElements("Wire"), 4);
EXPECT_NEAR(getArea(cube1TS.getShape()), 2.023056, 1e-6);
EXPECT_EQ(surface.countSubElements("Wire"), 4);
EXPECT_NEAR(getArea(surface.getShape()), 4, 1e-7);
// Assert that we're creating a correct element map
EXPECT_TRUE(cube1TS.getMappedChildElements().empty());
// TODO: Revisit these when resetElementMap() is fully worked through. Suspect that last loop
// of makeElementRuledSurface is dependent on this to create elementMaps.
// EXPECT_EQ(elements.size(), 24);
// EXPECT_EQ(elements.count(IndexedName("Edge", 1)), 1);
// EXPECT_EQ(elements[IndexedName("Edge", 1)], MappedName("Vertex1;:G;PSH;:H2:7,E"));
EXPECT_TRUE(surface.getMappedChildElements().empty());
EXPECT_EQ(elements.size(), 24);
EXPECT_EQ(elements.count(IndexedName("Edge", 1)), 1);
EXPECT_TRUE(elementsMatch( // Depending on OCCT versions can get 24 or 28 entries here.
surface,
{
"Edge1",
"Edge1;:L(Edge1;D1|Vertex1;:L(Vertex1;D1);RSF|Vertex2;:L(Vertex2;D1);RSF);RSF",
"Edge1;D1",
"Edge2",
"Edge2;:L(Edge2;D1|Vertex1;:L(Vertex1;D1);RSF|Vertex3;:L(Vertex3;D1);RSF);RSF",
"Edge2;D1",
"Edge3",
"Edge3;:L(Edge3;D1|Vertex3;:L(Vertex3;D1);RSF|Vertex4;:L(Vertex4;D1);RSF);RSF",
"Edge3;D1",
"Edge4",
"Edge4;:L(Edge4;D1|Vertex2;:L(Vertex2;D1);RSF|Vertex4;:L(Vertex4;D1);RSF);RSF",
"Edge4;D1",
"Vertex1",
"Vertex1;:L(Vertex1;D1);RSF",
"Vertex1;D1",
"Vertex2",
"Vertex2;:L(Vertex2;D1);RSF",
"Vertex2;D1",
"Vertex3",
"Vertex3;:L(Vertex3;D1);RSF",
"Vertex3;D1",
"Vertex4",
"Vertex4;:L(Vertex4;D1);RSF",
"Vertex4;D1",
}));
}
TEST_F(TopoShapeExpansionTest, makeElementLoft)