7bd071ed |
1 | // Created on: 2016-04-07 |
2 | // Copyright (c) 2016 OPEN CASCADE SAS |
3 | // Created by: Oleg AGASHIN |
4 | // |
5 | // This file is part of Open CASCADE Technology software library. |
6 | // |
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. |
12 | // |
13 | // Alternatively, this file may be used under the terms of Open CASCADE |
14 | // commercial license or contractual agreement. |
15 | |
16 | #include <BRepMeshData_Model.hxx> |
95c882e9 |
17 | |
7bd071ed |
18 | #include <BRepMeshData_Face.hxx> |
19 | #include <BRepMeshData_Edge.hxx> |
95c882e9 |
20 | #include <NCollection_IncAllocator.hxx> |
7bd071ed |
21 | |
4945e8be |
22 | IMPLEMENT_STANDARD_RTTIEXT(BRepMeshData_Model, IMeshData_Model) |
23 | |
7bd071ed |
24 | //======================================================================= |
25 | // Function: Constructor |
26 | // Purpose : |
27 | //======================================================================= |
28 | BRepMeshData_Model::BRepMeshData_Model (const TopoDS_Shape& theShape) |
29 | : IMeshData_Model (theShape), |
30 | myMaxSize (0.), |
95c882e9 |
31 | myAllocator (new NCollection_IncAllocator (IMeshData::MEMORY_BLOCK_SIZE_HUGE)), |
7bd071ed |
32 | myDFaces (256, myAllocator), |
33 | myDEdges (256, myAllocator) |
34 | { |
1103eb60 |
35 | myAllocator->SetThreadSafe(true); |
7bd071ed |
36 | } |
37 | |
38 | //======================================================================= |
39 | // Function: Destructor |
40 | // Purpose : |
41 | //======================================================================= |
42 | BRepMeshData_Model::~BRepMeshData_Model () |
43 | { |
44 | } |
45 | |
46 | //======================================================================= |
47 | // Function: FacesNb |
48 | // Purpose : |
49 | //======================================================================= |
50 | Standard_Integer BRepMeshData_Model::FacesNb () const |
51 | { |
52 | return myDFaces.Size (); |
53 | } |
54 | |
55 | //======================================================================= |
56 | // Function: AddFace |
57 | // Purpose : |
58 | //======================================================================= |
59 | const IMeshData::IFaceHandle& BRepMeshData_Model::AddFace (const TopoDS_Face& theFace) |
60 | { |
61 | IMeshData::IFaceHandle aFace (new (myAllocator) BRepMeshData_Face (theFace, myAllocator)); |
1103eb60 |
62 | return myDFaces.Append (aFace); |
7bd071ed |
63 | } |
64 | |
65 | //======================================================================= |
66 | // Function: GetFace |
67 | // Purpose : |
68 | //======================================================================= |
69 | const IMeshData::IFaceHandle& BRepMeshData_Model::GetFace (const Standard_Integer theIndex) const |
70 | { |
71 | return myDFaces (theIndex); |
72 | } |
73 | |
74 | //======================================================================= |
75 | // Function: EdgesNb |
76 | // Purpose : |
77 | //======================================================================= |
78 | Standard_Integer BRepMeshData_Model::EdgesNb () const |
79 | { |
80 | return myDEdges.Size (); |
81 | } |
82 | |
83 | //======================================================================= |
84 | // Function: AddEdge |
85 | // Purpose : |
86 | //======================================================================= |
87 | const IMeshData::IEdgeHandle& BRepMeshData_Model::AddEdge (const TopoDS_Edge& theEdge) |
88 | { |
89 | IMeshData::IEdgeHandle aEdge (new (myAllocator) BRepMeshData_Edge (theEdge, myAllocator)); |
1103eb60 |
90 | return myDEdges.Append (aEdge); |
7bd071ed |
91 | } |
92 | |
93 | //======================================================================= |
94 | // Function: GetEdge |
95 | // Purpose : |
96 | //======================================================================= |
97 | const IMeshData::IEdgeHandle& BRepMeshData_Model::GetEdge (const Standard_Integer theIndex) const |
98 | { |
99 | return myDEdges (theIndex); |
100 | } |