Modeling, BRepGraph - Identity copy path, lock-free cache reads, per-CoEdge queries (#1306)

Identity copy path:
- copyFullGraphIdentity with PrepareForLoad() + direct slot assignment
- CopyDerivedRelationsFrom for O(K) relation vector copy
- CopyRemovedFlagsFrom for bulk removed-flag copy
- CopyShapeBindingsFrom for TShape/Original shape binding copy
- PrepareForLoad skips Clear() when storage already empty (IsEmpty fast path)
- appendRelationIdDirect for O(1) append in rebuild loop (duplicates structurally impossible)
- ChangeCompoundRefsOfNodeInternal uses TryBound for single lookup
- Counts() and ActiveCounts() accessors for Counts struct construction

Lock-free cache reads:
- EdgeEntry: packed atomic<uint8_t> (GeomStatus+IsClosed+IsComputed)
- CoEdgeSameRangeEntry: packed atomic<uint8_t> (SameRange+SameParameter+Computed)
- WireEntry: packed atomic<uint8_t> (IsClosed+IsComputed)
- ShellEntry: atomic<ClosureStatus> with Invalid sentinel
- All entries use memory_order_acquire/release pairs
- ensureSize handles lazy array growth (no myPreSized)
- Enums (GeomStatus, ClosureStatus) moved inside entry structs

Per-CoEdge queries:
- SameRange/SameParameter are per-CoEdge properties, bound to CoEdge OwnGen
- Edge class no longer has SameParameter/SameRange/IsClosed coedge overloads
- CoEdge class owns SameParameter/SameRange queries
- Test files use local edgeSameParameter/edgeSameRange helpers

Lock-free storage and registry:
- BRepGraphInc_Storage: atomic dirty flags for UID reverse indexes
- BRepGraph_LayerRegistry: atomic subscription masks for lock-free dispatch
- Ensure/EnsureCache/EnsureLayer: double-checked locking with shared fast path

Other optimizations:
- Iterator Next() fast-path: check next element validity inline
- NbFaces O(K) inline dedup with NCollection_LocalArray
- GeomAdaptor_Curve/Surface/Geom2dAdaptor_Curve for cached geometry eval
- Value() calls replaced with EvalD0() for clearer naming
- TargetItem returns value instead of pointer (no null-pointer risk)
- copyTopologyDefinitionsIdentity clears Curve3DRepId on GeomPolicy::Drop
- ensureEdgeEntry concurrency: fast-path validation + selective field merge
This commit is contained in:
Pasukhin Dmitry
2026-06-14 14:15:32 +01:00
committed by GitHub
parent 2b379b9f08
commit ea3fc1f8bd
31 changed files with 2059 additions and 1350 deletions
@@ -40,7 +40,7 @@ namespace
{
struct BRepGraph_ReconstructionContext
{
const BRepGraph* Graph = nullptr;
BRepGraph* Graph = nullptr;
const BRepGraphInc_Storage* Storage = nullptr;
BRepGraphInc_Reconstruct::Cache Cache;
NCollection_FlatMap<BRepGraph_ProductId> ActiveProducts;
@@ -677,7 +677,7 @@ static TopoDS_Shape reconstructShape(BRepGraph_ReconstructionContext& theContext
}
static BRepGraph_ReconstructionContext makeReconstructionContext(
const BRepGraph& theGraph,
BRepGraph& theGraph,
const BRepGraphInc_Storage& theStorage)
{
BRepGraph_ReconstructionContext aContext;