rsvs3D
0.0.0
Codes for the c++ implementation of the 3D RSVS
|
Provides all the mesh tools used for the generation of 3D grids and geometries. More...
#include <algorithm>
#include <array>
#include <cfloat>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <iostream>
#include <sstream>
#include <stdexcept>
#include <string>
#include <unordered_map>
#include <vector>
#include "arraystructures.hpp"
#include "warning.hpp"
Go to the source code of this file.
Classes | |
class | coordvec |
Handles the use and norm of a vector for which the norm and the unit value might be needed. More... | |
class | meshpart |
/Abstract class to ensure mesh interfaces are correct. More... | |
class | volu |
Class for volume cell objects in a mesh. More... | |
class | surf |
Class for surface object in a mesh. More... | |
class | edge |
Class for an edge object in a mesh. More... | |
class | vert |
Class for a vertex in a mesh. More... | |
class | ConnecRemv |
Class containing the information needed to trim objects from a mesh. More... | |
class | meshdependence |
Class for connecting meshes. More... | |
class | mesh |
Class for mesh handling. More... | |
Namespaces | |
rsvs3d | |
Namespace for general purpose tools of the RSVS project. | |
Typedefs | |
typedef ModiftrackArray< surf > | surfarray |
typedef ArrayStruct< volu > | voluarray |
typedef ModiftrackArray< edge > | edgearray |
typedef ArrayStruct< vert > | vertarray |
typedef std::array< std::array< double, 2 >, 3 > | grid::limits |
typedef std::array< std::array< double, 3 >, 3 > | grid::transformation |
Defines a linear transformation to the mesh where for each dimension: {new minimum, old minimum , scaling}. | |
typedef std::vector< const std::vector< double > * > | grid::coordlist |
Defines a list of coordinates. | |
Functions | |
void | ConnVertFromConnEdge (const mesh &meshin, const std::vector< int > &edgeind, std::vector< int > &vertind) |
std::pair< int, int > | OrderMatchLists (const std::vector< int > &vec1, int p1, int p2) |
int | OrderMatchLists (const std::vector< int > &vec1, const std::vector< int > &vec2, int p1, int p2) |
void | CropMeshGreedy (mesh &meshin, const std::vector< double > &lb, const std::vector< double > &ub) |
Crops a mesh to only the elements inside the cropBox. More... | |
int | OrderEdgeList (std::vector< int > &edgeind, const mesh &meshin, bool warn=true, bool errout=true, const std::vector< int > *edgeIndOrigPtr=NULL, const surf *surfin=NULL) |
Orders a list of edge to be connected. More... | |
int | OrderList (std::vector< int > &edgeind, const std::vector< int > &edge2Vert, bool warn=true, bool errout=true, const std::vector< int > *edgeIndOrigPtr=NULL) |
Orders a list of elements defined by pairs of indices. More... | |
void | DiffPointsFromCentre (const std::vector< double > ¢re, const std::vector< double > &planeVert2, const std::vector< double > &planeVert3, coordvec &normal, coordvec &temp1) |
Computes vector between vertices to then compute angles and plane normals. More... | |
void | DiffPoints (const std::vector< double > &vert1, const std::vector< double > &vert2, coordvec &diffVerts) |
Computes vector between vertices to then compute angles and plane normals. More... | |
double | Angle3Points (const std::vector< double > ¢re, const std::vector< double > &planeVert2, const std::vector< double > &planeVert3, coordvec &vec1, coordvec &vec2) |
Calculates a plane's normal vector. More... | |
double | VertexDistanceToPlane (const std::vector< double > &planeVert1, const std::vector< double > &planeVert2, const std::vector< double > &planeVert3, const std::vector< double > &testVertex, coordvec &temp1, coordvec &temp2) |
Calculates the distance from a vertex to a plane. More... | |
std::vector< double > | VerticesDistanceToPlane (const std::vector< double > &planeVert1, const std::vector< double > &planeVert2, const std::vector< double > &planeVert3, const std::vector< double > &testVertices, coordvec &temp1, coordvec &temp2) |
Calculates the distance from a set of vertices to a plane. More... | |
double | VertexDistanceToPlane (const std::vector< double > &planeVert1, const std::vector< double > &planeVert2, const std::vector< double > &planeVert3, const std::vector< double > &testVertex) |
std::vector< double > | VerticesDistanceToPlane (const std::vector< double > &planeVert1, const std::vector< double > &planeVert2, const std::vector< double > &planeVert3, const std::vector< double > &testVertices) |
mesh | Points2Mesh (const std::vector< double > &vecPts, int nProp=3) |
Takes in a set of points and returns a mesh of points ready for voronisation. More... | |
double | PlanesDotProduct (const std::vector< double > &planeVert1, const std::vector< double > &planeVert2, const std::vector< double > &planeVert3, const std::vector< double > &planeVert4, const std::vector< double > &planeVert5, const std::vector< double > &planeVert6, bool normalize=true) |
void | PlaneNormal (const std::vector< double > &planeVert1, const std::vector< double > &planeVert2, const std::vector< double > &planeVert3, coordvec &normal, coordvec &temp1) |
Calculates a plane's normal vector. More... | |
double | PlaneNormalAndAngle (const std::vector< double > &planeVert1, const std::vector< double > &planeVert2, const std::vector< double > &planeVert3, coordvec &normal, coordvec &temp1) |
Calculates a plane's normal vector. More... | |
std::tuple< coordvec, double > | VertexNormal (const std::vector< double > ¢re, const grid::coordlist &vecPts) |
Calculates the vertex normal weighted by surface angle partitions. More... | |
template<class T , class V , class W > | |
double | meshhelp::ProjectRay (int count, const W &&boundBox, const T &dir, const V &orig, double minDist=0.0) |
void | meshhelp::PlaceBorderVertex (const std::vector< double > &coordIn, const std::vector< double > &coordOut, const std::vector< double > &lb, const std::vector< double > &ub, std::vector< double > &coordTarg) |
void | meshhelp::SplitBorderSurfaceEdgeind (const mesh &meshin, const std::vector< bool > &edgeOut, std::vector< int > &vecconnIn, std::vector< int > &vecconnOut) |
void | meshhelp::SplitBorderVolumeSurfind (const mesh &meshin, const std::vector< bool > &edgeOut, std::vector< int > &vecconnIn, std::vector< int > &vecconnOut) |
void | meshhelp::HandleMultiSurfaceSplit (mesh &meshin, vector< int > &edgeindOld, vector< int > &edgeindNew, vector< int > &vertindNew) |
Handles case for AddBoundary where a surface more than one split. More... | |
std::vector< int > | meshhelp::FindVertInFromEdgeOut (const mesh &meshin, const std::vector< bool > &vertOut, const std::vector< int > &edgeList, const std::vector< int > &edgeListCheck) |
std::vector< int > | meshhelp::FindEdgeInFromSurfOut (const mesh &meshin, const std::vector< bool > &edgeOut, std::vector< int > surfList) |
double | meshhelp::VerticesDistanceSquared (const mesh &meshin, const vector< int > &vertind) |
double | meshhelp::VerticesDistance (const mesh &meshin, const vector< int > &vertind) |
bool | meshhelp::IsVerticesDistance0 (const mesh &meshin, const vector< int > &vertind, double eps) |
int | meshhelp::VertexInVolume (const mesh &meshin, const vector< double > testCoord, bool needFlip) |
int | meshhelp::Get3PointsInSurface (const mesh &meshin, int surfCurr, std::array< int, 3 > &surfacePoints) |
Gets 3 unique points in the surface. More... | |
int | meshhelp::NormalShouldFlip (const std::vector< int > orderedList, int elm1, int elm2, const std::vector< int > &voluind, bool innerComparison) |
Answers if a normal should be flipped to point towards the outside of a volume. More... | |
int | Test_ArrayStructures () |
int | Test_Volu () |
int | Test_Surf () |
int | Test_Vert () |
int | Test_Edge () |
int | Test_Mesh () |
int | Test_Crop () |
Provides all the mesh tools used for the generation of 3D grids and geometries.
This file provides the mesh class and it's associated sub-component. These can be used to robustly control changes in geometry.
Definition in file mesh.hpp.
double Angle3Points | ( | const vector< double > & | centre, |
const vector< double > & | planeVert2, | ||
const vector< double > & | planeVert3, | ||
coordvec & | normal, | ||
coordvec & | temp1 | ||
) |
Calculates a plane's normal vector.
[in] | planeVert1 | The plane vertex 1 |
[in] | planeVert2 | The plane vertex 2 |
[in] | planeVert3 | The plane vertex 3 |
normal | The normal | |
temp1 | The temporary 1 |
void CropMeshGreedy | ( | mesh & | meshin, |
const std::vector< double > & | lb, | ||
const std::vector< double > & | ub | ||
) |
Crops a mesh to only the elements inside the cropBox.
Anything impinging on the cropBox is deleted. Steps: 1 - Find vertices out of the box 2 - Delete those vertices 3 - Propagate the deletion to the higher level containers 4 - Propagate back to the lower level containers removing empty connectors.
meshin | Input mesh | |
[in] | lb | lower bound vector |
[in] | ub | upper bound vector |
void DiffPoints | ( | const vector< double > & | vert1, |
const vector< double > & | vert2, | ||
coordvec & | diffVerts | ||
) |
void DiffPointsFromCentre | ( | const vector< double > & | centre, |
const vector< double > & | vert1, | ||
const vector< double > & | vert2, | ||
coordvec & | diffVert1, | ||
coordvec & | diffVert2 | ||
) |
Computes vector between vertices to then compute angles and plane normals.
[in] | centre | The starting vertex for all vertices |
[in] | vert1 | The first vertex |
[in] | vert2 | the second vertex |
diffVert1 | The difference : vert1 - centre | |
diffVert2 | The difference : vert2 - centre |
int meshhelp::Get3PointsInSurface | ( | const mesh & | meshin, |
int | surfCurr, | ||
std::array< int, 3 > & | surfacePoints | ||
) |
Gets 3 unique points in the surface.
These points are guaranteed to be separate
[in] | meshin | The input mesh |
[in] | surfCurr | current surface index to analyse. |
[out] | surfacePoints | The surface points indices. |
void meshhelp::HandleMultiSurfaceSplit | ( | mesh & | meshin, |
vector< int > & | edgeindOld, | ||
vector< int > & | edgeindNew, | ||
vector< int > & | vertindNew | ||
) |
int meshhelp::NormalShouldFlip | ( | const std::vector< int > | orderedList, |
int | elm1, | ||
int | elm2, | ||
const std::vector< int > & | voluind, | ||
bool | innerComparison | ||
) |
Answers if a normal should be flipped to point towards the outside of a volume.
[in] | orderedList | An ordered list of elements indicating the orientation of an object. |
[in] | elm1 | The first element of a second ordered list. |
[in] | elm2 | The second element of this second ordered list, these two elements are sufficient to represent that list and are enough to represent it. |
[in] | voluind | Normally the volume indices of a surface object. Could be any list with one 0 and one Non zero elements. |
[in] | innerComparison | Is this comparing two lists with an object inside the other or two outer neighbouring lists. If one is inside the other they are expected to go in the same direction otherwise they need to be contra-rotating (for no flip required). |
int OrderEdgeList | ( | vector< int > & | edgeind, |
const mesh & | meshin, | ||
bool | warn, | ||
bool | errout, | ||
const vector< int > * | edgeIndOrigPtr, | ||
const surf * | surfin | ||
) |
Orders a list of edge to be connected.
This list of edges is ordered in place. THis will not work for self crossing lists.
edgeind | The edgeind | |
[in] | meshin | The meshin |
[in] | warn | The warning |
[in] | errout | The errout |
int OrderList | ( | vector< int > & | edgeind, |
const vector< int > & | edge2Vert, | ||
bool | warn, | ||
bool | errout, | ||
const vector< int > * | edgeIndOrigPtr | ||
) |
Orders a list of elements defined by pairs of indices.
Each element is defined by 1 index in edgeind and 2 indices in edge2Vert. The two indices are then matched to the next element chaining equal indices together.
edgeind | The edgeind | |
[in] | edge2Vert | The edge 2 vertical |
[in] | warn | The warning |
[in] | errout | The errout |
[in] | edgeIndOrigPtr | The edge ind original pointer |
double PlaneNormalAndAngle | ( | const vector< double > & | planeVert1, |
const vector< double > & | planeVert2, | ||
const vector< double > & | planeVert3, | ||
coordvec & | normal, | ||
coordvec & | temp1 | ||
) |
Calculates a plane's normal vector.
[in] | planeVert1 | The plane vertex 1 |
[in] | planeVert2 | The plane vertex 2 |
[in] | planeVert3 | The plane vertex 3 |
normal | The normal | |
temp1 | The temporary 1 |
mesh Points2Mesh | ( | const std::vector< double > & | vecPts, |
int | nProp | ||
) |
double VertexDistanceToPlane | ( | const vector< double > & | planeVert1, |
const vector< double > & | planeVert2, | ||
const vector< double > & | planeVert3, | ||
const vector< double > & | testVertex, | ||
coordvec & | temp1, | ||
coordvec & | temp2 | ||
) |
Calculates the distance from a vertex to a plane.
calculates the distance from a plane to a vertex, with the plane defined by three vertices.
Two optional arguments can be provided to avoid the need for memory allocation if this is called in a loop. For max speedup if testing a surface multiple times against many vertices temp2 can be reused
[in] | planeVert1 | The plane vertex 1 |
[in] | planeVert2 | The plane vertex 2 |
[in] | planeVert3 | The plane vertex 3 |
[in] | testVertex | The test vertex |
[in|out] | temp1 The temporary array 1 | |
[in|out] | temp2 The temporary array 2 |
std::tuple<coordvec, double> VertexNormal | ( | const std::vector< double > & | centre, |
const grid::coordlist & | vecPts | ||
) |
Calculates the vertex normal weighted by surface angle partitions.
[in] | centre | The coordinate at which the normal needs to be evaluated. |
[in] | vecPts | The points used to compute the normal. |
std::vector<double> VerticesDistanceToPlane | ( | const vector< double > & | planeVert1, |
const vector< double > & | planeVert2, | ||
const vector< double > & | planeVert3, | ||
const vector< double > & | testVertices, | ||
coordvec & | temp1, | ||
coordvec & | temp2 | ||
) |
Calculates the distance from a set of vertices to a plane.
Calculates the distance from a plane to a vertex, with the plane defined by three vertices.
Two optional arguments can be provided to avoid the need for memory allocation if this is called in a loop. For max speedup if testing a surface multiple times against many vertices temp2 is reused internally allowing surface properties to only be calculated once.
[in] | planeVert1 | The plane vertex 1 |
[in] | planeVert2 | The plane vertex 2 |
[in] | planeVert3 | The plane vertex 3 |
[in] | testVertices | The test vertices |
[in|out] | temp1 The temporary array 1 | |
[in|out] | temp2 The temporary array 2 |