2 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
4 // + This file is part of enGrid. +
6 // + Copyright 2008-2012 enGits GmbH +
8 // + enGrid is free software: you can redistribute it and/or modify +
9 // + it under the terms of the GNU General Public License as published by +
10 // + the Free Software Foundation, either version 3 of the License, or +
11 // + (at your option) any later version. +
13 // + enGrid is distributed in the hope that it will be useful, +
14 // + but WITHOUT ANY WARRANTY; without even the implied warranty of +
15 // + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +
16 // + GNU General Public License for more details. +
18 // + You should have received a copy of the GNU General Public License +
19 // + along with enGrid. If not, see <http://www.gnu.org/licenses/>. +
21 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
23 #ifndef BOOLEANGEOMETRYOPERATION_H
24 #define BOOLEANGEOMETRYOPERATION_H
26 class BooleanGeometryOperation
;
28 #include "surfacealgorithm.h"
29 #include "trisurfaceprojection.h"
31 class BooleanGeometryOperation
: public SurfaceAlgorithm
34 protected: // data types
46 vtkIdType id1
, id2
, id3
;
50 private: // attributes
53 QList
<tri_t
> m_Triangles
;
54 tri_t m_CurrentTriangle
;
55 QVector
<int> m_OpenNode
;
56 QVector
<bool> m_SplitNode
;
57 QVector
<QSet
<vtkIdType
> > m_Node2Cell
;
58 QVector
<QSet
<vtkIdType
> > m_Node2Node
;
60 protected: // attributes
62 vtkUnstructuredGrid
*m_ShapeGrid1
;
63 vtkUnstructuredGrid
*m_ShapeGrid2
;
64 TriSurfaceProjection m_Proj1
;
65 TriSurfaceProjection m_Proj2
;
66 MeshPartition m_Part1
;
67 MeshPartition m_Part2
;
76 bool fillGap_prepare();
77 void fillGap_updateOpenNode(vtkIdType id_node
);
78 bool fillGap_onDifferentSides(vtkIdType id1
, vtkIdType id2
, vtkIdType id3
);
80 void fillGap_createTriangles();
82 void smoothJunction_triangulate();
83 void smoothJunction_updateBCs();
84 double smoothJunction_mesher();
86 protected: // methods;
89 void checkOrientation();
91 void smoothJunction();
95 template <class C
> BooleanGeometryOperation(vtkUnstructuredGrid
*grid
, const C
&bcs1
, const C
&bcs2
, int side1
, int side2
);
97 virtual void operate();
99 void setNumCutLayers(int N
) { m_NumCutLayers
= N
; }
104 BooleanGeometryOperation::BooleanGeometryOperation(vtkUnstructuredGrid
*grid
, const C
&bcs1
, const C
&bcs2
, int side1
, int side2
)
107 m_Part1
.setGrid(m_Grid
);
108 m_Part2
.setGrid(m_Grid
);
109 m_Part1
.setBCs(bcs1
);
110 m_Part2
.setBCs(bcs2
);
111 m_ShapeGrid1
= vtkUnstructuredGrid::New();
112 m_ShapeGrid2
= vtkUnstructuredGrid::New();
113 m_Part1
.extractToVtkGrid(m_ShapeGrid1
);
114 m_Part2
.extractToVtkGrid(m_ShapeGrid2
);
115 QVector
<vtkIdType
> cells1
;
116 getAllCells(cells1
, m_ShapeGrid1
);
117 QVector
<vtkIdType
> cells2
;
118 getAllCells(cells2
, m_ShapeGrid2
);
119 m_Proj1
.setBackgroundGrid(m_ShapeGrid1
, cells1
);
120 m_Proj2
.setBackgroundGrid(m_ShapeGrid2
, cells2
);
125 foreach (int bc
, bcs1
) {
128 foreach (int bc
, bcs2
) {
137 #endif // BOOLEANGEOMETRYOPERATION_H