1394bd7a4afa06ad904b1ac34848f5962f602742
[occt.git] / src / BRepMesh / BRepMesh_DelaunayBaseMeshAlgo.cxx
1 // Created on: 2016-04-19
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 <BRepMesh_DelaunayBaseMeshAlgo.hxx>
17 #include <BRepMesh_MeshTool.hxx>
18 #include <BRepMesh_Delaun.hxx>
19
20 //=======================================================================
21 // Function: Constructor
22 // Purpose : 
23 //=======================================================================
24 BRepMesh_DelaunayBaseMeshAlgo::BRepMesh_DelaunayBaseMeshAlgo()
25 {
26 }
27
28 //=======================================================================
29 // Function: Destructor
30 // Purpose : 
31 //=======================================================================
32 BRepMesh_DelaunayBaseMeshAlgo::~BRepMesh_DelaunayBaseMeshAlgo()
33 {
34 }
35
36 //=======================================================================
37 //function : generateMesh
38 //purpose  :
39 //=======================================================================
40 void BRepMesh_DelaunayBaseMeshAlgo::generateMesh()
41 {
42   const Handle(BRepMesh_DataStructureOfDelaun)& aStructure = getStructure();
43   const Handle(VectorOfPnt)&                    aNodesMap  = getNodesMap();
44
45   IMeshData::VectorOfInteger aVerticesOrder(aNodesMap->Size(), getAllocator());
46   for (Standard_Integer i = 1; i <= aNodesMap->Size(); ++i)
47   {
48     aVerticesOrder.Append(i);
49   }
50
51   std::pair<Standard_Integer, Standard_Integer> aCellsCount = getCellsCount (aVerticesOrder.Size ());
52   BRepMesh_Delaun aMesher(aStructure, aVerticesOrder, aCellsCount.first, aCellsCount.second);
53   BRepMesh_MeshTool aCleaner(aStructure);
54   aCleaner.EraseFreeLinks();
55
56   postProcessMesh(aMesher);
57 }