Tissue Forge Models Python API Reference
This is the API Reference page for the module: tissue_forge.models
Cell Polarity
This is the API Reference page for the module: cell_polarity
.
For details on the mathematics and modeling concepts, see the
Cell Polarity Module Documentation.
- tissue_forge.models.center.cell_polarity.getVectorAB(pId: int const &, current: bool const & = True) TissueForge::FVector3
Gets the AB polarity vector of a cell
- Parameters:
pId (int) – particle id
current (boolean) – current value flag; default true
- Return type:
FVector3
- Returns:
FVector3
- tissue_forge.models.center.cell_polarity.getVectorPCP(pId: int const &, current: bool const & = True) TissueForge::FVector3
Gets the PCP polarity vector of a cell
- Parameters:
pId (int) – particle id
current (boolean) – current value flag; default true
- Return type:
FVector3
- Returns:
FVector3
- tissue_forge.models.center.cell_polarity.setVectorAB(pId: int const &, pVec: fVector3, current: bool const & = True, init: bool const & = False) void
Sets the AB polarity vector of a cell
- Parameters:
pId (int) – particle id
pVec (
FVector3
) – vector valuecurrent (boolean) – current value flag; default true
init (boolean) – initialization flag; default false
- tissue_forge.models.center.cell_polarity.setVectorPCP(pId: int const &, pVec: fVector3, current: bool const & = True, init: bool const & = False) void
Sets the PCP polarity vector of a cell
- Parameters:
pId (int) – particle id
pVec (
FVector3
) – vector valuecurrent (boolean) – current value flag; default true
init (boolean) – initialization flag; default false
- tissue_forge.models.center.cell_polarity.registerParticle(ph: ParticleHandle) void
Registers a particle as polar.
This must be called before the first integration step. Otherwise, the engine will not know that the particle is polar and will be ignored.
- Parameters:
ph (
ParticleHandle
) – handle of particle
- tissue_forge.models.center.cell_polarity.unregister(ph: ParticleHandle) void
Unregisters a particle as polar.
This must be called before destroying a registered particle.
- Parameters:
ph (
ParticleHandle
) – handle of particle
- tissue_forge.models.center.cell_polarity.registerType(*args, **kwargs) void
Registers a particle type as polar.
This must be called on a particle type before any other type-specific operations.
- Parameters:
pType (
ParticleType
) – particle typeinitMode (string) – initialization mode for particles of this type
initPolarAB (
FVector3
) – initial value of AB polarity vector; only used when initMode=”value”initPolarPCP (
FVector3
) – initial value of PCP polarity vector; only used when initMode=”value”
- tissue_forge.models.center.cell_polarity.getInitMode(pType: ParticleType) std::string const
Gets the name of the initialization mode of a type
- Parameters:
pType (
ParticleType
) – a type- Return type:
string
- Returns:
const std::string
- tissue_forge.models.center.cell_polarity.setInitMode(pType: ParticleType, value: std::string const &) void
Sets the name of the initialization mode of a type
- Parameters:
pType (
ParticleType
) – a typevalue (string) – initialization mode
- tissue_forge.models.center.cell_polarity.getInitPolarAB(pType: ParticleType) TissueForge::FVector3 const
Gets the initial AB polar vector of a type
- Parameters:
pType (
ParticleType
) – a type- Return type:
FVector3
- Returns:
const FVector3
- tissue_forge.models.center.cell_polarity.setInitPolarAB(pType: ParticleType, value: fVector3) void
Sets the initial AB polar vector of a type
- Parameters:
pType (
ParticleType
) – a typevalue (
FVector3
) – initial AB polar vector
- tissue_forge.models.center.cell_polarity.getInitPolarPCP(pType: ParticleType) TissueForge::FVector3 const
Gets the initial PCP polar vector of a type
- Parameters:
pType (
ParticleType
) – a type- Return type:
FVector3
- Returns:
const FVector3
- tissue_forge.models.center.cell_polarity.setInitPolarPCP(pType: ParticleType, value: fVector3) void
Sets the initial PCP polar vector of a type
- Parameters:
pType (
ParticleType
) – a typevalue (
FVector3
) – initial PCP polar vector
- tissue_forge.models.center.cell_polarity.createPersistentForce(sensAB: FloatP_t const & = 0.0, sensPCP: FloatP_t const & = 0.0) TissueForge::models::center::CellPolarity::PersistentForce *
Creates a persistent polarity force.
- Parameters:
sensAB (float) – sensitivity to AB vector
sensPCP (float) – sensitivity to PCP vector
- Return type:
- Returns:
PersistentForce*
- tissue_forge.models.center.cell_polarity.setDrawVectors(_draw: bool const &) void
Toggles whether polarity vectors are rendered
- Parameters:
_draw (boolean) – rendering flag; vectors are rendered when true
- tissue_forge.models.center.cell_polarity.setArrowColors(colorAB: std::string const &, colorPCP: std::string const &) void
Sets rendered polarity vector colors.
Applies to subsequently created vectors and all current vectors.
- Parameters:
colorAB (string) – name of AB vector color
colorPCP (string) – name of PCP vector color
- tissue_forge.models.center.cell_polarity.setArrowScale(_scale: FloatP_t const &) void
Sets scale of rendered polarity vectors.
Applies to subsequently created vectors and all current vectors.
- Parameters:
_scale (float) – scale of rendered vectors
- tissue_forge.models.center.cell_polarity.setArrowLength(_length: FloatP_t const &) void
Sets length of rendered polarity vectors.
Applies to subsequently created vectors and all current vectors.
- Parameters:
_length (float) – length of rendered vectors
- tissue_forge.models.center.cell_polarity.load() void
Runs the polarity model along with a simulation. Must be called before doing any operations with this module.
- tissue_forge.models.center.cell_polarity.createContactPotential(*args, **kwargs) TissueForge::models::center::CellPolarity::ContactPotential *
Creates a contact-mediated polarity potential
- Parameters:
cutoff (float) – cutoff distance
mag (float) – magnitude of force
rate (float) – rate of state vector dynamics
distanceCoeff (float) – distance coefficient
couplingFlat (float) – flat coupling coefficient
couplingOrtho (float) – orthogonal coupling coefficient
couplingLateral (float) – lateral coupling coefficient
contactType (string) – type of contact; available are regular, isotropic, anisotropic
bendingCoeff (float) – bending coefficient
- Return type:
- Returns:
ContactPotential*
- class tissue_forge.models.center.cell_polarity.ContactPotential(tissue_forge.Potential)
- couplingFlat
Flat interaction coefficient
- couplingOrtho
Orthogonal interaction coefficient
- couplingLateral
Lateral interaction coefficient
- distanceCoeff
Distance coefficient
- cType
Contact type (e.g., normal, isotropic or anisotropic)
- mag
Magnitude of force due to potential
- rate
State vector dynamics rate due to potential
- bendingCoeff
Bending coefficient
Vertex Model Solver
This is the API Reference page for the module: vertex.solver
.
For details on the mathematics and modeling concepts, see the
Vertex Model Solver Module Documentation.
- tissue_forge.models.vertex.solver.init() HRESULT
Initialize the solver
- tissue_forge.models.vertex.solver.MeshParticleType_get() TissueForge::models::vertex::MeshParticleType *
- class tissue_forge.models.vertex.solver.MeshObjType(*args, **kwargs)
Base mesh object type definition.
The type definition of a mesh object should derive from this class
- property id
Id of the type. -1 when not registered with the solver.
- property actors
Object type actors
Solver
- class tissue_forge.models.vertex.solver.MeshSolverTimers
Mesh solver performance timers
- reset() HRESULT
Reset the timers
- str() std::string
Get a string representation of the current timer average values
- class tissue_forge.models.vertex.solver.MeshSolver
Vertex model mesh solver
A singleton solver performs all vertex model dynamics simulation at runtime.
- property timers
Performance timers
- static init() HRESULT
Initialize the solver
- static get() TissueForge::models::vertex::MeshSolver *
Get the solver singleton
- static compact() HRESULT
Reduce internal buffers and storage
- static engine_lock() HRESULT
Locks the engine for thread-safe engine operations
- static engine_unlock() HRESULT
Unlocks the engine for thread-safe engine operations
- static is_dirty() bool
Test whether the current mesh state needs updated
- static set_dirty(_isDirty: bool const &) HRESULT
Set whether the current mesh state needs updated
- static get_mesh() TissueForge::models::vertex::Mesh *
Get the mesh
- static register_type(*args) HRESULT
Overload 1:
Register a body type
- Parameters:
_type (
BodyType
) – type
Overload 2:
Register a surface type
- Parameters:
_type (
SurfaceType
) – type
- static find_surface_from_name(_name: std::string const &) TissueForge::models::vertex::SurfaceType *
Find a registered surface type by name
- Parameters:
_name (string) – type name
- static find_body_from_name(_name: std::string const &) TissueForge::models::vertex::BodyType *
Find a registered body type by name
- Parameters:
_name (string) – type name
- static get_body_type(typeId: unsigned int const &) TissueForge::models::vertex::BodyType *
Get a body type by id
- Parameters:
typeId (int) – type id
- static get_surface_type(typeId: unsigned int const &) TissueForge::models::vertex::SurfaceType *
Get a surface type by id
- Parameters:
typeId (int) – type id
- static num_body_types() int const
Get the number of registered body types
- static num_surface_types() int const
Get the number of registered surface types
- static num_vertices() unsigned int
Get the number of vertices
- static num_surfaces() unsigned int
Get the number of surfaces
- static num_bodies() unsigned int
Get the number of bodies
- static size_vertices() unsigned int
Get the size of the list of vertices
- static size_surfaces() unsigned int
Get the size of the list of surfaces
- static size_bodies() unsigned int
Get the size of the list of bodies
- static position_changed() HRESULT
Update internal data due to a change in position
- static update(_force: bool const & = False) HRESULT
Update the solver if dirty
- Parameters:
_force (boolean) – flag to force an update and ignore whether the solver is dirty
- static get_log() std::vector< TissueForge::models::vertex::MeshLogEvent,std::allocator< TissueForge::models::vertex::MeshLogEvent > >
Get the current logger events
- static log(*args, **kwargs) HRESULT
Log an event
- Parameters:
type (int) – type of event
objIDs (std::vector< int,std::allocator< int > >) – object ids
objTypes (std::vector< TissueForge::models::vertex::MeshObjTypeLabel,std::allocator< TissueForge::models::vertex::MeshObjTypeLabel > >) – object type ids
name (string) – name of event
- static is_3d() bool
Test whether the mesh is 3D.
A 3D mesh has at least one body.
- Return type:
boolean
- Returns:
true if the mesh is 3D
Vertex
- class tissue_forge.models.vertex.solver.Vertex
The mesh vertex is a volume of a mesh centered at a point in a space.
- property id: int
- property bodies
bodies defined by the vertex
- property surfaces
surfaces defined by the vertex
- property pid: int
id of underlying particle
- property connected_vertices
connected vertices
- property area: float
area of the vertex
- property volume: float
volume of the vertex
- property mass: float
mass of the vertex
- property position
position of the vertex
- property velocity
velocity of the vertex
- static create(*args) TissueForge::models::vertex::VertexHandle
Overload 1:
Create a vertex
- Parameters:
_pid (int) – id of underlying particle
Overload 2:
Create a vertex
- Parameters:
position (
FVector3
) – position of vertex
Overload 3:
Create a vertex
- Parameters:
vdata (
ThreeDFVertexData
) – a vertex
- destroy() HRESULT
- validate() bool
- position_changed() HRESULT
- defines(*args) bool
- toString() std::string
Get a JSON string representation
- insert(*args) HRESULT
Overload 1:
Insert a surface at a location in the list of surfaces
- Parameters:
s (
Surface
) – surface to insertidx (int) – location in the list of surfaces
Overload 2:
Insert a surface before another surface
Overload 3:
Inserts a vertex between two vertices
Overload 4:
Insert a vertex between a vertex and each of a set of vertices
- classmethod insert_c(pos, v1, v2=None, verts=None)
Create a vertex and inserts it between a vertices and either another vertex or a set of vertices.
- Parameters:
pos – position of new vertex
v1 – first vertex or its handle
v2 – second vertex of its handle
verts – set of vertices
- Returns:
handle to newly created vertex, if any
- remove(s: _vertex_solver_Surface) HRESULT
Remove a surface
- Parameters:
s (
Surface
) – surface to remove
- replace(*args) HRESULT
Overload 1:
Replace a surface at a location in the list of surfaces
- Parameters:
toInsert (
Surface
) – a surfaceidx (int) – a location in the list of surfaces
Overload 2:
Replace a surface with another surface
Overload 3:
Replace a surface
- Parameters:
toReplace (
Surface
) – surface to replace
Overload 4:
Replace a body
- Parameters:
toReplace (
Body
) – a body
- classmethod replace_c(pos, surface=None, body=None)
Create a vertex and replace either a surface or body with it
- Parameters:
pos – position of new vertex
surface – surface to replace or its handle
body – body to replace or its handle
- Returns:
handle to newly created vertex, if any
- find_surface(dir: fVector3) TissueForge::models::vertex::Surface *
Find a surface defined by this vertex
- Parameters:
dir (
FVector3
) – direction to look with respect to the vertex
- find_body(dir: fVector3) TissueForge::models::vertex::Body *
Find a body defined by this vertex
- Parameters:
dir (
FVector3
) – direction to look with respect to the vertex
- update_connected_vertices() void
Update internal connected vertex data
Get the surfaces that this vertex and another vertex both define
- Parameters:
other (
Vertex
) – another vertex
- update_properties() HRESULT
Update the properties of the underlying particle
- particle() TissueForge::ParticleHandle *
Get a handle to the underlying particle, if any
- set_position(pos: fVector3, updateChildren: bool const & = True) HRESULT
Set the current position
- Parameters:
pos (
FVector3
) – positionupdateChildren (boolean) – flag indicating whether to update dependent objects
- transfer_bonds_to(other: _vertex_solver_Vertex) HRESULT
Transfer all bonds to another vertex
- Parameters:
other (
Vertex
) – another vertex
- replace(*args) HRESULT
Overload 1:
Replace a surface at a location in the list of surfaces
- Parameters:
toInsert (
Surface
) – a surfaceidx (int) – a location in the list of surfaces
Overload 2:
Replace a surface with another surface
Overload 3:
Replace a surface
- Parameters:
toReplace (
Surface
) – surface to replace
Overload 4:
Replace a body
- Parameters:
toReplace (
Body
) – a body
- merge(toRemove: _vertex_solver_Vertex, lenCf: FloatP_t const & = 0.5) HRESULT
Merge with a vertex.
The passed vertex is destroyed.
- Parameters:
toRemove (
Vertex
) – vertex to removelenCf (float) – distance coefficient in [0, 1] for where to place the vertex, from the kept vertex to the removed vertex
- insert(*args) HRESULT
Overload 1:
Insert a surface at a location in the list of surfaces
- Parameters:
s (
Surface
) – surface to insertidx (int) – location in the list of surfaces
Overload 2:
Insert a surface before another surface
Overload 3:
Inserts a vertex between two vertices
Overload 4:
Insert a vertex between a vertex and each of a set of vertices
- split(sep: fVector3) TissueForge::models::vertex::Vertex *
Split a vertex into an edge
The vertex must define at least one surface.
New topology is governed by a cut plane at the midpoint of, and orthogonal to, the new edge. Each first-order neighbor vertex is connected to the vertex of the new edge on the same side of the cut plane.
- Parameters:
sep (
FVector3
) – separation distance- Return type:
- Returns:
newly created vertex
- __str__() str
Return str(self).
- __lt__(rhs) bool
Return self<value.
- __gt__(rhs) bool
Return self>value.
- __le__(rhs) bool
Return self<=value.
- __ge__(rhs) bool
Return self>=value.
- __eq__(rhs) bool
Return self==value.
- __ne__(rhs) bool
Return self!=value.
- class tissue_forge.models.vertex.solver.VertexHandle(_id: int const & = -1)
A handle to a
Vertex
.The engine allocates
Vertex
memory in blocks, andVertex
values get moved around all the time, so their addresses change.This is a safe way to work with a
Vertex
.- property id
- property bodies
bodies defined by the vertex
- property surfaces
surfaces defined by the vertex
- property pid: int
id of underlying particle
- property connected_vertices
connected vertices
- property area: float
area of the vertex
- property volume: float
volume of the vertex
- property mass: float
mass of the vertex
- property position
position of the vertex
- property velocity
velocity of the vertex
- defines(*args) bool
Overload 1:
Test whether defines a surface
- Parameters:
s (
SurfaceHandle
) – a surface- Return type:
boolean
- Returns:
true if defines a surface
Overload 2:
Test whether defines a body
- Parameters:
b (
BodyHandle
) – a body- Return type:
boolean
- Returns:
true if defines a body
- destroy() HRESULT
Destroy the vertex
- validate() bool
Validate the vertex
- position_changed() HRESULT
Update internal data due to a change in position
- toString() std::string
Get a JSON string representation
- static fromString(s: std::string const &) TissueForge::models::vertex::VertexHandle
Create an instance from a JSON string representation
- Parameters:
s (string) – JSON string
- add(s: _vertex_solver_SurfaceHandle) HRESULT
Add a surface
- Parameters:
s (
SurfaceHandle
) – surface to add
- remove(s: _vertex_solver_SurfaceHandle) HRESULT
Remove a surface
- Parameters:
s (
SurfaceHandle
) – surface to remove
- find_surface(dir: fVector3) TissueForge::models::vertex::SurfaceHandle
Find a surface defined by this vertex
- Parameters:
dir (
FVector3
) – direction to look with respect to the vertex
- find_body(dir: fVector3) TissueForge::models::vertex::BodyHandle
Find a body defined by this vertex
- Parameters:
dir (
FVector3
) – direction to look with respect to the vertex
- update_connected_vertices() void
Update internal connected vertex data
Get the surfaces that this vertex and another vertex both define
- Parameters:
other (
VertexHandle
) – another vertex
- update_properties() HRESULT
Update the properties of the underlying particle
- particle() TissueForge::ParticleHandle *
Get a handle to the underlying particle, if any
- set_position(pos: fVector3, updateChildren: bool const & = True) HRESULT
Set the current position
- Parameters:
pos (
FVector3
) – positionupdateChildren (boolean) – flag indicating whether to update dependent objects
- transfer_bonds_to(other: _vertex_solver_VertexHandle) HRESULT
Transfer all bonds to another vertex
- Parameters:
other (
VertexHandle
) – another vertex
- merge(toRemove: _vertex_solver_VertexHandle, lenCf: FloatP_t const & = 0.5) HRESULT
Merge with a vertex.
The passed vertex is destroyed.
- Parameters:
toRemove (
VertexHandle
) – vertex to removelenCf (float) – distance coefficient in [0, 1] for where to place the vertex, from the kept vertex to the removed vertex
- split(sep: fVector3) TissueForge::models::vertex::VertexHandle
Split a vertex into an edge
The vertex must define at least one surface.
New topology is governed by a cut plane at the midpoint of, and orthogonal to, the new edge. Each first-order neighbor vertex is connected to the vertex of the new edge on the same side of the cut plane.
- Parameters:
sep (
FVector3
) – separation distance- Return type:
- Returns:
newly created vertex
- __str__() str
Return str(self).
- __lt__(rhs) bool
Return self<value.
- __gt__(rhs) bool
Return self>value.
- __le__(rhs) bool
Return self<=value.
- __ge__(rhs) bool
Return self>=value.
- __eq__(rhs) bool
Return self==value.
- __ne__(rhs) bool
Return self!=value.
Surface
- class tissue_forge.models.vertex.solver.Surface
The mesh surface is an area-enclosed object of implicit mesh edges defined by mesh vertices.
The mesh surface consists of at least three mesh vertices.
The mesh surface is always flat.
The mesh surface can have a state vector, which represents a uniform amount of substance attached to the surface.
- property id: int
- property actors
Object actors
- property style
Surface style, if any
- property bodies
bodies defined by the surface
- property vertices
vertices that define the surface
- property neighbor_surfaces
surfaces that share at least one vertex
- property density
density of the surface; only used in 2D simulation
- property normal
normal of the surface
- property unnormalized_normal
unnormalized normal of the surface
- property centroid
centroid of the surface
- property velocity
velocity of the surface
- property area
area of the surface
- property perimeter
perimeter of the surface
- property normal_stresses
normal stresses bound to the surface
- property surface_area_constraints
surface area constraints bound to the surface
- property surface_tractions
surface tractions bound to the surface
- property edge_tensions
edge tensions bound to the surface
- property adhesions
adhesions bound to the surface
- property convex_polygon_constraints
convex polygon constraints bound to the surface
- property flat_surface_constraints
flat surface constraints bound to the surface
- static create(*args) TissueForge::models::vertex::SurfaceHandle
Overload 1:
Construct a surface from a set of vertices
- Parameters:
_vertices (std::vector< TissueForge::models::vertex::VertexHandle,std::allocator< TissueForge::models::vertex::VertexHandle > >) – a set of vertices
Overload 2:
Construct a surface from a face
- Parameters:
face (
ThreeDFFaceData
) – a face
- defines(obj: _vertex_solver_Body) bool
- definedBy(obj: _vertex_solver_Vertex) bool
- destroy() HRESULT
- classmethod destroy_c(s)
Destroy a surface.
Any resulting vertices without a surface are also destroyed.
- Parameters:
s – surface to destroy or its handle
- validate() bool
- position_changed() HRESULT
- toString() std::string
Get a JSON string representation
- add(*args) HRESULT
Overload 1:
Add a vertex
- Parameters:
v (
Vertex
) – vertex to add
Overload 2:
Add a body
- Parameters:
b (
Body
) – body to add
- remove(*args) HRESULT
Overload 1:
Remove a vertex
- Parameters:
v (
Vertex
) – vertex to remove
Overload 2:
Remove a body
- Parameters:
b (
Body
) – body to remove
- insert(*args) HRESULT
Overload 1:
Insert a vertex at a location in the list of vertices
- Parameters:
v (
Vertex
) – vertex to insertidx (int) – location
Overload 2:
Insert a vertex before another vertex
Overload 3:
Insert a vertex between two vertices
- remove(*args) HRESULT
Overload 1:
Remove a vertex
- Parameters:
v (
Vertex
) – vertex to remove
Overload 2:
Remove a body
- Parameters:
b (
Body
) – body to remove
- replace(*args) HRESULT
Overload 1:
Replace a vertex at a location in the list of vertices
- Parameters:
toInsert (
Vertex
) – vertex to insertidx (int) – location of vertex to replace
Overload 2:
Replace a vertex with another vertex
Overload 3:
Replace a body at a location in the list of bodies
- Parameters:
toInsert (
Body
) – body to insertidx (int) – location of body to remve
Overload 4:
Replace a body with another body
- refresh_bodies() HRESULT
Refresh internal ordering of defined bodies
- type() TissueForge::models::vertex::SurfaceType *
Get the surface type
- become(stype: _vertex_solver_SurfaceType) HRESULT
Become a different type
- Parameters:
stype (
SurfaceType
) – type to become
- find_vertex(dir: fVector3) TissueForge::models::vertex::Vertex *
Find a vertex that defines this surface
- Parameters:
dir (
FVector3
) – direction to look with respect to the centroid
- find_body(dir: fVector3) TissueForge::models::vertex::Body *
Find a body that this surface defines
- Parameters:
dir (
FVector3
) – direction to look with respect to the centroid
- neighbor_vertices(v: _vertex_solver_Vertex) std::tuple< TissueForge::models::vertex::Vertex *,TissueForge::models::vertex::Vertex * >
Connected vertices on the same surface
- Parameters:
v (
Vertex
) – a vertex
- connected_surfaces(*args) std::vector< TissueForge::models::vertex::Surface *,std::allocator< TissueForge::models::vertex::Surface * > >
Overload 1:
Surfaces that share at least one vertex in a set of vertices
- Parameters:
verts (std::vector< TissueForge::models::vertex::Vertex *,std::allocator< TissueForge::models::vertex::Vertex * > >) – vertices
Overload 2:
Surfaces that share at least one vertex
- connecting_vertices(other: _vertex_solver_Surface) std::vector< TissueForge::models::vertex::Vertex *,std::allocator< TissueForge::models::vertex::Vertex * > >
Vertices defining this and another surface
- Parameters:
other (
Surface
) – another surface
- contiguous_vertex_labels(other: _vertex_solver_Surface) std::vector< unsigned int,std::allocator< unsigned int > >
Get the integer labels of the contiguous vertices that this surface shares with another surface
- Parameters:
other (
Surface
) – another surface
Get the number of contiguous vertex sets that this surface shares with another surface
- Parameters:
other (
Surface
) – another surface
Get the vertices of a contiguous shared vertex set with another surface.
Vertices are labeled in increasing order starting with “1”. A requested set that does not exist returns empty.
A requested edge with label “0” returns all vertices not shared with another surface
- Parameters:
other (
Surface
) – another surfaceedgeLabel (int) – edge label
- volume_sense(body: _vertex_solver_Body) FloatP_t
Get the sign of the volume contribution to a body that this surface contributes
- Parameters:
body (
Body
) – a body
- get_volume_contr(body: _vertex_solver_Body) FloatP_t
Get the volume that this surface contributes to a body
- Parameters:
body (
Body
) – a body
- get_outward_normal(body: _vertex_solver_Body) TissueForge::FVector3
Get the outward facing normal w.r.t. a body
- Parameters:
body (
Body
) – a body
- get_vertex_area(v: _vertex_solver_Vertex) FloatP_t
Get the area that a vertex contributes to this surface
- Parameters:
v (
Vertex
) – a vertex
- get_vertex_mass(v: _vertex_solver_Vertex) FloatP_t
Get the mass contribution of a vertex to this surface; only used in 2D simulation
- Parameters:
v (
Vertex
) – a vertex
- triangle_normal(idx: unsigned int const &) TissueForge::FVector3
Get the normal of a triangle
- Parameters:
idx (int) – location of first vertex
- normal_distance(pos: fVector3) FloatP_t
Get the normal distance to a point.
A negative distance means that the point is on the inner side
- Parameters:
pos (
FVector3
) – position
- is_outside(pos: fVector3) bool
Test whether a point is on the outer side
- Parameters:
pos (
FVector3
) – position- Return type:
boolean
- Returns:
true if the point is on the outer side
- contains(*args) bool
Overload 1:
Test whether the surface contains a point
- Parameters:
Overload 2:
Test whether the surface contains a point
- Parameters:
pos (
FVector3
) – position of the point
- classmethod sew(s1=None, s2=None, surfs=None, dist_cf: float | None = None)
Sew either two surfaces or a set of surfaces.
All vertices are merged that are a distance apart less than a distance criterion.
The distance criterion is the square root of the average of the two surface areas, multiplied by a coefficient.
- Parameters:
s1 – the surface or its handle
s2 – another surface or its handle
surfs – a set of surfaces or their handles
dist_cf – distance criterion coefficient
- merge(toRemove: _vertex_solver_Surface, lenCfs: vectorf) HRESULT
Merge with a surface. The passed surface is destroyed.
Surfaces must have the same number of vertices. Vertices are paired by nearest distance.
- Parameters:
toRemove (
Surface
) – surface to removelenCfs (std::vector< FloatP_t,std::allocator< FloatP_t > >) – distance coefficients in [0, 1] for where to place the merged vertex, from each kept vertex to each removed vertex
- extend(vertIdxStart: unsigned int const &, pos: fVector3) TissueForge::models::vertex::Surface *
Create a surface from two vertices and a position
- Parameters:
vertIdxStart (int) – index of first vertex
pos (
FVector3
) – position
- extrude(vertIdxStart: unsigned int const &, normLen: FloatP_t const &) TissueForge::models::vertex::Surface *
Create a surface from two vertices of a surface in a mesh by extruding along the normal of the surface
todo: add support for extruding at an angle w.r.t. the center of the edge and centroid of the base surface
- Parameters:
vertIdxStart (int) – index of first vertex
normLen (float) – length along surface normal by which to extrude
- split(*args) TissueForge::models::vertex::Surface *
Overload 1:
Split into two surfaces
Both vertices must already be in the surface and not adjacent
Vertices in the winding from from vertex to second go to newly created surface
Requires updated surface members (e.g., centroid)
- Parameters:
- Return type:
- Returns:
Surface*
Overload 2:
Split into two surfaces
Requires updated surface members (e.g., centroid)
- Parameters:
cp_pos (
FVector3
) – point on the cut planecp_norm (
FVector3
) – normal of the cut plane
- __str__() str
Return str(self).
- __lt__(rhs) bool
Return self<value.
- __gt__(rhs) bool
Return self>value.
- __le__(rhs) bool
Return self<=value.
- __ge__(rhs) bool
Return self>=value.
- __eq__(rhs) bool
Return self==value.
- __ne__(rhs) bool
Return self!=value.
- class tissue_forge.models.vertex.solver.SurfaceHandle(_id: int const & = -1)
A handle to a
Surface
.The engine allocates
Surface
memory in blocks, andSurface
values get moved around all the time, so their addresses change.This is a safe way to work with a
Surface
.- property id
- property bodies
bodies defined by the surface
- property vertices
vertices that define the surface
- property neighbor_surfaces
surfaces that share at least one vertex
- property density
density of the surface; only used in 2D simulation
- property normal
normal of the surface
- property unnormalized_normal
unnormalized normal of the surface
- property centroid
centroid of the surface
- property velocity
velocity of the surface
- property area
area of the surface
- property perimeter
perimeter of the surface
- property style
style of the surface, if any
- property normal_stresses
normal stresses bound to the surface
- property perimeter_constraints
perimeter constraints bound to the surface
- property surface_area_constraints
surface area constraints bound to the surface
- property surface_tractions
surface tractions bound to the surface
- property edge_tensions
edge tensions bound to the surface
- property adhesions
adhesions bound to the surface
- property convex_polygon_constraints
convex polygon constraints bound to the surface
- property flat_surface_constraints
flat surface constraints bound to the surface
- defines(b: _vertex_solver_BodyHandle) bool
Test whether defines a body
- Parameters:
b (
BodyHandle
) – a body- Return type:
boolean
- Returns:
true if defines a body
- definedBy(v: _vertex_solver_VertexHandle) bool
Test whether defined by a vertex
- Parameters:
v (
VertexHandle
) – a vertex- Return type:
boolean
- Returns:
true if defined by a vertex
- destroy() HRESULT
Destroy the surface
- validate() bool
Validate the surface
- Return type:
boolean
- Returns:
true if valid
- position_changed() HRESULT
Update internal data due to a change in position
- toString() std::string
Get a JSON string representation
- static fromString(s: std::string const &) TissueForge::models::vertex::SurfaceHandle
Create an instance from a JSON string representation
- Parameters:
s (string) – JSON string
- add(*args) HRESULT
Overload 1:
Add a vertex
- Parameters:
v (
VertexHandle
) – vertex to add
Overload 2:
Add a body
- Parameters:
b (
BodyHandle
) – body to add
- remove(*args) HRESULT
Overload 1:
Remove a vertex
- Parameters:
v (
VertexHandle
) – vertex to remove
Overload 2:
Remove a body
- Parameters:
b (
BodyHandle
) – body to remove
- insert(*args) HRESULT
Overload 1:
Insert a vertex at a location in the list of vertices
- Parameters:
v (
VertexHandle
) – vertex to insertidx (int) – location of insertion
Overload 2:
Insert a vertex before another vertex
- Parameters:
v (
VertexHandle
) – vertex to insertbefore (
VertexHandle
) – vertex to insert before
Overload 3:
Insert a vertex between two vertices
- Parameters:
toInsert (
VertexHandle
) – vertex to insertv1 (
VertexHandle
) – first vertexv2 (
VertexHandle
) – second vertex
- replace(*args) HRESULT
Overload 1:
Replace a vertex at a location in the list of vertices
- Parameters:
toInsert (
VertexHandle
) – vertex to insertidx (int) – location of vertex to remove
Overload 2:
Replace a vertex with another vertex
- Parameters:
toInsert (
VertexHandle
) – vertex to inserttoRemove (
VertexHandle
) – vertex to remove
Overload 3:
Replace a body at a location in the list of bodies
- Parameters:
toInsert (
BodyHandle
) – body to insertidx (int) – location of body to remove
Overload 4:
Replace a body with another body
- Parameters:
toInsert (
BodyHandle
) – body to inserttoRemove (
BodyHandle
) – body to remove
- refresh_bodies() HRESULT
Refresh internal ordering of defined bodies
- type() TissueForge::models::vertex::SurfaceType *
Get the surface type
- become(stype: _vertex_solver_SurfaceType) HRESULT
Become a different type
- Parameters:
stype (
SurfaceType
) – type to become
- find_vertex(dir: fVector3) TissueForge::models::vertex::VertexHandle
Find a vertex that defines this surface
- Parameters:
dir (
FVector3
) – direction to look with respect to the centroid
- find_body(dir: fVector3) TissueForge::models::vertex::BodyHandle
Find a body that this surface defines
- Parameters:
dir (
FVector3
) – direction to look with respect to the centroid
- neighbor_vertices(v: _vertex_solver_VertexHandle) std::tuple< TissueForge::models::vertex::VertexHandle,TissueForge::models::vertex::VertexHandle >
Connected vertices on the same surface
- Parameters:
v (
VertexHandle
) – a vertex
- connected_surfaces(*args) std::vector< TissueForge::models::vertex::SurfaceHandle,std::allocator< TissueForge::models::vertex::SurfaceHandle > >
Overload 1:
Surfaces that share at least one vertex in a set of vertices
- Parameters:
verts (std::vector< TissueForge::models::vertex::VertexHandle,std::allocator< TissueForge::models::vertex::VertexHandle > >) – a set of vertices
Overload 2:
Surfaces that share at least one vertex
- connecting_vertices(other: _vertex_solver_SurfaceHandle) std::vector< TissueForge::models::vertex::VertexHandle,std::allocator< TissueForge::models::vertex::VertexHandle > >
Vertices defining this and another surface
- Parameters:
other (
SurfaceHandle
) – another surface
- contiguous_vertex_labels(other: _vertex_solver_SurfaceHandle) std::vector< unsigned int,std::allocator< unsigned int > >
Get the integer labels of the contiguous edges that this surface shares with another surface
- Parameters:
other (
SurfaceHandle
) – another surface
Get the number of contiguous edges that this surface shares with another surface
- Parameters:
other (
SurfaceHandle
) – another surface
Get the vertices of a contiguous shared edge with another surface.
Edges are labeled in increasing order starting with “1”. A requested edge that does not exist returns empty.
A requested edge with label “0” returns all vertices not shared with another surface
- Parameters:
other (
SurfaceHandle
) – another surfaceedgeLabel (int) – edge label
- volume_sense(body: _vertex_solver_BodyHandle) FloatP_t
Get the sign of the volume contribution to a body that this surface contributes
- Parameters:
body (
BodyHandle
) – a body
- get_volume_contr(body: _vertex_solver_BodyHandle) FloatP_t
Get the volume that this surface contributes to a body
- Parameters:
body (
BodyHandle
) – a body
- get_outward_normal(body: _vertex_solver_BodyHandle) TissueForge::FVector3
Get the outward facing normal w.r.t. a body
- Parameters:
body (
BodyHandle
) – a body
- get_vertex_area(v: _vertex_solver_VertexHandle) FloatP_t
Get the area that a vertex contributes to this surface
- Parameters:
v (
VertexHandle
) – a vertex
- get_vertex_mass(v: _vertex_solver_VertexHandle) FloatP_t
Get the mass contribution of a vertex to this surface; only used in 2D simulation
- Parameters:
v (
VertexHandle
) – a vertex
- triangle_normal(idx: unsigned int const &) TissueForge::FVector3
Get the normal of a triangle
- Parameters:
idx (int) – index of first triangle vertex
- normal_distance(pos: fVector3) FloatP_t
Get the normal distance to a point.
A negative distance means that the point is on the inner side
- Parameters:
pos (
FVector3
) – position
- is_outside(pos: fVector3) bool
Test whether a point is on the outer side
- Parameters:
pos (
FVector3
) – position- Return type:
boolean
- Returns:
true if on the outer side
- contains(*args) bool
Overload 1:
Test whether the surface contains a point
- Parameters:
pos (
FVector3
) – position of the pointv0 (
VertexHandle
) – a vertex of the nearest edgev1 (
VertexHandle
) – a vertex of the nearest edge
Overload 2:
Test whether the surface contains a point
- Parameters:
pos (
FVector3
) – position of the point
- merge(toRemove: _vertex_solver_SurfaceHandle, lenCfs: vectorf) HRESULT
Merge with a surface. The passed surface is destroyed.
Surfaces must have the same number of vertices. Vertices are paired by nearest distance.
- Parameters:
toRemove (
SurfaceHandle
) – surface to removelenCfs (std::vector< FloatP_t,std::allocator< FloatP_t > >) – distance coefficients in [0, 1] for where to place the merged vertex, from each kept vertex to each removed vertex
- extrude(vertIdxStart: unsigned int const &, normLen: FloatP_t const &) TissueForge::models::vertex::SurfaceHandle
Create a surface from two vertices of a surface in a mesh by extruding along the normal of the surface
todo: add support for extruding at an angle w.r.t. the center of the edge and centroid of the base surface
- Parameters:
vertIdxStart (int) – index of first vertex
normLen (float) – length along surface normal by which to extrude
- split(*args) TissueForge::models::vertex::SurfaceHandle
Overload 1:
Split into two surfaces
Both vertices must already be in the surface and not adjacent
Vertices in the winding from from vertex to second go to newly created surface
Requires updated surface members (e.g., centroid)
- Parameters:
v1 (
VertexHandle
) – first vertexv2 (
VertexHandle
) – second vertex
Overload 2:
Split into two surfaces
Requires updated surface members (e.g., centroid)
- Parameters:
cp_pos (
FVector3
) – point on the cut planecp_norm (
FVector3
) – normal of the cut plane
- __str__() str
Return str(self).
- __lt__(rhs) bool
Return self<value.
- __gt__(rhs) bool
Return self>value.
- __le__(rhs) bool
Return self<=value.
- __ge__(rhs) bool
Return self>=value.
- __eq__(rhs) bool
Return self==value.
- __ne__(rhs) bool
Return self!=value.
- class tissue_forge.models.vertex.solver.SurfaceTypeSpec
Interface for class-centric design of SurfaceType
- density: float | None = None
Mass density; only used in 2D simulation
- edge_tension_lam: float | None = None
Edge tension Lagrange multiplier
- edge_tension_order: int | None = None
Edge tension order
- normal_stress_mag: float | None = None
Normal stress magnitude
- perimeter_lam: float | None = None
Perimeter constraing Lagrange multiplier
- perimeter_val: float | None = None
Perimeter constraint target value
- surface_area_lam: float | None = None
Surface area constraint Lagrange multiplier
- surface_area_val: float | None = None
Surface area constraint target value
- adhesion: Dict[str, float] | None = None
Adhesion by name and parameter
- classmethod get() _vertex_solver_SurfaceType
Get the engine type that corresponds to this class.
The type is automatically registered as necessary.
- Returns:
registered type instance
- classmethod edge_tension() _vertex_solver_EdgeTension | None
edge tension actor generator according to specs, if any
- classmethod normal_stress() _vertex_solver_NormalStress | None
normal stress actor generator according to specs, if any
- classmethod perimeter_constaint() _vertex_solver_PerimeterConstraint | None
perimeter constaint actor generator according to specs, if any
- classmethod surface_area_constaint() _vertex_solver_SurfaceAreaConstraint | None
surface area constaint actor generator according to specs, if any
- classmethod surface_traction() _vertex_solver_SurfaceTraction | None
surface traction actor generator according to specs, if any
- static bind_adhesion(specs: List[Type]) Dict[str, Dict[str, _vertex_solver_Adhesion]]
Bind adhesion to all registered types according to all passed specifications
- class tissue_forge.models.vertex.solver.SurfaceType(MeshObjType)
Mesh surface type.
Can be used as a factory to create mesh surface instances with processes and properties that correspond to the type.
Overload 1:
Construct a new surface type
- Parameters:
flatLam (float) – parameter for flat surface constraint
convexLam (float) – parameter for convex surface constraint
- Overload 2:
Construct a new surface type
- property name
Name of this surface type
- property registered: bool
Tests whether this type is registered
- property style
The style of the surface type
- property density
Mass density; only used in 2D simulation
- property normal_stresses
normal stresses bound to the type
- property surface_area_constraints
surface area constraints bound to the type
- property surface_tractions
surface tractions bound to the type
- property edge_tensions
edge tensions bound to the type
- property adhesions
adhesions bound to the type
- property convex_polygon_constraints
convex polygon constraints bound to the type
- property flat_surface_constraints
flat surface constraints bound to the type
- toString() std::string
Get a JSON string representation
- static fromString(str: std::string const &) TissueForge::models::vertex::SurfaceType *
Create from a JSON string representation.
The returned type is automatically registered with the solver.
- Parameters:
str (string) – a string, as returned by
toString
- static find_from_name(_name: std::string const &) TissueForge::models::vertex::SurfaceType *
Get a registered type by name
- Parameters:
_name (string) – type name
- register_type() HRESULT
Registers a type with the engine.
Note that this occurs automatically, unless noReg==true in constructor.
- get() TissueForge::models::vertex::SurfaceType *
Get the type engine instance
- add(i: _vertex_solver_SurfaceHandle) HRESULT
Add an instance
- Parameters:
i (
SurfaceHandle
) – instance to add
- remove(i: _vertex_solver_SurfaceHandle) HRESULT
Remove an instance
- Parameters:
i (
SurfaceHandle
) – instance to remove
- n_polygon(n: int, center, radius: float, ax1, ax2)
Construct a N-sided polygonal surface of this type
- Parameters:
n – number of vertices
center – center of polygon
radius – radius of circle for placing vertices
ax1 – first axis defining the plane of the polygon
ax2 – second axis defining the plane of the polygon
- replace(to_replace, len_cfs)
Replace a vertex with a surface. Vertices are created for the surface along every destroyed edge.
- Parameters:
to_replace – vertex to replace
len_cfs – coefficient in (0, 1) along each connected edge defining how far to construct a new vertex
- __call__(vertices=None, positions=None, face_data=None)
Construct a surface of this type
- Parameters:
vertices – a list of vertices
positions – a list of positions
face_data – 3DF face data
- __str__() str
Return str(self).
- __lt__(rhs) bool
Return self<value.
- __gt__(rhs) bool
Return self>value.
- __le__(rhs) bool
Return self<=value.
- __ge__(rhs) bool
Return self>=value.
- __eq__(rhs) bool
Return self==value.
- __ne__(rhs) bool
Return self!=value.
- __len__() int
- __getitem__(index: int)
- __contains__(item)
Body
- class tissue_forge.models.vertex.solver.Body
The mesh body is a volume-enclosing object of mesh surfaces.
The mesh body consists of at least four mesh surfaces.
The mesh body can have a state vector, which represents a uniform amount of substance enclosed in the volume of the body.
- property id: int
- property actors
Object actors
- property surfaces
Surfaces that define the body
- property vertices
Vertices that define the body
- property connected_bodies
bodies in contact
- property adjacent_bodies
adjacent bodies
- property density
density of the body
- property centroid
centroid of the body
- property velocity
velocity of the body
- property area
area of the body
- property volume
volume of the body
- property mass
mass of the body
- property body_forces
body forces bound to the body
- property surface_area_constraints
surface area constraints bound to the body
- property volume_constraints
volume constraints bound to the body
- static create(*args) TissueForge::models::vertex::BodyHandle
Overload 1: Construct a body from a set of surfaces
Overload 2: Construct a body from a mesh
- definedBy(*args) bool
- destroy() HRESULT
- validate() bool
- position_changed() HRESULT
- toString() std::string
Get a JSON string representation
- update_internals() void
Update all internal data and parents
- replace(toInsert: _vertex_solver_Surface, toRemove: _vertex_solver_Surface) HRESULT
Replace a surface with a surface
- type() TissueForge::models::vertex::BodyType *
Get the body type
- become(btype: _vertex_solver_BodyType) HRESULT
Become a different type
- Parameters:
btype (
BodyType
) – the type to become
- find_vertex(dir: fVector3) TissueForge::models::vertex::Vertex *
Find a vertex that defines this body
- Parameters:
dir (
FVector3
) – direction to look with respect to the centroid
- find_surface(dir: fVector3) TissueForge::models::vertex::Surface *
Find a surface that defines this body
- Parameters:
dir (
FVector3
) – direction to look with respect to the centroid
- neighbor_surfaces(s: _vertex_solver_Surface) std::vector< TissueForge::models::vertex::Surface *,std::allocator< TissueForge::models::vertex::Surface * > >
Get the neighboring surfaces of a surface on this body.
Two surfaces are a neighbor on this body if they define the body and share a vertex
- Parameters:
s (
Surface
) – a surface of the body
- get_vertex_area(v: _vertex_solver_Vertex) FloatP_t
Get the surface area contribution of a vertex to this body
- Parameters:
v (
Vertex
) – a vertex
- get_vertex_volume(v: _vertex_solver_Vertex) FloatP_t
Get the volume contribution of a vertex to this body
- Parameters:
v (
Vertex
) – a vertex
- get_vertex_mass(v: _vertex_solver_Vertex) FloatP_t
Get the mass contribution of a vertex to this body
- Parameters:
v (
Vertex
) – a vertex
- find_interface(b: _vertex_solver_Body) std::vector< TissueForge::models::vertex::Surface *,std::allocator< TissueForge::models::vertex::Surface * > >
Get the surfaces that define the interface between this body and another body
- Parameters:
b (
Body
) – a body
- contact_area(other: _vertex_solver_Body) FloatP_t
Get the contacting surface area of this body with another body
- Parameters:
other (
Body
) – a body
Get the vertices that define both this body and another body
- Parameters:
other (
Body
) – a body
- is_outside(pos: fVector3) bool
Test whether a point is outside. Test is performed using the nearest surface
- Parameters:
pos (
FVector3
) – position- Return type:
boolean
- Returns:
true if the point is outside
- split(cp_pos: fVector3, cp_norm: fVector3, stype: _vertex_solver_SurfaceType = None) TissueForge::models::vertex::Body *
Split into two bodies. The split is defined by a cut plane
- Parameters:
cp_pos (
FVector3
) – position on the cut planecp_norm (
FVector3
) – cut plane normalstype (
SurfaceType
) – type of newly created surface. taken from connected surfaces if not specified
- classmethod destroy_c(b)
Destroy a body.
Any resulting surfaces without a body are also destroyed.
- Parameters:
b – body to destroy or its handle
- __str__() str
Return str(self).
- __lt__(rhs) bool
Return self<value.
- __gt__(rhs) bool
Return self>value.
- __le__(rhs) bool
Return self<=value.
- __ge__(rhs) bool
Return self>=value.
- __eq__(rhs) bool
Return self==value.
- __ne__(rhs) bool
Return self!=value.
- class tissue_forge.models.vertex.solver.BodyHandle(_id: int const & = -1)
A handle to a
Body
.The engine allocates
Body
memory in blocks, andBody
values get moved around all the time, so their addresses change.This is a safe way to work with a
Body
.- property id
- property surfaces
surfaces that define the body
- property vertices
vertices that define the body
- property connected_bodies
bodies in contact
- property adjacent_bodies
adjacent bodies
- property density
density of the body
- property centroid
centroid of the body
- property velocity
velocity of the body
- property area
area of the body
- property volume
volume of the body
- property mass
mass of the body
- property body_forces
body forces bound to the body
- property surface_area_constraints
surface area constraints bound to the body
- property volume_constraints
volume constraints bound to the body
- definedBy(*args) bool
Overload 1:
Test whether defined by a vertex
- Parameters:
v (
VertexHandle
) – a vertex- Return type:
boolean
- Returns:
true if defined by a vertex
Overload 2:
Test whether defined by a surface
- Parameters:
s (
SurfaceHandle
) – a surface- Return type:
boolean
- Returns:
true if defined by a surface
- destroy() HRESULT
Destroy the body.
- validate() bool
Validate the body
- position_changed() HRESULT
Update internal data due to a change in position
- toString() std::string
Get a JSON string representation
- static fromString(s: std::string const &) TissueForge::models::vertex::BodyHandle
Create an instance from a JSON string representation
- Parameters:
s (string) – a JSON string
- add(s: _vertex_solver_SurfaceHandle) HRESULT
Add a surface
- Parameters:
s (
SurfaceHandle
) – a surface
- remove(s: _vertex_solver_SurfaceHandle) HRESULT
Remove a surface
- Parameters:
s (
SurfaceHandle
) – a surface
- replace(toInsert: _vertex_solver_SurfaceHandle, toRemove: _vertex_solver_SurfaceHandle) HRESULT
Replace a surface with a surface
- Parameters:
toInsert (
SurfaceHandle
) – surface to inserttoRemove (
SurfaceHandle
) – surface to remove
- type() TissueForge::models::vertex::BodyType *
Get the body type
- become(btype: _vertex_solver_BodyType) HRESULT
Become a different type
- Parameters:
btype (
BodyType
) – the type to become
- find_vertex(dir: fVector3) TissueForge::models::vertex::VertexHandle
Find a vertex that defines this body
- Parameters:
dir (
FVector3
) – direction to look with respect to the centroid
- find_surface(dir: fVector3) TissueForge::models::vertex::SurfaceHandle
Find a surface that defines this body
- Parameters:
dir (
FVector3
) – direction to look with respect to the centroid
- neighbor_surfaces(s: _vertex_solver_SurfaceHandle) std::vector< TissueForge::models::vertex::SurfaceHandle,std::allocator< TissueForge::models::vertex::SurfaceHandle > >
Get the neighboring surfaces of a surface on this body.
Two surfaces are a neighbor on this body if they define the body and share a vertex
- Parameters:
s (
SurfaceHandle
) – a surface of the body
- get_vertex_area(v: _vertex_solver_VertexHandle) FloatP_t
Get the surface area contribution of a vertex to this body
- Parameters:
v (
VertexHandle
) – a vertex
- get_vertex_volume(v: _vertex_solver_VertexHandle) FloatP_t
Get the volume contribution of a vertex to this body
- Parameters:
v (
VertexHandle
) – a vertex
- get_vertex_mass(v: _vertex_solver_VertexHandle) FloatP_t
Get the mass contribution of a vertex to this body
- Parameters:
v (
VertexHandle
) – a vertex
- find_interface(b: _vertex_solver_BodyHandle) std::vector< TissueForge::models::vertex::SurfaceHandle,std::allocator< TissueForge::models::vertex::SurfaceHandle > >
Get the surfaces that define the interface between this body and another body
- Parameters:
b (
BodyHandle
) – a body
- contact_area(other: _vertex_solver_BodyHandle) FloatP_t
Get the contacting surface area of this body with another body
- Parameters:
other (
BodyHandle
) – a body
Get the vertices that define both this body and another body
- Parameters:
other (
BodyHandle
) – a body
- is_outside(pos: fVector3) bool
Test whether a point is outside. Test is performed using the nearest surface
- Parameters:
pos (
FVector3
) – position- Return type:
boolean
- Returns:
true if the point is outside
- split(cp_pos: fVector3, cp_norm: fVector3, stype: _vertex_solver_SurfaceType = None) TissueForge::models::vertex::BodyHandle
Split into two bodies. The split is defined by a cut plane
- Parameters:
cp_pos (
FVector3
) – position on the cut planecp_norm (
FVector3
) – cut plane normalstype (
SurfaceType
) – type of newly created surface. taken from connected surfaces if not specified
- __str__() str
Return str(self).
- __lt__(rhs) bool
Return self<value.
- __gt__(rhs) bool
Return self>value.
- __le__(rhs) bool
Return self<=value.
- __ge__(rhs) bool
Return self>=value.
- __eq__(rhs) bool
Return self==value.
- __ne__(rhs) bool
Return self!=value.
- class tissue_forge.models.vertex.solver.BodyTypeSpec
Interface for class-centric design of BodyType
- density: float | None = None
Mass density
- surface_area_lam: float | None = None
Surface area constraint Lagrange multiplier
- surface_area_val: float | None = None
Surface area constraint target value
- volume_lam: float | None = None
Volume constraint Lagrange multiplier
- volume_val: float | None = None
Volume constraint target value
- adhesion: Dict[str, float] | None = None
Adhesion by name and parameter
- classmethod get() _vertex_solver_BodyType
Get the engine type that corresponds to this class.
The type is automatically registered as necessary.
- Returns:
registered type instance
- classmethod body_force() _vertex_solver_BodyForce | None
body force actor generator according to specs, if any
- classmethod surface_area_constaint() _vertex_solver_SurfaceAreaConstraint | None
surface area constaint actor generator according to specs, if any
- classmethod volume_constraint() _vertex_solver_VolumeConstraint | None
volume constraint actor generator according to specs, if any
- static bind_adhesion(specs: List[Type]) Dict[str, Dict[str, _vertex_solver_Adhesion]]
Bind adhesion to all registered types according to all passed specifications
- class tissue_forge.models.vertex.solver.BodyType(MeshObjType)
Mesh body type
Can be used as a factory to create mesh body instances with processes and properties that correspond to the type.
- property name
Name of this body type
- property registered: bool
Tests whether this type is registered
- property density
Mass density
- property instances
List of instances that belong to this type
- property instance_ids
List of instance ids that belong to this type
- property num_instances: int
Number of instances that belong to this type
- property body_forces
body forces bound to the type
- property surface_area_constraints
surface area constraints bound to the type
- property volume_constraints
volume constraints bound to the type
- toString() std::string
Get a JSON string representation
- static fromString(str: std::string const &) TissueForge::models::vertex::BodyType *
Create from a JSON string representation.
The returned type is automatically registered with the solver.
- Parameters:
str (string) – a string, as returned by
toString
- static find_from_name(_name: std::string const &) TissueForge::models::vertex::BodyType *
Get a registered type by name
- register_type() HRESULT
Registers a type with the engine.
Note that this occurs automatically, unless noReg==true in constructor.
- get() TissueForge::models::vertex::BodyType *
Get the type engine instance
- add(i: _vertex_solver_BodyHandle) HRESULT
Add an instance
- Parameters:
i (
BodyHandle
) – instance
- remove(i: _vertex_solver_BodyHandle) HRESULT
Remove an instance
- Parameters:
i (
BodyHandle
) – instance
- __call__(*args) TissueForge::models::vertex::BodyHandle
Overload 1:
Construct a body of this type from a set of surfaces
Overload 2:
Construct a body of this type from a mesh
- extend(base: _vertex_solver_SurfaceHandle, pos: fVector3) TissueForge::models::vertex::BodyHandle
Create a body from a surface in the mesh and a position
- Parameters:
base (
SurfaceHandle
) – surfacepos (
FVector3
) – position
- extrude(base: _vertex_solver_SurfaceHandle, normLen: FloatP_t const &) TissueForge::models::vertex::BodyHandle
Create a body from a surface in a mesh by extruding along the outward-facing normal of the surface
todo: add support for extruding at an angle
- Parameters:
base (
SurfaceHandle
) – surfacenormLen (float) – length along which to extrude
- __str__() str
Return str(self).
- __lt__(rhs) bool
Return self<value.
- __gt__(rhs) bool
Return self>value.
- __le__(rhs) bool
Return self<=value.
- __ge__(rhs) bool
Return self>=value.
- __eq__(rhs) bool
Return self==value.
- __ne__(rhs) bool
Return self!=value.
- __len__() int
- __getitem__(index: int)
- __contains__(item)
Mesh
- class tissue_forge.models.vertex.solver.Mesh
Contains all
Vertex
,Surface
andBody
instances- property has_quality: bool
Test whether the mesh has automatic quality maintenance
- property quality_working: bool
Test whether mesh quality is currently being improved
- property quality
Quality maintenance
- property num_vertices: int
Number of vertices
- property num_surfaces: int
Number of surfaces
- property num_bodies: int
Number of bodies
- property size_vertices: int
Size of the list of vertices
- property size_surfaces: int
Size of the list of surfaces
- property size_bodies: int
Size of the list of bodies
- property is_3d: bool
Test whether the mesh is 3D. A 3D mesh has at least one body
- toString() std::string
Get a JSON string representation
- ensure_available_vertices(numAlloc: size_t const &) HRESULT
Ensure that there are a given number of allocated vertices
- Parameters:
numAlloc (int) – a given number of allocated vertices
- ensure_available_surfaces(numAlloc: size_t const &) HRESULT
Ensure that there are a given number of allocated surfaces
- Parameters:
numAlloc (int) – a given number of allocated surfaces
- ensure_available_bodies(numAlloc: size_t const &) HRESULT
Ensure that there are a given number of allocated bodies
- Parameters:
numAlloc (int) – a given number of allocated bodies
- create(*args) HRESULT
Overload 1:
Create a vertex
- Parameters:
obj (
Vertex
) – a vertex to populatepid (int) – the id of the underlying particle
Overload 2:
Create a surface
- Parameters:
obj (
Surface
) – a surface to populate
Overload 3:
Create a body
- Parameters:
obj (
Body
) – a body to populate
- static get() TissueForge::models::vertex::Mesh *
Get the mesh
- lock() void
Locks the mesh for thread-safe operations
- unlock() void
Unlocks the mesh for thread-safe operations
- find_vertex(pos: fVector3, tol: FloatP_t const & = 0.0001) TissueForge::models::vertex::Vertex *
Find a vertex in this mesh
- Parameters:
pos (
FVector3
) – position to looktol (float) – distance tolerance
- Return type:
- Returns:
a vertex within the distance tolerance of the position, otherwise NULL
- get_vertex_by_pid(pid: unsigned int const &) TissueForge::models::vertex::Vertex *
Get the vertex for a given particle id
- Parameters:
pid (int) – particle id
- get_vertex(idx: unsigned int const &) TissueForge::models::vertex::Vertex *
Get the vertex at a location in the list of vertices
- Parameters:
idx (int) – location in the list
- get_surface(idx: unsigned int const &) TissueForge::models::vertex::Surface *
Get the surface at a location in the list of surfaces
- Parameters:
idx (int) – location in the list
- get_body(idx: unsigned int const &) TissueForge::models::vertex::Body *
Get the body at a location in the list of bodies
- Parameters:
idx (int) – location in the list
- validate() bool
Validate state of the mesh
- Return type:
boolean
- Returns:
true if in a valid state
- make_dirty() HRESULT
Manually notify that the mesh has been changed
- connected(*args) bool
Overload 1:
Check whether two vertices are connected
- Parameters:
- Return type:
boolean
- Returns:
true if the two vertices are connected
Overload 2:
Check whether two surfaces are connected
- Parameters:
v1 – first surface
v2 – second surface
- Return type:
boolean
- Returns:
true if the two surfaces are connected
Overload 3:
Check whether two bodies are connected
- Parameters:
v1 – first body
v2 – second body
- Return type:
boolean
- Returns:
true if the two bodies are connected
- remove(*args) HRESULT
Overload 1:
Remove a vertex from the mesh; all dependent surfaces and bodies are also removed
- Parameters:
v (
Vertex
) – a vertex
Overload 2:
Remove a surface from the mesh; all dependent bodies are also removed
- Parameters:
s (
Surface
) – a surface
Overload 3:
Remove a body from the mesh
- Parameters:
b (
Body
) – a body
- __str__() str
Return str(self).
Actors
- class tissue_forge.models.vertex.solver.Adhesion(_lam: FloatP_t const & = 0)
Models adhesion between pairs of ‘Surface’ or ‘Body’ instances by type.
Adhesion is implemented for two-dimensional objects as minimization of the Hamiltonian,
\[\lambda L\]Here \(\lambda\) is a parameter and \(L\) is the length of edges shared by two objects.
Adhesion is implemented for three-dimensional objects as minimization of the Hamiltonian,
\[\lambda A\]Here \(A\) is the area shared by two objects.
- property lam
Adhesion value. Higher values result in weaker adhesivity.
- energy(*args) FloatP_t
Overload 1:
Calculate the energy of a source object acting on a target object
Overload 2:
Calculate the energy of a source object acting on a target object
- force(*args) TissueForge::FVector3
Overload 1:
Calculate the force that a source object exerts on a target object
Overload 2:
Calculate the force that a source object exerts on a target object
- class tissue_forge.models.vertex.solver.BodyForce(*args, **kwargs)
Imposes a body force on
Body
instances- property comps
Force components
- energy(source: _vertex_solver_Body, target: _vertex_solver_Vertex) FloatP_t
Calculate the energy of a source object acting on a target object
- class tissue_forge.models.vertex.solver.EdgeTension(lam: FloatP_t const & = 0, order: unsigned int const & = 1)
Models tension between connected vertices.
Edge tension is implemented for two-dimensional objects as minimization of the Hamiltonian,
\[\lambda L^n\]Here \(\lambda\) is a parameter, \(L\) is the length of an edge shared by two objects and \(n > 0\) is the order of the model.
- property lam
Tension value
- property order
Order of distance measurement
- energy(source: _vertex_solver_Surface, target: _vertex_solver_Vertex) FloatP_t
Calculate the energy of a source object acting on a target object
- class tissue_forge.models.vertex.solver.NormalStress(_mag: FloatP_t const & = 0)
Models a stress acting on a
Surface
along its normal- property mag
Magnitude
- energy(source: _vertex_solver_Surface, target: _vertex_solver_Vertex) FloatP_t
Calculate the energy of a source object acting on a target object
- class tissue_forge.models.vertex.solver.PerimeterConstraint(_lam: FloatP_t const & = 0, _constr: FloatP_t const & = 0)
Imposes a perimeter constraint on ‘Surface’ instances.
The perimeter constraint is implemented for two-dimensional objects as minimization of the Hamiltonian,
\[\lambda \left( L - L_o \]ight)^2
Here \(\lambda\) is a parameter, \(L\) is the perimeter of an object and \(L_o\) is a target perimeter.
- property lam
Constraint value
- property constr
Target perimeter
- energy(source: _vertex_solver_Surface, target: _vertex_solver_Vertex) FloatP_t
Calculate the energy of a source object acting on a target object
- class tissue_forge.models.vertex.solver.SurfaceAreaConstraint(_lam: FloatP_t const & = 0, _constr: FloatP_t const & = 0)
Imposes a surface area constraint on ‘Body’ or ‘Surface’ instances.
The surface area constraint is implemented for two- and three-dimensional objects as minimization of the Hamiltonian,
\[\lambda \left( A - A_o \]ight)^2
Here \(\lambda\) is a parameter, \(A\) is the area an object and \(A_o\) is a target area.
- property lam
Constraint value
- property constr
Target area
- energy(*args) FloatP_t
Overload 1:
Calculate the energy of a source object acting on a target object
Overload 2:
Calculate the energy of a source object acting on a target object
- force(*args) TissueForge::FVector3
Overload 1:
Calculate the force that a source object exerts on a target object
Overload 2:
Calculate the force that a source object exerts on a target object
- class tissue_forge.models.vertex.solver.SurfaceTraction(*args, **kwargs)
Models a traction force
- property comps
Force components
- energy(source: _vertex_solver_Surface, target: _vertex_solver_Vertex) FloatP_t
Calculate the energy of a source object acting on a target object
- class tissue_forge.models.vertex.solver.VolumeConstraint(_lam: FloatP_t const & = 0, _constr: FloatP_t const & = 0)
Imposes a volume constraint.
The volume constraint is implemented for three-dimensional objects as minimization of the Hamiltonian,
\[\lambda \left( V - V_o \]ight)^2
Here \(\lambda\) is a parameter, \(V\) is the volume an object and \(V_o\) is a target volume.
- property lam
Constraint value
- property constr
Target volume
- energy(source: _vertex_solver_Body, target: _vertex_solver_Vertex) FloatP_t
Calculate the energy of a source object acting on a target object
Binding
- tissue_forge.models.vertex.solver.bind.body(*args)
Bind an actor to either a body or body type
- Parameters:
args – an actor and either a body or body type
- tissue_forge.models.vertex.solver.bind.surface(*args)
Bind an actor to either a surface or surface type
- Parameters:
args – an actor and either a body or body type
- tissue_forge.models.vertex.solver.bind.types(a: MeshObjTypePairActor, type1: _vertex_solver_MeshObjType, type2: _vertex_solver_MeshObjType) HRESULT
Bind an actor to a pair of object types
- Parameters:
a (
MeshObjTypePairActor
) – actortype1 (
MeshObjType
) – first object typetype2 (
MeshObjType
) – second object type
Mesh Generators
- tissue_forge.models.vertex.solver.create_quad_mesh(*args, **kwargs) std::vector< std::vector< TissueForge::models::vertex::SurfaceHandle,std::allocator< TissueForge::models::vertex::SurfaceHandle > >,std::allocator< std::vector< TissueForge::models::vertex::SurfaceHandle,std::allocator< TissueForge::models::vertex::SurfaceHandle > > > >
Populate the mesh with quadrilateral surfaces.
Requires an initialized solver.
- Parameters:
stype (
SurfaceType
) – surface typestartPos (
FVector3
) – starting positionnum_1 (int) – number of elements in the first direction
num_2 (int) – number of elements in the second direction
len_1 (float) – length of each element in the first direction
len_2 (float) – length of each element in the second direction
ax_1 (string) – axis name of the first direction (e.g., “x”)
ax_2 (string) – axis name of the second direction
- Return type:
std::vector< std::vector< TissueForge::models::vertex::SurfaceHandle,std::allocator< TissueForge::models::vertex::SurfaceHandle > >,std::allocator< std::vector< TissueForge::models::vertex::SurfaceHandle,std::allocator< TissueForge::models::vertex::SurfaceHandle > > > >
- Returns:
constructed surfaces
- tissue_forge.models.vertex.solver.create_plpd_mesh(*args, **kwargs) std::vector< std::vector< std::vector< TissueForge::models::vertex::BodyHandle,std::allocator< TissueForge::models::vertex::BodyHandle > >,std::allocator< std::vector< TissueForge::models::vertex::BodyHandle,std::allocator< TissueForge::models::vertex::BodyHandle > > > >,std::allocator< std::vector< std::vector< TissueForge::models::vertex::BodyHandle,std::allocator< TissueForge::models::vertex::BodyHandle > >,std::allocator< std::vector< TissueForge::models::vertex::BodyHandle,std::allocator< TissueForge::models::vertex::BodyHandle > > > > > >
Populate the mesh with parallelepiped bodies.
Requires an initialized solver.
- Parameters:
btype (
BodyType
) – body typestype (
SurfaceType
) – surface typestartPos (
FVector3
) – starting positionnum_1 (int) – number of elements in the first direction
num_2 (int) – number of elements in the second direction
num_3 (int) – number of elements in the third direction
len_1 (float) – length of each element in the first direction
len_2 (float) – length of each element in the second direction
len_3 (float) – length of each element in the third direction
ax_1 (string) – axis name of the first direction (e.g., “x”)
ax_2 (string) – axis name of the second direction
- Return type:
std::vector< std::vector< std::vector< TissueForge::models::vertex::BodyHandle,std::allocator< TissueForge::models::vertex::BodyHandle > >,std::allocator< std::vector< TissueForge::models::vertex::BodyHandle,std::allocator< TissueForge::models::vertex::BodyHandle > > > >,std::allocator< std::vector< std::vector< TissueForge::models::vertex::BodyHandle,std::allocator< TissueForge::models::vertex::BodyHandle > >,std::allocator< std::vector< TissueForge::models::vertex::BodyHandle,std::allocator< TissueForge::models::vertex::BodyHandle > > > > > >
- Returns:
constructed bodies
- tissue_forge.models.vertex.solver.create_hex2d_mesh(*args, **kwargs) std::vector< std::vector< TissueForge::models::vertex::SurfaceHandle,std::allocator< TissueForge::models::vertex::SurfaceHandle > >,std::allocator< std::vector< TissueForge::models::vertex::SurfaceHandle,std::allocator< TissueForge::models::vertex::SurfaceHandle > > > >
Populate the mesh with hexagonal surfaces.
Requires an initialized solver.
- Parameters:
stype (
SurfaceType
) – surface typestartPos (
FVector3
) – starting positionnum_1 (int) – number of elements in the first direction
num_2 (int) – number of elements in the second direction
hexRad (float) – radius of hexagon vertices
ax_1 (string) – axis name of the first direction (e.g., “x”)
ax_2 (string) – axis name of the second direction
- Return type:
std::vector< std::vector< TissueForge::models::vertex::SurfaceHandle,std::allocator< TissueForge::models::vertex::SurfaceHandle > >,std::allocator< std::vector< TissueForge::models::vertex::SurfaceHandle,std::allocator< TissueForge::models::vertex::SurfaceHandle > > > >
- Returns:
constructed surfaces
- tissue_forge.models.vertex.solver.create_hex3d_mesh(*args, **kwargs) std::vector< std::vector< std::vector< TissueForge::models::vertex::BodyHandle,std::allocator< TissueForge::models::vertex::BodyHandle > >,std::allocator< std::vector< TissueForge::models::vertex::BodyHandle,std::allocator< TissueForge::models::vertex::BodyHandle > > > >,std::allocator< std::vector< std::vector< TissueForge::models::vertex::BodyHandle,std::allocator< TissueForge::models::vertex::BodyHandle > >,std::allocator< std::vector< TissueForge::models::vertex::BodyHandle,std::allocator< TissueForge::models::vertex::BodyHandle > > > > > >
Populate the mesh with bodies from extruded hexagonal surfaces.
Requires an initialized solver.
Surfaces are placed in the plane of the first and second directions, and extruded along the third direction.
- Parameters:
btype (
BodyType
) – body typestype (
SurfaceType
) – surface typestartPos (
FVector3
) – starting positionnum_1 (int) – number of elements in the first direction
num_2 (int) – number of elements in the second direction
num_3 (int) – number of elements in the third directionnumber of elements in the third direction
hexRad (float) – radius of hexagon vertices
hex_height (float) – extrusion length per body
ax_1 (string) – axis name of the first direction (e.g., “x”)
ax_2 (string) – axis name of the second direction
- Return type:
std::vector< std::vector< std::vector< TissueForge::models::vertex::BodyHandle,std::allocator< TissueForge::models::vertex::BodyHandle > >,std::allocator< std::vector< TissueForge::models::vertex::BodyHandle,std::allocator< TissueForge::models::vertex::BodyHandle > > > >,std::allocator< std::vector< std::vector< TissueForge::models::vertex::BodyHandle,std::allocator< TissueForge::models::vertex::BodyHandle > >,std::allocator< std::vector< TissueForge::models::vertex::BodyHandle,std::allocator< TissueForge::models::vertex::BodyHandle > > > > > >
- Returns:
constructed bodies
Quality
- class tissue_forge.models.vertex.solver.Quality(vertexMergeDistCf: FloatP_t const & = 0.0001, surfaceDemoteAreaCf: FloatP_t const & = 0.0001, bodyDemoteVolumeCf: FloatP_t const & = 0.0001, _edgeSplitDistCf: FloatP_t const & = 2.0)
An object that schedules topological operations on a mesh to maintain its quality
- property vertex_merge_distance: float
Distance below which two vertices are scheduled for merging
- property surface_demote_area: float
Area below which a surface is scheduled to become a vertex
- property body_demote_volume: float
Volume below which a body is scheduled to become a vertex
- property edge_split_distance: float
Distance at which two vertices are seperated when a vertex is split
- property collision_2d: bool
Whether 2D collisions are implemented
- toString() std::string
Get a JSON string representation
- static fromString(s: std::string const &) TissueForge::models::vertex::MeshQuality
Create an instance from a JSON string representation
- Parameters:
s (string) – JSON string representation
- do_quality() HRESULT
Perform quality operations work
- working() bool const
Test whether quality operations are being done
- Return type:
boolean
- Returns:
true if quality operations are being done
- __str__() str
Return str(self).
Logging
- class tissue_forge.models.vertex.solver.Logger
The Tissue Forge vertex model solver logger.
- static clear() HRESULT
Clear the log
- static log(event: MeshLogEvent) HRESULT
Add a log event to the log
- Parameters:
event (
MeshLogEvent
) – a log event
- static events() std::vector< TissueForge::models::vertex::MeshLogEvent,std::allocator< TissueForge::models::vertex::MeshLogEvent > >
Get the list of log events
- static getForwardLogging() bool
Test whether the logger is fowarding log events to the main Tissue Forge logger
- static setForwardLogging(_forward: bool const &) HRESULT
Set whether to foward log events to the main Tissue Forge logger
- Parameters:
_forward (boolean) – flag indicating whether to foward log events
- static getLogLevel() TissueForge::LogLevel
Get the current log level
- static setLogLevel(_level: TissueForge::LogLevel const &) HRESULT
Set the current log level
- Parameters:
_level (int) – the current log level