1 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
3 // + This file is part of enGrid. +
5 // + Copyright 2008-2014 enGits GmbH +
7 // + enGrid is free software: you can redistribute it and/or modify +
8 // + it under the terms of the GNU General Public License as published by +
9 // + the Free Software Foundation, either version 3 of the License, or +
10 // + (at your option) any later version. +
12 // + enGrid is distributed in the hope that it will be useful, +
13 // + but WITHOUT ANY WARRANTY; without even the implied warranty of +
14 // + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +
15 // + GNU General Public License for more details. +
17 // + You should have received a copy of the GNU General Public License +
18 // + along with enGrid. If not, see <http://www.gnu.org/licenses/>. +
20 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
21 #ifndef REMOVEPOINTS_H
22 #define REMOVEPOINTS_H
24 #include "surfaceoperation.h"
26 #include <vtkUnstructuredGrid.h>
27 #include <vtkPolyData.h>
28 #include <vtkCharArray.h>
32 #include <QTextStream>
35 class RemovePoints
: public SurfaceOperation
42 bool m_ProtectFeatureEdges
;
43 bool m_PerformGeometricChecks
;
46 QVector
<bool> m_IsFeatureNode
;
47 QVector
<bool> m_Fixed
;
53 virtual void operate();
55 int getNumRemoved() { return m_NumRemoved
; }
56 void setProtectFeatureEdgesOn() { m_ProtectFeatureEdges
= true; }
57 void setProtectFeatureEdgesOff() { m_ProtectFeatureEdges
= false; }
58 void setPerformGeometricChecksOn() { m_PerformGeometricChecks
= true; }
59 void setPerformGeometricChecksOff() { m_PerformGeometricChecks
= false; }
60 void setUpdatePSPOn() { m_UpdatePSP
= true; }
61 void setUpdatePSPOff() { m_UpdatePSP
= false; }
62 void setThreshold(double v
) { m_Threshold
= v
; }
63 void fixNodes(const QVector
<bool> &fixnodes
);
67 virtual bool checkEdge(vtkIdType id_node1
, vtkIdType id_node2
);
69 void markFeatureEdges();
71 /// deletes set of points DeadNodes
72 bool deleteSetOfPoints(const QVector
<vtkIdType
>& deadnode_vector
,
73 const QVector
<vtkIdType
>& snappoint_vector
,
74 const QVector
<vtkIdType
>& all_deadcells
,
75 const QVector
<vtkIdType
>& all_mutatedcells
);
77 /// returns a valid potential snappoint (checks for flipped cells, etc). If none is found, returns -1.
78 bool isSnapPoint(vtkIdType id_node1
, vtkIdType id_node2
,
79 QVector
<vtkIdType
>& dead_cells
, QVector
<vtkIdType
>& mutated_cells
,
80 int& num_newpoints
, int& num_newcells
,
81 const QVector
<bool>& marked_nodes
);
83 /// returns true if moving id_node to position P leads to flipped cells
84 bool flippedCell(vtkIdType id_node
, vec3_t x_new
, vtkIdType id_cell
);
85 bool flippedCell2(vtkIdType id_node
, vec3_t x_new
);
87 /// returns number of common neighbour nodes of id_node1 and id_node2. IsTetra becomes true if id_node1 and id_node2 belong to the edge of a tetrahedron.
88 int numberOfCommonPoints( vtkIdType id_node1
, vtkIdType id_node2
, bool& IsTetra
);
90 /// returns number of common neighbour nodes of id_node1 and id_node2. IsTetra becomes true if id_node1 and id_node2 belong to the edge of a tetrahedron.
91 bool checkForDestroyedVolumes( vtkIdType id_node1
, vtkIdType id_node2
, int& N_common_points
);