OCCT 8.0.1
OCCT documentation

Search guides and API reference

Enter at least two characters.

    Open CASCADE Technology Reference Manual 8.0.1
    BRepGraph Class Reference

    Topology-geometry graph over TopoDS / BRep. More...

    #include <BRepGraph.hxx>

    Data Structures

    class  EditorView
     Non-const view for programmatic graph construction and structural editing. More...
    class  TopoView
     Unified read-only view over topology definitions, adjacency, and representations. More...
    class  MeshView
     Read/write view over mesh data. More...
    class  RefsView
     Read-only view for RefId/RefUID-based reference storage. More...
    class  ShapesView
     View for TopoDS_Shape ingestion, reconstruction and lookup. More...
    class  UIDsView
     Read-only view for persistent node and reference identifiers. More...

    Public Member Functions

     BRepGraph (const BRepGraph &)=delete
     Copying is intentionally disabled: BRepGraph is the unique owner of graph data.
    BRepGraphoperator= (const BRepGraph &)=delete
     Copying is intentionally disabled: BRepGraph is the unique owner of graph data.
     BRepGraph ()
     Default constructor. Creates an empty graph with default allocator.
     ~BRepGraph ()
     Destructor.
     BRepGraph (BRepGraph &&) noexcept
     Move constructor.
    BRepGraphoperator= (BRepGraph &&) noexcept
     Move assignment operator.
    void Clear ()
     Reset the graph to an empty state. Increments generation and regenerates the graph GUID.
    bool IsEmpty () const
     Return true when the graph contains no topology definitions.
    bool ValidateRelations () const
     Verify relation consistency against entity / reference-entry tables. Intended for debug builds and regression tests of incremental mutation paths.
    const NCollection_LinearVector< BRepGraph_ProductId > & RootProductIds () const
     Return root product identifiers (products not referenced by any active occurrence). Maintained incrementally by Editor/EditorView mutations. Returns empty vector if the graph has not been built.
    const occ::handle< NCollection_BaseAllocator > & Allocator () const
     Return the current allocator.
    bool IsValid () const noexcept
     Return true when this wrapper references graph data.
    bool IsNull () const noexcept
     Return true when this wrapper does not reference graph data.
    const TopoViewTopo () const
     Access topology definitions, representation access, adjacency queries, raw Product/Occurrence definition storage, and assembly classification.
    const UIDsViewUIDs () const
     Access unique identifiers.
    const RefsViewRefs () const
     Access reference entries and their UIDs.
    ShapesViewShapes ()
     Access cached and fresh shape reconstruction.
    const ShapesViewShapes () const
     Access shape ingestion, cached shape reconstruction and fresh shape reconstruction.
    EditorViewEditor ()
     Access programmatic graph construction and mutation.
    const EditorViewEditor () const
     Const access to editor-specific state queries. Exposes IsDeferredMode() and ValidateMutationBoundary() on a const graph. All structural mutation methods require the non-const Editor() overload.
    const MeshViewMesh () const
     Access mesh data with explicit Cache()/Persistent() sub-views and Editor() for cache mutations. Persistent rep creation lives on Editor().Edges(), Editor().CoEdges(), Editor().Faces() (since reps back the topology defs).
    MeshViewMesh ()
     Non-const access to mesh view (required to call Editor() sub-view for cache mutations).
    BRepGraph_LayerRegistryLayerRegistry ()
     Access registered graph layers.
    const BRepGraph_LayerRegistryLayerRegistry () const
     Access registered graph layers (const).
    BRepGraph_CacheRegistryCacheRegistry ()
     Access registered graph cache services.
    const BRepGraph_CacheRegistryCacheRegistry () const
     Access registered graph cache services (const).

    Detailed Description

    Topology-geometry graph over TopoDS / BRep.

    Stores B-Rep topology as flat entity vectors (incidence-table model) with integer cross-references, enabling cache-friendly traversal, relation-table parent navigation, and parallel face-level geometry extraction.

    Key design concepts:

    • NodeId (Kind + Index): lightweight typed address into per-kind vectors.
    • UID (Kind + Counter): persistent identity surviving compaction/reorder.
    • RepId (Kind + Index): separate geometry/mesh addressing (Surface, Curve3D, Curve2D, Triangulation, Polygon) decoupled from topology nodes.
    • CoEdge: half-edge entity owning PCurve data for each edge-face binding; seam edges use paired CoEdges with opposite Orientation (Parasolid convention).
    • Lifecycle: Shapes().Add() populates from TopoDS_Shape; Editor() is the single mutation entry point for both structural creation/removal (Add*, Remove*, Append*) and field-level RAII-scoped mutation (Mut*()) with automatic cache invalidation and upward SubtreeGen propagation.

    Per-occurrence data (orientation, location) lives on incidence refs. Definition types are aliases to BRepGraphInc entity structs.

    Grouped View API

    Related methods are grouped behind lightweight view objects. Include the corresponding header (e.g. BRepGraph_TopoView.hxx) to use.

    Thread safety

    Const query methods are safe for concurrent reads. Concurrent reads during active mutation still require external synchronization. Deferred invalidation (BRepGraph_DeferredScope) batches SubtreeGen propagation; concurrent Editor().Mut*() calls during deferred mode still require external serialization. Shapes().Add() is internally parallel when requested.

    UID persistence

    UIDs use monotonic counters (not vector indices), persisting across Compact() and node removal. Only BRepGraph::Clear() resets counters (new generation). See BRepGraph_UID.hxx for the serialization contract.

    Extension model

    Extend via BRepGraph_Layer (persistent metadata / observers) or BRepGraph_CacheRegistry (typed algorithm-computed transient cache services). Direct storage extension is not supported.

    ID systems

    Four ID types with different stability guarantees:

    • NodeId (Kind + per-kind Index): fast graph-local address. NOT stable across Compact(). Use for in-graph traversal and short-lived algorithm temporaries.
    • UID (Kind + monotonic Counter): persistent identity surviving Compact() and node removal. Use for cross-session storage, history tracking, and external references.
    • RefId (Kind + per-kind Index): same stability as NodeId, but addresses reference entries (Shell->Solid binding, Face->Shell binding, CoEdge->Wire binding) rather than defs.
    • RepId (Kind + per-kind Index): addresses owner-scoped geometry/mesh representation slots (Surface, Curve3D, Curve2D, Triangulation, Polygon).

    Iterator guide

    Choose the iterator that matches your traversal need:

    • BRepGraph_Iterator<NodeType>: flat sequential scan of ALL definitions of one kind (e.g. every FaceDef, skipping removed). Use for bulk per-kind algorithms.
    • BRepGraph_DefsIterator / BRepGraph_RefsIterator: single-level typed children of one parent (e.g. active shells of one solid, coedges of one wire). Zero allocation. Use when you have a specific parent and need its direct children.
    • BRepGraph_ChildExplorer: depth-first downward walk from a root with accumulated location/orientation per step. Use when visiting descendants across multiple levels or when the global transform matters. Supports Recursive and DirectChildren modes.
    • BRepGraph_ParentExplorer: upward walk via relation tables from a starting node. Use when tracing which shells/solids/compounds contain a given face or edge.
    • BRepGraph_RelatedIterator: single-level semantic neighbors (adjacent faces, boundary edges, incident vertices). No structural descent; no location accumulation.

    Constructor & Destructor Documentation

    ◆ BRepGraph() [1/3]

    BRepGraph::BRepGraph ( const BRepGraph & )
    delete

    Copying is intentionally disabled: BRepGraph is the unique owner of graph data.

    ◆ BRepGraph() [2/3]

    BRepGraph::BRepGraph ( )

    Default constructor. Creates an empty graph with default allocator.

    ◆ ~BRepGraph()

    BRepGraph::~BRepGraph ( )

    Destructor.

    ◆ BRepGraph() [3/3]

    BRepGraph::BRepGraph ( BRepGraph && )
    noexcept

    Move constructor.

    Member Function Documentation

    ◆ Allocator()

    const occ::handle< NCollection_BaseAllocator > & BRepGraph::Allocator ( ) const
    nodiscard

    Return the current allocator.

    ◆ CacheRegistry() [1/2]

    BRepGraph_CacheRegistry & BRepGraph::CacheRegistry ( )
    nodiscard

    Access registered graph cache services.

    Returns
    cache registry for managing typed transient cache services

    ◆ CacheRegistry() [2/2]

    const BRepGraph_CacheRegistry & BRepGraph::CacheRegistry ( ) const
    nodiscard

    Access registered graph cache services (const).

    Returns
    cache registry for managing typed transient cache services

    ◆ Clear()

    void BRepGraph::Clear ( )

    Reset the graph to an empty state. Increments generation and regenerates the graph GUID.

    ◆ Editor() [1/2]

    EditorView & BRepGraph::Editor ( )
    nodiscard

    Access programmatic graph construction and mutation.

    ◆ Editor() [2/2]

    const EditorView & BRepGraph::Editor ( ) const
    nodiscard

    Const access to editor-specific state queries. Exposes IsDeferredMode() and ValidateMutationBoundary() on a const graph. All structural mutation methods require the non-const Editor() overload.

    ◆ IsEmpty()

    bool BRepGraph::IsEmpty ( ) const
    nodiscard

    Return true when the graph contains no topology definitions.

    ◆ IsNull()

    bool BRepGraph::IsNull ( ) const
    inlinenodiscardnoexcept

    Return true when this wrapper does not reference graph data.

    ◆ IsValid()

    bool BRepGraph::IsValid ( ) const
    nodiscardnoexcept

    Return true when this wrapper references graph data.

    ◆ LayerRegistry() [1/2]

    BRepGraph_LayerRegistry & BRepGraph::LayerRegistry ( )
    nodiscard

    Access registered graph layers.

    Returns
    layer registry for managing attribute layers

    ◆ LayerRegistry() [2/2]

    const BRepGraph_LayerRegistry & BRepGraph::LayerRegistry ( ) const
    nodiscard

    Access registered graph layers (const).

    Returns
    layer registry for managing attribute layers

    ◆ Mesh() [1/2]

    MeshView & BRepGraph::Mesh ( )
    nodiscard

    Non-const access to mesh view (required to call Editor() sub-view for cache mutations).

    Returns
    mutable mesh view

    ◆ Mesh() [2/2]

    const MeshView & BRepGraph::Mesh ( ) const
    nodiscard

    Access mesh data with explicit Cache()/Persistent() sub-views and Editor() for cache mutations. Persistent rep creation lives on Editor().Edges(), Editor().CoEdges(), Editor().Faces() (since reps back the topology defs).

    Returns
    read-only mesh view

    ◆ operator=() [1/2]

    BRepGraph & BRepGraph::operator= ( BRepGraph && )
    noexcept

    Move assignment operator.

    ◆ operator=() [2/2]

    BRepGraph & BRepGraph::operator= ( const BRepGraph & )
    delete

    Copying is intentionally disabled: BRepGraph is the unique owner of graph data.

    ◆ Refs()

    const RefsView & BRepGraph::Refs ( ) const
    nodiscard

    Access reference entries and their UIDs.

    ◆ RootProductIds()

    const NCollection_LinearVector< BRepGraph_ProductId > & BRepGraph::RootProductIds ( ) const
    nodiscard

    Return root product identifiers (products not referenced by any active occurrence). Maintained incrementally by Editor/EditorView mutations. Returns empty vector if the graph has not been built.

    ◆ Shapes() [1/2]

    ShapesView & BRepGraph::Shapes ( )
    nodiscard

    Access cached and fresh shape reconstruction.

    ◆ Shapes() [2/2]

    const ShapesView & BRepGraph::Shapes ( ) const
    nodiscard

    Access shape ingestion, cached shape reconstruction and fresh shape reconstruction.

    ◆ Topo()

    const TopoView & BRepGraph::Topo ( ) const
    nodiscard

    Access topology definitions, representation access, adjacency queries, raw Product/Occurrence definition storage, and assembly classification.

    ◆ UIDs()

    const UIDsView & BRepGraph::UIDs ( ) const
    nodiscard

    Access unique identifiers.

    ◆ ValidateRelations()

    bool BRepGraph::ValidateRelations ( ) const
    nodiscard

    Verify relation consistency against entity / reference-entry tables. Intended for debug builds and regression tests of incremental mutation paths.

    Returns
    true when every stored relation matches its endpoints.

    The documentation for this class was generated from the following file: