for Doxygen
[engrid.git] / gridsmoother.h
blob83e9f37844627d99065e974a3975e85b93fb41ec
1 //
2 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
3 // + +
4 // + This file is part of enGrid. +
5 // + +
6 // + Copyright 2008,2009 Oliver Gloth +
7 // + +
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. +
12 // + +
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. +
17 // + +
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/>. +
20 // + +
21 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
26 // This file is part of enGrid.
27 //
28 // enGrid is free software: you can redistribute it and/or modify
29 // it under the terms of the GNU General Public License as published by
30 // the Free Software Foundation, either version 3 of the License, or
31 // (at your option) any later version.
32 //
33 // enGrid is distributed in the hope that it will be useful,
34 // but WITHOUT ANY WARRANTY; without even the implied warranty of
35 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
36 // GNU General Public License for more details.
37 //
38 // You should have received a copy of the GNU General Public License
39 // along with Foobar. If not, see <http://www.gnu.org/licenses/>.
41 #ifndef gridsmoother_H
42 #define gridsmoother_H
44 class GridSmoother;
46 #include "operation.h"
47 #include "optimisation.h"
49 #include <vtkCellLocator.h>
51 class GridSmoother : public Operation, public Optimisation
54 private: // attributes
56 bool smooth_prisms;
57 QVector<bool> node_marked;
58 int N_marked_nodes;
59 bool dbg;
61 protected: // attributes
63 int N_iterations;
64 int N_relaxations;
65 int N_boundary_corrections;
66 int N_smooth_layers;
67 int N_search;
68 double relax;
69 double L_search;
70 double F_old;
71 double F_new;
73 double w_tet;
74 double w_tet_save;
75 double w_h;
76 double w_par;
77 double w_n;
78 double w_A;
79 double w_skew;
80 double w_orth;
81 double w_sharp1;
82 double e_sharp1;
83 double w_sharp2;
84 double e_sharp2;
85 double H;
87 struct stencil_node_t {
88 vec3_t x;
89 double C;
91 double V0;
92 double L0;
93 double sum_C;
94 int i_nodes_opt;
95 QList<stencil_node_t> stencil;
97 protected: // methods
99 virtual void operate();
100 virtual double func(vec3_t x);
102 double errThickness(double x);
104 bool setNewPosition(vtkIdType id_node, vec3_t x_new);
105 void resetStencil();
106 void addToStencil(double C, vec3_t x);
107 void correctDx(int i_nodes, vec3_t &Dx);
108 bool moveNode(int i_nodes, vec3_t &Dx);
109 void markNodes();
110 void setPrismWeighting() { w_tet_save = w_tet; w_tet = 0; };
111 void setAllWeighting() { w_tet = w_tet_save; };
113 public: // methods
115 GridSmoother();
116 void setNumIterations (int N) { N_iterations = N; };
117 void setNumRelaxations (int N) { N_relaxations = N; };
118 void setNumBoundaryCorrections(int N) { N_boundary_corrections = N; };
119 void setNumSmoothLayers (int N) { N_smooth_layers = N; };
121 void setRelaxationFactor(double v) { relax = v; };
123 void prismsOn() { smooth_prisms = true; };
124 void prismsOff() { smooth_prisms = false; };
126 double funcOld() { return F_old; };
127 double funcNew() { return F_new; };
128 double improvement();
130 void setWSharp1(double w) { w_sharp1 = w; };
131 void setWSharp2(double w) { w_sharp2 = w; };
136 typedef GridSmoother SmoothVolumeGrid;
138 #endif