1 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
3 // + This file is part of enGrid. +
5 // + Copyright 2008-2014 enGits GmbH +
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. +
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. +
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/>. +
20 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
22 #ifndef gridsmoother_H
23 #define gridsmoother_H
27 #include "surfaceoperation.h"
29 #include <vtkCellLocator.h>
32 class GridSmoother
: public SurfaceOperation
42 private: // attributes
44 QVector
<bool> m_NodeMarked
;
45 QVector
<bool> m_SurfNode
;
47 QList
<rule_t
> m_Rules
;
49 QVector
<vec3_t
> m_GeoNormal
;
51 protected: // attributes
55 int m_NumBoundaryCorrections
;
57 int m_NumNormalRelaxations
;
58 int m_NumHeightRelaxations
;
62 double m_AbsoluteHeight
;
63 double m_RelativeHeight
;
66 double m_MaxHeightInGaps
;
67 double m_DesiredStretching
;
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
;
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
);
90 void computeNormals();
91 void relaxNormalVectors();
92 void correctNormalVectors();
93 void computeDesiredHeights();
94 void computeHeights();
96 void simpleNodeMovement(int i_nodes
);
98 bool faceFine(vtkIdType id_face
, double scale
);
100 void writeDebugFile(QString file_name
);
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
;