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> node_marked
;
45 protected: // attributes
49 int N_boundary_corrections
;
72 struct stencil_node_t
{
80 QList
<stencil_node_t
> stencil
;
84 virtual void operate();
85 virtual double func(vec3_t x
);
87 double errThickness(double x
);
89 bool setNewPosition(vtkIdType id_node
, vec3_t x_new
);
91 void addToStencil(double C
, vec3_t x
);
92 void correctDx(int i_nodes
, vec3_t
&Dx
);
93 bool moveNode(int i_nodes
, vec3_t
&Dx
);
95 void setPrismWeighting() { w_tet_save
= w_tet
; w_tet
= 0; };
96 void setAllWeighting() { w_tet
= w_tet_save
; };
101 void setNumIterations (int N
) { N_iterations
= N
; };
102 void setNumRelaxations (int N
) { N_relaxations
= N
; };
103 void setNumBoundaryCorrections(int N
) { N_boundary_corrections
= N
; };
105 void prismsOn() { smooth_prisms
= true; };
106 void prismsOff() { smooth_prisms
= false; };
108 double improvement();
113 typedef GridSmoother SmoothVolumeGrid
;