deactivated deprecated start_engrid copy
[engrid.git] / src / gridsmoother.h
blob183a2dddbe861edec67ae654cac2840ce3d4fab0
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 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
24 #ifndef gridsmoother_H
25 #define gridsmoother_H
27 class GridSmoother;
29 #include "operation.h"
30 #include "optimisation.h"
32 #include <vtkCellLocator.h>
33 #include <QSettings>
35 class GridSmoother : public Operation, public Optimisation
38 private: // attributes
40 bool m_SmoothPrisms;
41 QVector<bool> m_NodeMarked;
42 int m_NumMarkedNodes;
44 protected: // attributes
46 int m_NumIterations;
47 int m_NumRelaxations;
48 int m_NumBoundaryCorrections;
49 int m_NumSearch;
51 double m_LSearch;
52 double m_FOld;
53 double m_FNew;
54 double m_FMaxOld;
55 double m_FMaxNew;
57 double m_WTet;
58 double m_WTetSave;
59 double m_WH;
60 double m_WPar;
61 double m_WN;
62 double m_WA;
63 double m_WSkew;
64 double m_WOrth;
65 double m_WSharp1;
66 double m_ESharp1;
67 double m_WSharp2;
68 double m_ESharp2;
69 double m_H;
71 QVector<vtkIdType> m_FootToField;
72 QVector<bool> m_IsSharpNode;
73 QVector<bool> m_IsTripleNode;
74 MeshPartition m_BPart;
76 double m_RelativeHeight;
77 double m_CritAngle;
79 bool m_SimpleOperation;
81 struct stencil_node_t {
82 vec3_t x;
83 double C;
85 double m_V0;
86 double m_L0;
87 double m_SumC;
88 int m_INodesOpt;
90 QList<stencil_node_t> m_Stencil;
91 QVector<vtkIdType> m_IdFoot;
92 QVector<double> m_L;
93 QVector<vec3_t> m_NodeNormal;
95 protected: // methods
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);
103 void resetStencil();
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);
107 void markNodes();
108 void setPrismWeighting() { m_WTetSave = m_WTet; m_WTet = 0; };
109 void setAllWeighting() { m_WTet = m_WTetSave; };
110 void computeNormals();
111 void computeFeet();
112 void simpleNodeMovement(int i_nodes);
114 void operateOptimisation();
115 void operateSimple();
117 public: // methods
119 GridSmoother();
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;
137 #endif