|
libatomprobe
Library for Atom Probe Tomography (APT) computation
|
Simple mesh class for storing and manipulating meshes consisting of 2 and 3D simplexes (triangles or tetrahedra) More...
#include <mesh.h>

Public Member Functions | |
| void | setNode (unsigned int index, Point3D node) |
| Set the nodes value. More... | |
| void | resizeNodes (unsigned int newSize) |
| Resize the node vector. More... | |
| Point3D | getNodes (unsigned int index) |
| Retrieve an object. More... | |
| 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 | 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 Point3D &origin) |
| Translate mesh to specified position. 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 Point3D &axis, const Point3D &origin, float angle) |
| Rotate mesh. More... | |
| float | getVolume () const |
| Obtain the volume of the triangulated space. More... | |
| void | clear () |
| Clear the mesh. 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 |
| obtain the number of duplicate vertices in the mesh More... | |
| unsigned int | numDupTris () const |
| Obtain the number of duplicate triangles in the mesh. More... | |
| void | print (std::ostream &o) const |
| Print some statistics about the mesh data. More... | |
| bool | isOrientedCoherently () const |
| Returns true if the mesh is coherently oriented. More... | |
| void | killOrphanNodes () |
| Kill specified orphan nodes within this dataset. More... | |
| void | pointsInside (const std::vector< Point3D > &p, std::vector< bool > &meshResults, unsigned int &prog) const |
| Find the points that lie inside a this mesh. More... | |
| void | pointsInside (const std::vector< Point3D > &p, std::vector< bool > &meshResults) const |
| Convenience wraper for pointsInside. More... | |
| size_t | getNearestTri (const Point3D &p, float &distance) const |
| Find the nearest triangle to a particular point. More... | |
| void | getTriNormal (size_t tri, Point3D &normal) const |
Public Attributes | |
| std::vector< Point3D > | nodes |
| Point storage for 3D Data (nodes/coords/vertices..) More... | |
| std::vector< std::string > | physGroupNames |
| Physical group storage. More... | |
| std::vector< TETRAHEDRON > | tetrahedra |
| Storage for node connectivity in tetrahedral form. More... | |
| std::vector< TRIANGLE > | triangles |
| Storage for node connectivity in triangle form (take in groups of 3) More... | |
| std::vector< LINE > | lines |
| Storage for line segments. .size()%2 should always==0. More... | |
| std::vector< unsigned long long > | points |
| points More... | |
Simple mesh class for storing and manipulating meshes consisting of 2 and 3D simplexes (triangles or tetrahedra)
| void AtomProbe::Mesh::clear | ( | ) |
Clear the mesh.
Definition at line 936 of file mesh.cpp.
References lines, nodes, physGroupNames, points, tetrahedra, and triangles.
Referenced by setTriangleMesh().
| unsigned int AtomProbe::Mesh::countTriNodes | ( | ) | const |
| unsigned int AtomProbe::Mesh::divideMeshSurface | ( | float | divisionAngle, |
| unsigned int | newPhysGroupStart, | ||
| const std::vector< size_t > & | physGroupsToSplit | ||
| ) |
Definition at line 1597 of file mesh.cpp.
References AtomProbe::Point3D::angle(), ASSERT, AtomProbe::BoundCube::expand(), getTriNormal(), nodes, AtomProbe::BoundCube::setBounds(), AtomProbe::BoundCube::setInverseLimits(), and triangles.

| size_t AtomProbe::Mesh::elementCount | ( | ) | const |
Definition at line 1977 of file mesh.cpp.
References lines, points, tetrahedra, and triangles.
Referenced by loadGmshMesh().
| void AtomProbe::Mesh::erasePhysGroup | ( | unsigned int | group, |
| unsigned int | typeMask | ||
| ) |
Definition at line 1880 of file mesh.cpp.
References AtomProbe::ELEMENT_LINE, AtomProbe::ELEMENT_TETRAHEDRON, AtomProbe::ELEMENT_TRIANGLE, tetrahedra, and triangles.
| void AtomProbe::Mesh::getBounds | ( | BoundCube & | b | ) | const |
| void AtomProbe::Mesh::getContainedNodes | ( | const BoundCube & | b, |
| std::vector< size_t > & | nodes | ||
| ) | const |
Return all the nodes that are contained within specified bounding box.
Definition at line 1761 of file mesh.cpp.
References ASSERT, AtomProbe::BoundCube::containsPt(), and nodes.

| void AtomProbe::Mesh::getCurPhysGroups | ( | std::vector< std::pair< unsigned int, size_t > > & | curPhys | ) | const |
Definition at line 1829 of file mesh.cpp.
References tetrahedra, and triangles.
| void AtomProbe::Mesh::getIntersectingPrimitives | ( | std::vector< size_t > & | searchNodes, |
| std::vector< size_t > & | lines, | ||
| std::vector< size_t > & | triangles, | ||
| std::vector< size_t > & | tetrahedra | ||
| ) | const |
| size_t AtomProbe::Mesh::getNearestTri | ( | const Point3D & | p, |
| float & | distance | ||
| ) | const |
Find the nearest triangle to a particular point.
returns index of nearest triangle, and distance (reference)
Definition at line 2126 of file mesh.cpp.
References getTriNormal(), nodes, AtomProbe::signedDistanceToFacet(), and triangles.
Referenced by AtomProbe::TRIANGLE::edgesMismatch(), and main().

| Point3D AtomProbe::Mesh::getNodes | ( | unsigned int | index | ) |
| void AtomProbe::Mesh::getTriNormal | ( | size_t | tri, |
| Point3D & | normal | ||
| ) | const |
Definition at line 1753 of file mesh.cpp.
References ASSERT, AtomProbe::Point3D::crossProd(), nodes, AtomProbe::Point3D::normalise(), and triangles.
Referenced by divideMeshSurface(), and getNearestTri().

| float AtomProbe::Mesh::getVolume | ( | ) | const |
Obtain the volume of the triangulated space.
Definition at line 1946 of file mesh.cpp.
References ASSERT, AtomProbe::Point3D::crossProd(), AtomProbe::Point3D::dotProd(), isOrientedCoherently(), isSane(), nodes, AtomProbe::TRIANGLE::p, and triangles.

| bool AtomProbe::Mesh::isOrientedCoherently | ( | ) | const |
Returns true if the mesh is coherently oriented.
Definition at line 2152 of file mesh.cpp.
References ASSERT, isSane(), and triangles.
Referenced by AtomProbe::TRIANGLE::edgesMismatch(), getVolume(), and pointsInside().

| bool AtomProbe::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.
Definition at line 572 of file mesh.cpp.
References lines, nodes, tetrahedra, and triangles.
Referenced by AtomProbe::TRIANGLE::edgesMismatch(), getVolume(), isOrientedCoherently(), killOrphanNodes(), loadGmshMesh(), mergeDuplicateVertices(), numDupTris(), print(), removeDuplicateTris(), saveGmshMesh(), and setTriangleMesh().
| void AtomProbe::Mesh::killOrphanNodes | ( | ) |
| unsigned int AtomProbe::Mesh::loadGmshMesh | ( | const char * | meshfile, |
| unsigned int & | curLine, | ||
| bool | allowBadMeshes = true |
||
| ) |
Definition at line 1039 of file mesh.cpp.
References ARRAYSIZE, AtomProbe::ELEM_FOUR_NODE_TETRAHEDRON, AtomProbe::ELEM_SINGLE_NODE_POINT, AtomProbe::ELEM_THREE_NODE_TRIANGLE, AtomProbe::ELEM_TWO_NODE_LINE, elementCount(), isSane(), lines, AtomProbe::MESH_LOAD_BAD_ELEMENTCOUNT, AtomProbe::MESH_LOAD_BAD_NODECOUNT, AtomProbe::MESH_LOAD_ENUM_END, AtomProbe::MESH_LOAD_IS_INSANE, nodes, AtomProbe::TETRAHEDRON::p, AtomProbe::TRIANGLE::p, AtomProbe::LINE::p, AtomProbe::TETRAHEDRON::physGroup, AtomProbe::TRIANGLE::physGroup, AtomProbe::LINE::physGroup, points, AtomProbe::splitStrsRef(), AtomProbe::stream_cast(), tetrahedra, and triangles.

| void AtomProbe::Mesh::mergeDuplicateVertices | ( | float | tolerance | ) |
Definition at line 738 of file mesh.cpp.
References ASSERT, AtomProbe::findNearVerticies(), isSane(), killOrphanNodes(), lines, nodes, points, tetrahedra, and triangles.
Referenced by main().

| unsigned int AtomProbe::Mesh::numDupTris | ( | ) | const |
| unsigned int AtomProbe::Mesh::numDupVertices | ( | float | tolerance | ) | const |
| void AtomProbe::Mesh::pointsInside | ( | const std::vector< Point3D > & | p, |
| std::vector< bool > & | meshResults, | ||
| unsigned int & | prog | ||
| ) | const |
Find the points that lie inside a this mesh.
Definition at line 1989 of file mesh.cpp.
References ASSERT, AtomProbe::BoundCube::containsPt(), AtomProbe::intersect_RayTriangle(), isOrientedCoherently(), nodes, AtomProbe::PROGRESS_REDUCE, AtomProbe::BoundCube::setBounds(), tetrahedra, and triangles.
Referenced by main(), and pointsInside().

| void AtomProbe::Mesh::pointsInside | ( | const std::vector< Point3D > & | p, |
| std::vector< bool > & | meshResults | ||
| ) | const |
Convenience wraper for pointsInside.
Definition at line 2119 of file mesh.cpp.
References pointsInside().

| void AtomProbe::Mesh::print | ( | std::ostream & | o | ) | const |
Print some statistics about the mesh data.
Definition at line 445 of file mesh.cpp.
References ASSERT, isSane(), killOrphanNodes(), lines, nodes, AtomProbe::TRIANGLE::p, points, AtomProbe::BoundCube::setBounds(), tetrahedra, and triangles.

| void AtomProbe::Mesh::reassignGroups | ( | unsigned int | i | ) |
reassign the physical groups to a single number
Definition at line 1375 of file mesh.cpp.
References lines, tetrahedra, and triangles.
| void AtomProbe::Mesh::removeDuplicateTris | ( | ) |
| void AtomProbe::Mesh::resizeNodes | ( | unsigned int | newSize | ) |
Rotate mesh.
Definition at line 1453 of file mesh.cpp.
References AtomProbe::Point3f::fx, AtomProbe::Point3f::fy, AtomProbe::Point3f::fz, nodes, AtomProbe::quat_get_rot_quat(), and AtomProbe::quat_rot_apply_quat().

| unsigned int AtomProbe::Mesh::saveGmshMesh | ( | const char * | meshfile | ) | const |
Definition at line 1390 of file mesh.cpp.
References ASSERT, AtomProbe::ELEM_FOUR_NODE_TETRAHEDRON, AtomProbe::ELEM_SINGLE_NODE_POINT, AtomProbe::ELEM_THREE_NODE_TRIANGLE, AtomProbe::ELEM_TWO_NODE_LINE, isSane(), lines, nodes, points, tetrahedra, and triangles.

| void AtomProbe::Mesh::scale | ( | const Point3D & | origin, |
| float | scaleFactor | ||
| ) |
| void AtomProbe::Mesh::scale | ( | float | scaleFactor | ) |
| void AtomProbe::Mesh::setNode | ( | unsigned int | index, |
| Point3D | node | ||
| ) |
| void AtomProbe::Mesh::setTriangleMesh | ( | const std::vector< float > & | ptsA, |
| const std::vector< float > & | ptsB, | ||
| const std::vector< float > & | ptsC | ||
| ) |
Definition at line 946 of file mesh.cpp.
References ASSERT, clear(), AtomProbe::findNearVerticies(), isSane(), nodes, AtomProbe::TRIANGLE::p, and triangles.

| void AtomProbe::Mesh::translate | ( | ) |
| void AtomProbe::Mesh::translate | ( | const Point3D & | origin | ) |
| std::vector<LINE> AtomProbe::Mesh::lines |
Storage for line segments. .size()%2 should always==0.
Definition at line 123 of file mesh.h.
Referenced by clear(), elementCount(), getIntersectingPrimitives(), isSane(), killOrphanNodes(), loadGmshMesh(), mergeDuplicateVertices(), print(), reassignGroups(), and saveGmshMesh().
| std::vector<Point3D> AtomProbe::Mesh::nodes |
Point storage for 3D Data (nodes/coords/vertices..)
Definition at line 110 of file mesh.h.
Referenced by clear(), divideMeshSurface(), AtomProbe::TRIANGLE::edgesMismatch(), getBounds(), getContainedNodes(), getNearestTri(), getNodes(), getTriNormal(), getVolume(), isSane(), killOrphanNodes(), loadGmshMesh(), main(), mergeDuplicateVertices(), numDupTris(), numDupVertices(), pointsInside(), print(), removeDuplicateTris(), resizeNodes(), rotate(), saveGmshMesh(), scale(), setNode(), setTriangleMesh(), and translate().
| std::vector<std::string> AtomProbe::Mesh::physGroupNames |
| std::vector<unsigned long long> AtomProbe::Mesh::points |
points
Definition at line 125 of file mesh.h.
Referenced by clear(), elementCount(), killOrphanNodes(), loadGmshMesh(), mergeDuplicateVertices(), print(), and saveGmshMesh().
| std::vector<TETRAHEDRON> AtomProbe::Mesh::tetrahedra |
Storage for node connectivity in tetrahedral form.
Definition at line 118 of file mesh.h.
Referenced by clear(), elementCount(), erasePhysGroup(), getCurPhysGroups(), getIntersectingPrimitives(), isSane(), killOrphanNodes(), loadGmshMesh(), mergeDuplicateVertices(), pointsInside(), print(), reassignGroups(), and saveGmshMesh().
| std::vector<TRIANGLE> AtomProbe::Mesh::triangles |
Storage for node connectivity in triangle form (take in groups of 3)
Definition at line 121 of file mesh.h.
Referenced by clear(), countTriNodes(), divideMeshSurface(), AtomProbe::TRIANGLE::edgesMismatch(), elementCount(), erasePhysGroup(), getBounds(), getCurPhysGroups(), getIntersectingPrimitives(), getNearestTri(), getTriNormal(), getVolume(), isOrientedCoherently(), isSane(), killOrphanNodes(), loadGmshMesh(), main(), mergeDuplicateVertices(), numDupTris(), pointsInside(), print(), reassignGroups(), removeDuplicateTris(), saveGmshMesh(), and setTriangleMesh().
1.8.13