limited volume meshing to boundary layer only
[engrid-github.git] / src / libengrid / surfaceoperation.h
blobebd55cf8d47e166cafa821b40d5d1e8a36b3480f
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 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
21 #ifndef SURFACEOPERATION_H
22 #define SURFACEOPERATION_H
24 #include "operation.h"
26 //==============================================
28 /// Special structure for working on two (or more) linked cells
29 struct stencil_t
31 QVector<vtkIdType> id_cell;
32 QVector<vtkIdType> id_node;
33 QVector<vtkIdType> type_cell;
34 vtkIdType p1, p2;
35 bool sameBC; ///< do all cells have the same BCs?
38 /// Prints out stencil information
39 ostream& operator<<( ostream &out, stencil_t S );
41 //==============================================
43 class SurfaceOperation : public Operation
46 private:
48 /** Vector used to store the "Potential Snap Points" of each point,
49 * i.e. the neighbour points belonging to the same edge (boundary or feature) in case of edge points,
50 * all neighbour points in case of simple points and the points belonging to edges in case of fixed points */
51 QVector < QVector <vtkIdType> > m_PotentialSnapPoints;
54 protected: // attributes
56 double m_FeatureAngle;
57 double m_EdgeAngle;
58 double m_FaceOrientationThreshold;
59 bool m_UniformSnapPoints;
60 bool m_StrictFeatureSnap;
63 QVector<vec3_t> m_NodeNormal; ///< node normal vectors
64 QVector <VertexMeshDensity> m_VMDvector;
66 double m_StretchingFactor;
69 protected: // methods
71 void computeNormals();
72 char geometricNodeType(vtkIdType id_node);
73 double normalIrregularity(vtkIdType id_node);
74 void readVMD();
75 void updateNodeInfo();
76 bool checkSnapPointPairForBcMatch(vtkIdType id_node1, vtkIdType id_node2);
77 void updatePotentialSnapPoints();
78 double edgeAngle(vtkIdType id_node1, vtkIdType id_node2);
81 public:
83 SurfaceOperation();
84 virtual void operate();
86 QVector <vtkIdType> getPotentialSnapPoints( vtkIdType id_node ); ///< Returns a QVector containing neighbour points to which the point id_node can snap.
88 int UpdateCurrentMeshDensity();
91 void setFeatureAngle(double FA) { m_FeatureAngle = FA; }
92 void setEdgeAngle(double EA) { m_EdgeAngle = EA; }
94 double currentVertexAvgDist(vtkIdType id_node); ///< Returns the average distance of id_node to its neighbours
95 double CurrentMeshDensity( vtkIdType id_node ); ///< Returns 1/CurrentVertexAvgDist(id_node)
96 char getNodeType(vtkIdType a_node, bool fix_unselected = true); ///< Returns the node type
98 /**
99 * Get the type of a given edge based on the topology.
100 * @param id_node1 first node of the edge
101 * @param id_node2 second node of the edge
102 * @param fix_unselected fix all edges which belong to unselected boundary codes
103 * @return the type of the edge
105 char getEdgeType(vtkIdType id_node1, vtkIdType od_node2, bool fix_unselected = false);
107 /// passes a vector containing the cells surrounding edge [id_node1,id_node2] by reference and returns its size
108 int getEdgeCells( vtkIdType id_node1, vtkIdType id_node2, QVector <vtkIdType> &EdgeCells );
110 /// passes a set containing the cells surrounding edge [id_node1,id_node2] by reference and returns its size
111 int getEdgeCells( vtkIdType id_node1, vtkIdType id_node2, QSet <vtkIdType> &EdgeCells );
113 /// Get VertexMeshDensity object
114 VertexMeshDensity getVMD(vtkIdType id_node);
116 /// returns the stencil containing id_cell1 and the neighbour cell on side j1 of id_cell1
117 stencil_t getStencil(vtkIdType id_cell1, int j1);
119 /// desired edge length for id_node
120 double desiredEdgeLength(vtkIdType id_node);
122 /// mean desired edge length for id_cell
123 double meanDesiredEdgeLength(vtkIdType id_cell);
125 bool isCell(vtkIdType id_node1, vtkIdType id_node2, vtkIdType id_node3);
127 void setStretchingFactor(double sf) { m_StretchingFactor = sf; }
129 double getSurfaceDeviation(vtkIdType id_node);
131 bool isFeatureNode(vtkIdType id_node);
135 #endif