finally found and fixed adjacent BC hole problem
[engrid-github.git] / src / libengrid / boundarylayeroperation.h
blobd169fdacf08ac780c6ad0ca2cc20f380bd57004b
1 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 // + +
3 // + This file is part of enGrid. +
4 // + +
5 // + Copyright 2008-2014 enGits GmbH +
6 // + +
7 // + enGrid is free software: you can redistribute it and/or modify +
8 // + it under the terms of the GNU General Public License as published by +
9 // + the Free Software Foundation, either version 3 of the License, or +
10 // + (at your option) any later version. +
11 // + +
12 // + enGrid is distributed in the hope that it will be useful, +
13 // + but WITHOUT ANY WARRANTY; without even the implied warranty of +
14 // + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +
15 // + GNU General Public License for more details. +
16 // + +
17 // + You should have received a copy of the GNU General Public License +
18 // + along with enGrid. If not, see <http://www.gnu.org/licenses/>. +
19 // + +
20 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
22 #ifndef BOUNDARYLAYEROPERATION_H
23 #define BOUNDARYLAYEROPERATION_H
25 #include "surfaceoperation.h"
26 #include "edgelengthsourcemanager.h"
27 #include "cadinterface.h"
29 class BoundaryLayerOperation;
32 class BoundaryLayerOperation : public SurfaceOperation
35 protected: // data types
37 enum nodetype_t { NormalNode, EdgeNode, CornerNode };
40 protected: // attributes
42 QVector<vec3_t> m_BoundaryLayerVectors;
43 QVector<int> m_BoundaryLayerCodes;
44 QVector<bool> m_BoundaryLayerNode;
45 QVector<nodetype_t> m_NodeTypes;
46 QVector<QSet<vtkIdType> > m_SnapPoints;
47 QVector<double> m_Height;
48 QSet<int> m_LayerAdjacentBoundaryCodes;
49 double m_FeatureAngle;
50 double m_StretchingRatio;
51 double m_FarfieldRatio;
52 double m_RadarAngle;
53 double m_MaxHeightInGaps;
54 double m_FaceSizeLowerLimit;
55 double m_FaceSizeUpperLimit;
56 double m_FaceAngleLimit;
57 bool m_UseGrouping;
58 double m_GroupingAngle;
59 int m_NumBoundaryLayerVectorRelaxations;
60 int m_NumBoundaryLayerHeightRelaxations;
61 double m_ShellPassBand;
62 int m_NumLayers;
63 EdgeLengthSourceManager m_ELSManagerBLayer;
64 EdgeLengthSourceManager m_ELSManagerSurface;
65 vtkUnstructuredGrid* m_ShellGrid;
68 protected: // methods
70 void readSettings();
71 void correctBoundaryLayerVectors();
72 void computeBoundaryLayerVectors();
73 void addToSnapPoints(vtkIdType id_node, vtkIdType id_snap);
74 void computeNodeTypes();
75 void smoothBoundaryLayerVectors(int n_iter, double w_iso = 1.0, double w_dir = 0.0, QVector<bool> *node_fixed = NULL);
76 void writeBoundaryLayerVectors(QString file_name, int counter = -1);
77 void computeDesiredHeights();
78 bool faceFine(vtkIdType id_face, double scale);
79 void computeHeights();
81 void createSmoothShell();
82 void fixBoundaryLayerVectors(const QList<vtkIdType> &bad_cells, int num_smooth_iter);
83 double largestAngle(vtkIdType id_node1, vtkIdType id_node2);
84 void smoothUsingBLVectors();
85 void writeWallGrid(QString file_name, int counter = -1);
87 void laplacianIntersectSmoother(const QVector<bool>& on_boundary);
88 void weightedSmoother(const QVector<bool>& on_boundary);
89 void angleSmoother(const QVector<bool>& on_boundary, const QVector<bool>& is_convex, QVector<vec3_t>& grid_pnts);
90 void intersectSmoother(const QVector<bool>& on_boundary, const QVector<bool>& is_convex, QVector<vec3_t>& grid_pnts);
91 void laplacianSmoother();
92 void pushOut(const QVector<bool>& on_boundary, const QVector<bool>& is_convex);
93 void limitHeights(double safety_factor);
94 bool checkVectorForNode(vec3_t v, vtkIdType id_node);
95 vec3_t snapToShell(CadInterface *cad, vtkIdType id_node);
96 void snapAllVectorsToShell(vtkUnstructuredGrid* shell_grid);
97 void newHeightFromShellIntersect(double relax);
98 void limitSizeAndAngleErrors();
99 bool swapRequired(stencil_t stencil, CadInterface *cad, double threshold_angle);
100 void swapEdgesToMatchShell(vtkUnstructuredGrid *shell_grid, double threshold_angle);
103 public: // methods
105 BoundaryLayerOperation();
106 ~BoundaryLayerOperation();
108 QSet<int> getLayerAdjacentBoundaryCodes();
114 #endif // BOUNDARYLAYEROPERATION_H