updated to modern VTK
[engrid-github.git] / src / libengrid / surfacealgorithm.h
blob78a01119ac7c770f16a6b88def99c63601c45b93
1 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 // + +
3 // + This file is part of enGrid. +
4 // + +
5 // + Copyright 2008-2014 enGits GmbH +
6 // + +
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. +
11 // + +
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. +
16 // + +
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/>. +
19 // + +
20 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
21 #ifndef SURFACEALGORITHM_H
22 #define SURFACEALGORITHM_H
24 #include <vtkUnstructuredGrid.h>
25 #include <vtkPolyData.h>
26 #include <vtkSignedCharArray.h>
28 #include <QSet>
29 #include <QVector>
30 #include <QString>
31 #include <QTextStream>
32 #include <QTime>
34 #include "surfaceoperation.h"
35 #include "vertexmeshdensity.h"
36 #include "geometrytools.h"
38 #include <cmath>
39 #include <iostream>
41 class SurfaceAlgorithm : public SurfaceOperation
44 protected: // attributes
46 int m_NumMaxIter;
47 int m_NumSmoothSteps;
48 double m_MaxEdgeLength;
49 double m_MinEdgeLength;
50 double m_NodesPerQuarterCircle;
51 double m_FeatureResolution2D;
52 double m_FeatureResolution3D;
53 bool m_RespectFeatureEdgesForDeleteNodes;
54 double m_FeatureAngleForDeleteNodes;
55 bool m_PerformGeometricTests;
56 bool m_UseProjectionForSmoothing;
57 bool m_UseNormalCorrectionForSmoothing;
58 bool m_AllowFeatureEdgeSwapping;
59 double m_GrowthFactor;
60 bool m_SmoothSuccess;
61 int m_NumDelaunaySweeps;
62 bool m_AllowSmallAreaSwapping;
63 bool m_InsertNodes;
64 bool m_DeleteNodes;
67 protected: // methods
69 void readSettings();
72 protected: // methods
74 void prepare();
75 void swap(double delaunay_threshold = 1.0, bool verbose = false);
76 void smooth(int N_iter, bool correct_curvature = false);
77 int insertNodes();
78 int deleteNodes();
79 void computeMeshDensity();
81 public:
83 SurfaceAlgorithm();
85 void setVertexMeshDensityVector(QVector <VertexMeshDensity> a_VMDvector) { m_VMDvector = a_VMDvector; }
86 void setMaxEdgeLength(double l) { m_MaxEdgeLength = l; }
87 void setNodesPerQuarterCircle(double N) { m_NodesPerQuarterCircle = N; }
88 void setCellGrowthFactor(double cgf) { m_GrowthFactor = cgf; }
89 void setMaxNumIterations(int N) { m_NumMaxIter = N; }
90 void setNumSmoothSteps(int N) { m_NumSmoothSteps = N; }
91 void setNumDelaunaySweeps(int N) { m_NumDelaunaySweeps = N; }
92 void setDeleteNodesOn() { m_DeleteNodes = true; }
93 void setDeleteNodesOff() { m_DeleteNodes = false; }
94 void setInsertNodesOn() { m_InsertNodes = true; }
95 void setInsertNodesOff() { m_InsertNodes = false; }
96 void setDeleteNodes(bool s) { m_DeleteNodes = s; }
97 void setInsertNodes(bool s) { m_InsertNodes = s; }
101 #endif // SURFACEALGORITHM_H