mirror of
https://github.com/Open-Cascade-SAS/OCCT.git
synced 2026-09-04 11:47:53 +08:00
Coding - Apply Clang-Tidy automatic fixes (#1245)
Flags: aChecks="modernize-deprecated-headers,modernize-redundant-void-arg,modernize-use-bool-literals,modernize-use-equals-default,modernize-use-equals-delete,modernize-use-nullptr,modernize-use-override,performance-avoid-endl,performance-move-constructor-init,readability-braces-around-statements,readability-delete-null-pointer,readability-redundant-control-flow,readability-redundant-declaration,readability-redundant-function-ptr-dereference,readability-redundant-member-init,readability-redundant-string-init,readability-static-accessed-through-instance" clang-tidy version: 22.1.3
This commit is contained in:
@@ -104,9 +104,13 @@ TEST(BRepAdaptor_CompCurve_Test, OCC29430_ArcBoundaryPoints)
|
||||
for (const gp_Pnt& aV : aVertices)
|
||||
{
|
||||
if (aStartPt.Distance(aV) < 1.0e-7)
|
||||
{
|
||||
aStartMatchesAnyVertex = true;
|
||||
}
|
||||
if (anEndPt.Distance(aV) < 1.0e-7)
|
||||
{
|
||||
anEndMatchesAnyVertex = true;
|
||||
}
|
||||
}
|
||||
EXPECT_TRUE(aStartMatchesAnyVertex) << "Start point does not match any wire vertex";
|
||||
EXPECT_TRUE(anEndMatchesAnyVertex) << "End point does not match any wire vertex";
|
||||
@@ -143,9 +147,13 @@ TEST(BRepAdaptor_CompCurve_Test, OCC30869_ReversedEdgeBoundaryPoints)
|
||||
aBACC.D1(aLast, aPLast, aVLast);
|
||||
|
||||
if (aVFirst.SquareMagnitude() > gp::Resolution())
|
||||
{
|
||||
aVFirst.Normalize();
|
||||
}
|
||||
if (aVLast.SquareMagnitude() > gp::Resolution())
|
||||
{
|
||||
aVLast.Normalize();
|
||||
}
|
||||
|
||||
// Reference: inverse circle (normal = (0,1,0)), evaluated at the same parameters
|
||||
const gp_Ax2 anAx2Ref(gp_Pnt(1., 0., 0.), gp_Dir(0., 1., 0.), gp_Dir(0., 0., -1.));
|
||||
@@ -156,9 +164,13 @@ TEST(BRepAdaptor_CompCurve_Test, OCC30869_ReversedEdgeBoundaryPoints)
|
||||
aCircleRef->D1(t1, aRefP1, aRefV1);
|
||||
aCircleRef->D1(t2, aRefP2, aRefV2);
|
||||
if (aRefV1.SquareMagnitude() > gp::Resolution())
|
||||
{
|
||||
aRefV1.Normalize();
|
||||
}
|
||||
if (aRefV2.SquareMagnitude() > gp::Resolution())
|
||||
{
|
||||
aRefV2.Normalize();
|
||||
}
|
||||
|
||||
const double aTol = 1.e-7;
|
||||
EXPECT_NEAR(aPFirst.X(), aRefP1.X(), aTol) << "First point X";
|
||||
|
||||
@@ -73,7 +73,9 @@ static int countSubShapes(const TopoDS_Shape& theShape, TopAbs_ShapeEnum theType
|
||||
{
|
||||
int aCount = 0;
|
||||
for (TopExp_Explorer anExp(theShape, theType); anExp.More(); anExp.Next())
|
||||
{
|
||||
++aCount;
|
||||
}
|
||||
return aCount;
|
||||
}
|
||||
|
||||
@@ -429,7 +431,9 @@ TEST(BRepGraphIncTest, Box_ReverseIndex_EdgesToFaces)
|
||||
for (BRepGraph_EdgeId anEdgeId(0); anEdgeId.IsValid(aNbEdges); ++anEdgeId)
|
||||
{
|
||||
if (aStorage.Edge(anEdgeId).IsDegenerate)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
const NCollection_DynamicArray<BRepGraph_FaceId>* aFaces =
|
||||
aStorage.ReverseIndex().FacesOfEdge(anEdgeId);
|
||||
EXPECT_TRUE(aFaces != nullptr) << "Edge " << anEdgeId.Index << " not in any face";
|
||||
@@ -533,7 +537,9 @@ TEST(BRepGraphIncTest, Box_CoEdgeCount)
|
||||
const NCollection_DynamicArray<BRepGraph_CoEdgeId>* aCoEdgeIdxs =
|
||||
aStorage.ReverseIndex().CoEdgesOfEdge(anEdgeId);
|
||||
if (aCoEdgeIdxs != nullptr)
|
||||
{
|
||||
aCoEdgeCount += aCoEdgeIdxs->Length();
|
||||
}
|
||||
}
|
||||
EXPECT_EQ(aCoEdgeCount, 24);
|
||||
}
|
||||
@@ -555,7 +561,9 @@ TEST(BRepGraphIncTest, Cylinder_HasSeamEdges)
|
||||
const NCollection_DynamicArray<BRepGraph_CoEdgeId>* aCoEdgeIdxs =
|
||||
aStorage.ReverseIndex().CoEdgesOfEdge(anEdgeId);
|
||||
if (aCoEdgeIdxs == nullptr)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
for (const BRepGraph_CoEdgeId& aCoEdgeId : *aCoEdgeIdxs)
|
||||
{
|
||||
const BRepGraphInc::CoEdgeDef& aCE = aStorage.CoEdge(aCoEdgeId);
|
||||
@@ -586,7 +594,9 @@ TEST(BRepGraphIncTest, Cylinder_SeamEdge_ReverseIndex_NoDuplicateFace)
|
||||
const NCollection_DynamicArray<BRepGraph_FaceId>* aFaces =
|
||||
aStorage.ReverseIndex().FacesOfEdge(anEdgeId);
|
||||
if (aFaces == nullptr)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
for (int i = 0; i < aFaces->Length(); ++i)
|
||||
{
|
||||
for (int j = i + 1; j < aFaces->Length(); ++j)
|
||||
@@ -703,24 +713,24 @@ TEST(BRepGraphIncTest, Cylinder_RoundTrip_BRepDump)
|
||||
++aLineNo;
|
||||
if (anOrigLine != aReconLine)
|
||||
{
|
||||
std::cout << "BRep diff at line " << aLineNo << ":" << std::endl;
|
||||
std::cout << " ORIG: " << anOrigLine << std::endl;
|
||||
std::cout << " RECON: " << aReconLine << std::endl;
|
||||
std::cout << "BRep diff at line " << aLineNo << ":" << '\n';
|
||||
std::cout << " ORIG: " << anOrigLine << '\n';
|
||||
std::cout << " RECON: " << aReconLine << '\n';
|
||||
++aDiffCount;
|
||||
}
|
||||
}
|
||||
std::cout << "Total " << aDiffCount << " line differences. "
|
||||
<< "Orig size=" << anOrigStream.str().size()
|
||||
<< " Recon size=" << aReconStream.str().size() << std::endl;
|
||||
<< " Recon size=" << aReconStream.str().size() << '\n';
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cout << "BRep dumps are IDENTICAL (size=" << anOrigStream.str().size() << ")" << std::endl;
|
||||
std::cout << "BRep dumps are IDENTICAL (size=" << anOrigStream.str().size() << ")" << '\n';
|
||||
}
|
||||
|
||||
const double anOrigArea = computeArea(aCyl);
|
||||
const double aReconArea = computeArea(aRecon);
|
||||
std::cout << "Orig area=" << anOrigArea << " Recon area=" << aReconArea << std::endl;
|
||||
std::cout << "Orig area=" << anOrigArea << " Recon area=" << aReconArea << '\n';
|
||||
EXPECT_NEAR(aReconArea, anOrigArea, Precision::Confusion());
|
||||
}
|
||||
|
||||
@@ -900,10 +910,14 @@ TEST(BRepGraphIncTest, EdgeMultipleInternalVertices_AllCaptured)
|
||||
{
|
||||
if (aStorage.VertexRef(anEdgeEnt.InternalVertexRefIds.Value(j)).Orientation
|
||||
== TopAbs_INTERNAL)
|
||||
{
|
||||
aHasInternal = true;
|
||||
}
|
||||
if (aStorage.VertexRef(anEdgeEnt.InternalVertexRefIds.Value(j)).Orientation
|
||||
== TopAbs_EXTERNAL)
|
||||
{
|
||||
aHasExternal = true;
|
||||
}
|
||||
}
|
||||
EXPECT_TRUE(aHasInternal);
|
||||
EXPECT_TRUE(aHasExternal);
|
||||
@@ -1320,7 +1334,9 @@ TEST(BRepGraphIncTest, ReverseIndex_CoEdgeToWire_IsPopulated)
|
||||
{
|
||||
const BRepGraphInc::CoEdgeDef& aCE = aStorage.CoEdge(aCoEdgeId);
|
||||
if (aCE.IsRemoved)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
const NCollection_DynamicArray<BRepGraph_WireId>* aWires =
|
||||
aStorage.ReverseIndex().WiresOfCoEdge(aCoEdgeId);
|
||||
EXPECT_NE(aWires, nullptr) << "CoEdge " << aCoEdgeId.Index << " not in any wire";
|
||||
@@ -1461,7 +1477,9 @@ TEST(BRepGraphIncTest, ReverseIndex_AfterEditorMutations_StaysConsistent)
|
||||
const NCollection_DynamicArray<BRepGraph_WireRefId> aWireRefs =
|
||||
BRepGraph_TestTools::WireRefsOfFace(aGraph, aFaceId);
|
||||
if (aWireRefs.IsEmpty())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
ASSERT_TRUE(aGraph.Editor().Faces().RemoveWire(aFaceId, aWireRefs.Value(0)));
|
||||
break;
|
||||
}
|
||||
@@ -1510,10 +1528,14 @@ TEST(BRepGraphIncTest, ReverseIndex_BulkBuild_TwiceProducesEqualState)
|
||||
aStorageB.ReverseIndex().WiresOfEdge(anEdgeId);
|
||||
ASSERT_EQ(aWiresA == nullptr, aWiresB == nullptr);
|
||||
if (aWiresA == nullptr)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
ASSERT_EQ(aWiresA->Size(), aWiresB->Size());
|
||||
for (size_t i = 0; i < aWiresA->Size(); ++i)
|
||||
{
|
||||
EXPECT_EQ(aWiresA->Value(i), aWiresB->Value(i));
|
||||
}
|
||||
|
||||
const NCollection_DynamicArray<BRepGraph_FaceId>* aFacesA =
|
||||
aStorageA.ReverseIndex().FacesOfEdge(anEdgeId);
|
||||
@@ -1521,10 +1543,14 @@ TEST(BRepGraphIncTest, ReverseIndex_BulkBuild_TwiceProducesEqualState)
|
||||
aStorageB.ReverseIndex().FacesOfEdge(anEdgeId);
|
||||
ASSERT_EQ(aFacesA == nullptr, aFacesB == nullptr);
|
||||
if (aFacesA == nullptr)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
ASSERT_EQ(aFacesA->Size(), aFacesB->Size());
|
||||
for (size_t i = 0; i < aFacesA->Size(); ++i)
|
||||
{
|
||||
EXPECT_EQ(aFacesA->Value(i), aFacesB->Value(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1544,11 +1570,19 @@ TEST(BRepGraphIncTest, ReverseIndex_EdgeOpsAdd_BindsStartEndVertices)
|
||||
|
||||
bool foundV0 = false, foundV1 = false;
|
||||
for (const BRepGraph_EdgeId& aE : aGraph.Topo().Vertices().Edges(aV0))
|
||||
{
|
||||
if (aE == anEdge)
|
||||
{
|
||||
foundV0 = true;
|
||||
}
|
||||
}
|
||||
for (const BRepGraph_EdgeId& aE : aGraph.Topo().Vertices().Edges(aV1))
|
||||
{
|
||||
if (aE == anEdge)
|
||||
{
|
||||
foundV1 = true;
|
||||
}
|
||||
}
|
||||
EXPECT_TRUE(foundV0);
|
||||
EXPECT_TRUE(foundV1);
|
||||
EXPECT_TRUE(aGraph.ValidateReverseIndex());
|
||||
@@ -1568,9 +1602,13 @@ TEST(BRepGraphIncTest, ReverseIndex_RemoveEdge_UnbindsStartEndVertices)
|
||||
aGraph.Editor().Gen().RemoveNode(BRepGraph_NodeId(anEdge));
|
||||
|
||||
for (const BRepGraph_EdgeId& aE : aGraph.Topo().Vertices().Edges(aV0))
|
||||
{
|
||||
EXPECT_NE(aE, anEdge);
|
||||
}
|
||||
for (const BRepGraph_EdgeId& aE : aGraph.Topo().Vertices().Edges(aV1))
|
||||
{
|
||||
EXPECT_NE(aE, anEdge);
|
||||
}
|
||||
EXPECT_TRUE(aGraph.ValidateReverseIndex());
|
||||
}
|
||||
|
||||
@@ -1592,11 +1630,19 @@ TEST(BRepGraphIncTest, ReverseIndex_SetRefVertexDefId_RebindsVertexToEdges)
|
||||
|
||||
bool stillUnderV0 = false, foundUnderV2 = false;
|
||||
for (const BRepGraph_EdgeId& aE : aGraph.Topo().Vertices().Edges(aV0))
|
||||
{
|
||||
if (aE == anEdge)
|
||||
{
|
||||
stillUnderV0 = true;
|
||||
}
|
||||
}
|
||||
for (const BRepGraph_EdgeId& aE : aGraph.Topo().Vertices().Edges(aV2))
|
||||
{
|
||||
if (aE == anEdge)
|
||||
{
|
||||
foundUnderV2 = true;
|
||||
}
|
||||
}
|
||||
EXPECT_FALSE(stillUnderV0);
|
||||
EXPECT_TRUE(foundUnderV2);
|
||||
EXPECT_TRUE(aGraph.ValidateReverseIndex());
|
||||
@@ -1649,11 +1695,19 @@ TEST(BRepGraphIncTest, ReverseIndex_SetRefWireDefId_RebindsWireToFaces)
|
||||
|
||||
bool oldStillBound = false, newBound = false;
|
||||
for (const BRepGraph_FaceId& f : aGraph.Topo().Wires().Faces(aOldWire))
|
||||
{
|
||||
if (f == aFace0)
|
||||
{
|
||||
oldStillBound = true;
|
||||
}
|
||||
}
|
||||
for (const BRepGraph_FaceId& f : aGraph.Topo().Wires().Faces(aNewWire))
|
||||
{
|
||||
if (f == aFace0)
|
||||
{
|
||||
newBound = true;
|
||||
}
|
||||
}
|
||||
EXPECT_FALSE(oldStillBound);
|
||||
EXPECT_TRUE(newBound);
|
||||
EXPECT_TRUE(aGraph.ValidateReverseIndex());
|
||||
@@ -1731,11 +1785,19 @@ TEST(BRepGraphIncTest, ReverseIndex_SetEdgeDefIdOnCoEdge_RebindsEdgeToCoEdges)
|
||||
|
||||
bool oldHasCoEdge = false, newHasCoEdge = false;
|
||||
for (const BRepGraph_CoEdgeId& aC : aGraph.Topo().Edges().CoEdges(anOldEdge))
|
||||
{
|
||||
if (aC == aCoEdge)
|
||||
{
|
||||
oldHasCoEdge = true;
|
||||
}
|
||||
}
|
||||
for (const BRepGraph_CoEdgeId& aC : aGraph.Topo().Edges().CoEdges(aNewEdge))
|
||||
{
|
||||
if (aC == aCoEdge)
|
||||
{
|
||||
newHasCoEdge = true;
|
||||
}
|
||||
}
|
||||
EXPECT_FALSE(oldHasCoEdge);
|
||||
EXPECT_TRUE(newHasCoEdge);
|
||||
EXPECT_TRUE(aGraph.ValidateReverseIndex());
|
||||
@@ -1760,13 +1822,17 @@ TEST(BRepGraphIncTest, ReverseIndex_SetFaceDefIdOnCoEdge_LastBondCheck)
|
||||
{
|
||||
const NCollection_DynamicArray<BRepGraph_CoEdgeId>& aCEs = aGraph.Topo().Edges().CoEdges(aE);
|
||||
if (aCEs.Size() < 2)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
NCollection_DataMap<int, BRepGraph_CoEdgeId> aSeenFace;
|
||||
for (const BRepGraph_CoEdgeId& aCE : aCEs)
|
||||
{
|
||||
const BRepGraphInc::CoEdgeDef& aD = aGraph.Topo().CoEdges().Definition(aCE);
|
||||
if (!aD.FaceDefId.IsValid())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (aSeenFace.IsBound(aD.FaceDefId.Index))
|
||||
{
|
||||
aSeamEdge = aE;
|
||||
@@ -1784,8 +1850,12 @@ TEST(BRepGraphIncTest, ReverseIndex_SetFaceDefIdOnCoEdge_LastBondCheck)
|
||||
// The seam-pair partner of aSeamCoEdge still binds (aSeamEdge, aSeamFace).
|
||||
bool stillBound = false;
|
||||
for (const BRepGraph_FaceId& f : aGraph.Topo().Edges().Faces(aSeamEdge))
|
||||
{
|
||||
if (f == aSeamFace)
|
||||
{
|
||||
stillBound = true;
|
||||
}
|
||||
}
|
||||
EXPECT_TRUE(stillBound);
|
||||
EXPECT_TRUE(aGraph.ValidateReverseIndex());
|
||||
}
|
||||
@@ -1809,7 +1879,9 @@ TEST(BRepGraphIncTest, ReverseIndex_SetFaceDefIdOnCoEdge_OnlyBondUnbinds)
|
||||
aGraph.Editor().CoEdges().SetFaceDefId(aCoEdge, BRepGraph_FaceId());
|
||||
|
||||
for (const BRepGraph_FaceId& f : aGraph.Topo().Edges().Faces(anEdge))
|
||||
{
|
||||
EXPECT_NE(f, anOldFace);
|
||||
}
|
||||
EXPECT_TRUE(aGraph.ValidateReverseIndex());
|
||||
}
|
||||
|
||||
@@ -1834,11 +1906,19 @@ TEST(BRepGraphIncTest, ReverseIndex_SetEndVertexRefId_RebindsVertexToEdges)
|
||||
|
||||
bool stillUnderV1 = false, foundUnderV2 = false;
|
||||
for (const BRepGraph_EdgeId& aE : aGraph.Topo().Vertices().Edges(aV1))
|
||||
{
|
||||
if (aE == anEdge)
|
||||
{
|
||||
stillUnderV1 = true;
|
||||
}
|
||||
}
|
||||
for (const BRepGraph_EdgeId& aE : aGraph.Topo().Vertices().Edges(aV2))
|
||||
{
|
||||
if (aE == anEdge)
|
||||
{
|
||||
foundUnderV2 = true;
|
||||
}
|
||||
}
|
||||
EXPECT_FALSE(stillUnderV1);
|
||||
EXPECT_TRUE(foundUnderV2);
|
||||
EXPECT_TRUE(aGraph.ValidateReverseIndex());
|
||||
@@ -1902,11 +1982,19 @@ TEST(BRepGraphIncTest, ReverseIndex_SetChildRefChildDefId_CrossKindRebinds)
|
||||
const BRepGraph_SolidId anOldSolid = BRepGraph_SolidId::FromNodeId(anOldChild);
|
||||
bool oldStill = false, newBound = false;
|
||||
for (const BRepGraph_CompoundId& c : aGraph.Topo().Solids().Compounds(anOldSolid))
|
||||
{
|
||||
if (c == aCompound0)
|
||||
{
|
||||
oldStill = true;
|
||||
}
|
||||
}
|
||||
for (const BRepGraph_CompoundId& c : aGraph.Topo().Shells().Compounds(aShell))
|
||||
{
|
||||
if (c == aCompound0)
|
||||
{
|
||||
newBound = true;
|
||||
}
|
||||
}
|
||||
EXPECT_FALSE(oldStill);
|
||||
EXPECT_TRUE(newBound);
|
||||
EXPECT_TRUE(aGraph.ValidateReverseIndex());
|
||||
@@ -1932,7 +2020,9 @@ TEST(BRepGraphIncTest, ReverseIndex_SetEdgeDefIdOnCoEdge_LastBondInWireCheck)
|
||||
{
|
||||
const NCollection_DynamicArray<BRepGraph_CoEdgeId>& aCEs = aGraph.Topo().Edges().CoEdges(aE);
|
||||
if (aCEs.Size() < 2)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
NCollection_DataMap<int, BRepGraph_CoEdgeId> aSeenWire;
|
||||
for (const BRepGraph_CoEdgeId& aCE : aCEs)
|
||||
{
|
||||
@@ -1950,7 +2040,9 @@ TEST(BRepGraphIncTest, ReverseIndex_SetEdgeDefIdOnCoEdge_LastBondInWireCheck)
|
||||
aSeenWire.Bind(aW.Index, aCE);
|
||||
}
|
||||
if (aSeamEdge.IsValid())
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
ASSERT_TRUE(aSeamEdge.IsValid()) << "cylinder must have a wire with two coedges of same edge";
|
||||
@@ -1958,11 +2050,13 @@ TEST(BRepGraphIncTest, ReverseIndex_SetEdgeDefIdOnCoEdge_LastBondInWireCheck)
|
||||
// Pick a different edge to redirect to.
|
||||
BRepGraph_EdgeId aTargetEdge;
|
||||
for (BRepGraph_EdgeId aE(0); aE.IsValid(aGraph.Topo().Edges().Nb()); ++aE)
|
||||
{
|
||||
if (aE != aSeamEdge)
|
||||
{
|
||||
aTargetEdge = aE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
ASSERT_TRUE(aTargetEdge.IsValid());
|
||||
|
||||
aGraph.Editor().CoEdges().SetEdgeDefId(aSeamCoEdge, aTargetEdge);
|
||||
@@ -1970,8 +2064,12 @@ TEST(BRepGraphIncTest, ReverseIndex_SetEdgeDefIdOnCoEdge_LastBondInWireCheck)
|
||||
// The OTHER coedge of aSeamWire still references aSeamEdge -> wire still bound.
|
||||
bool stillBound = false;
|
||||
for (const BRepGraph_WireId& aW : aGraph.Topo().Edges().Wires(aSeamEdge))
|
||||
{
|
||||
if (aW == aSeamWire)
|
||||
{
|
||||
stillBound = true;
|
||||
}
|
||||
}
|
||||
EXPECT_TRUE(stillBound);
|
||||
EXPECT_TRUE(aGraph.ValidateReverseIndex());
|
||||
}
|
||||
@@ -2022,6 +2120,8 @@ TEST(BRepGraphIncTest, ReverseIndex_RemoveRef_UnbindsByKind)
|
||||
ASSERT_TRUE(aGraph.Editor().Gen().RemoveRef(aFaceRefId));
|
||||
|
||||
for (const BRepGraph_ShellId& aShellId : aGraph.Topo().Faces().Shells(aFaceId))
|
||||
{
|
||||
EXPECT_NE(aShellId, BRepGraph_ShellId::Start());
|
||||
}
|
||||
EXPECT_TRUE(aGraph.ValidateReverseIndex());
|
||||
}
|
||||
|
||||
@@ -82,7 +82,7 @@ double runBenchmark(const char* theLabel, Func theFunc)
|
||||
|
||||
const double anAvg = aTotal / static_cast<double>(THE_MEASURE_ITERS);
|
||||
std::cout << "[ PERF ] " << theLabel << ": avg " << anAvg << " s over " << THE_MEASURE_ITERS
|
||||
<< " iters" << std::endl;
|
||||
<< " iters" << '\n';
|
||||
return anAvg;
|
||||
}
|
||||
|
||||
@@ -196,7 +196,7 @@ TEST(BRepGraph_BenchmarkTest, DISABLED_Reconstruct_RoundTrip)
|
||||
});
|
||||
|
||||
const double aPerFace = aAvg / static_cast<double>(aNbFaces);
|
||||
std::cout << "[ PERF ] Reconstruct per-face avg: " << aPerFace << " s" << std::endl;
|
||||
std::cout << "[ PERF ] Reconstruct per-face avg: " << aPerFace << " s" << '\n';
|
||||
EXPECT_GT(aAvg, 0.0);
|
||||
}
|
||||
|
||||
@@ -222,6 +222,6 @@ TEST(BRepGraph_BenchmarkTest, DISABLED_SpatialQuery_Throughput)
|
||||
});
|
||||
|
||||
const double aPerQuery = aAvg / static_cast<double>(aNbFaces);
|
||||
std::cout << "[ PERF ] SpatialQuery per-face avg: " << aPerQuery << " s" << std::endl;
|
||||
std::cout << "[ PERF ] SpatialQuery per-face avg: " << aPerQuery << " s" << '\n';
|
||||
EXPECT_GT(aAvg, 0.0);
|
||||
}
|
||||
|
||||
@@ -1248,9 +1248,13 @@ TEST(BRepGraph_BuildTest, RegularityLayer_EdgeMutation_InvalidatesBindings)
|
||||
{
|
||||
const BRepGraph_FaceId aFace = aGraph.Topo().CoEdges().Definition(aCoEdgeId).FaceDefId;
|
||||
if (!aFace.IsValid())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (!aFace1.IsValid())
|
||||
{
|
||||
aFace1 = aFace;
|
||||
}
|
||||
else if (aFace != aFace1)
|
||||
{
|
||||
aFace2 = aFace;
|
||||
@@ -1258,7 +1262,9 @@ TEST(BRepGraph_BuildTest, RegularityLayer_EdgeMutation_InvalidatesBindings)
|
||||
}
|
||||
}
|
||||
if (!aFace1.IsValid() || !aFace2.IsValid())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
aRegularityLayer->SetRegularity(anEdgeId, aFace1, aFace2, GeomAbs_C1);
|
||||
aRegularity.FaceEntity1 = aFace1;
|
||||
aRegularity.FaceEntity2 = aFace2;
|
||||
@@ -1303,9 +1309,13 @@ TEST(BRepGraph_BuildTest, RegularityLayer_FaceMutation_InvalidatesBindings)
|
||||
{
|
||||
const BRepGraph_FaceId aFace = aGraph.Topo().CoEdges().Definition(aCoEdgeId).FaceDefId;
|
||||
if (!aFace.IsValid())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (!aFace1.IsValid())
|
||||
{
|
||||
aFace1 = aFace;
|
||||
}
|
||||
else if (aFace != aFace1)
|
||||
{
|
||||
aFace2 = aFace;
|
||||
@@ -1313,7 +1323,9 @@ TEST(BRepGraph_BuildTest, RegularityLayer_FaceMutation_InvalidatesBindings)
|
||||
}
|
||||
}
|
||||
if (!aFace1.IsValid() || !aFace2.IsValid())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
aRegularityLayer->SetRegularity(anEdgeId, aFace1, aFace2, GeomAbs_C1);
|
||||
aRegularity.FaceEntity1 = aFace1;
|
||||
aRegularity.FaceEntity2 = aFace2;
|
||||
|
||||
@@ -708,12 +708,16 @@ TEST(BRepGraph_BuilderTest, RemoveSolid_CascadesToFaces)
|
||||
// All shells should be removed.
|
||||
const int aNbShells = aGraph.Topo().Shells().Nb();
|
||||
for (BRepGraph_ShellId aShellId(0); aShellId.IsValid(aNbShells); ++aShellId)
|
||||
{
|
||||
EXPECT_TRUE(aGraph.Topo().Gen().IsRemoved(aShellId));
|
||||
}
|
||||
|
||||
// All faces should be removed.
|
||||
const int aNbFaces = aGraph.Topo().Faces().Nb();
|
||||
for (BRepGraph_FaceId aFaceId(0); aFaceId.IsValid(aNbFaces); ++aFaceId)
|
||||
{
|
||||
EXPECT_TRUE(aGraph.Topo().Gen().IsRemoved(aFaceId));
|
||||
}
|
||||
}
|
||||
|
||||
TEST(BRepGraph_BuilderTest, RemoveSubgraph_SharedFace_PreservesSharedEdgesAndVertices)
|
||||
@@ -745,18 +749,24 @@ TEST(BRepGraph_BuilderTest, RemoveSubgraph_SharedFace_PreservesSharedEdgesAndVer
|
||||
|
||||
// Other faces must remain active.
|
||||
for (int aIdx = 1; aIdx < aNbFaces; ++aIdx)
|
||||
{
|
||||
EXPECT_FALSE(aGraph.Topo().Gen().IsRemoved(BRepGraph_FaceId(aIdx)));
|
||||
}
|
||||
|
||||
// All 12 edges of a box are shared by exactly 2 faces.
|
||||
// Removing 1 face leaves each shared edge with at least 1 active parent face.
|
||||
// Therefore all edges must remain active.
|
||||
for (int aIdx = 0; aIdx < aNbEdges; ++aIdx)
|
||||
{
|
||||
EXPECT_FALSE(aGraph.Topo().Gen().IsRemoved(BRepGraph_EdgeId(aIdx)));
|
||||
}
|
||||
|
||||
// All 8 vertices of a box are shared by 3 edges. All edges are still active,
|
||||
// so all vertices must remain active.
|
||||
for (int aIdx = 0; aIdx < aNbVertices; ++aIdx)
|
||||
{
|
||||
EXPECT_FALSE(aGraph.Topo().Gen().IsRemoved(BRepGraph_VertexId(aIdx)));
|
||||
}
|
||||
}
|
||||
|
||||
// ============================================================
|
||||
@@ -806,7 +816,9 @@ TEST(BRepGraph_BuilderTest, SharedEdges_AdjacentBoxFaces)
|
||||
NCollection_DynamicArray<BRepGraph_EdgeId> aShared =
|
||||
aGraph.Topo().Faces().SharedEdges(aFaceA, aFaceB, aGraph.Allocator());
|
||||
if (!aShared.IsEmpty())
|
||||
{
|
||||
++aSharingPairs;
|
||||
}
|
||||
}
|
||||
}
|
||||
// A box has 12 edges, each shared by 2 faces, so 12 sharing pairs.
|
||||
@@ -867,7 +879,9 @@ TEST(BRepGraph_BuilderTest, EdgesOfFace_Box_HasEdges)
|
||||
BRepGraph_NodeId::Kind::Edge);
|
||||
anExp.More();
|
||||
anExp.Next())
|
||||
{
|
||||
++aNbEdges;
|
||||
}
|
||||
EXPECT_EQ(aNbEdges, 4);
|
||||
}
|
||||
|
||||
@@ -885,7 +899,9 @@ TEST(BRepGraph_BuilderTest, VerticesOfEdge_Box_HasTwoVertices)
|
||||
BRepGraph_NodeId::Kind::Vertex);
|
||||
anExp.More();
|
||||
anExp.Next())
|
||||
{
|
||||
++aNbVertices;
|
||||
}
|
||||
EXPECT_EQ(aNbVertices, 2);
|
||||
}
|
||||
|
||||
|
||||
@@ -75,7 +75,9 @@ TEST(BRepGraph_ChildExplorerTest, Box_EdgeOccurrences_Count24)
|
||||
BRepGraph_NodeId::Kind::Edge);
|
||||
anExp.More();
|
||||
anExp.Next())
|
||||
{
|
||||
++aCount;
|
||||
}
|
||||
// 12 edges x 2 faces each = 24 edge occurrences.
|
||||
EXPECT_EQ(aCount, 24);
|
||||
}
|
||||
@@ -94,7 +96,9 @@ TEST(BRepGraph_ChildExplorerTest, Box_FaceOccurrences_Count6)
|
||||
BRepGraph_NodeId::Kind::Face);
|
||||
anExp.More();
|
||||
anExp.Next())
|
||||
{
|
||||
++aFaceCount;
|
||||
}
|
||||
EXPECT_EQ(aFaceCount, 6);
|
||||
}
|
||||
|
||||
@@ -136,7 +140,9 @@ TEST(BRepGraph_ChildExplorerTest, Face_EdgeOccurrences_4)
|
||||
BRepGraph_NodeId::Kind::Edge);
|
||||
anExp.More();
|
||||
anExp.Next())
|
||||
{
|
||||
++aCount;
|
||||
}
|
||||
EXPECT_EQ(aCount, 4);
|
||||
}
|
||||
|
||||
@@ -404,7 +410,9 @@ TEST(BRepGraph_ChildExplorerTest, Compound_FaceCount)
|
||||
BRepGraph_NodeId::Kind::Face);
|
||||
anExp.More();
|
||||
anExp.Next())
|
||||
{
|
||||
++aCount;
|
||||
}
|
||||
EXPECT_EQ(aCount, 12); // 6 + 6 faces
|
||||
}
|
||||
|
||||
@@ -454,7 +462,9 @@ TEST(BRepGraph_ChildExplorerTest, DeepCompound_NoStackOverflow)
|
||||
BRepGraph_NodeId::Kind::Face);
|
||||
anExp.More();
|
||||
anExp.Next())
|
||||
{
|
||||
++aCount;
|
||||
}
|
||||
EXPECT_EQ(aCount, 6);
|
||||
}
|
||||
|
||||
@@ -469,7 +479,9 @@ TEST(BRepGraph_ChildExplorerTest, Recreate_ResetAndReexplore)
|
||||
int aFaceCount = 0;
|
||||
BRepGraph_ChildExplorer anExp(aGraph, BRepGraph_SolidId::Start(), BRepGraph_NodeId::Kind::Face);
|
||||
for (; anExp.More(); anExp.Next())
|
||||
{
|
||||
++aFaceCount;
|
||||
}
|
||||
EXPECT_EQ(aFaceCount, 6);
|
||||
|
||||
// Recreate targeting edges.
|
||||
@@ -479,7 +491,9 @@ TEST(BRepGraph_ChildExplorerTest, Recreate_ResetAndReexplore)
|
||||
BRepGraph_NodeId::Kind::Edge);
|
||||
anEdgeExp.More();
|
||||
anEdgeExp.Next())
|
||||
{
|
||||
++aEdgeCount;
|
||||
}
|
||||
EXPECT_EQ(aEdgeCount, 24);
|
||||
}
|
||||
|
||||
@@ -545,7 +559,9 @@ TEST(BRepGraph_ChildExplorerTest, DirectChildren_ShellFaces_CountAndOrder)
|
||||
{
|
||||
const BRepGraphInc::FaceRef& aRef = aGraph.Refs().Faces().Entry(aFaceRefId);
|
||||
if (!aRef.IsRemoved)
|
||||
{
|
||||
anExpectedFaceIds.Append(aRef.FaceDefId.Index);
|
||||
}
|
||||
}
|
||||
|
||||
NCollection_DynamicArray<int> anActualFaceIds;
|
||||
@@ -560,7 +576,9 @@ TEST(BRepGraph_ChildExplorerTest, DirectChildren_ShellFaces_CountAndOrder)
|
||||
|
||||
ASSERT_EQ(anActualFaceIds.Length(), anExpectedFaceIds.Length());
|
||||
for (int i = 0; i < anExpectedFaceIds.Length(); ++i)
|
||||
{
|
||||
EXPECT_EQ(anActualFaceIds.Value(i), anExpectedFaceIds.Value(i));
|
||||
}
|
||||
}
|
||||
|
||||
TEST(BRepGraph_ChildExplorerTest, DirectChildren_ShellFaces_ExposeParentAndRef)
|
||||
@@ -869,9 +887,13 @@ TEST(BRepGraph_ChildExplorerTest, Recursive_SharedProduct_ChildrenHaveDistinctCo
|
||||
{
|
||||
ASSERT_EQ(anIt.Current().DefId, BRepGraph_NodeId(BRepGraph_SolidId::Start()));
|
||||
if (aCount == 0)
|
||||
{
|
||||
aLoc1 = anIt.Current().Location;
|
||||
}
|
||||
else if (aCount == 1)
|
||||
{
|
||||
aLoc2 = anIt.Current().Location;
|
||||
}
|
||||
++aCount;
|
||||
}
|
||||
|
||||
@@ -950,7 +972,9 @@ TEST(BRepGraph_ChildExplorerTest, DirectChildren_HighFanout_DirectChildrenComple
|
||||
|
||||
constexpr int THE_NB_CHILDREN = 80;
|
||||
for (int i = 0; i < THE_NB_CHILDREN; ++i)
|
||||
{
|
||||
aBuilder.Add(aComp, BRepPrimAPI_MakeBox(1.0 + i, 2.0, 3.0).Shape());
|
||||
}
|
||||
|
||||
BRepGraph aGraph;
|
||||
aGraph.Clear();
|
||||
@@ -964,7 +988,9 @@ TEST(BRepGraph_ChildExplorerTest, DirectChildren_HighFanout_DirectChildrenComple
|
||||
BRepGraph_NodeId::Kind::Solid);
|
||||
anIt.More();
|
||||
anIt.Next())
|
||||
{
|
||||
++aCount;
|
||||
}
|
||||
|
||||
EXPECT_EQ(aCount, THE_NB_CHILDREN);
|
||||
}
|
||||
@@ -977,7 +1003,9 @@ TEST(BRepGraph_ChildExplorerTest, HighFanout_CompletesAllChildren)
|
||||
aBB.MakeCompound(aComp);
|
||||
constexpr int THE_NB_CHILDREN = 500;
|
||||
for (int i = 0; i < THE_NB_CHILDREN; ++i)
|
||||
{
|
||||
aBB.Add(aComp, BRepPrimAPI_MakeBox(1, 1, 1).Shape());
|
||||
}
|
||||
|
||||
BRepGraph aGraph;
|
||||
aGraph.Clear();
|
||||
@@ -991,7 +1019,9 @@ TEST(BRepGraph_ChildExplorerTest, HighFanout_CompletesAllChildren)
|
||||
BRepGraph_NodeId::Kind::Face);
|
||||
anExp.More();
|
||||
anExp.Next())
|
||||
{
|
||||
++aFaceCount;
|
||||
}
|
||||
// Each box has 6 faces.
|
||||
EXPECT_EQ(aFaceCount, THE_NB_CHILDREN * 6);
|
||||
}
|
||||
|
||||
@@ -86,7 +86,9 @@ int countHistoryRecordsByOp(const BRepGraph& theGraph, const TCollection_AsciiSt
|
||||
for (size_t aRecIdx = 0; aRecIdx < theGraph.History().NbRecords(); ++aRecIdx)
|
||||
{
|
||||
if (theGraph.History().Record(aRecIdx).OperationName == theOp)
|
||||
{
|
||||
++aCount;
|
||||
}
|
||||
}
|
||||
return aCount;
|
||||
}
|
||||
@@ -182,19 +184,27 @@ TEST(BRepGraph_CompactTest, IndexDensity_NoGaps)
|
||||
for (BRepGraph_VertexId aVertexId = BRepGraph_VertexId::Start();
|
||||
aVertexId.IsValid(aGraph.Topo().Vertices().Nb());
|
||||
++aVertexId)
|
||||
{
|
||||
EXPECT_FALSE(aGraph.Topo().Vertices().Definition(aVertexId).IsRemoved);
|
||||
}
|
||||
for (BRepGraph_EdgeId anEdgeId = BRepGraph_EdgeId::Start();
|
||||
anEdgeId.IsValid(aGraph.Topo().Edges().Nb());
|
||||
++anEdgeId)
|
||||
{
|
||||
EXPECT_FALSE(aGraph.Topo().Edges().Definition(anEdgeId).IsRemoved);
|
||||
}
|
||||
for (BRepGraph_FaceId aFaceId = BRepGraph_FaceId::Start();
|
||||
aFaceId.IsValid(aGraph.Topo().Faces().Nb());
|
||||
++aFaceId)
|
||||
{
|
||||
EXPECT_FALSE(aGraph.Topo().Faces().Definition(aFaceId).IsRemoved);
|
||||
}
|
||||
for (BRepGraph_WireId aWireId = BRepGraph_WireId::Start();
|
||||
aWireId.IsValid(aGraph.Topo().Wires().Nb());
|
||||
++aWireId)
|
||||
{
|
||||
EXPECT_FALSE(aGraph.Topo().Wires().Definition(aWireId).IsRemoved);
|
||||
}
|
||||
}
|
||||
|
||||
TEST(BRepGraph_CompactTest, CrossReferences_Valid)
|
||||
@@ -609,7 +619,9 @@ TEST(BRepGraph_CompactTest, UIDRoundTrip_RefUIDs_AfterCompaction)
|
||||
const BRepGraphInc::EdgeDef& anEdge =
|
||||
aGraph.Topo().Edges().Definition(BRepGraph_EdgeId::Start());
|
||||
if (anEdge.StartVertexRefId.IsValid())
|
||||
{
|
||||
aVertexRefId = anEdge.StartVertexRefId;
|
||||
}
|
||||
}
|
||||
|
||||
// CoEdgeRef - from Face 1 wire (Face 0 will be removed before compact).
|
||||
@@ -621,7 +633,9 @@ TEST(BRepGraph_CompactTest, UIDRoundTrip_RefUIDs_AfterCompaction)
|
||||
const BRepGraphInc::WireRef& aWireRef = aGraph.Refs().Wires().Entry(aFace.WireRefIds.First());
|
||||
const BRepGraphInc::WireDef& aWire = aGraph.Topo().Wires().Definition(aWireRef.WireDefId);
|
||||
if (!aWire.CoEdgeRefIds.IsEmpty())
|
||||
{
|
||||
aCoEdgeRefId = aWire.CoEdgeRefIds.First();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -631,7 +645,9 @@ TEST(BRepGraph_CompactTest, UIDRoundTrip_RefUIDs_AfterCompaction)
|
||||
{
|
||||
const BRepGraphInc::FaceDef& aFace = aGraph.Topo().Faces().Definition(BRepGraph_FaceId(1));
|
||||
if (!aFace.WireRefIds.IsEmpty())
|
||||
{
|
||||
aWireRefId = aFace.WireRefIds.First();
|
||||
}
|
||||
}
|
||||
|
||||
// FaceRef - from Shell, pointing to Face 1 (skip Face 0 whose ref will be removed).
|
||||
@@ -650,7 +666,9 @@ TEST(BRepGraph_CompactTest, UIDRoundTrip_RefUIDs_AfterCompaction)
|
||||
}
|
||||
}
|
||||
if (aFaceRefId.IsValid())
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -666,22 +684,34 @@ TEST(BRepGraph_CompactTest, UIDRoundTrip_RefUIDs_AfterCompaction)
|
||||
break;
|
||||
}
|
||||
if (aShellRefId.IsValid())
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Capture RefUIDs before compact.
|
||||
BRepGraph_RefUID aVertexRefUID, aCoEdgeRefUID, aWireRefUID, aFaceRefUID, aShellRefUID;
|
||||
if (aVertexRefId.IsValid())
|
||||
{
|
||||
aVertexRefUID = aGraph.UIDs().Of(aVertexRefId);
|
||||
}
|
||||
if (aCoEdgeRefId.IsValid())
|
||||
{
|
||||
aCoEdgeRefUID = aGraph.UIDs().Of(aCoEdgeRefId);
|
||||
}
|
||||
if (aWireRefId.IsValid())
|
||||
{
|
||||
aWireRefUID = aGraph.UIDs().Of(aWireRefId);
|
||||
}
|
||||
if (aFaceRefId.IsValid())
|
||||
{
|
||||
aFaceRefUID = aGraph.UIDs().Of(aFaceRefId);
|
||||
}
|
||||
if (aShellRefId.IsValid())
|
||||
{
|
||||
aShellRefUID = aGraph.UIDs().Of(aShellRefId);
|
||||
}
|
||||
|
||||
// Remove one face to trigger compaction.
|
||||
aGraph.Editor().Gen().RemoveNode(BRepGraph_FaceId::Start());
|
||||
|
||||
@@ -226,7 +226,9 @@ TEST_F(BRepGraph_ConvenienceTest, FindPCurve_WithOrientation_SeamEdge)
|
||||
{
|
||||
const BRepGraphInc::CoEdgeDef& aCE = aDefs.CoEdges().Definition(aCoEdgeId);
|
||||
if (!aCE.SeamPairId.IsValid())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// Found seam edge - verify FindPCurve returns distinct entries for each orientation.
|
||||
const BRepGraph_FaceId aFaceDefId = aCE.FaceDefId;
|
||||
|
||||
@@ -83,7 +83,9 @@ TEST(BRepGraph_CopyTest, CopyBox_FaceCount)
|
||||
|
||||
int aNbFaces = 0;
|
||||
for (TopExp_Explorer anExp(aCopy, TopAbs_FACE); anExp.More(); anExp.Next())
|
||||
{
|
||||
++aNbFaces;
|
||||
}
|
||||
EXPECT_EQ(aNbFaces, 6);
|
||||
}
|
||||
|
||||
|
||||
@@ -121,7 +121,9 @@ int nbPCurveEntries(const BRepGraph& theGraph)
|
||||
const BRepGraphInc::CoEdgeDef& aCE =
|
||||
theGraph.Topo().CoEdges().Definition(aCoEdgeIdxs.Value(i));
|
||||
if (aCE.FaceDefId.IsValid())
|
||||
{
|
||||
++aCount;
|
||||
}
|
||||
}
|
||||
}
|
||||
return aCount;
|
||||
@@ -1556,7 +1558,9 @@ TEST(BRepGraph_DeduplicateTest, BackRefs_CurveRewrite_UpdatesEdgeDefUsers)
|
||||
const BRepGraph_EdgeId anEdgeId = anEdgeIt.CurrentId();
|
||||
const occ::handle<Geom_Curve>& aCurve = BRepGraph_Tool::Edge::Curve(aGraph, anEdgeId);
|
||||
if (!aCurve.IsNull())
|
||||
{
|
||||
aDistinctCurves.Add(aCurve.get());
|
||||
}
|
||||
}
|
||||
// After dedup, 4 canonical curves should remain (from 8 originally).
|
||||
EXPECT_EQ(aDistinctCurves.Extent(), 4);
|
||||
@@ -2182,11 +2186,15 @@ TEST(BRepGraph_DeduplicateTest, WireDedup_PreservesShellAuxChildRefs)
|
||||
const BRepGraphInc::ChildRef& aRef =
|
||||
aGraph.Refs().Children().Entry(aSh.AuxChildRefIds.Value(aRefIdx));
|
||||
if (aRef.IsRemoved)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
const BRepGraphInc::WireDef& aWireDef =
|
||||
aGraph.Topo().Wires().Definition(BRepGraph_WireId(aRef.ChildDefId));
|
||||
if (!aWireDef.IsRemoved)
|
||||
{
|
||||
++aNbActiveAuxChildren;
|
||||
}
|
||||
}
|
||||
}
|
||||
EXPECT_EQ(aNbActiveAuxChildren, 1) << "AuxChildRef points to a removed wire after dedup";
|
||||
|
||||
@@ -119,16 +119,24 @@ public:
|
||||
bool HasImmediateEventFor(BRepGraph_NodeId theNode) const
|
||||
{
|
||||
for (const BRepGraph_NodeId& anEvent : myImmediateEvents)
|
||||
{
|
||||
if (anEvent == theNode)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool HasBatchEventFor(BRepGraph_NodeId theNode) const
|
||||
{
|
||||
for (const BRepGraph_NodeId& anEvent : myBatchEvents)
|
||||
{
|
||||
if (anEvent == theNode)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -136,8 +144,12 @@ public:
|
||||
{
|
||||
int aCount = 0;
|
||||
for (const BRepGraph_NodeId& anEvent : myImmediateEvents)
|
||||
{
|
||||
if (anEvent.NodeKind == theKind)
|
||||
{
|
||||
++aCount;
|
||||
}
|
||||
}
|
||||
return aCount;
|
||||
}
|
||||
|
||||
@@ -536,7 +548,9 @@ TEST_F(BRepGraph_EventBusTest, KindBit_Helpers)
|
||||
// 8 distinct bits set.
|
||||
int aBitCount = 0;
|
||||
for (int v = aAll; v != 0; v >>= 1)
|
||||
{
|
||||
aBitCount += (v & 1);
|
||||
}
|
||||
EXPECT_EQ(aBitCount, 8);
|
||||
}
|
||||
|
||||
@@ -560,7 +574,9 @@ TEST_F(BRepGraph_EventBusTest, RefKindBit_Helpers)
|
||||
| BRepGraph_Layer::RefKindBit(Kind::Child) | BRepGraph_Layer::RefKindBit(Kind::Occurrence);
|
||||
int aBitCount = 0;
|
||||
for (int v = aAll; v != 0; v >>= 1)
|
||||
{
|
||||
aBitCount += (v & 1);
|
||||
}
|
||||
EXPECT_EQ(aBitCount, 8);
|
||||
}
|
||||
|
||||
@@ -667,9 +683,13 @@ TEST_F(BRepGraph_EventBusTest, LayerIterator_RangeFor)
|
||||
BRepGraph_LayerIterator(myGraph.LayerRegistry()))
|
||||
{
|
||||
if (aLayer == aLayer1)
|
||||
{
|
||||
hasL1 = true;
|
||||
}
|
||||
if (aLayer == aLayer2)
|
||||
{
|
||||
hasL2 = true;
|
||||
}
|
||||
++aCount;
|
||||
}
|
||||
EXPECT_EQ(aCount, 2);
|
||||
|
||||
@@ -75,7 +75,9 @@ bool applyOne(BRepGraph& theGraph, std::mt19937& theRng)
|
||||
|
||||
auto pickActiveEdge = [&](BRepGraph_EdgeId& theOut) -> bool {
|
||||
if (aNbEdges <= 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
std::uniform_int_distribution<int> aDist(0, aNbEdges - 1);
|
||||
for (int aTry = 0; aTry < 8; ++aTry)
|
||||
{
|
||||
@@ -91,7 +93,9 @@ bool applyOne(BRepGraph& theGraph, std::mt19937& theRng)
|
||||
|
||||
auto pickActiveVertex = [&](BRepGraph_VertexId& theOut) -> bool {
|
||||
if (aNbVertices <= 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
std::uniform_int_distribution<int> aDist(0, aNbVertices - 1);
|
||||
for (int aTry = 0; aTry < 8; ++aTry)
|
||||
{
|
||||
@@ -110,7 +114,9 @@ bool applyOne(BRepGraph& theGraph, std::mt19937& theRng)
|
||||
case MutationKind::BumpEdgeTolerance: {
|
||||
BRepGraph_EdgeId anEdgeId;
|
||||
if (!pickActiveEdge(anEdgeId))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
BRepGraph_MutGuard<BRepGraphInc::EdgeDef> aMut = theGraph.Editor().Edges().Mut(anEdgeId);
|
||||
theGraph.Editor().Edges().SetTolerance(aMut, aMut->Tolerance + 1.0e-4);
|
||||
return true;
|
||||
@@ -118,7 +124,9 @@ bool applyOne(BRepGraph& theGraph, std::mt19937& theRng)
|
||||
case MutationKind::MutateVertexPoint: {
|
||||
BRepGraph_VertexId aVtxId;
|
||||
if (!pickActiveVertex(aVtxId))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
BRepGraph_MutGuard<BRepGraphInc::VertexDef> aMut = theGraph.Editor().Vertices().Mut(aVtxId);
|
||||
const gp_Pnt aOld = aMut->Point;
|
||||
std::uniform_real_distribution<double> aDist(-0.1, 0.1);
|
||||
@@ -129,11 +137,15 @@ bool applyOne(BRepGraph& theGraph, std::mt19937& theRng)
|
||||
}
|
||||
case MutationKind::BumpFaceTolerance: {
|
||||
if (aNbFaces <= 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
std::uniform_int_distribution<int> aDist(0, aNbFaces - 1);
|
||||
BRepGraph_FaceId aFaceId(aDist(theRng));
|
||||
if (theGraph.Topo().Faces().Definition(aFaceId).IsRemoved)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
BRepGraph_MutGuard<BRepGraphInc::FaceDef> aMut = theGraph.Editor().Faces().Mut(aFaceId);
|
||||
theGraph.Editor().Faces().SetTolerance(aMut, aMut->Tolerance + 1.0e-4);
|
||||
return true;
|
||||
|
||||
@@ -136,7 +136,9 @@ TEST(BRepGraph_GeometryTest, Sphere_AllFacesShareSurface)
|
||||
const BRepGraph_FaceId aFaceId = aFaceIt.CurrentId();
|
||||
if (BRepGraph_Tool::Face::HasSurface(aGraph, aFaceId)
|
||||
&& BRepGraph_Tool::Face::Surface(aGraph, aFaceId).get() == aFirstSurf.get())
|
||||
{
|
||||
++aSameCount;
|
||||
}
|
||||
}
|
||||
EXPECT_EQ(aSameCount, aGraph.Topo().Faces().Nb());
|
||||
}
|
||||
@@ -780,7 +782,9 @@ TEST(BRepGraph_GeometryTest, Cylinder_SeamEdge_FindPCurve_WithOrientation)
|
||||
{
|
||||
const BRepGraphInc::CoEdgeDef& aCE = aGraph.Topo().CoEdges().Definition(aCoEdgeId);
|
||||
if (!aCE.SeamPairId.IsValid())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// This is a seam edge - test oriented overload.
|
||||
const BRepGraph_FaceId aFaceId(aCE.FaceDefId.Index);
|
||||
@@ -846,7 +850,9 @@ TEST(BRepGraph_GeometryTest, Cylinder_SeamEdge_FindPCurve_DistinguishesOrientati
|
||||
{
|
||||
const BRepGraphInc::CoEdgeDef& aCE = aGraph.Topo().CoEdges().Definition(aCoEdgeId);
|
||||
if (!aCE.SeamPairId.IsValid())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// Seam edge: same face, two orientations.
|
||||
const BRepGraph_FaceId aFaceId = aCE.FaceDefId;
|
||||
|
||||
@@ -114,9 +114,13 @@ TEST_F(BRepGraph_HistoryTest, FindDerived_ChainABC_ContainsBAndC)
|
||||
for (const BRepGraph_NodeId& aDerivedId : aDerived)
|
||||
{
|
||||
if (aDerivedId == anEdge1)
|
||||
{
|
||||
hasEdge1 = true;
|
||||
}
|
||||
if (aDerivedId == anEdge2)
|
||||
{
|
||||
hasEdge2 = true;
|
||||
}
|
||||
}
|
||||
EXPECT_TRUE(hasEdge1);
|
||||
EXPECT_TRUE(hasEdge2);
|
||||
@@ -228,9 +232,13 @@ TEST_F(BRepGraph_HistoryTest, ApplyModification_MultipleReplacements)
|
||||
for (const BRepGraph_NodeId& aDerivedId : aDerived)
|
||||
{
|
||||
if (aDerivedId == aNew1)
|
||||
{
|
||||
hasNew1 = true;
|
||||
}
|
||||
if (aDerivedId == aNew2)
|
||||
{
|
||||
hasNew2 = true;
|
||||
}
|
||||
}
|
||||
EXPECT_TRUE(hasNew1);
|
||||
EXPECT_TRUE(hasNew2);
|
||||
@@ -494,12 +502,18 @@ TEST_F(BRepGraph_HistoryTest, SplitEdge_IgnoresRemovedCoEdgeRefEntries)
|
||||
{
|
||||
const BRepGraphInc::CoEdgeRef& aRef = myGraph.Refs().CoEdges().Entry(aRefId);
|
||||
if (aRef.IsRemoved || !aRef.CoEdgeDefId.IsValid(myGraph.Topo().CoEdges().Nb()))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
const BRepGraph_NodeId anId(myGraph.Topo().CoEdges().Definition(aRef.CoEdgeDefId).EdgeDefId);
|
||||
if (anId == aSubA)
|
||||
{
|
||||
hasSubA = true;
|
||||
}
|
||||
if (anId == aSubB)
|
||||
{
|
||||
hasSubB = true;
|
||||
}
|
||||
}
|
||||
EXPECT_TRUE(hasSubA);
|
||||
EXPECT_TRUE(hasSubB);
|
||||
|
||||
@@ -85,46 +85,62 @@ TEST_F(BRepGraph_MutationGenTest, SubtreeGen_PropagatedParent_Incremented)
|
||||
for (BRepGraph_WireIterator aWireIt(myGraph); aWireIt.More(); aWireIt.Next())
|
||||
{
|
||||
if (aWireIt.Current().SubtreeGen > 0u)
|
||||
{
|
||||
aAnyWireSubtreeIncremented = true;
|
||||
}
|
||||
}
|
||||
EXPECT_TRUE(aAnyWireSubtreeIncremented);
|
||||
|
||||
// Verify parent OwnGen did NOT change (split behavior).
|
||||
for (BRepGraph_WireIterator aWireIt(myGraph); aWireIt.More(); aWireIt.Next())
|
||||
{
|
||||
EXPECT_EQ(aWireIt.Current().OwnGen, 0u);
|
||||
}
|
||||
|
||||
bool aAnyFaceSubtreeIncremented = false;
|
||||
for (BRepGraph_FaceIterator aFaceIt(myGraph); aFaceIt.More(); aFaceIt.Next())
|
||||
{
|
||||
if (aFaceIt.Current().SubtreeGen > 0u)
|
||||
{
|
||||
aAnyFaceSubtreeIncremented = true;
|
||||
}
|
||||
}
|
||||
EXPECT_TRUE(aAnyFaceSubtreeIncremented);
|
||||
|
||||
for (BRepGraph_FaceIterator aFaceIt(myGraph); aFaceIt.More(); aFaceIt.Next())
|
||||
{
|
||||
EXPECT_EQ(aFaceIt.Current().OwnGen, 0u);
|
||||
}
|
||||
|
||||
bool aAnyShellSubtreeIncremented = false;
|
||||
for (BRepGraph_ShellIterator aShellIt(myGraph); aShellIt.More(); aShellIt.Next())
|
||||
{
|
||||
if (aShellIt.Current().SubtreeGen > 0u)
|
||||
{
|
||||
aAnyShellSubtreeIncremented = true;
|
||||
}
|
||||
}
|
||||
EXPECT_TRUE(aAnyShellSubtreeIncremented);
|
||||
|
||||
for (BRepGraph_ShellIterator aShellIt(myGraph); aShellIt.More(); aShellIt.Next())
|
||||
{
|
||||
EXPECT_EQ(aShellIt.Current().OwnGen, 0u);
|
||||
}
|
||||
|
||||
bool aAnySolidSubtreeIncremented = false;
|
||||
for (BRepGraph_SolidIterator aSolidIt(myGraph); aSolidIt.More(); aSolidIt.Next())
|
||||
{
|
||||
if (aSolidIt.Current().SubtreeGen > 0u)
|
||||
{
|
||||
aAnySolidSubtreeIncremented = true;
|
||||
}
|
||||
}
|
||||
EXPECT_TRUE(aAnySolidSubtreeIncremented);
|
||||
|
||||
for (BRepGraph_SolidIterator aSolidIt(myGraph); aSolidIt.More(); aSolidIt.Next())
|
||||
{
|
||||
EXPECT_EQ(aSolidIt.Current().OwnGen, 0u);
|
||||
}
|
||||
}
|
||||
|
||||
TEST_F(BRepGraph_MutationGenTest, SubtreeGen_DeferredPropagatedParent_Incremented)
|
||||
@@ -134,10 +150,14 @@ TEST_F(BRepGraph_MutationGenTest, SubtreeGen_DeferredPropagatedParent_Incremente
|
||||
myGraph.Topo().Edges().Definition(BRepGraph_EdgeId::Start()).OwnGen;
|
||||
NCollection_DynamicArray<uint32_t> aWireSubtreeGensBefore;
|
||||
for (BRepGraph_WireIterator aWireIt(myGraph); aWireIt.More(); aWireIt.Next())
|
||||
{
|
||||
aWireSubtreeGensBefore.Append(aWireIt.Current().SubtreeGen);
|
||||
}
|
||||
NCollection_DynamicArray<uint32_t> aFaceSubtreeGensBefore;
|
||||
for (BRepGraph_FaceIterator aFaceIt(myGraph); aFaceIt.More(); aFaceIt.Next())
|
||||
{
|
||||
aFaceSubtreeGensBefore.Append(aFaceIt.Current().SubtreeGen);
|
||||
}
|
||||
|
||||
// Deferred mutation + flush.
|
||||
myGraph.Editor().BeginDeferredInvalidation();
|
||||
@@ -151,17 +171,25 @@ TEST_F(BRepGraph_MutationGenTest, SubtreeGen_DeferredPropagatedParent_Incremente
|
||||
// At least one parent wire must have SubtreeGen incremented vs its baseline.
|
||||
bool aAnyWireSubtreeIncremented = false;
|
||||
for (BRepGraph_WireIterator aWireIt(myGraph); aWireIt.More(); aWireIt.Next())
|
||||
{
|
||||
if (aWireIt.Current().SubtreeGen
|
||||
> aWireSubtreeGensBefore.Value(static_cast<int>(aWireIt.CurrentId().Index)))
|
||||
{
|
||||
aAnyWireSubtreeIncremented = true;
|
||||
}
|
||||
}
|
||||
EXPECT_TRUE(aAnyWireSubtreeIncremented);
|
||||
|
||||
// At least one parent face must have SubtreeGen incremented vs its baseline.
|
||||
bool aAnyFaceSubtreeIncremented = false;
|
||||
for (BRepGraph_FaceIterator aFaceIt(myGraph); aFaceIt.More(); aFaceIt.Next())
|
||||
{
|
||||
if (aFaceIt.Current().SubtreeGen
|
||||
> aFaceSubtreeGensBefore.Value(static_cast<int>(aFaceIt.CurrentId().Index)))
|
||||
{
|
||||
aAnyFaceSubtreeIncremented = true;
|
||||
}
|
||||
}
|
||||
EXPECT_TRUE(aAnyFaceSubtreeIncremented);
|
||||
}
|
||||
|
||||
@@ -189,7 +217,9 @@ TEST_F(BRepGraph_MutationGenTest, RepMutation_Curve3DPropagatesSubtreeGenToEdge)
|
||||
const BRepGraph_EdgeId anEdgeId(0);
|
||||
const BRepGraph_Curve3DRepId aCurveId = myGraph.Topo().Edges().Definition(anEdgeId).Curve3DRepId;
|
||||
if (!aCurveId.IsValid())
|
||||
{
|
||||
return; // Skip degenerate edges without 3D curves.
|
||||
}
|
||||
|
||||
EXPECT_EQ(myGraph.Topo().Edges().Definition(anEdgeId).OwnGen, 0u);
|
||||
EXPECT_EQ(myGraph.Topo().Edges().Definition(anEdgeId).SubtreeGen, 0u);
|
||||
@@ -212,7 +242,9 @@ TEST_F(BRepGraph_MutationGenTest, RepMutation_Curve2DPropagatesSubtreeGenToCoEdg
|
||||
{
|
||||
const BRepGraph_Curve2DRepId aCurveId = aCoEdgeIt.Current().Curve2DRepId;
|
||||
if (!aCurveId.IsValid())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
const BRepGraph_CoEdgeId aCoEdgeId = aCoEdgeIt.CurrentId();
|
||||
EXPECT_EQ(aCoEdgeIt.Current().OwnGen, 0u);
|
||||
@@ -238,7 +270,9 @@ TEST_F(BRepGraph_MutationGenTest, RepMutation_TriangulationPropagatesSubtreeGenT
|
||||
{
|
||||
const BRepGraphInc::FaceDef& aFace = aFaceIt.Current();
|
||||
if (!aFace.TriangulationRepId.IsValid())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
const BRepGraph_FaceId aFaceId = aFaceIt.CurrentId();
|
||||
const BRepGraph_TriangulationRepId aTriId = aFace.TriangulationRepId;
|
||||
@@ -265,7 +299,9 @@ TEST_F(BRepGraph_MutationGenTest, RepMutation_Polygon3DPropagatesSubtreeGenToEdg
|
||||
{
|
||||
const BRepGraph_Polygon3DRepId aPolyId = anEdgeIt.Current().Polygon3DRepId;
|
||||
if (!aPolyId.IsValid())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
const BRepGraph_EdgeId anEdgeId = anEdgeIt.CurrentId();
|
||||
EXPECT_EQ(anEdgeIt.Current().OwnGen, 0u);
|
||||
|
||||
@@ -78,18 +78,26 @@ TEST(BRepGraph_PermissionUpdateTest, RemoveRef_OccurrenceRef_PreservesProductToO
|
||||
|
||||
bool aFoundBefore = false;
|
||||
for (const BRepGraph_OccurrenceId& anId : aGraph.Topo().Products().Instances(aChild))
|
||||
{
|
||||
if (anId == aOccId)
|
||||
{
|
||||
aFoundBefore = true;
|
||||
}
|
||||
}
|
||||
EXPECT_TRUE(aFoundBefore) << "Occurrence must be indexed under referenced product before remove";
|
||||
|
||||
EXPECT_TRUE(aGraph.Editor().Gen().RemoveRef(BRepGraph_RefId(aOccRefId)));
|
||||
|
||||
for (const BRepGraph_OccurrenceId& anId : aGraph.Topo().Products().Instances(aChild))
|
||||
{
|
||||
EXPECT_NE(anId, aOccId) << "RemoveRef must drop the referenced-product entry";
|
||||
}
|
||||
|
||||
// The wrong-key bug would also leave a stale entry under the parent product id.
|
||||
for (const BRepGraph_OccurrenceId& anId : aGraph.Topo().Products().Instances(aParent))
|
||||
{
|
||||
EXPECT_NE(anId, aOccId) << "Bug: Unbind happened against parent product key";
|
||||
}
|
||||
}
|
||||
|
||||
// B2: removing one CoEdgeRef must leave the wire's other usages of the same edge
|
||||
@@ -123,8 +131,12 @@ TEST(BRepGraph_PermissionUpdateTest, RemoveRef_CoEdge_PreservesEdgeToWireWhenSib
|
||||
|
||||
auto containsWire = [&](const BRepGraph_EdgeId theE) -> bool {
|
||||
for (const BRepGraph_WireId& aW : aGraph.Topo().Edges().Wires(theE))
|
||||
{
|
||||
if (aW == aWireId)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
};
|
||||
ASSERT_TRUE(containsWire(aEdge)) << "Edge->Wire reverse must be present before removal";
|
||||
@@ -166,8 +178,12 @@ TEST(BRepGraph_PermissionUpdateTest, SetRefVertexDefId_SelfLoopSibling_KeepsRevI
|
||||
ASSERT_TRUE(aOldV.IsValid());
|
||||
bool aOldStillIndexed = false;
|
||||
for (const BRepGraph_EdgeId& aE : aGraph.Topo().Vertices().Edges(aOldV))
|
||||
{
|
||||
if (aE == aEdge)
|
||||
{
|
||||
aOldStillIndexed = true;
|
||||
}
|
||||
}
|
||||
EXPECT_TRUE(aOldStillIndexed)
|
||||
<< "Vold must remain in EdgesOfVertex(Vold) after start-side rebind";
|
||||
}
|
||||
|
||||
@@ -112,13 +112,17 @@ TEST(BRepGraph_PolygonTest, Polygon3D_Captured_WhenPresent)
|
||||
for (BRepGraph_EdgeIterator anEdgeIt(aGraph); anEdgeIt.More(); anEdgeIt.Next())
|
||||
{
|
||||
if (BRepGraph_Tool::Edge::HasPolygon3D(aGraph, anEdgeIt.CurrentId()))
|
||||
{
|
||||
++aNbPoly3DGraph;
|
||||
}
|
||||
}
|
||||
for (TopExp_Explorer anExp(aBox, TopAbs_EDGE); anExp.More(); anExp.Next())
|
||||
{
|
||||
TopLoc_Location aLoc;
|
||||
if (!BRep_Tool::Polygon3D(TopoDS::Edge(anExp.Current()), aLoc).IsNull())
|
||||
{
|
||||
++aNbPoly3DOrig;
|
||||
}
|
||||
}
|
||||
EXPECT_EQ(aNbPoly3DGraph, aNbPoly3DOrig)
|
||||
<< "Graph Polygon3D count should match BRep_Tool::Polygon3D count";
|
||||
@@ -127,7 +131,9 @@ TEST(BRepGraph_PolygonTest, Polygon3D_Captured_WhenPresent)
|
||||
for (BRepGraph_EdgeIterator anEdgeIt(aGraph); anEdgeIt.More(); anEdgeIt.Next())
|
||||
{
|
||||
if (!BRepGraph_Tool::Edge::HasPolygon3D(aGraph, anEdgeIt.CurrentId()))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
TopoDS_Shape aReconEdge = aGraph.Shapes().Reconstruct(anEdgeIt.CurrentId());
|
||||
ASSERT_FALSE(aReconEdge.IsNull());
|
||||
TopLoc_Location aPolyLoc;
|
||||
@@ -213,12 +219,16 @@ TEST(BRepGraph_PolygonTest, PolyOnTri_Roundtrip_PreservedOnReconstruct)
|
||||
TopLoc_Location aTriLoc;
|
||||
occ::handle<Poly_Triangulation> aTri = BRep_Tool::Triangulation(aFace, aTriLoc);
|
||||
if (aTri.IsNull())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
TopLoc_Location aPolyLoc;
|
||||
occ::handle<Poly_PolygonOnTriangulation> aPolyOnTri =
|
||||
BRep_Tool::PolygonOnTriangulation(anEdge, aTri, aPolyLoc);
|
||||
if (!aPolyOnTri.IsNull())
|
||||
{
|
||||
++aNbReconPolyOnTri;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -279,7 +289,9 @@ TEST(BRepGraph_PolygonTest, VertexPointRepresentations_StructurallyValid)
|
||||
double aLast = 0.0;
|
||||
TopLoc_Location aLoc;
|
||||
if (BRep_Tool::Curve(anEdge, aLoc, aFirst, aLast).IsNull())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
for (TopoDS_Iterator aVtxIt(anEdge, false, false); aVtxIt.More(); aVtxIt.Next())
|
||||
{
|
||||
@@ -319,7 +331,9 @@ TEST(BRepGraph_PolygonTest, VertexPointRepresentations_StructurallyValid)
|
||||
double aLast = 0.0;
|
||||
occ::handle<Geom2d_Curve> aPCurve = BRep_Tool::CurveOnSurface(anEdge, aFace, aFirst, aLast);
|
||||
if (aPCurve.IsNull())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
aBuilder.UpdateEdge(anEdge, aPCurve, aFace, BRep_Tool::Tolerance(anEdge));
|
||||
aBuilder.Range(anEdge, aFace, aFirst, aLast);
|
||||
@@ -358,18 +372,26 @@ TEST(BRepGraph_PolygonTest, VertexPointRepresentations_StructurallyValid)
|
||||
const BRepGraph_VertexId aVertexId = aVertexIt.CurrentId();
|
||||
const BRepGraph_LayerParam::VertexParams* aParams = aParamLayer->FindVertexParams(aVertexId);
|
||||
if (aParams == nullptr)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
aNbPointsOnCurve += aParams->PointsOnCurve.Length();
|
||||
aNbPointsOnSurface += aParams->PointsOnSurface.Length();
|
||||
aNbPointsOnPCurve += aParams->PointsOnPCurve.Length();
|
||||
|
||||
// Validate that any captured entries have valid def references.
|
||||
for (const BRepGraph_LayerParam::PointOnCurveEntry& anEntry : aParams->PointsOnCurve)
|
||||
{
|
||||
EXPECT_TRUE(anEntry.EdgeDefId.IsValid());
|
||||
}
|
||||
for (const BRepGraph_LayerParam::PointOnSurfaceEntry& anEntry : aParams->PointsOnSurface)
|
||||
{
|
||||
EXPECT_TRUE(anEntry.FaceDefId.IsValid());
|
||||
}
|
||||
for (const BRepGraph_LayerParam::PointOnPCurveEntry& anEntry : aParams->PointsOnPCurve)
|
||||
{
|
||||
EXPECT_TRUE(anEntry.CoEdgeDefId.IsValid());
|
||||
}
|
||||
}
|
||||
|
||||
EXPECT_GT(aNbPointsOnSurface, 0);
|
||||
@@ -393,11 +415,15 @@ TEST(BRepGraph_PolygonTest, EdgeRegularity_MatchesOriginal)
|
||||
const TopoDS_Edge& anEdge = TopoDS::Edge(anEdgeExp.Current());
|
||||
const occ::handle<BRep_TEdge>& aTEdge = occ::down_cast<BRep_TEdge>(anEdge.TShape());
|
||||
if (aTEdge.IsNull())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
for (const occ::handle<BRep_CurveRepresentation>& aCRep : aTEdge->Curves())
|
||||
{
|
||||
if (!occ::down_cast<BRep_CurveOn2Surfaces>(aCRep).IsNull())
|
||||
{
|
||||
++aNbOrigReg;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -450,7 +476,9 @@ TEST(BRepGraph_PolygonTest, SeamEdge_PolyOnTri_TwoEntries)
|
||||
const BRepGraphInc::CoEdgeDef& aCE = aGraph.Topo().CoEdges().Definition(aCoEdgeId);
|
||||
const int aFaceIdx = aCE.FaceDefId.Index;
|
||||
if (!aFaceCounts.IsBound(aFaceIdx))
|
||||
{
|
||||
aFaceCounts.Bind(aFaceIdx, 0);
|
||||
}
|
||||
aFaceCounts.ChangeFind(aFaceIdx) += 1;
|
||||
}
|
||||
for (const auto& [aFaceIdx, aCount] : aFaceCounts.Items())
|
||||
@@ -462,7 +490,9 @@ TEST(BRepGraph_PolygonTest, SeamEdge_PolyOnTri_TwoEntries)
|
||||
}
|
||||
}
|
||||
if (aFoundSeam)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
// Seam edges on cylinder lateral face should produce two PolyOnTri entries.
|
||||
EXPECT_TRUE(aFoundSeam) << "Meshed cylinder should have seam edge with two PolyOnTri entries";
|
||||
|
||||
@@ -250,7 +250,9 @@ TEST(BRepGraph_ReconstructTest, Edge_HasCurve_NonNull)
|
||||
for (BRepGraph_EdgeIterator anEdgeIt(aGraph); anEdgeIt.More(); anEdgeIt.Next())
|
||||
{
|
||||
if (BRepGraph_Tool::Edge::Degenerated(aGraph, anEdgeIt.CurrentId()))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
TopoDS_Shape aReconEdge = aGraph.Shapes().Reconstruct(BRepGraph_NodeId(anEdgeIt.CurrentId()));
|
||||
TopLoc_Location aLoc;
|
||||
@@ -276,7 +278,9 @@ TEST(BRepGraph_ReconstructTest, Edge_ParameterRange_Preserved)
|
||||
for (BRepGraph_EdgeIterator anEdgeIt(aGraph); anEdgeIt.More(); anEdgeIt.Next())
|
||||
{
|
||||
if (BRepGraph_Tool::Edge::Degenerated(aGraph, anEdgeIt.CurrentId()))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
TopoDS_Shape aReconEdge = aGraph.Shapes().Reconstruct(BRepGraph_NodeId(anEdgeIt.CurrentId()));
|
||||
TopLoc_Location aLoc;
|
||||
@@ -341,7 +345,9 @@ TEST(BRepGraph_ReconstructTest, Face_PCurvesPresent_OnAllEdges)
|
||||
{
|
||||
const TopoDS_Edge& anEdge = TopoDS::Edge(anEdgeExp.Current());
|
||||
if (BRep_Tool::Degenerated(anEdge))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
double aFirst = 0.0;
|
||||
double aLast = 0.0;
|
||||
@@ -505,7 +511,9 @@ TEST(BRepGraph_ReconstructTest, Reconstruct_Edge_ValidShape)
|
||||
for (BRepGraph_EdgeIterator anEdgeIt(aGraph); anEdgeIt.More(); anEdgeIt.Next())
|
||||
{
|
||||
if (BRepGraph_Tool::Edge::Degenerated(aGraph, anEdgeIt.CurrentId()))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
TopoDS_Shape aRecon = aGraph.Shapes().Reconstruct(BRepGraph_NodeId(anEdgeIt.CurrentId()));
|
||||
EXPECT_FALSE(aRecon.IsNull());
|
||||
|
||||
@@ -37,7 +37,9 @@ int countInlineFaceRefs(const BRepGraph& theGraph)
|
||||
{
|
||||
int aNb = 0;
|
||||
for (BRepGraph_ShellIterator aShellIt(theGraph); aShellIt.More(); aShellIt.Next())
|
||||
{
|
||||
aNb += BRepGraph_TestTools::CountFaceRefsOfShell(theGraph, aShellIt.CurrentId());
|
||||
}
|
||||
return aNb;
|
||||
}
|
||||
|
||||
@@ -45,7 +47,9 @@ int countInlineWireRefs(const BRepGraph& theGraph)
|
||||
{
|
||||
int aNb = 0;
|
||||
for (BRepGraph_FaceIterator aFaceIt(theGraph); aFaceIt.More(); aFaceIt.Next())
|
||||
{
|
||||
aNb += BRepGraph_TestTools::CountWireRefsOfFace(theGraph, aFaceIt.CurrentId());
|
||||
}
|
||||
return aNb;
|
||||
}
|
||||
|
||||
@@ -53,7 +57,9 @@ int countInlineCoEdgeRefs(const BRepGraph& theGraph)
|
||||
{
|
||||
int aNb = 0;
|
||||
for (BRepGraph_WireIterator aWireIt(theGraph); aWireIt.More(); aWireIt.Next())
|
||||
{
|
||||
aNb += BRepGraph_TestTools::CountCoEdgeRefsOfWire(theGraph, aWireIt.CurrentId());
|
||||
}
|
||||
return aNb;
|
||||
}
|
||||
|
||||
@@ -64,13 +70,19 @@ int countInlineVertexRefs(const BRepGraph& theGraph)
|
||||
{
|
||||
const BRepGraphInc::EdgeDef& anEdge = anEdgeIt.Current();
|
||||
if (anEdge.StartVertexRefId.IsValid())
|
||||
{
|
||||
++aNb;
|
||||
}
|
||||
if (anEdge.EndVertexRefId.IsValid())
|
||||
{
|
||||
++aNb;
|
||||
}
|
||||
aNb += anEdge.InternalVertexRefIds.Length();
|
||||
}
|
||||
for (BRepGraph_FaceIterator aFaceIt(theGraph); aFaceIt.More(); aFaceIt.Next())
|
||||
{
|
||||
aNb += aFaceIt.Current().VertexRefIds.Length();
|
||||
}
|
||||
return aNb;
|
||||
}
|
||||
|
||||
@@ -78,7 +90,9 @@ int countInlineShellRefs(const BRepGraph& theGraph)
|
||||
{
|
||||
int aNb = 0;
|
||||
for (BRepGraph_SolidIterator aSolidIt(theGraph); aSolidIt.More(); aSolidIt.Next())
|
||||
{
|
||||
aNb += BRepGraph_TestTools::CountShellRefsOfSolid(theGraph, aSolidIt.CurrentId());
|
||||
}
|
||||
return aNb;
|
||||
}
|
||||
|
||||
@@ -86,7 +100,9 @@ int countInlineSolidRefs(const BRepGraph& theGraph)
|
||||
{
|
||||
int aNb = 0;
|
||||
for (BRepGraph_CompSolidIterator aCSIt(theGraph); aCSIt.More(); aCSIt.Next())
|
||||
{
|
||||
aNb += BRepGraph_TestTools::CountSolidRefsOfCompSolid(theGraph, aCSIt.CurrentId());
|
||||
}
|
||||
return aNb;
|
||||
}
|
||||
|
||||
@@ -94,11 +110,17 @@ int countInlineChildRefs(const BRepGraph& theGraph)
|
||||
{
|
||||
int aNb = 0;
|
||||
for (BRepGraph_CompoundIterator aCompIt(theGraph); aCompIt.More(); aCompIt.Next())
|
||||
{
|
||||
aNb += BRepGraph_TestTools::CountChildRefsOfParent(theGraph, aCompIt.CurrentId());
|
||||
}
|
||||
for (BRepGraph_ShellIterator aShellIt(theGraph); aShellIt.More(); aShellIt.Next())
|
||||
{
|
||||
aNb += BRepGraph_TestTools::CountChildRefsOfParent(theGraph, aShellIt.CurrentId());
|
||||
}
|
||||
for (BRepGraph_SolidIterator aSolidIt(theGraph); aSolidIt.More(); aSolidIt.Next())
|
||||
{
|
||||
aNb += BRepGraph_TestTools::CountChildRefsOfParent(theGraph, aSolidIt.CurrentId());
|
||||
}
|
||||
return aNb;
|
||||
}
|
||||
|
||||
|
||||
@@ -40,7 +40,9 @@ inline NCollection_DynamicArray<BRepGraph_CoEdgeRefId> CoEdgeRefsOfWire(
|
||||
{
|
||||
const BRepGraphInc::CoEdgeRef& aRef = aRefs.CoEdges().Entry(aRefId);
|
||||
if (aRef.ParentId == aParentNode && !aRef.IsRemoved)
|
||||
{
|
||||
aRefIds.Append(aRefId);
|
||||
}
|
||||
}
|
||||
return aRefIds;
|
||||
}
|
||||
@@ -66,7 +68,9 @@ inline NCollection_DynamicArray<BRepGraph_WireRefId> WireRefsOfFace(
|
||||
{
|
||||
const BRepGraphInc::WireRef& aRef = aRefs.Wires().Entry(aRefId);
|
||||
if (aRef.ParentId == aParentNode && !aRef.IsRemoved)
|
||||
{
|
||||
aRefIds.Append(aRefId);
|
||||
}
|
||||
}
|
||||
return aRefIds;
|
||||
}
|
||||
@@ -90,7 +94,9 @@ inline bool FaceUsesWire(const BRepGraph& theGraph,
|
||||
for (const BRepGraph_WireRefId& aWireRefId : aWireRefs)
|
||||
{
|
||||
if (aRefs.Wires().Entry(aWireRefId).WireDefId == theWireId)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -109,7 +115,9 @@ inline NCollection_DynamicArray<BRepGraph_FaceRefId> FaceRefsOfShell(
|
||||
{
|
||||
const BRepGraphInc::FaceRef& aRef = aRefs.Faces().Entry(aRefId);
|
||||
if (aRef.ParentId == aParentNode && !aRef.IsRemoved)
|
||||
{
|
||||
aRefIds.Append(aRefId);
|
||||
}
|
||||
}
|
||||
return aRefIds;
|
||||
}
|
||||
@@ -135,7 +143,9 @@ inline NCollection_DynamicArray<BRepGraph_ShellRefId> ShellRefsOfSolid(
|
||||
{
|
||||
const BRepGraphInc::ShellRef& aRef = aRefs.Shells().Entry(aRefId);
|
||||
if (aRef.ParentId == aParentNode && !aRef.IsRemoved)
|
||||
{
|
||||
aRefIds.Append(aRefId);
|
||||
}
|
||||
}
|
||||
return aRefIds;
|
||||
}
|
||||
@@ -161,7 +171,9 @@ inline NCollection_DynamicArray<BRepGraph_SolidRefId> SolidRefsOfCompSolid(
|
||||
{
|
||||
const BRepGraphInc::SolidRef& aRef = aRefs.Solids().Entry(aRefId);
|
||||
if (aRef.ParentId == aParentNode && !aRef.IsRemoved)
|
||||
{
|
||||
aRefIds.Append(aRefId);
|
||||
}
|
||||
}
|
||||
return aRefIds;
|
||||
}
|
||||
@@ -187,7 +199,9 @@ inline NCollection_DynamicArray<BRepGraph_ChildRefId> ChildRefsOfParent(
|
||||
{
|
||||
const BRepGraphInc::ChildRef& aRef = aRefs.Children().Entry(aRefId);
|
||||
if (aRef.ParentId == theParentId && !aRef.IsRemoved)
|
||||
{
|
||||
aRefIds.Append(aRefId);
|
||||
}
|
||||
}
|
||||
return aRefIds;
|
||||
}
|
||||
@@ -219,7 +233,9 @@ inline NCollection_DynamicArray<BRepGraph_CoEdgeRefId> CoEdgeRefsOfWire(
|
||||
{
|
||||
const BRepGraphInc::CoEdgeRef& aRef = theStorage.CoEdgeRef(aRefId);
|
||||
if (aRef.ParentId == aParentNode && !aRef.IsRemoved)
|
||||
{
|
||||
aRefIds.Append(aRefId);
|
||||
}
|
||||
}
|
||||
return aRefIds;
|
||||
}
|
||||
@@ -245,7 +261,9 @@ inline NCollection_DynamicArray<BRepGraph_WireRefId> WireRefsOfFace(
|
||||
{
|
||||
const BRepGraphInc::WireRef& aRef = theStorage.WireRef(aRefId);
|
||||
if (aRef.ParentId == aParentNode && !aRef.IsRemoved)
|
||||
{
|
||||
aRefIds.Append(aRefId);
|
||||
}
|
||||
}
|
||||
return aRefIds;
|
||||
}
|
||||
@@ -270,7 +288,9 @@ inline bool FaceUsesWire(const BRepGraphInc_Storage& theStorage,
|
||||
{
|
||||
const BRepGraphInc::WireRef& aWireRef = theStorage.WireRef(aWireRefId);
|
||||
if (aWireRef.WireDefId == theWireId)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -288,7 +308,9 @@ inline NCollection_DynamicArray<BRepGraph_FaceRefId> FaceRefsOfShell(
|
||||
{
|
||||
const BRepGraphInc::FaceRef& aRef = theStorage.FaceRef(aRefId);
|
||||
if (aRef.ParentId == aParentNode && !aRef.IsRemoved)
|
||||
{
|
||||
aRefIds.Append(aRefId);
|
||||
}
|
||||
}
|
||||
return aRefIds;
|
||||
}
|
||||
@@ -314,7 +336,9 @@ inline NCollection_DynamicArray<BRepGraph_ShellRefId> ShellRefsOfSolid(
|
||||
{
|
||||
const BRepGraphInc::ShellRef& aRef = theStorage.ShellRef(aRefId);
|
||||
if (aRef.ParentId == aParentNode && !aRef.IsRemoved)
|
||||
{
|
||||
aRefIds.Append(aRefId);
|
||||
}
|
||||
}
|
||||
return aRefIds;
|
||||
}
|
||||
@@ -340,7 +364,9 @@ inline NCollection_DynamicArray<BRepGraph_SolidRefId> SolidRefsOfCompSolid(
|
||||
{
|
||||
const BRepGraphInc::SolidRef& aRef = theStorage.SolidRef(aRefId);
|
||||
if (aRef.ParentId == aParentNode && !aRef.IsRemoved)
|
||||
{
|
||||
aRefIds.Append(aRefId);
|
||||
}
|
||||
}
|
||||
return aRefIds;
|
||||
}
|
||||
@@ -365,7 +391,9 @@ inline NCollection_DynamicArray<BRepGraph_ChildRefId> ChildRefsOfParent(
|
||||
{
|
||||
const BRepGraphInc::ChildRef& aRef = theStorage.ChildRef(aRefId);
|
||||
if (aRef.ParentId == theParentId && !aRef.IsRemoved)
|
||||
{
|
||||
aRefIds.Append(aRefId);
|
||||
}
|
||||
}
|
||||
return aRefIds;
|
||||
}
|
||||
@@ -389,7 +417,9 @@ inline BRepGraph_WireId OuterWireOfFace(const BRepGraphInc_Storage& theStorage,
|
||||
{
|
||||
const BRepGraphInc::WireRef& aWireRef = theStorage.WireRef(aWireRefId);
|
||||
if (aWireRef.IsOuter)
|
||||
{
|
||||
return aWireRef.WireDefId;
|
||||
}
|
||||
}
|
||||
return BRepGraph_WireId();
|
||||
}
|
||||
|
||||
@@ -155,7 +155,9 @@ TEST(BRepGraph_ScenarioMatrix, Box_MutateVertex_ValidateReconstructPopulateRound
|
||||
{
|
||||
const TopoDS_Vertex aVtx = TopoDS::Vertex(anExp.Current());
|
||||
if (BRep_Tool::Pnt(aVtx).SquareDistance(aMutatedPt) < Precision::SquareConfusion())
|
||||
{
|
||||
aFoundMutatedVertex = true;
|
||||
}
|
||||
}
|
||||
EXPECT_TRUE(aFoundMutatedVertex)
|
||||
<< "Reconstructed solid must contain a vertex at the mutated point - "
|
||||
@@ -213,7 +215,9 @@ TEST(BRepGraph_ScenarioMatrix, Cylinder_SeamEdge_MutationAndBothSubsystemsConsis
|
||||
const NCollection_DynamicArray<BRepGraph_CoEdgeId>* aCoEdges =
|
||||
aOrigStorage.ReverseIndex().CoEdgesOfEdge(anEdgeId);
|
||||
if (aCoEdges == nullptr)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
for (const BRepGraph_CoEdgeId& aCoEdgeId : *aCoEdges)
|
||||
{
|
||||
if (aOrigStorage.CoEdge(aCoEdgeId).SeamPairId.IsValid())
|
||||
@@ -266,7 +270,9 @@ TEST(BRepGraph_ScenarioMatrix, Cylinder_SeamEdge_MutationAndBothSubsystemsConsis
|
||||
const NCollection_DynamicArray<BRepGraph_CoEdgeId>* aCoEdges =
|
||||
aReconStorage.ReverseIndex().CoEdgesOfEdge(anEdgeId);
|
||||
if (aCoEdges == nullptr)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
for (const BRepGraph_CoEdgeId& aCoEdgeId : *aCoEdges)
|
||||
{
|
||||
if (aReconStorage.CoEdge(aCoEdgeId).SeamPairId.IsValid())
|
||||
@@ -587,7 +593,9 @@ TEST(BRepGraph_ScenarioMatrix, Compound_BoxAndCylinder_MutationReconstructAreaRe
|
||||
const NCollection_DynamicArray<BRepGraph_CoEdgeId>* aCoEdges =
|
||||
aBaseStorage.ReverseIndex().CoEdgesOfEdge(anEdgeId);
|
||||
if (aCoEdges == nullptr)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
for (const BRepGraph_CoEdgeId& aCoEdgeId : *aCoEdges)
|
||||
{
|
||||
if (aBaseStorage.CoEdge(aCoEdgeId).SeamPairId.IsValid())
|
||||
@@ -651,7 +659,9 @@ TEST(BRepGraph_ScenarioMatrix, Compound_BoxAndCylinder_MutationReconstructAreaRe
|
||||
const NCollection_DynamicArray<BRepGraph_CoEdgeId>* aCoEdges =
|
||||
aReconStorage.ReverseIndex().CoEdgesOfEdge(anEdgeId);
|
||||
if (aCoEdges == nullptr)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
for (const BRepGraph_CoEdgeId& aCoEdgeId : *aCoEdges)
|
||||
{
|
||||
if (aReconStorage.CoEdge(aCoEdgeId).SeamPairId.IsValid())
|
||||
@@ -829,13 +839,17 @@ TEST(BRepGraph_ScenarioMatrix, Compound_MixedAtomicChildren_ReverseIndexCoverage
|
||||
aBB.MakeCompound(aShellContainer);
|
||||
TopExp_Explorer aShellExp(aBox, TopAbs_SHELL);
|
||||
if (aShellExp.More())
|
||||
{
|
||||
aFreeSh = aShellExp.Current();
|
||||
}
|
||||
}
|
||||
TopoDS_Shape aFreeFace;
|
||||
{
|
||||
TopExp_Explorer aFaceExp(aBox, TopAbs_FACE);
|
||||
if (aFaceExp.More())
|
||||
{
|
||||
aFreeFace = aFaceExp.Current();
|
||||
}
|
||||
}
|
||||
TopoDS_Edge aFreeEdge = BRepBuilderAPI_MakeEdge(gp_Pnt(0, 0, 0), gp_Pnt(10, 0, 0));
|
||||
TopoDS_Vertex aFreeVertex;
|
||||
@@ -999,7 +1013,9 @@ TEST(BRepGraph_ScenarioMatrix, Sphere_SeamCoEdgePair_Bidirectional)
|
||||
{
|
||||
const BRepGraphInc::CoEdgeDef& aCoEdge = aStorage.CoEdge(aCoEdgeId);
|
||||
if (!aCoEdge.SeamPairId.IsValid())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
++aNbPairedCoEdges;
|
||||
|
||||
ASSERT_TRUE(aCoEdge.SeamPairId.IsValid(aStorage.NbCoEdges()));
|
||||
@@ -1033,7 +1049,9 @@ TEST(BRepGraph_ScenarioMatrix, Sphere_SeamCoEdgePair_Bidirectional)
|
||||
{
|
||||
const BRepGraphInc::CoEdgeDef& aCoEdge = aReconStorage.CoEdge(aCoEdgeId);
|
||||
if (!aCoEdge.SeamPairId.IsValid())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
++aNbPairedAfter;
|
||||
const BRepGraphInc::CoEdgeDef& aPaired = aReconStorage.CoEdge(aCoEdge.SeamPairId);
|
||||
EXPECT_EQ(aPaired.SeamPairId, aCoEdgeId)
|
||||
@@ -1128,7 +1146,9 @@ TEST(BRepGraph_ScenarioMatrix, Cylinder_SeamEdgeSplit_AuditStable)
|
||||
}
|
||||
}
|
||||
if (aSeamEdgeId.IsValid())
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
ASSERT_TRUE(aSeamEdgeId.IsValid()) << "Cylinder must carry at least one seam edge";
|
||||
|
||||
@@ -1162,7 +1182,9 @@ TEST(BRepGraph_ScenarioMatrix, Cylinder_SeamEdgeSplit_AuditStable)
|
||||
{
|
||||
const BRepGraphInc::CoEdgeDef& aCoEdge = aGraph.Topo().CoEdges().Definition(aCoEdgeId);
|
||||
if (!aCoEdge.SeamPairId.IsValid())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
const BRepGraphInc::CoEdgeDef& aPaired =
|
||||
aGraph.Topo().CoEdges().Definition(aCoEdge.SeamPairId);
|
||||
EXPECT_EQ(aPaired.SeamPairId, aCoEdgeId)
|
||||
@@ -1203,7 +1225,9 @@ TEST(BRepGraph_ScenarioMatrix, Cylinder_SeamEdgeSplit_CoEdgeFaceIncidence)
|
||||
}
|
||||
}
|
||||
if (aSeamEdgeId.IsValid())
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
ASSERT_TRUE(aSeamEdgeId.IsValid());
|
||||
|
||||
|
||||
@@ -166,7 +166,9 @@ TEST_F(BRepGraph_SharingTest, SharedEdge_IncidenceRefs_DifferentOrientation)
|
||||
const NCollection_DynamicArray<BRepGraph_CoEdgeId>& aCoEdgeIdxs =
|
||||
myGraph.Topo().Edges().CoEdges(anEdgeId);
|
||||
if (aCoEdgeIdxs.Length() < 2)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
// Check if coedges reference different faces.
|
||||
const BRepGraph_NodeId aFace0 =
|
||||
myGraph.Topo().CoEdges().Definition(aCoEdgeIdxs.Value(0)).FaceDefId;
|
||||
@@ -191,7 +193,9 @@ TEST_F(BRepGraph_SharingTest, NonClosedEdge_StartEnd_Different)
|
||||
const BRepGraph_EdgeId anEdgeId = anEdgeIt.CurrentId();
|
||||
const BRepGraphInc::EdgeDef& aDef = anEdgeIt.Current();
|
||||
if (aDef.IsDegenerate)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
// Box edges are not closed, so start and end vertex defs must differ
|
||||
const BRepGraph_VertexId aStartVtx =
|
||||
BRepGraph_Tool::Edge::StartVertexRef(myGraph, anEdgeId).VertexDefId;
|
||||
|
||||
@@ -1045,7 +1045,9 @@ TEST_F(BRepGraphTest, FindPCurve_ValidPair)
|
||||
const BRepGraph_WireId anOuterWire =
|
||||
BRepGraph_TestTools::OuterWireOfFace(myGraph, aFaceIt.CurrentId());
|
||||
if (!anOuterWire.IsValid())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
const NCollection_DynamicArray<BRepGraph_CoEdgeRefId> aCoEdgeRefs =
|
||||
BRepGraph_TestTools::CoEdgeRefsOfWire(myGraph, anOuterWire);
|
||||
for (const BRepGraph_CoEdgeRefId& aCoEdgeRefId : aCoEdgeRefs)
|
||||
@@ -1053,7 +1055,9 @@ TEST_F(BRepGraphTest, FindPCurve_ValidPair)
|
||||
const BRepGraphInc::CoEdgeRef& aCR = myGraph.Refs().CoEdges().Entry(aCoEdgeRefId);
|
||||
const BRepGraphInc::CoEdgeDef& aCoEdge = myGraph.Topo().CoEdges().Definition(aCR.CoEdgeDefId);
|
||||
if (BRepGraph_Tool::Edge::Degenerated(myGraph, BRepGraph_EdgeId(aCoEdge.EdgeDefId)))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
const BRepGraphInc::CoEdgeDef* aPCurveEntry =
|
||||
BRepGraph_Tool::Edge::FindPCurve(myGraph,
|
||||
BRepGraph_EdgeId(aCoEdge.EdgeDefId),
|
||||
@@ -1068,17 +1072,29 @@ TEST_F(BRepGraphTest, UID_Unique)
|
||||
{
|
||||
NCollection_Map<BRepGraph_UID> aUIDSet;
|
||||
for (BRepGraph_SolidIterator aSolidIt(myGraph); aSolidIt.More(); aSolidIt.Next())
|
||||
{
|
||||
EXPECT_TRUE(aUIDSet.Add(myGraph.UIDs().Of(BRepGraph_NodeId(aSolidIt.CurrentId()))));
|
||||
}
|
||||
for (BRepGraph_ShellIterator aShellIt(myGraph); aShellIt.More(); aShellIt.Next())
|
||||
{
|
||||
EXPECT_TRUE(aUIDSet.Add(myGraph.UIDs().Of(BRepGraph_NodeId(aShellIt.CurrentId()))));
|
||||
}
|
||||
for (BRepGraph_FaceIterator aFaceIt(myGraph); aFaceIt.More(); aFaceIt.Next())
|
||||
{
|
||||
EXPECT_TRUE(aUIDSet.Add(myGraph.UIDs().Of(BRepGraph_NodeId(aFaceIt.CurrentId()))));
|
||||
}
|
||||
for (BRepGraph_WireIterator aWireIt(myGraph); aWireIt.More(); aWireIt.Next())
|
||||
{
|
||||
EXPECT_TRUE(aUIDSet.Add(myGraph.UIDs().Of(BRepGraph_NodeId(aWireIt.CurrentId()))));
|
||||
}
|
||||
for (BRepGraph_EdgeIterator anEdgeIt(myGraph); anEdgeIt.More(); anEdgeIt.Next())
|
||||
{
|
||||
EXPECT_TRUE(aUIDSet.Add(myGraph.UIDs().Of(BRepGraph_NodeId(anEdgeIt.CurrentId()))));
|
||||
}
|
||||
for (BRepGraph_VertexIterator aVertexIt(myGraph); aVertexIt.More(); aVertexIt.Next())
|
||||
{
|
||||
EXPECT_TRUE(aUIDSet.Add(myGraph.UIDs().Of(BRepGraph_NodeId(aVertexIt.CurrentId()))));
|
||||
}
|
||||
// Surface/Curve geometry UIDs are no longer separate nodes; geometry is stored inline on defs.
|
||||
}
|
||||
|
||||
@@ -1360,9 +1376,13 @@ TEST_F(BRepGraphTest, ParallelBuild_CompoundOfFaces)
|
||||
aBuilder.MakeCompound(aCompound);
|
||||
|
||||
for (TopExp_Explorer anExp(aBox1.Shape(), TopAbs_FACE); anExp.More(); anExp.Next())
|
||||
{
|
||||
aBuilder.Add(aCompound, anExp.Current());
|
||||
}
|
||||
for (TopExp_Explorer anExp(aBox2.Shape(), TopAbs_FACE); anExp.More(); anExp.Next())
|
||||
{
|
||||
aBuilder.Add(aCompound, anExp.Current());
|
||||
}
|
||||
|
||||
BRepGraph aGraph;
|
||||
aGraph.Clear();
|
||||
@@ -1452,9 +1472,13 @@ TEST_F(BRepGraphTest, ReconstructFace_AfterEdgeReplace_ContainsNewEdge)
|
||||
occ::handle<Geom_Curve> aCurve =
|
||||
BRep_Tool::Curve(TopoDS::Edge(anExp.Current()), aLoc, aFirst, aLast);
|
||||
if (!aCurve.IsNull() && !aNewCurve.IsNull() && aCurve.get() == aNewCurve.get())
|
||||
{
|
||||
isNewFound = true;
|
||||
}
|
||||
if (!aCurve.IsNull() && !anOldCurve.IsNull() && aCurve.get() == anOldCurve.get())
|
||||
{
|
||||
isOldFound = true;
|
||||
}
|
||||
}
|
||||
EXPECT_TRUE(isNewFound) << "New edge curve not found in reconstructed face";
|
||||
EXPECT_FALSE(isOldFound) << "Old edge curve still present in reconstructed face";
|
||||
@@ -1467,7 +1491,9 @@ TEST_F(BRepGraphTest, ReconstructShape_SolidRoot_SameFaceCount)
|
||||
|
||||
int aFaceCount = 0;
|
||||
for (TopExp_Explorer anExp(aReconstructed, TopAbs_FACE); anExp.More(); anExp.Next())
|
||||
{
|
||||
++aFaceCount;
|
||||
}
|
||||
EXPECT_EQ(aFaceCount, 6);
|
||||
}
|
||||
|
||||
@@ -1819,7 +1845,9 @@ TEST_F(BRepGraphTest, ApplyModification_MultiStepChain_FindOriginalTracesBack)
|
||||
for (const BRepGraph_NodeId& aDerivedId : aDerived)
|
||||
{
|
||||
if (aDerivedId == anEdge2)
|
||||
{
|
||||
isEdge2Found = true;
|
||||
}
|
||||
}
|
||||
EXPECT_TRUE(isEdge2Found) << "Edge2 not found in FindDerived(Edge0)";
|
||||
|
||||
@@ -1829,7 +1857,9 @@ TEST_F(BRepGraphTest, ApplyModification_MultiStepChain_FindOriginalTracesBack)
|
||||
for (const BRepGraph_NodeId& aDerivedId : aDerived1)
|
||||
{
|
||||
if (aDerivedId == anEdge2)
|
||||
{
|
||||
isEdge2FromEdge1 = true;
|
||||
}
|
||||
}
|
||||
EXPECT_TRUE(isEdge2FromEdge1) << "Edge2 not found in FindDerived(Edge1)";
|
||||
}
|
||||
@@ -2260,7 +2290,9 @@ TEST_F(BRepGraphTest, EdgeDef_HasValidCurve3d)
|
||||
for (BRepGraph_EdgeIterator anEdgeIt(myGraph); anEdgeIt.More(); anEdgeIt.Next())
|
||||
{
|
||||
if (BRepGraph_Tool::Edge::Degenerated(myGraph, anEdgeIt.CurrentId()))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
EXPECT_TRUE(BRepGraph_Tool::Edge::HasCurve(myGraph, anEdgeIt.CurrentId()))
|
||||
<< "Edge " << anEdgeIt.CurrentId().Index << " has no Curve3D rep";
|
||||
@@ -2323,16 +2355,22 @@ TEST_F(BRepGraphTest, DetectToleranceConflicts_ManualConflict_Detected)
|
||||
{
|
||||
if (BRepGraph_Tool::Edge::Degenerated(myGraph, anEdgeId)
|
||||
|| !BRepGraph_Tool::Edge::HasCurve(myGraph, anEdgeId))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
for (BRepGraph_EdgeId anOtherId(anEdgeId.Index + 1); anOtherId.IsValid(aNbEdges); ++anOtherId)
|
||||
{
|
||||
if (BRepGraph_Tool::Edge::Degenerated(myGraph, anOtherId)
|
||||
|| !BRepGraph_Tool::Edge::HasCurve(myGraph, anOtherId))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (BRepGraph_Tool::Edge::Curve(myGraph, anEdgeId).get()
|
||||
!= BRepGraph_Tool::Edge::Curve(myGraph, anOtherId).get())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// Set very different tolerances on two edges sharing the same curve.
|
||||
myGraph.Editor().Edges().SetTolerance(anEdgeId, 0.001);
|
||||
@@ -2522,7 +2560,9 @@ TEST_F(BRepGraphTest, Face_InnerWireRefs_BoxHasNone)
|
||||
for (const BRepGraph_WireRefId& aWireRefId : aWireRefs)
|
||||
{
|
||||
if (!myGraph.Refs().Wires().Entry(aWireRefId).IsOuter)
|
||||
{
|
||||
++aNonOuterCount;
|
||||
}
|
||||
}
|
||||
EXPECT_EQ(aNonOuterCount, 0) << "Box face " << aFaceIt.CurrentId().Index
|
||||
<< " should have no inner wires";
|
||||
@@ -2561,7 +2601,9 @@ TEST_F(BRepGraphTest, Edge_ParamRange_ValidBounds)
|
||||
for (BRepGraph_EdgeIterator anEdgeIt(myGraph); anEdgeIt.More(); anEdgeIt.Next())
|
||||
{
|
||||
if (BRepGraph_Tool::Edge::Degenerated(myGraph, anEdgeIt.CurrentId()))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
const auto [aFirst, aLast] = BRepGraph_Tool::Edge::Range(myGraph, anEdgeIt.CurrentId());
|
||||
EXPECT_LT(aFirst, aLast) << "Edge " << anEdgeIt.CurrentId().Index
|
||||
<< " has invalid parameter range [" << aFirst << ", " << aLast << "]";
|
||||
@@ -2748,7 +2790,9 @@ TEST_F(BRepGraphTest, ReconstructShape_ShellRoot_SameFaceCount)
|
||||
|
||||
int aFaceCount = 0;
|
||||
for (TopExp_Explorer aFaceExp(aReconstructed, TopAbs_FACE); aFaceExp.More(); aFaceExp.Next())
|
||||
{
|
||||
++aFaceCount;
|
||||
}
|
||||
EXPECT_EQ(aFaceCount, 6);
|
||||
}
|
||||
|
||||
@@ -2784,7 +2828,9 @@ TEST_F(BRepGraphTest, Wire_OuterWireIdx_MatchesFaceDef)
|
||||
EXPECT_TRUE(anOuterWire.IsValid())
|
||||
<< "Face " << aFaceIt.CurrentId().Index << " has no outer wire";
|
||||
if (!anOuterWire.IsValid())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
EXPECT_LT(anOuterWire.Index, myGraph.Topo().Wires().Nb())
|
||||
<< "Face " << aFaceIt.CurrentId().Index << " outer wire index out of range";
|
||||
}
|
||||
|
||||
@@ -74,7 +74,9 @@ TEST_F(BRepGraph_QuerySurfaceTest, Face_Bounds_CylinderFaceReturnsSurfaceBounds)
|
||||
for (BRepGraph_FaceId aFaceId(0); aFaceId.IsValid(aNbFaces); ++aFaceId)
|
||||
{
|
||||
if (!BRepGraph_Tool::Face::HasSurface(myCylGraph, aFaceId))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
double uMin = 0.0, uMax = 0.0, vMin = 0.0, vMax = 0.0;
|
||||
BRepGraph_Tool::Face::Bounds(myCylGraph, aFaceId, uMin, uMax, vMin, vMax);
|
||||
|
||||
@@ -57,7 +57,9 @@ NCollection_DynamicArray<BRepGraph_CoEdgeRefId> coEdgeRefsOfWire(const BRepGraph
|
||||
{
|
||||
const BRepGraphInc::CoEdgeRef& aRef = aRefs.CoEdges().Entry(aRefId);
|
||||
if (aRef.ParentId == aParentNode && !aRef.IsRemoved)
|
||||
{
|
||||
aRefIds.Append(aRefId);
|
||||
}
|
||||
}
|
||||
return aRefIds;
|
||||
}
|
||||
@@ -696,7 +698,9 @@ TEST(BRepGraph_ValidateTest, Audit_DetectsOrphanWireRef_AfterFaceRemoval)
|
||||
const BRepGraph_WireRefId aRefId(aRefIdx);
|
||||
const BRepGraphInc::WireRef& aRef = aRefs.Wires().Entry(aRefId);
|
||||
if (aRef.IsRemoved)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
BRepGraph_MutGuard<BRepGraphInc::WireRef> aMut = aGraph.Editor().Wires().MutRef(aRefId);
|
||||
aMut.Internal().ParentId = BRepGraph_NodeId(BRepGraph_NodeId::Kind::Face, 9999);
|
||||
aDidCorrupt = true;
|
||||
|
||||
@@ -553,7 +553,9 @@ TEST_F(BRepGraph_ViewsTest, AttrsView_CacheKindIter_RangeFor)
|
||||
for (const occ::handle<BRepGraph_CacheKind>& aKind : myGraph.Cache().CacheKindIter(aFaceId))
|
||||
{
|
||||
if (!aKind.IsNull() && aKind->ID() == testUserAttrKind()->ID())
|
||||
{
|
||||
hasUserKind = true;
|
||||
}
|
||||
++aCount;
|
||||
}
|
||||
EXPECT_EQ(aCount, 1);
|
||||
@@ -599,7 +601,9 @@ TEST_F(BRepGraph_ViewsTest, AttrsView_CacheKindIter_RefId_RangeFor)
|
||||
for (const occ::handle<BRepGraph_CacheKind>& aKind : myGraph.Cache().CacheKindIter(aRef))
|
||||
{
|
||||
if (!aKind.IsNull() && aKind->ID() == testUserAttrKind()->ID())
|
||||
{
|
||||
hasUserKind = true;
|
||||
}
|
||||
++aCount;
|
||||
}
|
||||
EXPECT_EQ(aCount, 1);
|
||||
|
||||
@@ -128,7 +128,9 @@ TEST_F(BRepGraph_WireExplorerTest, Reset_RestartsIteration)
|
||||
|
||||
// Consume all edges.
|
||||
while (anExp.More())
|
||||
{
|
||||
anExp.Next();
|
||||
}
|
||||
EXPECT_FALSE(anExp.More());
|
||||
|
||||
// Reset and verify re-iteration works.
|
||||
|
||||
@@ -169,7 +169,9 @@ TEST(BRepTools_ReShapeTest, Apply_DiamondSharingIsProcessedCorrectly)
|
||||
EXPECT_FALSE(anExp.Current().TShape() == aV2.TShape())
|
||||
<< "Original v2 must have been replaced on every diamond arm";
|
||||
if (anExp.Current().TShape() == aV2Repl.TShape())
|
||||
{
|
||||
++aNbReplVertices;
|
||||
}
|
||||
}
|
||||
EXPECT_GE(aNbReplVertices, 2) << "Replacement must appear on both arms of the diamond";
|
||||
}
|
||||
@@ -283,13 +285,17 @@ TEST(BRepTools_ReShapeTest, Apply_SharedEdgeAcrossTwoParents)
|
||||
{
|
||||
EXPECT_FALSE(anExp.Current().TShape() == aE1.TShape());
|
||||
if (anExp.Current().TShape() == aE1New.TShape())
|
||||
{
|
||||
aFoundNewInA = true;
|
||||
}
|
||||
}
|
||||
for (TopExp_Explorer anExp(aResultB, TopAbs_EDGE); anExp.More(); anExp.Next())
|
||||
{
|
||||
EXPECT_FALSE(anExp.Current().TShape() == aE1.TShape());
|
||||
if (anExp.Current().TShape() == aE1New.TShape())
|
||||
{
|
||||
aFoundNewInB = true;
|
||||
}
|
||||
}
|
||||
EXPECT_TRUE(aFoundNewInA);
|
||||
EXPECT_TRUE(aFoundNewInB);
|
||||
|
||||
@@ -211,7 +211,9 @@ TEST(TopoDS_Iterator_Test, ReInitialization)
|
||||
// Count first compound
|
||||
int aCount1 = 0;
|
||||
for (; anIt.More(); anIt.Next())
|
||||
{
|
||||
++aCount1;
|
||||
}
|
||||
EXPECT_EQ(aCount1, 3);
|
||||
|
||||
// Re-initialize with second compound
|
||||
@@ -220,7 +222,9 @@ TEST(TopoDS_Iterator_Test, ReInitialization)
|
||||
// Count second compound
|
||||
int aCount2 = 0;
|
||||
for (; anIt.More(); anIt.Next())
|
||||
{
|
||||
++aCount2;
|
||||
}
|
||||
EXPECT_EQ(aCount2, 5);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user