possibility to use old and new surface projection strategy
[engrid.git] / src / libengrid / surfaceoperation.h
blobdb2ab53ad055167e45a3d0b5b5f415ec051d0a46
1 //
2 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
3 // + +
4 // + This file is part of enGrid. +
5 // + +
6 // + Copyright 2008-2012 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 SURFACEOPERATION_H
24 #define SURFACEOPERATION_H
26 #include "operation.h"
28 //==============================================
30 /// Special structure for working on two (or more) linked cells
31 struct stencil_t
33 QVector<vtkIdType> id_cell;
34 QVector<vtkIdType> id_node;
35 QVector<vtkIdType> type_cell;
36 vtkIdType p1, p2;
37 bool sameBC; ///< do all cells have the same BCs?
40 /// Prints out stencil information
41 ostream& operator<<( ostream &out, stencil_t S );
43 //==============================================
45 class SurfaceOperation : public Operation
48 private:
50 /** Vector used to store the "Potential Snap Points" of each point,
51 * i.e. the neighbour points belonging to the same edge (boundary or feature) in case of edge points,
52 * all neighbour points in case of simple points and the points belonging to edges in case of fixed points */
53 QVector < QVector <vtkIdType> > m_PotentialSnapPoints;
55 void updatePotentialSnapPoints();
57 protected: // attributes
59 double m_FeatureAngle;
60 double m_EdgeAngle;
61 bool m_UniformSnapPoints;
62 bool m_StrictFeatureSnap;
63 bool m_BCodeFeatureDefinition;
66 QVector<vec3_t> m_NodeNormal; ///< node normal vectors
67 QVector <VertexMeshDensity> m_VMDvector;
69 double m_StretchingFactor;
72 protected: // methods
74 void computeNormals();
75 bool isConvexNode(vtkIdType id_node);
76 char geometricNodeType(vtkIdType id_node);
77 double normalIrregularity(vtkIdType id_node);
78 void readVMD();
79 void updateNodeInfo();
82 public:
84 SurfaceOperation();
85 virtual void operate();
87 QVector <vtkIdType> getPotentialSnapPoints( vtkIdType id_node ); ///< Returns a QVector containing neighbour points to which the point id_node can snap.
89 int UpdateCurrentMeshDensity();
92 void setFeatureAngle(double FA) { m_FeatureAngle = FA; }
93 void setEdgeAngle(double EA) { m_EdgeAngle = EA; }
95 void setBCodesFeatureDefinition(bool flag) { m_BCodeFeatureDefinition = flag; }
97 double currentVertexAvgDist(vtkIdType id_node); ///< Returns the average distance of id_node to its neighbours
98 double CurrentMeshDensity( vtkIdType id_node ); ///< Returns 1/CurrentVertexAvgDist(id_node)
99 char getNodeType(vtkIdType a_node, bool fix_unselected = true); ///< Returns the node type
102 * Get the type of a given edge based on the topology.
103 * @param id_node1 first node of the edge
104 * @param id_node2 second node of the edge
105 * @param fix_unselected fix all edges which belong to unselected boundary codes
106 * @return the type of the edge
108 char getEdgeType(vtkIdType id_node1, vtkIdType od_node2, bool fix_unselected);
110 /// passes a vector containing the cells surrounding edge [id_node1,id_node2] by reference and returns its size
111 int getEdgeCells( vtkIdType id_node1, vtkIdType id_node2, QVector <vtkIdType> &EdgeCells );
113 /// passes a set containing the cells surrounding edge [id_node1,id_node2] by reference and returns its size
114 int getEdgeCells( vtkIdType id_node1, vtkIdType id_node2, QSet <vtkIdType> &EdgeCells );
116 /// Get VertexMeshDensity object
117 VertexMeshDensity getVMD(vtkIdType id_node);
119 /// returns the stencil containing id_cell1 and the neighbour cell on side j1 of id_cell1
120 stencil_t getStencil(vtkIdType id_cell1, int j1);
122 /// desired edge length for id_node
123 double desiredEdgeLength(vtkIdType id_node);
125 /// mean desired edge length for id_cell
126 double meanDesiredEdgeLength(vtkIdType id_cell);
128 bool isCell(vtkIdType id_node1, vtkIdType id_node2, vtkIdType id_node3);
130 void setStretchingFactor(double sf) { m_StretchingFactor = sf; }
132 double getSurfaceDeviation(vtkIdType id_node);
134 bool isFeatureNode(vtkIdType id_node);
138 #endif