Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-28 09:19:37

0001 // Copyright (c) 2026 OPEN CASCADE SAS
0002 //
0003 // This file is part of Open CASCADE Technology software library.
0004 //
0005 // This library is free software; you can redistribute it and/or modify it under
0006 // the terms of the GNU Lesser General Public License version 2.1 as published
0007 // by the Free Software Foundation, with special exception defined in the file
0008 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0009 // distribution for complete text of the license and disclaimer of any warranty.
0010 //
0011 // Alternatively, this file may be used under the terms of Open CASCADE
0012 // commercial license or contractual agreement.
0013 
0014 #ifndef _BRepGraphInc_Reference_HeaderFile
0015 #define _BRepGraphInc_Reference_HeaderFile
0016 
0017 #include <BRepGraphInc_ParityOrientation.hxx>
0018 #include <BRepGraph_NodeId.hxx>
0019 #include <BRepGraph_RefId.hxx>
0020 #include <TopLoc_Location.hxx>
0021 
0022 //! @brief Managed reference entry structs for the incidence-table storage.
0023 //!
0024 //! Each reference entry extends BaseRef with representation fields describing
0025 //! how a child definition is used by its parent.
0026 //! Reference entries are stored in flat per-kind vectors in BRepGraphInc_Storage
0027 //! and support mutation tracking and soft-removal.
0028 //! Not every definition kind has a dedicated Ref kind by design:
0029 //! - CoEdge usage is stored directly on CoEdgeDef and ordered through WireRelations
0030 //! - Compound children use ChildRef (heterogeneous NodeId target)
0031 //! - Product children use OccurrenceRef (placement owned by OccurrenceDef)
0032 //! - CompSolid children use SolidRef
0033 //!
0034 //! For lightweight read-only projections without lifecycle fields, see
0035 //! BRepGraphInc_Instance.hxx (Instance structs carry only DefId + Orientation + Location).
0036 namespace BRepGraphInc
0037 {
0038 
0039 //! Fields shared by every reference entry.
0040 struct BaseRef
0041 {
0042   using TypeId = BRepGraph_RefId;
0043 
0044   //! Persistent per-kind UID counter value.
0045   //! 0 = invalid sentinel (not yet allocated). Valid UIDs start at 1.
0046   //! Kind is implicit from the concrete struct type (ShellRef, FaceRef, etc.).
0047   uint32_t UID = 0;
0048 };
0049 
0050 //! Shell reference storage entry.
0051 struct ShellRef : public BaseRef
0052 {
0053   using TypeId = BRepGraph_ShellRefId;
0054 
0055   BRepGraph_SolidId ParentSolidId;                //!< Parent solid identifier
0056   BRepGraph_ShellId ChildShellId;                 //!< Child shell identifier
0057   ParityOrientation Orientation = TopAbs_FORWARD; //!< Orientation within parent
0058 };
0059 
0060 //! Face reference storage entry.
0061 struct FaceRef : public BaseRef
0062 {
0063   using TypeId = BRepGraph_FaceRefId;
0064 
0065   BRepGraph_ShellId ParentShellId;                //!< Parent shell identifier
0066   BRepGraph_FaceId  ChildFaceId;                  //!< Child face identifier
0067   ParityOrientation Orientation = TopAbs_FORWARD; //!< Orientation within parent
0068 };
0069 
0070 //! Wire reference storage entry.
0071 struct WireRef : public BaseRef
0072 {
0073   using TypeId = BRepGraph_WireRefId;
0074 
0075   BRepGraph_FaceId  ParentFaceId;                 //!< Parent face identifier
0076   BRepGraph_WireId  ChildWireId;                  //!< Child wire identifier
0077   ParityOrientation Orientation = TopAbs_FORWARD; //!< Orientation within parent
0078 };
0079 
0080 //! Vertex reference storage entry.
0081 struct VertexRef : public BaseRef
0082 {
0083   using TypeId = BRepGraph_VertexRefId;
0084 
0085   BRepGraph_VertexId ChildVertexId;                //!< Child vertex identifier
0086   BRepGraph_EdgeId   ParentEdgeId;                 //!< Edge that owns this vertex reference
0087   ParityOrientation  Orientation = TopAbs_FORWARD; //!< Orientation within parent
0088 };
0089 
0090 //! Solid reference storage entry.
0091 struct SolidRef : public BaseRef
0092 {
0093   using TypeId = BRepGraph_SolidRefId;
0094 
0095   BRepGraph_CompSolidId ParentCompSolidId;            //!< Parent compsolid identifier
0096   BRepGraph_SolidId     ChildSolidId;                 //!< Child solid identifier
0097   ParityOrientation     Orientation = TopAbs_FORWARD; //!< Orientation within parent
0098 };
0099 
0100 //! Child reference storage entry.
0101 struct ChildRef : public BaseRef
0102 {
0103   using TypeId = BRepGraph_ChildRefId;
0104 
0105   BRepGraph_CompoundId ParentCompoundId;             //!< Parent compound identifier
0106   BRepGraph_NodeId     ChildNodeId;                  //!< Child node identifier (heterogeneous)
0107   ParityOrientation    Orientation = TopAbs_FORWARD; //!< Orientation within parent
0108   TopLoc_Location      LocalLocation;                //!< Location relative to parent
0109 };
0110 
0111 //! Occurrence reference storage entry.
0112 //! Like ChildRef but without Orientation - placement is a reference property.
0113 //! Structurally parallel to other ref types: definitions carry no location.
0114 struct OccurrenceRef : public BaseRef
0115 {
0116   using TypeId = BRepGraph_OccurrenceRefId;
0117 
0118   BRepGraph_ProductId    ParentProductId;
0119   BRepGraph_OccurrenceId ChildOccurrenceId;
0120   TopLoc_Location        LocalLocation; //!< Placement relative to parent product
0121 };
0122 
0123 } // namespace BRepGraphInc
0124 
0125 #endif // _BRepGraphInc_Reference_HeaderFile