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
;
42 QVector
<bool> m_CriticalTetra
;
45 protected: // attributes
49 int m_NumBoundaryCorrections
;
57 double m_ReductionFactor
;
58 double m_PostSmoothingStrength
;
75 bool m_StrictPrismChecking
;
77 QVector
<vtkIdType
> m_FootToField
;
78 QVector
<bool> m_IsSharpNode
;
79 QVector
<bool> m_IsTripleNode
;
80 MeshPartition m_BPart
;
82 double m_RelativeHeight
;
85 bool m_SimpleOperation
;
88 struct stencil_node_t
{
97 QList
<stencil_node_t
> m_Stencil
;
98 QVector
<vtkIdType
> m_IdFoot
;
100 QVector
<vec3_t
> m_NodeNormal
;
102 protected: // methods
104 virtual void operate();
105 virtual double func(vec3_t x
);
107 double errThickness(double x
);
109 bool setNewPosition(vtkIdType id_node
, vec3_t x_new
);
111 void addToStencil(double C
, vec3_t x
);
112 void correctDx(int i_nodes
, vec3_t
&Dx
);
113 bool moveNode(int i_nodes
, vec3_t
&Dx
);
115 void findCriticalTetras();
116 void setPrismWeighting() { m_WTetSave
= m_WTet
; m_WTet
= 0; };
117 void setAllWeighting() { m_WTet
= m_WTetSave
; };
118 void computeNormals();
120 void simpleNodeMovement(int i_nodes
);
122 void operateOptimisation();
123 void operateSimple();
124 void operatePostSmoothing();
129 void setNumIterations (int N
) { m_NumIterations
= N
; };
130 void setNumRelaxations (int N
) { m_NumRelaxations
= N
; };
131 void setNumBoundaryCorrections(int N
) { m_NumBoundaryCorrections
= N
; };
132 void setRelativeHeight (double h
) { m_RelativeHeight
= h
; }
134 void prismsOn() { m_SmoothPrisms
= true; };
135 void prismsOff() { m_SmoothPrisms
= false; };
136 void simpleOn() { m_SimpleOperation
= true; }
137 void simpleOff() { m_SimpleOperation
= false; }
138 void postOn() { simpleOff(); m_PostOperation
= true; }
139 void postOff() { m_PostOperation
= false; }
141 double improvement();
146 typedef GridSmoother SmoothVolumeGrid
;