2 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
4 // + This file is part of enGrid. +
6 // + Copyright 2008,2009 Oliver Gloth +
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 "operation.h"
30 #include "optimisation.h"
32 #include <vtkCellLocator.h>
35 class GridSmoother
: public Operation
, public Optimisation
38 private: // attributes
41 QVector
<bool> m_NodeMarked
;
44 protected: // attributes
48 int m_NumBoundaryCorrections
;
71 QVector
<vtkIdType
> m_FootToField
;
72 QVector
<bool> m_IsSharpNode
;
73 QVector
<bool> m_IsTripleNode
;
74 MeshPartition m_BPart
;
76 double m_RelativeHeight
;
79 bool m_SimpleOperation
;
81 struct stencil_node_t
{
90 QList
<stencil_node_t
> m_Stencil
;
91 QVector
<vtkIdType
> m_IdFoot
;
93 QVector
<vec3_t
> m_NodeNormal
;
97 virtual void operate();
98 virtual double func(vec3_t x
);
100 double errThickness(double x
);
102 bool setNewPosition(vtkIdType id_node
, vec3_t x_new
);
104 void addToStencil(double C
, vec3_t x
);
105 void correctDx(int i_nodes
, vec3_t
&Dx
);
106 bool moveNode(int i_nodes
, vec3_t
&Dx
);
108 void setPrismWeighting() { m_WTetSave
= m_WTet
; m_WTet
= 0; };
109 void setAllWeighting() { m_WTet
= m_WTetSave
; };
110 void computeNormals();
112 void simpleNodeMovement(int i_nodes
);
114 void operateOptimisation();
115 void operateSimple();
120 void setNumIterations (int N
) { m_NumIterations
= N
; };
121 void setNumRelaxations (int N
) { m_NumRelaxations
= N
; };
122 void setNumBoundaryCorrections(int N
) { m_NumBoundaryCorrections
= N
; };
123 void setRelativeHeight (double h
) { m_RelativeHeight
= h
; }
125 void prismsOn() { m_SmoothPrisms
= true; };
126 void prismsOff() { m_SmoothPrisms
= false; };
127 void simpleOn() { m_SimpleOperation
= true; }
128 void simpleOff() { m_SimpleOperation
= false; }
130 double improvement();
135 typedef GridSmoother SmoothVolumeGrid
;