1 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
3 // + This file is part of enGrid. +
5 // + Copyright 2008-2014 enGits GmbH +
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. +
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. +
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/>. +
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
;
53 double m_MaxHeightInGaps
;
54 double m_FaceSizeLowerLimit
;
55 double m_FaceSizeUpperLimit
;
56 double m_FaceAngleLimit
;
58 double m_GroupingAngle
;
59 int m_NumBoundaryLayerVectorRelaxations
;
60 int m_NumBoundaryLayerHeightRelaxations
;
61 double m_ShellPassBand
;
63 EdgeLengthSourceManager m_ELSManagerBLayer
;
64 EdgeLengthSourceManager m_ELSManagerSurface
;
70 void correctBoundaryLayerVectors();
71 void computeBoundaryLayerVectors();
72 void addToSnapPoints(vtkIdType id_node
, vtkIdType id_snap
);
73 void computeNodeTypes();
74 void smoothBoundaryLayerVectors(int n_iter
, double w_iso
= 1.0, double w_dir
= 0.0, QVector
<bool> *node_fixed
= NULL
);
75 void writeBoundaryLayerVectors(QString file_name
, int counter
= -1);
76 void computeDesiredHeights();
77 bool faceFine(vtkIdType id_face
, double scale
);
78 void computeHeights();
80 void createSmoothShell(vtkUnstructuredGrid
*shell_grid
, int num_iter
);
81 void fixBoundaryLayerVectors(const QList
<vtkIdType
> &bad_cells
, int num_smooth_iter
);
82 double largestAngle(vtkIdType id_node1
, vtkIdType id_node2
);
83 void smoothUsingBLVectors();
84 void writeWallGrid(QString file_name
, int counter
= -1);
86 void laplacianIntersectSmoother(const QVector
<bool>& on_boundary
);
87 void weightedSmoother(const QVector
<bool>& on_boundary
);
88 void angleSmoother(const QVector
<bool>& on_boundary
, const QVector
<bool>& is_convex
, QVector
<vec3_t
>& grid_pnts
);
89 void intersectSmoother(const QVector
<bool>& on_boundary
, const QVector
<bool>& is_convex
, QVector
<vec3_t
>& grid_pnts
);
90 void laplacianSmoother();
91 void pushOut(const QVector
<bool>& on_boundary
, const QVector
<bool>& is_convex
);
92 int limitHeights(double safety_factor
);
93 bool checkVectorForNode(vec3_t v
, vtkIdType id_node
);
94 vec3_t
snapToShell(CadInterface
*cad
, vtkIdType id_node
);
95 void snapAllVectorsToShell(vtkUnstructuredGrid
* shell_grid
);
96 void newHeightFromShellIntersect(vtkUnstructuredGrid
* shell_grid
, double relax
);
97 void limitSizeAndAngleErrors();
98 bool swapRequired(stencil_t stencil
, CadInterface
*cad
, double threshold_angle
);
99 void swapEdgesToMatchShell(vtkUnstructuredGrid
*shell_grid
, double threshold_angle
);
104 QSet
<int> getLayerAdjacentBoundaryCodes();
110 #endif // BOUNDARYLAYEROPERATION_H