replaced abort() with EG_BUG
[engrid.git] / src / removepoints.h
blob5c108c4803c237b09a7be54a4232903180332c57
1 //
2 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
3 // + +
4 // + This file is part of enGrid. +
5 // + +
6 // + Copyright 2008,2009 Oliver Gloth +
7 // + +
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. +
12 // + +
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. +
17 // + +
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/>. +
20 // + +
21 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
23 #ifndef REMOVEPOINTS_H
24 #define REMOVEPOINTS_H
26 #include "surfaceoperation.h"
28 #include <vtkUnstructuredGrid.h>
29 #include <vtkPolyData.h>
30 #include <vtkCharArray.h>
32 #include <QVector>
33 #include <QString>
34 #include <QTextStream>
35 #include <QTime>
37 class RemovePoints : public SurfaceOperation
40 protected:
42 int m_NumRemoved;
43 double m_Threshold;
44 bool m_ProtectFeatureEdges;
45 bool m_PerformGeometricChecks;
47 QVector<bool> m_IsFeatureNode;
49 public:
51 RemovePoints();
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; }
61 protected:
63 void markFeatureEdges();
65 /// deletes set of points DeadNodes
66 bool DeleteSetOfPoints(const QVector<vtkIdType>& deadnode_vector,
67 const QVector<vtkIdType>& snappoint_vector,
68 const QVector<vtkIdType>& all_deadcells,
69 const QVector<vtkIdType>& all_mutatedcells,
70 int& num_newpoints,
71 int& num_newcells);
73 /// returns a valid potential snappoint (checks for flipped cells, etc). If none is found, returns -1.
74 vtkIdType FindSnapPoint( vtkIdType DeadNode,
75 QVector<vtkIdType>& DeadCells,
76 QVector<vtkIdType>& MutatedCells,
77 int& N_newpoints, int & N_newcells,
78 QVector<bool>& marked_nodes);
80 /// returns true if moving id_node to position P leads to flipped cells
81 bool FlippedCells( vtkIdType id_node, vec3_t P );
83 /// 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.
84 int NumberOfCommonPoints( vtkIdType id_node1, vtkIdType id_node2, bool& IsTetra );
88 #endif