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 #include <BRepMeshData_Model.hxx>
18 #include <BRepMeshData_Face.hxx>
19 #include <BRepMeshData_Edge.hxx>
20 #include <BRepMesh_OrientedEdge.hxx>
21 #include <BRepMesh_Vertex.hxx>
22 #include <NCollection_IncAllocator.hxx>
24 IMPLEMENT_STANDARD_RTTIEXT(BRepMeshData_Model, IMeshData_Model)
26 //=======================================================================
27 // Function: Constructor
29 //=======================================================================
30 BRepMeshData_Model::BRepMeshData_Model (const TopoDS_Shape& theShape)
31 : IMeshData_Model (theShape),
33 myAllocator (new NCollection_IncAllocator (IMeshData::MEMORY_BLOCK_SIZE_HUGE)),
34 myDFaces (256, myAllocator),
35 myDEdges (256, myAllocator)
37 myAllocator->SetThreadSafe();
40 //=======================================================================
41 // Function: Destructor
43 //=======================================================================
44 BRepMeshData_Model::~BRepMeshData_Model ()
48 //=======================================================================
51 //=======================================================================
52 Standard_Integer BRepMeshData_Model::FacesNb () const
54 return myDFaces.Size ();
57 //=======================================================================
60 //=======================================================================
61 const IMeshData::IFaceHandle& BRepMeshData_Model::AddFace (const TopoDS_Face& theFace)
63 IMeshData::IFaceHandle aFace (new (myAllocator) BRepMeshData_Face (theFace, myAllocator));
64 myDFaces.Append (aFace);
65 return myDFaces (FacesNb () - 1);
68 //=======================================================================
71 //=======================================================================
72 const IMeshData::IFaceHandle& BRepMeshData_Model::GetFace (const Standard_Integer theIndex) const
74 return myDFaces (theIndex);
77 //=======================================================================
80 //=======================================================================
81 Standard_Integer BRepMeshData_Model::EdgesNb () const
83 return myDEdges.Size ();
86 //=======================================================================
89 //=======================================================================
90 const IMeshData::IEdgeHandle& BRepMeshData_Model::AddEdge (const TopoDS_Edge& theEdge)
92 IMeshData::IEdgeHandle aEdge (new (myAllocator) BRepMeshData_Edge (theEdge, myAllocator));
93 myDEdges.Append (aEdge);
94 return myDEdges (EdgesNb () - 1);
97 //=======================================================================
100 //=======================================================================
101 const IMeshData::IEdgeHandle& BRepMeshData_Model::GetEdge (const Standard_Integer theIndex) const
103 return myDEdges (theIndex);