3Depict
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Public Member Functions | Public Attributes | List of all members
Mesh Class Reference

#include <mesh.h>

Collaboration diagram for Mesh:
Collaboration graph
[legend]

Public Member Functions

unsigned int loadGmshMesh (const char *meshfile, unsigned int &curLine, bool allowBadMeshes=true)
 
unsigned int saveGmshMesh (const char *meshfile) const
 
size_t elementCount () const
 
void setTriangleMesh (const std::vector< float > &ptsA, const std::vector< float > &ptsB, const std::vector< float > &ptsC)
 
void reassignGroups (unsigned int i)
 reassign the physical groups to a single number More...
 
void removeDuplicateTris ()
 Remove exact duplicate triangles. More...
 
void removeStrayTris ()
 
void mergeDuplicateVertices (float tolerance)
 
bool isSane (bool output=false, std::ostream &outStream=std::cerr) const
 Perform various sanity tests on mesh. Should return true if your mesh is sane. More...
 
void getBounds (BoundCube &b) const
 Get the Axis aligned bounding box for this mesh. More...
 
unsigned int countTriNodes () const
 Count the number of unique nodes shared by triangles. More...
 
void translate ()
 Translate mesh around node centroid. More...
 
void translate (const Point3f &origin)
 Translate mesh to specified position. More...
 
void translate (const Point3D &origin)
 
void scale (const Point3f &origin, float scalefactor)
 Scale the mesh around a specified origin. More...
 
void scale (const Point3D &origin, float scaleFactor)
 Scale the mesh around a specified origin. More...
 
void scale (float scaleFactor)
 Scale the mesh around origin. More...
 
void rotate (const Point3f &axis, const Point3f &origin, float angle)
 Rotate mesh. More...
 
float getVolume () const
 Obtain the volume of the triangulated space. More...
 
void resurface (unsigned int newPhys)
 place triangles over exposed tetrahedral faces More...
 
void clear ()
 Clear the mesh. More...
 
bool isTetFullyConnected (unsigned int &badTet) const
 Check to see if the mesh is a single unit of tetrahedra. More...
 
void refineTetrahedra (std::vector< size_t > &refineTets)
 Refine the selected tetrahedra using a midpoint division method. More...
 
void getAttachedComponents (size_t tet, std::vector< size_t > &tris, std::vector< size_t > &l) const
 Get the line and triangle segments that are connected to a particular tetrahedron. More...
 
void getContainedNodes (const BoundCube &b, std::vector< size_t > &nodes) const
 Return all the nodes that are contained within specified bounding box. More...
 
void getIntersectingPrimitives (std::vector< size_t > &searchNodes, std::vector< size_t > &lines, std::vector< size_t > &triangles, std::vector< size_t > &tetrahedra) const
 Return all primitives that are WHOLLY contained withing bounding box. More...
 
unsigned int divideMeshSurface (float divisionAngle, unsigned int newPhysGroupStart, const std::vector< size_t > &physGroupsToSplit)
 
void getCurPhysGroups (std::vector< std::pair< unsigned int, size_t > > &curPhys) const
 
void erasePhysGroup (unsigned int group, unsigned int typeMask)
 
unsigned int numDupVertices (float tolerance) const
 
unsigned int numDupTris () const
 
void print (std::ostream &o) const
 
void orientTriEdgesCoherently ()
 
bool isOrientedCoherently () const
 
void killOrphanNodes ()
 Kill specified orphan nodes within this dataset. More...
 
void relax (size_t iterations, float relaxFactor)
 Perform vertex weighted relaxation. More...
 
void pointsInside (const std::vector< Point3D > &p, std::vector< bool > &meshResults, std::ostream &msgs, bool wantProg) const
 
size_t getNearestTri (const Point3D &p, float &distance) const
 
void getTriNormal (size_t tri, Point3D &normal) const
 

Public Attributes

std::vector< Point3Dnodes
 Point storage for 3D Data (nodes/coords/vertices..) More...
 
std::vector< std::string > physGroupNames
 Physical group storage. More...
 
std::vector< TETRAHEDRONtetrahedra
 Storage for node connectivity in tet. form. More...
 
std::vector< TRIANGLEtriangles
 Storage for node connectivity in triangle form (take in groups of 3) More...
 
std::vector< LINElines
 Storage for line segments. .size()%2 should always==0. More...
 
std::vector< unsigned long long > points
 

Member Function Documentation

◆ clear()

void Mesh::clear ( )

Clear the mesh.

References lines, nodes, physGroupNames, points, tetrahedra, and triangles.

Referenced by setTriangleMesh().

Here is the caller graph for this function:

◆ countTriNodes()

unsigned int Mesh::countTriNodes ( ) const

Count the number of unique nodes shared by triangles.

References triangles.

◆ divideMeshSurface()

unsigned int Mesh::divideMeshSurface ( float  divisionAngle,
unsigned int  newPhysGroupStart,
const std::vector< size_t > &  physGroupsToSplit 
)

◆ elementCount()

size_t Mesh::elementCount ( ) const

References lines, points, tetrahedra, and triangles.

◆ erasePhysGroup()

void Mesh::erasePhysGroup ( unsigned int  group,
unsigned int  typeMask 
)

◆ getAttachedComponents()

void Mesh::getAttachedComponents ( size_t  tet,
std::vector< size_t > &  tris,
std::vector< size_t > &  l 
) const

Get the line and triangle segments that are connected to a particular tetrahedron.

References Point3D::angle(), ASSERT, getTriNormal(), lines, tetrahedra, and triangles.

Referenced by isSane().

Here is the caller graph for this function:

◆ getBounds()

void Mesh::getBounds ( BoundCube b) const

Get the Axis aligned bounding box for this mesh.

References nodes, and BoundCube::setBounds().

◆ getContainedNodes()

void Mesh::getContainedNodes ( const BoundCube b,
std::vector< size_t > &  nodes 
) const

Return all the nodes that are contained within specified bounding box.

References ASSERT, BoundCube::containsPt(), and nodes.

◆ getCurPhysGroups()

void Mesh::getCurPhysGroups ( std::vector< std::pair< unsigned int, size_t > > &  curPhys) const

References triangles.

Referenced by resurface().

Here is the caller graph for this function:

◆ getIntersectingPrimitives()

void Mesh::getIntersectingPrimitives ( std::vector< size_t > &  searchNodes,
std::vector< size_t > &  lines,
std::vector< size_t > &  triangles,
std::vector< size_t > &  tetrahedra 
) const

Return all primitives that are WHOLLY contained withing bounding box.

References ASSERT, lines, tetrahedra, and triangles.

◆ getNearestTri()

size_t Mesh::getNearestTri ( const Point3D p,
float &  distance 
) const

◆ getTriNormal()

void Mesh::getTriNormal ( size_t  tri,
Point3D normal 
) const

References ASSERT, Point3D::crossProd(), nodes, Point3D::normalise(), and triangles.

Referenced by getAttachedComponents().

Here is the caller graph for this function:

◆ getVolume()

float Mesh::getVolume ( ) const

Obtain the volume of the triangulated space.

References ASSERT, Point3D::crossProd(), Point3D::dotProd(), isSane(), nodes, TRIANGLE::p, and triangles.

Referenced by relax().

Here is the caller graph for this function:

◆ isOrientedCoherently()

bool Mesh::isOrientedCoherently ( ) const

◆ isSane()

bool Mesh::isSane ( bool  output = false,
std::ostream &  outStream = std::cerr 
) const

Perform various sanity tests on mesh. Should return true if your mesh is sane.

References ASSERT, getAttachedComponents(), lines, nodes, tetrahedra, and triangles.

Referenced by getVolume(), killOrphanNodes(), mergeDuplicateVertices(), numDupTris(), print(), relax(), removeDuplicateTris(), resurface(), saveGmshMesh(), and setTriangleMesh().

Here is the caller graph for this function:

◆ isTetFullyConnected()

bool Mesh::isTetFullyConnected ( unsigned int &  badTet) const

Check to see if the mesh is a single unit of tetrahedra.

References ASSERT, nodes, and tetrahedra.

◆ killOrphanNodes()

void Mesh::killOrphanNodes ( )

Kill specified orphan nodes within this dataset.

References ASSERT, isSane(), lines, nodes, points, tetrahedra, and triangles.

Referenced by mergeDuplicateVertices(), and print().

Here is the caller graph for this function:

◆ loadGmshMesh()

unsigned int Mesh::loadGmshMesh ( const char *  meshfile,
unsigned int &  curLine,
bool  allowBadMeshes = true 
)

◆ mergeDuplicateVertices()

void Mesh::mergeDuplicateVertices ( float  tolerance)

◆ numDupTris()

unsigned int Mesh::numDupTris ( ) const

References ASSERT, isSane(), nodes, and triangles.

◆ numDupVertices()

unsigned int Mesh::numDupVertices ( float  tolerance) const

References nodes.

◆ orientTriEdgesCoherently()

void Mesh::orientTriEdgesCoherently ( )

◆ pointsInside()

void Mesh::pointsInside ( const std::vector< Point3D > &  p,
std::vector< bool > &  meshResults,
std::ostream &  msgs,
bool  wantProg 
) const

◆ print()

void Mesh::print ( std::ostream &  o) const

◆ reassignGroups()

void Mesh::reassignGroups ( unsigned int  i)

reassign the physical groups to a single number

References lines, tetrahedra, and triangles.

◆ refineTetrahedra()

void Mesh::refineTetrahedra ( std::vector< size_t > &  refineTets)

Refine the selected tetrahedra using a midpoint division method.

References ASSERT, nodes, TETRAHEDRON::p, tetrahedra, and triangles.

◆ relax()

void Mesh::relax ( size_t  iterations,
float  relaxFactor 
)

Perform vertex weighted relaxation.

References ASSERT, getVolume(), isSane(), lines, M_PI, nodes, tetrahedra, and triangles.

◆ removeDuplicateTris()

void Mesh::removeDuplicateTris ( )

Remove exact duplicate triangles.

References ASSERT, isSane(), nodes, and triangles.

◆ removeStrayTris()

void Mesh::removeStrayTris ( )

References edgeIdx(), and triangles.

◆ resurface()

void Mesh::resurface ( unsigned int  newPhys)

◆ rotate()

void Mesh::rotate ( const Point3f axis,
const Point3f origin,
float  angle 
)

Rotate mesh.

◆ saveGmshMesh()

unsigned int Mesh::saveGmshMesh ( const char *  meshfile) const

◆ scale() [1/3]

void Mesh::scale ( const Point3f origin,
float  scalefactor 
)

Scale the mesh around a specified origin.

References Point3f::fx, Point3f::fy, Point3f::fz, and nodes.

◆ scale() [2/3]

void Mesh::scale ( const Point3D origin,
float  scaleFactor 
)

Scale the mesh around a specified origin.

References nodes.

◆ scale() [3/3]

void Mesh::scale ( float  scaleFactor)

Scale the mesh around origin.

References nodes.

◆ setTriangleMesh()

void Mesh::setTriangleMesh ( const std::vector< float > &  ptsA,
const std::vector< float > &  ptsB,
const std::vector< float > &  ptsC 
)

◆ translate() [1/3]

void Mesh::translate ( )

Translate mesh around node centroid.

References nodes.

◆ translate() [2/3]

void Mesh::translate ( const Point3f origin)

Translate mesh to specified position.

References Point3f::fx, Point3f::fy, Point3f::fz, and nodes.

◆ translate() [3/3]

void Mesh::translate ( const Point3D origin)

References nodes.

Member Data Documentation

◆ lines

std::vector<LINE> Mesh::lines

◆ nodes

std::vector<Point3D> Mesh::nodes

◆ physGroupNames

std::vector<std::string> Mesh::physGroupNames

Physical group storage.

Referenced by clear().

◆ points

std::vector<unsigned long long> Mesh::points

◆ tetrahedra

std::vector<TETRAHEDRON> Mesh::tetrahedra

◆ triangles

std::vector<TRIANGLE> Mesh::triangles

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