rsvs3D  0.0.0
Codes for the c++ implementation of the 3D RSVS
meshprocessing.hpp
Go to the documentation of this file.
1 
7 //===============================================
8 // Include Guards
9 #ifndef MESHPROCESSING_H_INCLUDED
10 #define MESHPROCESSING_H_INCLUDED
11 
12 //===============================================
13 // Levels of debuging Guards
14 #ifdef DEBUGLVL2 // All Debugging calls
15 #define DEBUGLVL1
16 #define TEST_RANGE // deprecated
17 #define TEST_ARRAYSTRUCT
18 
19 #endif
20 
21 #ifdef DEBUGLVL1 // Debugging of new features.
22 #ifndef SAFE_ACCESS
23 #define SAFE_ACCESS
24 #endif
25 #endif
26 
27 //=================================
28 // forward declared dependencies
29 // class foo; //when you only need a pointer not the actual object
30 // and to avoid circular dependencies
31 
32 //=================================
33 // included dependencies
34 
35 #include <vector>
36 
37 #include "arraystructures.hpp"
38 #include "mesh.hpp"
39 #include "snake.hpp"
40 //
41 
42 //==================================
43 // Code
44 // NOTE: function in a class definition are IMPLICITELY INLINED
45 // ie replaced by their code at compile time
46 //
47 
48 void FlattenBoundaryFaces(mesh &meshin);
49 void TriangulateAllFaces(mesh &meshin);
50 std::vector<int> FindHolesInSnake(const snake &snakein, const HashedVector<int, int> &uncertainVert);
51 void PrepareSnakeForCFD(const snake &snakein, double distanceTol, mesh &meshgeom, std::vector<double> &holeCoords);
52 HashedVector<int, int> GroupCloseSnaxels(const snake &snakein, double distTol);
53 void TestVertClose(int vertIndIn, std::vector<bool> &isSnaxDone, const mesh &meshin, double distTol,
54  std::vector<int> &sameEdges);
55 HashedVector<int, int> GroupCloseVertices(const mesh &meshin, double distTol);
56 int FindVertexHole(int vertInd, const mesh &meshin, const std::vector<bool> &vertIn,
57  const HashedVector<int, int> &uncertainVert, std::vector<bool> &vertExplored);
58 double DomInter(double x, double y1, double y2);
59 mesh BuildDomain(const std::array<double, 3> &lowerB, const std::array<double, 3> &upperB, double tolInner = 0.0);
60 mesh BuildCutCellDomain(const std::array<double, 3> &outerLowerB, const std::array<double, 3> &outerUpperB,
61  const std::array<double, 3> &innerLowerB, const std::array<double, 3> &innerUpperB, int nSteps,
62  std::vector<int> &vertPerSubDomain);
63 double PseudoSurfaceAngle(const mesh &meshin, const std::array<int, 2> &surfInds);
64 std::vector<double> CalculateEdgeCurvature(const mesh &meshin);
65 std::vector<double> CalculateVertexCurvature(const mesh &meshin, int smoothingSteps);
66 std::vector<double> CalculateVertexMinEdgeLength(const mesh &meshin);
67 std::vector<double> CalculateVertexMaxEdgeLength(const mesh &meshin);
68 std::vector<double> CalculateVertexMeanEdgeLength(const mesh &meshin);
69 std::vector<double> CalculateEdgeLengths(const mesh &meshin);
70 std::vector<double> CoordInVolume(const mesh &meshin);
71 std::vector<double> VolumeCentroids(const mesh &meshin);
72 std::vector<double> VolumeInternalLayers(const mesh &meshin, int nLayers);
73 std::vector<double> SurfaceCentroids(const mesh &meshin);
74 std::vector<double> SurfaceInternalLayers(const mesh &meshin, int nLayers);
75 double CotanLaplacianWeight(const std::vector<double> &centre, const std::vector<double> &p_im1,
76  const std::vector<double> &p_i, const std::vector<double> &p_ip1, coordvec &temp1,
77  coordvec &temp2);
78 int VertexLaplacianVector(const mesh &meshin, const vert *vertsmooth, coordvec &lapVec, bool isOrdered = false);
79 coordvec VertexLaplacianVector(const mesh &meshin, int vertIndex);
80 std::array<double, 2> IntersectLineSphere(const coordvec &lineVec, const coordvec &offset, double sphereRadius);
81 std::array<double, 2> IntersectLineSphere(const coordvec &lineVec, const std::vector<double> &linePoint,
82  const coordvec &sphereCentre, double sphereRadius);
83 std::vector<double> MeshUnitNormals(const mesh &meshin);
84 std::vector<double> MeshLaplacians(const mesh &meshin);
85 // Forward declared templated functions
86 
87 // Base class
88 
89 #endif // MESH_H_INCLUDED
Provide std::vector container with hashed index mapping.
Handles the use and norm of a vector for which the norm and the unit value might be needed.
Definition: mesh.hpp:114
Class for mesh handling.
Definition: mesh.hpp:592
Definition: snake.hpp:83
Class for a vertex in a mesh.
Definition: mesh.hpp:448
Provides all the mesh tools used for the generation of 3D grids and geometries.
std::vector< double > CalculateEdgeCurvature(const mesh &meshin)
Calculates the angles between the surfaces connected at an edge.
std::vector< double > CalculateVertexCurvature(const mesh &meshin, int smoothingSteps)
Calculates the vertex curvature.
std::array< double, 2 > IntersectLineSphere(const coordvec &lineVec, const coordvec &offset, double sphereRadius)
Calculates the parametric position along a line at which it intersects a sphere.
std::vector< double > CalculateEdgeLengths(const mesh &meshin)
Calculates the edge lengths.
std::vector< double > SurfaceCentroids(const mesh &meshin)
Generate a vector of coordinates of points at the surfaces pseudo centroid.
mesh BuildCutCellDomain(const std::array< double, 3 > &outerLowerB, const std::array< double, 3 > &outerUpperB, const std::array< double, 3 > &innerLowerB, const std::array< double, 3 > &innerUpperB, int nSteps, std::vector< int > &vertPerSubDomain)
Builds a series of domains with different edge properties controlling the interpolation of the metric...
std::vector< double > CalculateVertexMinEdgeLength(const mesh &meshin)
Calculates the vertex minimum edge length.
std::vector< double > VolumeInternalLayers(const mesh &meshin, int nLayers)
Returns points on edges between volume pseudo centroid and vertices.
std::vector< double > CalculateVertexMeanEdgeLength(const mesh &meshin)
Calculates the vertex mean edge length.
std::vector< double > SurfaceInternalLayers(const mesh &meshin, int nLayers)
Returns points on edges between surface pseudo centroid and vertices.
std::vector< double > VolumeCentroids(const mesh &meshin)
Generate a vector of coordinates of points at the volume pseudo centroid.
double PseudoSurfaceAngle(const mesh &meshin, const std::array< int, 2 > &surfInds)
Calculates the pseudo surface angle.
std::vector< double > CalculateVertexMaxEdgeLength(const mesh &meshin)
Calculates the vertex maximum edge length.
std::vector< double > CoordInVolume(const mesh &meshin)
Generate a vector of coordinates of points probably inside volumes.
void PrepareSnakeForCFD(const snake &snakein, double distanceTol, mesh &meshgeom, std::vector< double > &holeCoords)
Prepares the snake to be used for CFD, removes duplicate points and triangulates it.
Provides the core restricted surface snake container.