rsvs3D  0.0.0
Codes for the c++ implementation of the 3D RSVS
mesh Class Reference

Class for mesh handling. More...

#include <mesh.hpp>

Public Member Functions

void clear ()
 
void RemoveFromFamily ()
 
void AddChild (mesh *meshin)
 
void AddParent (mesh *meshin)
 
void AddParent (mesh *meshin, std::vector< int > &parentind)
 
void AddChild (mesh *meshin, std::vector< int > &parentind)
 
void SetMeshDepElm ()
 
void MaintainLineage ()
 
int CountParents () const
 
int SurfInParent (int surfind) const
 
void SurfInParent (std::vector< int > &listInParent) const
 
void ElmOnParentBound (std::vector< int > &listInParent, std::vector< int > &voluInd, bool isBorderBound=true, bool outerVolume=true) const
 
void SurfOnParentBound (std::vector< int > &listInParent, std::vector< int > &voluInd, bool isBorderBound, bool outerVolume) const
 
void EdgeOnParentBound (std::vector< int > &listInParent, std::vector< int > &voluInd, bool isBorderBound, bool outerVolume) const
 
int CountVoluParent () const
 
void ReturnParentMap (std::vector< int > &currind, std::vector< int > &parentpos, std::vector< std::pair< int, int >> &parentcases, std::vector< double > &voluVals) const
 
void MapVolu2Parent (const std::vector< double > &fillIn, const std::vector< std::pair< int, int >> &parentcases, double volu::*mp=&volu::fill)
 
void MapVolu2Self (const std::vector< double > &fillIn, const std::vector< int > &elms, double volu::*mp=&volu::fill)
 
void VoluValuesofParents (int elmInd, std::vector< double > &vals, int volType=0) const
 
void VoluValuesofParents (int elmInd, std::vector< double > &vals, double volu::*mp) const
 
void SurfValuesofParents (int elmInd, std::vector< double > &vals, int volType=0) const
 
void SurfValuesofParents (int elmInd, std::vector< double > &vals, double surf::*mp) const
 
int ParentElementIndex (int childElmInd, int parentInd=0) const
 
int WhatDim () const
 
void HashArray ()
 
void SetMaxIndex ()
 
void GetMaxIndex (int *nVert, int *nEdge, int *nSurf, int *nVolu) const
 
void Init (int nVe, int nE, int nS, int nVo)
 
void size (int &nVe, int &nE, int &nS, int &nVo) const
 
void reserve (int nVe, int nE, int nS, int nVo)
 
void PrepareForUse (bool needOrder=true)
 
void SetEdgeLengths ()
 
void InvalidateEdgeLength (int iEdge)
 
void disp () const
 
void displight () const
 
void Concatenate (const mesh &other)
 
bool isready () const
 
void PopulateIndices ()
 
void TightenConnectivity ()
 
int TestConnectivity (const char *strRoot="") const
 
int TestConnectivityBiDir (const char *strRoot="", bool emptyIsErr=true) const
 
void write (FILE *fid) const
 
void read (FILE *fid)
 
int write (const char *str) const
 
int read (const char *str)
 
void MakeCompatible_inplace (mesh &other) const
 
mesh MakeCompatible (mesh other) const
 
void ChangeIndices (int nVert, int nEdge, int nSurf, int nVolu)
 
void SwitchIndex (int typeInd, int oldInd, int newInd, const std::vector< int > &scopeInd={0})
 
void RemoveIndex (int typeInd, int oldInd)
 
int ConnectedVertex (std::vector< int > &vertBlock) const
 Return in a vector for each vertex a block number which it is part of. More...
 
int ConnectedVolumes (std::vector< int > &volBlock, const std::vector< bool > &boundaryFaces={}) const
 
void ForceCloseContainers ()
 
void RemoveSingularConnectors (const std::vector< int > &rmvVertInds={}, bool voidError=true)
 
std::vector< int > MergeGroupedVertices (HashedVector< int, int > &closeVert, bool delVerts=true)
 
std::vector< int > OrderEdges ()
 
void SetBorders ()
 
void OrientFaces ()
 Orients either surfaces or edges depending on the dimensionality of the object.
 
int OrderVertexEdges (int vertIndex)
 
void ReOrder ()
 
bool CompareVerts (const vert &in1, const vert &in2) const
 
bool CompareEdges (const edge &in1, const edge &in2) const
 
bool CompareSurfs (const surf &in1, const surf &in2) const
 
bool CompareVolus (const volu &in1, const volu &in2) const
 
void GetOffBorderVert (std::vector< int > &vertList, std::vector< int > &voluInd, int outerVolume=-1)
 
void GetOffBorderVert (std::vector< int > &vertList, std::vector< int > &voluInd, int outerVolume=-1) const
 
void GetOffBorderVert3D (std::vector< int > &vertList, std::vector< int > &voluInd, int outerVolume=-1) const
 
void GetOffBorderVert2D (std::vector< int > &vertInd, std::vector< int > &surfind, int outerVolume=-1) const
 
coordvec CalcCentreVolu (int ind) const
 
coordvec CalcPseudoNormalSurf (int ind) const
 
std::vector< int > VertexInVolume (const std::vector< double > testVertices, int sizeVert=3) const
 Finds for each vertex, the volume object containing it. More...
 
grid::transformation Scale ()
 
grid::transformation Scale (const grid::limits &domain)
 
void LinearTransform (const grid::transformation &transform)
 Applies a linear transformation to the points on a grid. More...
 
void LinearTransformFamily (const grid::transformation &transform)
 Applies a linear transform to child and parent meshes. More...
 
void LoadTargetFill (const std::string &fileName)
 
grid::limits BoundingBox () const
 
void ReturnBoundingBox (std::array< double, 3 > &lowerB, std::array< double, 3 > &upperB) const
 
void Crop (std::vector< int > indList, int indType=1)
 
std::vector< int > AddBoundary (const std::vector< double > &lb, const std::vector< double > &ub)
 Adds boundaries alond max and min xyz planes. More...
 
void CropAtBoundary (const std::vector< double > &lb, const std::vector< double > &ub)
 
int EdgeFromVerts (int v1, int v2) const
 
int SurfFromEdges (int e1, int e2, int repetitionBehaviour=-1) const
 Returns the index of the surface connecting two edges. More...
 
int VertFromVertEdge (int v, int e) const
 Returns the vertex in edges.isearch(e)->vertind which does not match v. More...
 
void VerticesVector (int v1, int v2, coordvec &vec) const
 
void EdgeVector (int e, coordvec &vec) const
 

Public Attributes

vertarray verts
 
edgearray edges
 
surfarray surfs
 
voluarray volus
 
meshdependence meshtree
 

Private Member Functions

void SetLastIndex ()
 
void OrientSurfaceVolume ()
 
void OrientEdgeSurface ()
 
int OrientRelativeSurfaceVolume (std::vector< int > &surfOrient)
 
void ArraysAreHashed ()
 
void _LinearTransformGeneration (const grid::transformation &transform, std::vector< mesh * > meshdependence::*mp)
 Applies reccursively linear transforms to a tree of meshes. More...
 

Private Attributes

bool borderIsSet = false
 
bool meshDepIsSet = false
 
bool facesAreOriented = false
 
bool edgesLengthsAreSet = false
 
int meshDim = 0
 

Friends

class snake
 

Detailed Description

Class for mesh handling.

Class implementing the functionality of this file. The mesh class allow, the robust evolution of a grid. Element connectivity is stored bi-directionnaly. This allows no connectivity to need to be infered and allows very fast and robust traversing of the mesh by using hashed lists of the indices of the mesh components.

Definition at line 591 of file mesh.hpp.

Member Function Documentation

◆ _LinearTransformGeneration()

void mesh::_LinearTransformGeneration ( const grid::transformation transform,
std::vector< mesh * > meshdependence::*  mp 
)
private

Applies reccursively linear transforms to a tree of meshes.

Parameters
[in]transformThe transform
[in]meshdependenceA member pointer to either the parent meshes or the child meshes of the meshtree.

Definition at line 5238 of file mesh.cpp.

◆ AddBoundary()

std::vector< int > mesh::AddBoundary ( const std::vector< double > &  lb,
const std::vector< double > &  ub 
)

Adds boundaries alond max and min xyz planes.

Arguments

Parameters
[in]lblower boundary vector of 3 doubles.
[in]ubupper boundary vector of 3 doubles.
Returns
List of vertex indices in the mesh which lie outside.

Raises:

  • logic_error,
  • Process: THis method could be readily refactored to allow treatment of more complex boundaries
    Steps:
            1 - Identify vertices lying outside
            2 - Indentify connectors lying on boundary
                    a - edges
                    b - surfs
                    c - volus
            3 - Introduce boundary vertices (BV)
            4 - Connect those BV to form new boundary edges (BE)
            5 - Assemble BEs inside a volu into a boundary surf (BS)
            (This process is similar to the voronoisation)
    

Definition at line 5357 of file mesh.cpp.

◆ ConnectedVertex()

int mesh::ConnectedVertex ( std::vector< int > &  vertBlock) const

Return in a vector for each vertex a block number which it is part of.

Fills a vector with a number for each vertex corresponding to a group of connected edges it is part of , can be used close surfaces in 2D or volumes in 3D. Uses a flood fill with queue method.

Parameters
[in/out]vertBlock Either a vector of the same size contaigning 0 for vertices which need to be labelled and some other integers in other positions. OR an empty vector.
Returns
The total number of blocks of vertices identified.

Definition at line 4633 of file mesh.cpp.

◆ LinearTransform()

void mesh::LinearTransform ( const grid::transformation transform)

Applies a linear transformation to the points on a grid.

Parameters
[in]transformThe transform to apply.

Definition at line 5207 of file mesh.cpp.

◆ LinearTransformFamily()

void mesh::LinearTransformFamily ( const grid::transformation transform)

Applies a linear transform to child and parent meshes.

Parameters
[in]transformThe transform

Definition at line 5225 of file mesh.cpp.

◆ SurfFromEdges()

int mesh::SurfFromEdges ( int  e1,
int  e2,
int  repetitionBehaviour = -1 
) const

Returns the index of the surface connecting two edges.

Parameters
[in]e1Index of the first edge
[in]e2Index of the second edge
[in]flagRepHandles the possibility of multiple surfaces connecting two edges.
Returns
The index of the connecting surface.

Definition at line 5872 of file mesh.cpp.

◆ VertexInVolume()

vector< int > mesh::VertexInVolume ( const std::vector< double >  testVertices,
int  sizeVert = 3 
) const

Finds for each vertex, the volume object containing it.

This only works robustly for outside points for convex meshes.

Parameters
[in]testVerticesThe test vertices
[in]sizeVertThe size of each vertex data
Returns
returns a list of indices containing the same number of values as there are input vertices (testVertices/sizeVert)

Definition at line 492 of file mesh.cpp.

◆ VertFromVertEdge()

int mesh::VertFromVertEdge ( int  v,
int  e 
) const

Returns the vertex in edges.isearch(e)->vertind which does not match v.

Parameters
[in]vvertex index
[in]eedgeindex
Returns
{ description_of_the_return_value }

Definition at line 5926 of file mesh.cpp.


The documentation for this class was generated from the following files: