limited volume meshing to boundary layer only
[engrid-github.git] / src / libengrid / gridsmoother.h
blobf7b2645d8c9a91638a41fb16289fcc571fdf93fd
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 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
22 #ifndef gridsmoother_H
23 #define gridsmoother_H
25 class GridSmoother;
27 #include "surfaceoperation.h"
29 #include <vtkCellLocator.h>
30 #include <QSettings>
32 class GridSmoother : public SurfaceOperation
35 private: // types
37 struct rule_t {
38 QSet<int> bcs;
39 double h;
42 private: // attributes
44 QVector<bool> m_NodeMarked;
45 QVector<bool> m_SurfNode;
46 int m_NumMarkedNodes;
47 QList<rule_t> m_Rules;
48 bool m_FirstCall;
49 QVector<vec3_t> m_GeoNormal;
51 protected: // attributes
53 int m_NumIterations;
54 int m_NumRelaxations;
55 int m_NumBoundaryCorrections;
56 int m_NumSearch;
57 int m_NumNormalRelaxations;
58 int m_NumHeightRelaxations;
59 int m_NumLayers;
61 double m_Blending;
62 double m_AbsoluteHeight;
63 double m_RelativeHeight;
64 double m_CritAngle;
65 double m_RadarAngle;
66 double m_MaxHeightInGaps;
67 double m_DesiredStretching;
68 double m_FarRatio;
69 double m_FaceSizeLowerLimit;
70 double m_FaceSizeUpperLimit;
71 double m_FaceAngleLimit;
73 bool m_StrictPrismChecking;
74 bool m_CollisionDetected;
76 QVector<vtkIdType> m_FootToField;
78 QVector<vtkIdType> m_IdFoot;
79 QVector<double> m_Height;
80 QSet<int> m_LayerAdjacentBoundaryCodes;
82 protected: // methods
84 virtual void operate();
86 bool setNewPosition(vtkIdType id_node, vec3_t x_new);
87 void correctDx(int i_nodes, vec3_t &Dx);
88 bool moveNode(int i_nodes, vec3_t &Dx);
89 void markNodes();
90 void computeNormals();
91 void relaxNormalVectors();
92 void correctNormalVectors();
93 void computeDesiredHeights();
94 void computeHeights();
95 void computeFeet();
96 void simpleNodeMovement(int i_nodes);
97 void getRules();
98 bool faceFine(vtkIdType id_face, double scale);
100 void writeDebugFile(QString file_name);
102 public: // methods
104 GridSmoother();
105 void setNumIterations (int N) { m_NumIterations = N; }
106 void setNumRelaxations (int N) { m_NumRelaxations = N; }
107 void setNumHeightRelaxations (int N) { m_NumHeightRelaxations = N; }
108 void setNumNormalRelaxations (int N) { m_NumNormalRelaxations = N; }
109 void setNumBoundaryCorrections(int N) { m_NumBoundaryCorrections = N; }
110 void setRelativeHeight (double h) { m_RelativeHeight = h; }
111 void setAbsoluteHeight (double h) { m_AbsoluteHeight = h; }
112 void setBlending (double b) { m_Blending = b; }
113 void setDesiredStretching (double s) { m_DesiredStretching = s; }
114 void setFarRatio (double r) { m_FarRatio = r; }
115 void forceNormalCalculation () { m_FirstCall = true; }
117 void setLayerAdjacentBoundaryCodes(const QSet<int> &abcs) { m_LayerAdjacentBoundaryCodes = abcs; }
122 typedef GridSmoother SmoothVolumeGrid;
124 #endif