25#ifndef _MODELS_VERTEX_SOLVER_TFMESH_H_
26#define _MODELS_VERTEX_SOLVER_TFMESH_H_
28#define TFMESHINV_INCR 100
38#include <unordered_map>
41namespace TissueForge::models::vertex {
52 class CAPI_EXPORT Mesh {
54 std::vector<Vertex> *vertices;
56 std::vector<Surface> *surfaces;
58 std::vector<Body> *bodies;
61 std::set<unsigned int> vertexIdsAvail, surfaceIdsAvail, bodyIdsAvail;
62 std::unordered_map<int, Vertex*> verticesByPID;
64 MeshSolver *_solver = NULL;
68 HRESULT incrementVertices(
const size_t &numIncr=TFMESHINV_INCR);
69 HRESULT incrementSurfaces(
const size_t &numIncr=TFMESHINV_INCR);
70 HRESULT incrementBodies(
const size_t &numIncr=TFMESHINV_INCR);
74 HRESULT allocateVertices(
Vertex*** objs,
const size_t& numObjs);
76 HRESULT allocateBodies(
Body*** objs,
const size_t& numObjs);
87 std::string
str()
const;
195 void lock() { this->meshLock.lock(); }
200 void unlock() { this->meshLock.unlock(); }
360 bool is3D()
const {
return nr_bodies > 0; }
The mesh body is a volume-enclosing object of mesh surfaces.
Definition tfBody.h:59
Vertex * getVertexByPID(const unsigned int &pid) const
Get the vertex for a given particle id.
HRESULT remove(Vertex **v, const size_t &numObjs)
Remove vertices from the mesh; all dependent surfaces and bodies are also removed.
unsigned int numBodies() const
Get the number of bodies.
Definition tfMesh.h:252
TissueForge::models::vertex::MeshQuality & getQuality() const
Get the mesh quality instance.
Definition tfMesh.h:104
bool qualityWorking() const
Test whether a mesh quality instance is working on the mesh.
Definition tfMesh.h:118
HRESULT remove(Surface *s)
Remove a surface from the mesh; all dependent bodies are also removed.
HRESULT ensureAvailableBodies(const size_t &numAlloc)
Ensure that there are a given number of allocated bodies.
HRESULT create(Surface **obj)
Create a surface.
bool connected(const Surface *s1, const Surface *s2) const
Check whether two surfaces are connected.
Surface * getSurface(const unsigned int &idx)
Get the surface at a location in the list of surfaces.
HRESULT remove(Body **b, const size_t &numObjs)
Remove bodies from the mesh.
HRESULT create(Vertex **obj, const unsigned int &pid)
Create a vertex.
HRESULT create(Vertex ***objs, const std::vector< unsigned int > &pids)
Create vertices.
bool is3D() const
Test whether the mesh is 3D.
Definition tfMesh.h:360
unsigned int sizeSurfaces() const
Get the size of the list of surfaces.
Definition tfMesh.h:262
Vertex * getVertex(const unsigned int &idx)
Get the vertex at a location in the list of vertices.
HRESULT remove(Body *b)
Remove a body from the mesh.
bool connected(const Vertex *v1, const Vertex *v2) const
Check whether two vertices are connected.
HRESULT remove(Vertex *v)
Remove a vertex from the mesh; all dependent surfaces and bodies are also removed.
std::string toString()
Get a JSON string representation.
static Mesh * get()
Get the mesh.
unsigned int sizeBodies() const
Get the size of the list of bodies.
Definition tfMesh.h:267
bool validate()
Validate state of the mesh.
HRESULT makeDirty()
Manually notify that the mesh has been changed.
Vertex * findVertex(const FVector3 &pos, const FloatP_t &tol=0.0001)
Find a vertex in this mesh.
void unlock()
Unlocks the mesh for thread-safe operations.
Definition tfMesh.h:200
unsigned int sizeVertices() const
Get the size of the list of vertices.
Definition tfMesh.h:257
HRESULT create(Body **obj)
Create a body.
Body * getBody(const unsigned int &idx)
Get the body at a location in the list of bodies.
HRESULT create(Body ***objs, const size_t &numObjs)
Create bodies.
HRESULT create(Surface ***objs, const size_t &numObjs)
Create surfaces.
bool connected(const Body *b1, const Body *b2) const
Check whether two bodies are connected.
bool hasQuality() const
Test whether this mesh has a mesh quality instance.
Definition tfMesh.h:99
void lock()
Locks the mesh for thread-safe operations.
Definition tfMesh.h:195
HRESULT ensureAvailableSurfaces(const size_t &numAlloc)
Ensure that there are a given number of allocated surfaces.
HRESULT ensureAvailableVertices(const size_t &numAlloc)
Ensure that there are a given number of allocated vertices.
unsigned int numSurfaces() const
Get the number of surfaces.
Definition tfMesh.h:247
HRESULT remove(Surface **s, const size_t &numObjs)
Remove surfaces from the mesh; all dependent bodies are also removed.
std::string str() const
Get a summary string.
unsigned int numVertices() const
Get the number of vertices.
Definition tfMesh.h:242
HRESULT setQuality(TissueForge::models::vertex::MeshQuality *quality)
Set the mesh quality instance.
An object that schedules topological operations on a mesh to maintain its quality.
Definition tfMeshQuality.h:205
The mesh surface is an area-enclosed object of implicit mesh edges defined by mesh vertices.
Definition tfSurface.h:65
The mesh vertex is a volume of a mesh centered at a point in a space.
Definition tfVertex.h:71
Definition tfMeshRenderer.h:35
Vertex model mesh solver.
Definition tfMeshSolver.h:148
int32_t HRESULT
Definition tf_port.h:255