1 // Created on: 2016-04-07
2 // Copyright (c) 2016 OPEN CASCADE SAS
3 // Created by: Oleg AGASHIN
5 // This file is part of Open CASCADE Technology software library.
7 // This library is free software; you can redistribute it and/or modify it under
8 // the terms of the GNU Lesser General Public License version 2.1 as published
9 // by the Free Software Foundation, with special exception defined in the file
10 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11 // distribution for complete text of the license and disclaimer of any warranty.
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
16 #ifndef _IMeshData_Types_HeaderFile
17 #define _IMeshData_Types_HeaderFile
19 #include <NCollection_DataMap.hxx>
20 #include <NCollection_Vector.hxx>
21 #include <NCollection_Sequence.hxx>
22 #include <NCollection_List.hxx>
23 #include <NCollection_Shared.hxx>
24 #include <TopTools_ShapeMapHasher.hxx>
25 #include <TopoDS_Shape.hxx>
26 #include <NCollection_DefineAlloc.hxx>
27 #include <NCollection_StdAllocator.hxx>
28 #include <IMeshData_ParametersListArrayAdaptor.hxx>
29 #include <TColStd_PackedMapOfInteger.hxx>
30 #include <TColStd_MapIteratorOfPackedMapOfInteger.hxx>
31 #include <Precision.hxx>
32 #include <NCollection_EBTree.hxx>
33 #include <Bnd_Box2d.hxx>
34 #include <NCollection_CellFilter.hxx>
35 #include <NCollection_IndexedDataMap.hxx>
36 #include <NCollection_UBTreeFiller.hxx>
37 #include <NCollection_IndexedMap.hxx>
38 #include <BRepMesh_OrientedEdge.hxx>
39 #include <BRepMesh_Vertex.hxx>
40 #include <Bnd_B2d.hxx>
41 #include <BRepMesh_Circle.hxx>
42 #include <BRepMesh_Triangle.hxx>
43 #include <BRepMesh_PairOfIndex.hxx>
44 #include <BRepMesh_Edge.hxx>
50 class IMeshData_Shape;
54 class IMeshData_Curve;
55 class IMeshData_PCurve;
56 class IMeshData_Model;
57 class BRepMesh_VertexInspector;
58 class BRepMesh_CircleInspector;
60 #define DEFINE_INC_ALLOC \
61 DEFINE_NCOLLECTION_ALLOC \
62 void operator delete (void* /*theAddress*/) \
64 /*it's inc allocator, nothing to do*/ \
69 //! Default size for memory block allocated by IncAllocator.
71 * The idea here is that blocks of the given size are returned to the system
72 * rather than retained in the malloc heap, at least on WIN32 and WIN64 platforms.
75 const size_t MEMORY_BLOCK_SIZE_HUGE = 1024 * 1024;
77 const size_t MEMORY_BLOCK_SIZE_HUGE = 512 * 1024;
80 typedef IMeshData_Edge* IEdgePtr;
81 typedef IMeshData_Face* IFacePtr;
83 typedef Handle(IMeshData_Edge) IEdgeHandle;
84 typedef Handle(IMeshData_Wire) IWireHandle;
85 typedef Handle(IMeshData_Face) IFaceHandle;
86 typedef Handle(IMeshData_Curve) ICurveHandle;
87 typedef Handle(IMeshData_PCurve) IPCurveHandle;
89 typedef IMeshData_ParametersListArrayAdaptor<ICurveHandle> ICurveArrayAdaptor;
90 typedef Handle(ICurveArrayAdaptor) ICurveArrayAdaptorHandle;
92 typedef NCollection_Shared<NCollection_EBTree<Standard_Integer, Bnd_Box2d> > BndBox2dTree;
93 typedef NCollection_UBTreeFiller<Standard_Integer, Bnd_Box2d> BndBox2dTreeFiller;
96 typedef NCollection_Shared<NCollection_Vector<IFaceHandle> > VectorOfIFaceHandles;
97 typedef NCollection_Shared<NCollection_Vector<IWireHandle> > VectorOfIWireHandles;
98 typedef NCollection_Shared<NCollection_Vector<IEdgeHandle> > VectorOfIEdgeHandles;
99 typedef NCollection_Shared<NCollection_Vector<IPCurveHandle> > VectorOfIPCurveHandles;
100 typedef NCollection_Shared<NCollection_Vector<IEdgePtr> > VectorOfIEdgePtrs;
101 typedef NCollection_Shared<NCollection_Vector<Standard_Boolean> > VectorOfBoolean;
102 typedef NCollection_Shared<NCollection_Vector<Standard_Integer> > VectorOfInteger;
103 typedef NCollection_Shared<NCollection_Vector<TopAbs_Orientation> > VectorOfOrientation;
104 typedef NCollection_Shared<NCollection_Vector<BRepMesh_Triangle> > VectorOfElements;
105 typedef NCollection_Shared<NCollection_Vector<BRepMesh_Circle> > VectorOfCircle;
107 typedef NCollection_Shared<NCollection_Array1<BRepMesh_Vertex> > Array1OfVertexOfDelaun;
108 typedef NCollection_Shared<NCollection_Vector<BRepMesh_Vertex> > VectorOfVertex;
111 typedef NCollection_Shared<NCollection_Sequence<Bnd_B2d> > SequenceOfBndB2d;
112 typedef NCollection_Shared<NCollection_Sequence<Standard_Integer> > SequenceOfInteger;
113 typedef NCollection_Shared<NCollection_Sequence<Standard_Real> > SequenceOfReal;
117 typedef std::deque<gp_Pnt, NCollection_StdAllocator<gp_Pnt> > SequenceOfPnt;
118 typedef std::deque<gp_Pnt2d, NCollection_StdAllocator<gp_Pnt2d> > SequenceOfPnt2d;
119 typedef std::deque<Standard_Real, NCollection_StdAllocator<Standard_Real> > SequenceOfReal;
120 typedef std::deque<Standard_Integer, NCollection_StdAllocator<Standard_Integer> > SequenceOfInteger;
124 typedef NCollection_Shared<NCollection_List<Standard_Integer> > ListOfInteger;
125 typedef NCollection_Shared<NCollection_List<gp_Pnt2d> > ListOfPnt2d;
126 typedef NCollection_Shared<NCollection_List<IPCurveHandle> > ListOfIPCurves;
128 typedef NCollection_Shared<TColStd_PackedMapOfInteger> MapOfInteger;
129 typedef TColStd_MapIteratorOfPackedMapOfInteger IteratorOfMapOfInteger;
131 typedef NCollection_CellFilter<BRepMesh_CircleInspector> CircleCellFilter;
132 typedef NCollection_CellFilter<BRepMesh_VertexInspector> VertexCellFilter;
135 template<typename Type>
138 static Standard_Boolean IsEqual(const Type* theFirst,
139 const Type* theSecond)
141 return (theFirst == theSecond);
144 //! Computes a hash code for the given pointer, in the range [1, theUpperBound]
145 //! @param thePointer the pointer which hash code is to be computed
146 //! @param theUpperBound the upper bound of the range a computing hash code must be within
147 //! @return a computed hash code, in the range [1, theUpperBound]
148 static Standard_Integer HashCode (const Type* const thePointer, Standard_Integer theUpperBound)
150 return ::HashCode (thePointer, theUpperBound);
154 typedef NCollection_Shared<NCollection_DataMap<TopoDS_Shape, Standard_Integer, TopTools_ShapeMapHasher> > DMapOfShapeInteger;
155 typedef NCollection_Shared<NCollection_DataMap<IFacePtr, ListOfInteger, WeakEqual<IMeshData_Face> > > DMapOfIFacePtrsListOfInteger;
156 typedef NCollection_Shared<NCollection_Map<IEdgePtr, WeakEqual<IMeshData_Edge> > > MapOfIEdgePtr;
157 typedef NCollection_Shared<NCollection_Map<IFacePtr, WeakEqual<IMeshData_Face> > > MapOfIFacePtr;
158 typedef NCollection_Shared<NCollection_Map<BRepMesh_OrientedEdge> > MapOfOrientedEdges;
159 typedef NCollection_Shared<NCollection_Map<Standard_Real> > MapOfReal;
160 typedef NCollection_Shared<NCollection_IndexedDataMap<IFacePtr, ListOfIPCurves, WeakEqual<IMeshData_Face> > > IDMapOfIFacePtrsListOfIPCurves;
161 typedef NCollection_Shared<NCollection_DataMap<IFacePtr, Handle(MapOfIEdgePtr), WeakEqual<IMeshData_Face> > > DMapOfIFacePtrsMapOfIEdgePtrs;
162 typedef NCollection_Shared<NCollection_IndexedDataMap<BRepMesh_Edge, BRepMesh_PairOfIndex> > IDMapOfLink;
163 typedef NCollection_Shared<NCollection_DataMap<Standard_Integer, ListOfInteger> > DMapOfIntegerListOfInteger;
164 typedef NCollection_Shared<NCollection_DataMap<Standard_Integer, Standard_Integer> > MapOfIntegerInteger;
165 typedef NCollection_Shared<NCollection_IndexedMap<Standard_Real> > IMapOfReal;
167 typedef NCollection_Shared<NCollection_Array1<Standard_Integer> > Array1OfInteger;