17 #ifndef ATOMPROBE_MESH_H 18 #define ATOMPROBE_MESH_H 65 inline unsigned int getP(
unsigned int offset) {
return p[offset];};
66 inline void setP(
unsigned int offset,
unsigned int v) { p[offset]=v;};
67 bool isSane(
size_t pLimit=(
size_t)-1)
const;
68 bool edgesMismatch(
const TRIANGLE &tOther)
const;
83 bool sameTriangle(
unsigned int ui,
unsigned int uj)
const;
89 bool trianglesCoincident(
unsigned int ui,
const std::vector<size_t> &v)
const;
98 void getTriEdgeAdjacencyMap(std::vector<std::list<size_t> > &map)
const;
101 float normalAngle(
size_t triOne,
size_t triTwo,
bool flip=
false )
const;
104 void flipTriNormalCoherently(
size_t triOne,
size_t triTwo);
107 void killOrphanNodes(
const std::vector<size_t> &orphans) ;
131 void setNode(
unsigned int index,
Point3D node);
133 void resizeNodes(
unsigned int newSize);
135 Point3D getNodes(
unsigned int index);
141 unsigned int loadGmshMesh(
const char *meshfile,
unsigned int &curLine,
bool allowBadMeshes=
true);
142 unsigned int saveGmshMesh(
const char *meshfile)
const;
145 size_t elementCount()
const;
149 void setTriangleMesh(
const std::vector<float> &ptsA,
150 const std::vector<float> &ptsB,
const std::vector<float> &ptsC);
153 void reassignGroups(
unsigned int i);
156 void removeDuplicateTris();
160 void mergeDuplicateVertices(
float tolerance);
164 bool isSane(
bool output=
false,std::ostream &outStream=std::cerr)
const;
170 unsigned int countTriNodes()
const;
175 void translate(
const Point3D &origin);
178 void scale(
const Point3D &origin,
float scaleFactor);
181 void scale(
float scaleFactor);
184 void rotate(
const Point3D &axis,
const Point3D &origin,
float angle);
188 float getVolume()
const;
194 void getContainedNodes(
const BoundCube &b,
195 std::vector<size_t> &nodes)
const;
198 void getIntersectingPrimitives( std::vector<size_t> &searchNodes,
199 std::vector<size_t> &lines,
200 std::vector<size_t> &triangles,
201 std::vector<size_t> &tetrahedra )
const;
203 unsigned int divideMeshSurface(
float divisionAngle,
unsigned int newPhysGroupStart,
204 const std::vector<size_t> &physGroupsToSplit) ;
206 void getCurPhysGroups(std::vector<std::pair<unsigned int,size_t> > &curPhys)
const;
208 void erasePhysGroup(
unsigned int group,
unsigned int typeMask);
212 unsigned int numDupVertices(
float tolerance)
const;
216 unsigned int numDupTris()
const;
219 void print(std::ostream &o)
const;
222 bool isOrientedCoherently()
const;
225 void killOrphanNodes();
228 void pointsInside(
const std::vector<Point3D> &
p,
229 std::vector<bool> &meshResults,
unsigned int &prog)
const ;
231 void pointsInside(
const std::vector<Point3D> &
p,
232 std::vector<bool> &meshResults)
const;
237 size_t getNearestTri(
const Point3D &
p,
float &distance)
const;
239 void getTriNormal(
size_t tri,
Point3D &normal)
const;
std::vector< std::string > physGroupNames
Physical group storage.
std::vector< TETRAHEDRON > tetrahedra
Storage for node connectivity in tetrahedral form.
const char * MESH_LOAD_ERRS[]
unsigned int getP(unsigned int offset)
std::vector< LINE > lines
Storage for line segments. .size()%2 should always==0.
Simple mesh class for storing and manipulating meshes consisting of 2 and 3D simplexes (triangles or ...
const unsigned int ELEM_FOUR_NODE_TETRAHEDRON
const unsigned int ELEM_SINGLE_NODE_POINT
const unsigned int ELEM_THREE_NODE_TRIANGLE
A 3D point data class storage.
std::vector< Point3D > nodes
Point storage for 3D Data (nodes/coords/vertices..)
const unsigned int ELEM_TWO_NODE_LINE
Helper class to define a bounding cube.
void setP(unsigned int offset, unsigned int v)
std::vector< unsigned long long > points
points
std::vector< TRIANGLE > triangles
Storage for node connectivity in triangle form (take in groups of 3)