simplified
[engrid-github.git] / src / libengrid / gridsmoother.h
blob0d8ac7b07a4c86a66c4a5fa9fb8208b1e71d90b4
1 //
2 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
3 // + +
4 // + This file is part of enGrid. +
5 // + +
6 // + Copyright 2008-2013 enGits GmbH +
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 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
22 //
24 #ifndef gridsmoother_H
25 #define gridsmoother_H
27 class GridSmoother;
29 #include "surfaceoperation.h"
31 #include <vtkCellLocator.h>
32 #include <QSettings>
34 class GridSmoother : public SurfaceOperation
37 private: // types
39 struct rule_t {
40 QSet<int> bcs;
41 double h;
44 private: // attributes
46 QVector<bool> m_NodeMarked;
47 QVector<bool> m_SurfNode;
48 int m_NumMarkedNodes;
49 QList<rule_t> m_Rules;
50 bool m_FirstCall;
51 QVector<vec3_t> m_GeoNormal;
53 protected: // attributes
55 int m_NumIterations;
56 int m_NumRelaxations;
57 int m_NumBoundaryCorrections;
58 int m_NumSearch;
59 int m_NumNormalRelaxations;
60 int m_NumHeightRelaxations;
61 int m_NumLayers;
63 double m_Blending;
64 double m_AbsoluteHeight;
65 double m_RelativeHeight;
66 double m_CritAngle;
67 double m_RadarAngle;
68 double m_MaxHeightInGaps;
69 double m_DesiredStretching;
70 double m_FarRatio;
71 double m_FaceSizeLowerLimit;
72 double m_FaceSizeUpperLimit;
73 double m_FaceAngleLimit;
75 bool m_StrictPrismChecking;
76 bool m_CollisionDetected;
78 QVector<vtkIdType> m_FootToField;
80 QVector<vtkIdType> m_IdFoot;
81 QVector<double> m_Height;
82 QSet<int> m_LayerAdjacentBoundaryCodes;
84 protected: // methods
86 virtual void operate();
88 bool setNewPosition(vtkIdType id_node, vec3_t x_new);
89 void correctDx(int i_nodes, vec3_t &Dx);
90 bool moveNode(int i_nodes, vec3_t &Dx);
91 void markNodes();
92 void computeNormals();
93 void relaxNormalVectors();
94 void correctNormalVectors();
95 void computeDesiredHeights();
96 void computeHeights();
97 void computeFeet();
98 void simpleNodeMovement(int i_nodes);
99 void getRules();
100 bool faceFine(vtkIdType id_face, double scale);
102 void writeDebugFile(QString file_name);
104 public: // methods
106 GridSmoother();
107 void setNumIterations (int N) { m_NumIterations = N; }
108 void setNumRelaxations (int N) { m_NumRelaxations = N; }
109 void setNumHeightRelaxations (int N) { m_NumHeightRelaxations = N; }
110 void setNumNormalRelaxations (int N) { m_NumNormalRelaxations = N; }
111 void setNumBoundaryCorrections(int N) { m_NumBoundaryCorrections = N; }
112 void setRelativeHeight (double h) { m_RelativeHeight = h; }
113 void setAbsoluteHeight (double h) { m_AbsoluteHeight = h; }
114 void setBlending (double b) { m_Blending = b; }
115 void setDesiredStretching (double s) { m_DesiredStretching = s; }
116 void setFarRatio (double r) { m_FarRatio = r; }
117 void forceNormalCalculation () { m_FirstCall = true; }
119 void setLayerAdjacentBoundaryCodes(const QSet<int> &abcs) { m_LayerAdjacentBoundaryCodes = abcs; }
124 typedef GridSmoother SmoothVolumeGrid;
126 #endif