feature magic is an amplification factor for edge sharpening (not corners)
[engrid.git] / src / libengrid / laplacesmoother.h
blob208317e08341bbfe89ec974063177b079e3251cc
1 //
2 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
3 // + +
4 // + This file is part of enGrid. +
5 // + +
6 // + Copyright 2008-2013 enGits GmbH +
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 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
22 //
23 #ifndef LAPLACESMOOTHER_H
24 #define LAPLACESMOOTHER_H
26 #include "surfaceoperation.h"
27 #include "surfacenodemovementcheck.h"
28 #include "cadinterface.h"
30 class LaplaceSmoother : public SurfaceOperation
33 private:
35 QSet<int> m_BCs;
36 int m_NumberOfIterations;
37 bool m_UseProjection;
38 bool m_UseNormalCorrection;
39 double m_UnderRelaxation;
40 bool m_Success;
41 int m_ProjectionIterations;
42 double m_FeatureMagic;
43 double m_Limit;
45 QVector<QVector<int> > m_NodeToBc;
47 bool m_CorrectCurvature;
48 bool m_NoCheck;
50 QSet<vtkIdType> m_AllowedCellTypes;
51 QVector<bool> m_Fixed;
53 SurfaceNodeMovementCheck m_Check;
56 private: // methods
58 bool setNewPosition(vtkIdType id_node, vec3_t x_new);
59 bool moveNode(vtkIdType id_node, vec3_t &Dx);
60 void featureCorrection(vtkIdType id_node, CadInterface* cad_interface, vec3_t &x_new);
63 public:
65 LaplaceSmoother(); ///< default constructor
66 virtual void operate(); ///< Run operation
67 void setNumberOfIterations(int N) { m_NumberOfIterations = N;} ///< Set number of iterations
68 void setProjectionOn() { m_UseProjection = true; }
69 void setProjectionOff() { m_UseProjection = false; }
70 void setNormalCorrectionOn() { m_UseNormalCorrection = true; }
71 void setNormalCorrectionOff() { m_UseNormalCorrection = false; }
72 bool succeeded() { return m_Success; }
73 void fixNodes(const QVector<bool> &fixnodes);
75 public:
77 void setCorrectCurvature(bool b) { m_CorrectCurvature = b; }
78 bool getCorrectCurvature() { return m_CorrectCurvature; }
79 void setNoCheck(bool b) { m_NoCheck = b; }
80 bool getNoCheck() { return m_NoCheck; }
81 void setProjectionIterations(int n) { m_ProjectionIterations = n; }
85 #endif