2 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
4 // + This file is part of enGrid. +
6 // + Copyright 2008-2013 enGits GmbH +
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. +
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. +
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/>. +
21 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
24 #ifndef gridsmoother_H
25 #define gridsmoother_H
29 #include "surfaceoperation.h"
31 #include <vtkCellLocator.h>
34 class GridSmoother
: public SurfaceOperation
44 private: // attributes
46 QVector
<bool> m_NodeMarked
;
47 QVector
<bool> m_SurfNode
;
49 QList
<rule_t
> m_Rules
;
51 QVector
<vec3_t
> m_GeoNormal
;
53 protected: // attributes
57 int m_NumBoundaryCorrections
;
59 int m_NumNormalRelaxations
;
60 int m_NumHeightRelaxations
;
64 double m_AbsoluteHeight
;
65 double m_RelativeHeight
;
68 double m_MaxHeightInGaps
;
69 double m_DesiredStretching
;
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
;
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
);
92 void computeNormals();
93 void relaxNormalVectors();
94 void correctNormalVectors();
95 void computeDesiredHeights();
96 void computeHeights();
98 void simpleNodeMovement(int i_nodes
);
100 bool faceFine(vtkIdType id_face
, double scale
);
102 void writeDebugFile(QString file_name
);
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
;