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, current=True)

Gets the AB polarity vector of a cell

Parameters:
  • pId (int) – particle id

  • current (boolean, optional) – current value flag; default true

Return type:

FVector3

Returns:

FVector3

tissue_forge.models.center.cell_polarity.getVectorPCP(pId, current=True)

Gets the PCP polarity vector of a cell

Parameters:
  • pId (int) – particle id

  • current (boolean, optional) – current value flag; default true

Return type:

FVector3

Returns:

FVector3

tissue_forge.models.center.cell_polarity.setVectorAB(pId, pVec, current=True, init=False)

Sets the AB polarity vector of a cell

Parameters:
  • pId (int) – particle id

  • pVec (FVector3) – vector value

  • current (boolean, optional) – current value flag; default true

  • init (boolean, optional) – initialization flag; default false

tissue_forge.models.center.cell_polarity.setVectorPCP(pId, pVec, current=True, init=False)

Sets the PCP polarity vector of a cell

Parameters:
  • pId (int) – particle id

  • pVec (FVector3) – vector value

  • current (boolean, optional) – current value flag; default true

  • init (boolean, optional) – initialization flag; default false

tissue_forge.models.center.cell_polarity.registerParticle(ph)

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)

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)

Registers a particle type as polar.

This must be called on a particle type before any other type-specific operations.

Parameters:
  • pType (ParticleType) – particle type

  • initMode (string, optional) – initialization mode for particles of this type

  • initPolarAB (FVector3, optional) – initial value of AB polarity vector; only used when initMode=”value”

  • initPolarPCP (FVector3, optional) – initial value of PCP polarity vector; only used when initMode=”value”

tissue_forge.models.center.cell_polarity.getInitMode(pType)

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, value)

Sets the name of the initialization mode of a type

Parameters:
  • pType (ParticleType) – a type

  • value (string) – initialization mode

tissue_forge.models.center.cell_polarity.getInitPolarAB(pType)

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, value)

Sets the initial AB polar vector of a type

Parameters:
  • pType (ParticleType) – a type

  • value (FVector3) – initial AB polar vector

tissue_forge.models.center.cell_polarity.getInitPolarPCP(pType)

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, value)

Sets the initial PCP polar vector of a type

Parameters:
  • pType (ParticleType) – a type

  • value (FVector3) – initial PCP polar vector

tissue_forge.models.center.cell_polarity.createPersistentForce(sensAB=0.0, sensPCP=0.0)

Creates a persistent polarity force.

Parameters:
  • sensAB (float, optional) – sensitivity to AB vector

  • sensPCP (float, optional) – sensitivity to PCP vector

Return type:

PersistentForce

Returns:

PersistentForce*

tissue_forge.models.center.cell_polarity.setDrawVectors(_draw)

Toggles whether polarity vectors are rendered

Parameters:

_draw (boolean) – rendering flag; vectors are rendered when true

tissue_forge.models.center.cell_polarity.setArrowColors(colorAB, colorPCP)

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)

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)

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()

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)

Creates a contact-mediated polarity potential

Parameters:
  • cutoff (float) – cutoff distance

  • mag (float, optional) – magnitude of force

  • rate (float, optional) – rate of state vector dynamics

  • distanceCoeff (float, optional) – distance coefficient

  • couplingFlat (float, optional) – flat coupling coefficient

  • couplingOrtho (float, optional) – orthogonal coupling coefficient

  • couplingLateral (float, optional) – lateral coupling coefficient

  • contactType (string, optional) – type of contact; available are regular, isotropic, anisotropic

  • bendingCoeff (float, optional) – bending coefficient

Return type:

ContactPotential

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

class tissue_forge.models.center.cell_polarity.PersistentForce(tissue_forge.Force)
sensAB

Proportionality of force to AB vector

sensPCP

Proportionality of force to PCP vector

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()

Initialize the solver

tissue_forge.models.vertex.solver.MeshParticleType_get()
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()

Reset the timers

str()

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()

Initialize the solver

static get()

Get the solver singleton

static compact()

Reduce internal buffers and storage

static engine_lock()

Locks the engine for thread-safe engine operations

static engine_unlock()

Unlocks the engine for thread-safe engine operations

static is_dirty()

Test whether the current mesh state needs updated

static set_dirty(_isDirty)

Set whether the current mesh state needs updated

static get_mesh()

Get the mesh

static register_type(*args)

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)

Find a registered surface type by name

Parameters:

_name (string) – type name

static find_body_from_name(_name)

Find a registered body type by name

Parameters:

_name (string) – type name

static get_body_type(typeId)

Get a body type by id

Parameters:

typeId (int) – type id

static get_surface_type(typeId)

Get a surface type by id

Parameters:

typeId (int) – type id

static num_body_types()

Get the number of registered body types

static num_surface_types()

Get the number of registered surface types

static num_vertices()

Get the number of vertices

static num_surfaces()

Get the number of surfaces

static num_bodies()

Get the number of bodies

static size_vertices()

Get the size of the list of vertices

static size_surfaces()

Get the size of the list of surfaces

static size_bodies()

Get the size of the list of bodies

static position_changed()

Update internal data due to a change in position

static update(_force=False)

Update the solver if dirty

Parameters:

_force (boolean, optional) – flag to force an update and ignore whether the solver is dirty

static get_log()

Get the current logger events

static log(*args, **kwargs)

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, optional) – name of event

static is_3d()

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)

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


Overload 4:

Create vertices

Parameters:

_pids (std::vector< unsigned int,std::allocator< unsigned int > >) – ids of underlying particles


Overload 5:

Create vertices

Parameters:

positions (std::vector< TissueForge::FVector3,std::allocator< TissueForge::FVector3 > >) – positions of vertices


Overload 6:

Create vertices

Parameters:

vdata (std::vector< TissueForge::io::ThreeDFVertexData *,std::allocator< TissueForge::io::ThreeDFVertexData * > >) – vertices

static destroy(*args)

Destroy instances

Parameters:

toDestroy (std::vector< TissueForge::models::vertex::Vertex *,std::allocator< TissueForge::models::vertex::Vertex * > >) – instances to destroy

validate()
position_changed()
defines(*args)
toString()

Get a JSON string representation

add(s)

Add a surface

Parameters:

s (Surface) – surface to add

insert(*args)

Overload 1:

Insert a surface at a location in the list of surfaces

Parameters:
  • s (Surface) – surface to insert

  • idx (int) – location in the list of surfaces


Overload 2:

Insert a surface before another surface

Parameters:
  • s (Surface) – a surface

  • before (Surface) – surface to insert before


Overload 3:

Inserts a vertex between two vertices

Parameters:
  • v1 (Vertex) – first vertex

  • v2 (Vertex) – second vertex


Overload 4:

Insert a vertex between a vertex and each of a set of vertices

Parameters:
  • vf (Vertex) – a vertex

  • nbs (std::vector< TissueForge::models::vertex::Vertex *,std::allocator< TissueForge::models::vertex::Vertex * > >) – 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)

Remove a surface

Parameters:

s (Surface) – surface to remove

replace(*args)

Overload 1:

Replace a surface at a location in the list of surfaces

Parameters:
  • toInsert (Surface) – a surface

  • idx (int) – a location in the list of surfaces


Overload 2:

Replace a surface with another surface

Parameters:
  • toInsert (Surface) – surface to insert

  • toRemove (Surface) – surface to remove


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)

Find a surface defined by this vertex

Parameters:

dir (FVector3) – direction to look with respect to the vertex

find_body(dir)

Find a body defined by this vertex

Parameters:

dir (FVector3) – direction to look with respect to the vertex

update_connected_vertices()

Update internal connected vertex data

shared_surfaces(other)

Get the surfaces that this vertex and another vertex both define

Parameters:

other (Vertex) – another vertex

update_properties()

Update the properties of the underlying particle

particle()

Get a handle to the underlying particle, if any

set_position(pos, updateChildren=True)

Set the current position

Parameters:
  • pos (FVector3) – position

  • updateChildren (boolean, optional) – flag indicating whether to update dependent objects

static transfer_bonds_to(*args)

Overload 1:

Transfer all bonds to another vertex

Parameters:

other (Vertex) – another vertex


Overload 2:

Transfer all bonds to other vertices

Parameters:

targets (std::vector< std::pair< TissueForge::models::vertex::Vertex *,TissueForge::models::vertex::Vertex * >,std::allocator< std::pair< TissueForge::models::vertex::Vertex *,TissueForge::models::vertex::Vertex * > > >) – target vertices; first element is source, second element is target

replace(*args)

Overload 1:

Replace a surface at a location in the list of surfaces

Parameters:
  • toInsert (Surface) – a surface

  • idx (int) – a location in the list of surfaces


Overload 2:

Replace a surface with another surface

Parameters:
  • toInsert (Surface) – surface to insert

  • toRemove (Surface) – surface to remove


Overload 3:

Replace a surface

Parameters:

toReplace (Surface) – surface to replace


Overload 4:

Replace a body

Parameters:

toReplace (Body) – a body

static merge(*args)

Overload 1:

Merge with a vertex.

The passed vertex is destroyed.

Parameters:
  • toRemove (Vertex) – vertex to remove

  • lenCf (float, optional) – distance coefficient in [0, 1] for where to place the vertex, from the kept vertex to the removed vertex


Overload 2:

Merge sets of vertices.

The first instance of each list absorbs the remaining vertices.

Parameters:
  • toMerge (std::vector< std::vector< TissueForge::models::vertex::Vertex *,std::allocator< TissueForge::models::vertex::Vertex * > >,std::allocator< std::vector< TissueForge::models::vertex::Vertex *,std::allocator< TissueForge::models::vertex::Vertex * > > > >) – sets of vertices to merge

  • lenCf (float, optional) – distance coefficient in [0, 1] for where to place the vertex, from the kept vertex to the removed vertex

insert(*args)

Overload 1:

Insert a surface at a location in the list of surfaces

Parameters:
  • s (Surface) – surface to insert

  • idx (int) – location in the list of surfaces


Overload 2:

Insert a surface before another surface

Parameters:
  • s (Surface) – a surface

  • before (Surface) – surface to insert before


Overload 3:

Inserts a vertex between two vertices

Parameters:
  • v1 (Vertex) – first vertex

  • v2 (Vertex) – second vertex


Overload 4:

Insert a vertex between a vertex and each of a set of vertices

Parameters:
  • vf (Vertex) – a vertex

  • nbs (std::vector< TissueForge::models::vertex::Vertex *,std::allocator< TissueForge::models::vertex::Vertex * > >) – a set of vertices

split(sep)

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:

Vertex

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=-1)

A handle to a Vertex.

The engine allocates Vertex memory in blocks, and Vertex values get moved around all the time, so their addresses change.

This is a safe way to work with a Vertex.

property id
property vertex

underlying Vertex instance, if any

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)

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()

Destroy the vertex

validate()

Validate the vertex

position_changed()

Update internal data due to a change in position

toString()

Get a JSON string representation

static fromString(s)

Create an instance from a JSON string representation

Parameters:

s (string) – JSON string

add(s)

Add a surface

Parameters:

s (SurfaceHandle) – surface to add

remove(s)

Remove a surface

Parameters:

s (SurfaceHandle) – surface to remove

find_surface(dir)

Find a surface defined by this vertex

Parameters:

dir (FVector3) – direction to look with respect to the vertex

find_body(dir)

Find a body defined by this vertex

Parameters:

dir (FVector3) – direction to look with respect to the vertex

update_connected_vertices()

Update internal connected vertex data

shared_surfaces(other)

Get the surfaces that this vertex and another vertex both define

Parameters:

other (VertexHandle) – another vertex

update_properties()

Update the properties of the underlying particle

particle()

Get a handle to the underlying particle, if any

set_position(pos, updateChildren=True)

Set the current position

Parameters:
  • pos (FVector3) – position

  • updateChildren (boolean, optional) – flag indicating whether to update dependent objects

transfer_bonds_to(other)

Transfer all bonds to another vertex

Parameters:

other (VertexHandle) – another vertex

merge(toRemove, lenCf=0.5)

Merge with a vertex.

The passed vertex is destroyed.

Parameters:
  • toRemove (VertexHandle) – vertex to remove

  • lenCf (float, optional) – distance coefficient in [0, 1] for where to place the vertex, from the kept vertex to the removed vertex

split(sep)

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:

VertexHandle

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)

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


Overload 3:

Construct surfaces from sets of vertices

Parameters:

_vertices (std::vector< std::vector< TissueForge::models::vertex::VertexHandle,std::allocator< TissueForge::models::vertex::VertexHandle > >,std::allocator< std::vector< TissueForge::models::vertex::VertexHandle,std::allocator< TissueForge::models::vertex::VertexHandle > > > >) – sets of vertices


Overload 4:

Construct surfaces from faces

Parameters:

_faces (std::vector< TissueForge::io::ThreeDFFaceData *,std::allocator< TissueForge::io::ThreeDFFaceData * > >) – faces

defines(obj)
definedBy(obj)
static destroy(*args)

Destroy surfaces.

Any resulting vertices without a surface are also destroyed.

Parameters:

target (std::vector< TissueForge::models::vertex::Surface *,std::allocator< TissueForge::models::vertex::Surface * > >) – handles to a surface to destroy

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()
position_changed()
toString()

Get a JSON string representation

add(*args)

Overload 1:

Add a vertex

Parameters:

v (Vertex) – vertex to add


Overload 2:

Add a body

Parameters:

b (Body) – body to add

remove(*args)

Overload 1:

Remove a vertex

Parameters:

v (Vertex) – vertex to remove


Overload 2:

Remove a body

Parameters:

b (Body) – body to remove

insert(*args)

Overload 1:

Insert a vertex at a location in the list of vertices

Parameters:
  • v (Vertex) – vertex to insert

  • idx (int) – location


Overload 2:

Insert a vertex before another vertex

Parameters:
  • v (Vertex) – vertex to insert

  • before (Vertex) – vertex to insert before


Overload 3:

Insert a vertex between two vertices

Parameters:
  • toInsert (Vertex) – vertex to insert

  • v1 (Vertex) – first vertex

  • v2 (Vertex) – second vertex

remove(*args)

Overload 1:

Remove a vertex

Parameters:

v (Vertex) – vertex to remove


Overload 2:

Remove a body

Parameters:

b (Body) – body to remove

replace(*args)

Overload 1:

Replace a vertex at a location in the list of vertices

Parameters:
  • toInsert (Vertex) – vertex to insert

  • idx (int) – location of vertex to replace


Overload 2:

Replace a vertex with another vertex

Parameters:
  • toInsert (Vertex) – vertex to insert

  • toRemove (Vertex) – vertex to remove


Overload 3:

Replace a body at a location in the list of bodies

Parameters:
  • toInsert (Body) – body to insert

  • idx (int) – location of body to remve


Overload 4:

Replace a body with another body

Parameters:
  • toInsert (Body) – body to insert

  • toRemove (Body) – body to remove

refresh_bodies()

Refresh internal ordering of defined bodies

type()

Get the surface type

become(stype)

Become a different type

Parameters:

stype (SurfaceType) – type to become

find_vertex(dir)

Find a vertex that defines this surface

Parameters:

dir (FVector3) – direction to look with respect to the centroid

find_body(dir)

Find a body that this surface defines

Parameters:

dir (FVector3) – direction to look with respect to the centroid

neighbor_vertices(v)

Connected vertices on the same surface

Parameters:

v (Vertex) – a vertex

connected_surfaces(*args)

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)

Vertices defining this and another surface

Parameters:

other (Surface) – another surface

contiguous_vertex_labels(other)

Get the integer labels of the contiguous vertices that this surface shares with another surface

Parameters:

other (Surface) – another surface

num_shared_contiguous_vertex_sets(other)

Get the number of contiguous vertex sets that this surface shares with another surface

Parameters:

other (Surface) – another surface

shared_contiguous_vertices(other, edgeLabel)

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 surface

  • edgeLabel (int) – edge label

volume_sense(body)

Get the sign of the volume contribution to a body that this surface contributes

Parameters:

body (Body) – a body

get_volume_contr(body)

Get the volume that this surface contributes to a body

Parameters:

body (Body) – a body

get_outward_normal(body)

Get the outward facing normal w.r.t. a body

Parameters:

body (Body) – a body

get_vertex_area(v)

Get the area that a vertex contributes to this surface

Parameters:

v (Vertex) – a vertex

get_vertex_mass(v)

Get the mass contribution of a vertex to this surface; only used in 2D simulation

Parameters:

v (Vertex) – a vertex

triangle_normal(idx)

Get the normal of a triangle

Parameters:

idx (int) – location of first vertex

normal_distance(pos)

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)

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)

Overload 1:

Test whether the surface contains a point

Parameters:
  • pos (FVector3) – position of the point

  • v0 (Vertex) – a vertex of the nearest edge

  • v1 (Vertex) – a vertex of the nearest edge


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, lenCfs)

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 remove

  • lenCfs (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, pos)

Create a surface from two vertices and a position

Parameters:
  • vertIdxStart (int) – index of first vertex

  • pos (FVector3) – position

extrude(vertIdxStart, normLen)

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)

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 (Vertex) – fist vertex defining the split

  • v2 (Vertex) – second vertex defining the split

Return type:

Surface

Returns:

Surface*


Overload 2:

Split into two surfaces

Requires updated surface members (e.g., centroid)

Parameters:
  • cp_pos (FVector3) – point on the cut plane

  • cp_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=-1)

A handle to a Surface.

The engine allocates Surface memory in blocks, and Surface values get moved around all the time, so their addresses change.

This is a safe way to work with a Surface.

property id
property surface

underlying Surface instance, 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 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)

Test whether defines a body

Parameters:

b (BodyHandle) – a body

Return type:

boolean

Returns:

true if defines a body

definedBy(v)

Test whether defined by a vertex

Parameters:

v (VertexHandle) – a vertex

Return type:

boolean

Returns:

true if defined by a vertex

destroy()

Destroy the surface

validate()

Validate the surface

Return type:

boolean

Returns:

true if valid

position_changed()

Update internal data due to a change in position

toString()

Get a JSON string representation

static fromString(s)

Create an instance from a JSON string representation

Parameters:

s (string) – JSON string

add(*args)

Overload 1:

Add a vertex

Parameters:

v (VertexHandle) – vertex to add


Overload 2:

Add a body

Parameters:

b (BodyHandle) – body to add

remove(*args)

Overload 1:

Remove a vertex

Parameters:

v (VertexHandle) – vertex to remove


Overload 2:

Remove a body

Parameters:

b (BodyHandle) – body to remove

insert(*args)

Overload 1:

Insert a vertex at a location in the list of vertices

Parameters:
  • v (VertexHandle) – vertex to insert

  • idx (int) – location of insertion


Overload 2:

Insert a vertex before another vertex

Parameters:

Overload 3:

Insert a vertex between two vertices

Parameters:
replace(*args)

Overload 1:

Replace a vertex at a location in the list of vertices

Parameters:
  • toInsert (VertexHandle) – vertex to insert

  • idx (int) – location of vertex to remove


Overload 2:

Replace a vertex with another vertex

Parameters:

Overload 3:

Replace a body at a location in the list of bodies

Parameters:
  • toInsert (BodyHandle) – body to insert

  • idx (int) – location of body to remove


Overload 4:

Replace a body with another body

Parameters:
refresh_bodies()

Refresh internal ordering of defined bodies

type()

Get the surface type

become(stype)

Become a different type

Parameters:

stype (SurfaceType) – type to become

find_vertex(dir)

Find a vertex that defines this surface

Parameters:

dir (FVector3) – direction to look with respect to the centroid

find_body(dir)

Find a body that this surface defines

Parameters:

dir (FVector3) – direction to look with respect to the centroid

neighbor_vertices(v)

Connected vertices on the same surface

Parameters:

v (VertexHandle) – a vertex

connected_surfaces(*args)

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)

Vertices defining this and another surface

Parameters:

other (SurfaceHandle) – another surface

contiguous_vertex_labels(other)

Get the integer labels of the contiguous edges that this surface shares with another surface

Parameters:

other (SurfaceHandle) – another surface

num_shared_contiguous_vertex_sets(other)

Get the number of contiguous edges that this surface shares with another surface

Parameters:

other (SurfaceHandle) – another surface

shared_contiguous_vertices(other, edgeLabel)

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 surface

  • edgeLabel (int) – edge label

volume_sense(body)

Get the sign of the volume contribution to a body that this surface contributes

Parameters:

body (BodyHandle) – a body

get_volume_contr(body)

Get the volume that this surface contributes to a body

Parameters:

body (BodyHandle) – a body

get_outward_normal(body)

Get the outward facing normal w.r.t. a body

Parameters:

body (BodyHandle) – a body

get_vertex_area(v)

Get the area that a vertex contributes to this surface

Parameters:

v (VertexHandle) – a vertex

get_vertex_mass(v)

Get the mass contribution of a vertex to this surface; only used in 2D simulation

Parameters:

v (VertexHandle) – a vertex

triangle_normal(idx)

Get the normal of a triangle

Parameters:

idx (int) – index of first triangle vertex

normal_distance(pos)

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)

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)

Overload 1:

Test whether the surface contains a point

Parameters:
  • pos (FVector3) – position of the point

  • v0 (VertexHandle) – a vertex of the nearest edge

  • v1 (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, lenCfs)

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 remove

  • lenCfs (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, normLen)

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)

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:

Overload 2:

Split into two surfaces

Requires updated surface members (e.g., centroid)

Parameters:
  • cp_pos (FVector3) – point on the cut plane

  • cp_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

surface_traction_comps: fVector3 | List[float] | None = None

Surface traction components

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()

Get a JSON string representation

static fromString(str)

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)

Get a registered type by name

Parameters:

_name (string) – type name

register_type()

Registers a type with the engine.

Note that this occurs automatically, unless noReg==true in constructor.

get()

Get the type engine instance

add(*args)

Overload 1:

Add an instance

Parameters:

i (SurfaceHandle) – instance to add


Overload 2:

Add instances

Parameters:

i (std::vector< TissueForge::models::vertex::SurfaceHandle,std::allocator< TissueForge::models::vertex::SurfaceHandle > >) – instances to add

remove(*args)

Overload 1:

Remove an instance

Parameters:

i (SurfaceHandle) – instance to remove


Overload 2:

Remove instances

Parameters:

i (std::vector< TissueForge::models::vertex::SurfaceHandle,std::allocator< TissueForge::models::vertex::SurfaceHandle > >) – instances 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, safe_face_data: bool = True)

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)

Overload 1: Construct a body from a set of surfaces


Overload 2: Construct a body from a mesh

definedBy(*args)
static destroy(*args)

Destroy bodies.

Any resulting surfaces without a body are also destroyed.

Parameters:

target – handles to a body

Return type:

int

Returns:

HRESULT

validate()
position_changed()
toString()

Get a JSON string representation

update_internals()

Update all internal data and parents

add(s)

Add a surface

Parameters:

s (Surface) – a surface

remove(s)

Remove a surface

Parameters:

s (Surface) – a surface

replace(toInsert, toRemove)

Replace a surface with a surface

Parameters:
  • toInsert (Surface) – surface to insert

  • toRemove (Surface) – surface to remove

type()

Get the body type

become(btype)

Become a different type

Parameters:

btype (BodyType) – the type to become

find_vertex(dir)

Find a vertex that defines this body

Parameters:

dir (FVector3) – direction to look with respect to the centroid

find_surface(dir)

Find a surface that defines this body

Parameters:

dir (FVector3) – direction to look with respect to the centroid

neighbor_surfaces(s)

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)

Get the surface area contribution of a vertex to this body

Parameters:

v (Vertex) – a vertex

get_vertex_volume(v)

Get the volume contribution of a vertex to this body

Parameters:

v (Vertex) – a vertex

get_vertex_mass(v)

Get the mass contribution of a vertex to this body

Parameters:

v (Vertex) – a vertex

find_interface(b)

Get the surfaces that define the interface between this body and another body

Parameters:

b (Body) – a body

contact_area(other)

Get the contacting surface area of this body with another body

Parameters:

other (Body) – a body

shared_vertices(other)

Get the vertices that define both this body and another body

Parameters:

other (Body) – a body

is_outside(pos)

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, cp_norm, stype=None)

Split into two bodies. The split is defined by a cut plane

Parameters:
  • cp_pos (FVector3) – position on the cut plane

  • cp_norm (FVector3) – cut plane normal

  • stype (SurfaceType, optional) – 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=-1)

A handle to a Body.

The engine allocates Body memory in blocks, and Body values get moved around all the time, so their addresses change.

This is a safe way to work with a Body.

property id
property body

underlying Body instance, if any

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)

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()

Destroy the body.

validate()

Validate the body

position_changed()

Update internal data due to a change in position

toString()

Get a JSON string representation

static fromString(s)

Create an instance from a JSON string representation

Parameters:

s (string) – a JSON string

add(s)

Add a surface

Parameters:

s (SurfaceHandle) – a surface

remove(s)

Remove a surface

Parameters:

s (SurfaceHandle) – a surface

replace(toInsert, toRemove)

Replace a surface with a surface

Parameters:
type()

Get the body type

become(btype)

Become a different type

Parameters:

btype (BodyType) – the type to become

find_vertex(dir)

Find a vertex that defines this body

Parameters:

dir (FVector3) – direction to look with respect to the centroid

find_surface(dir)

Find a surface that defines this body

Parameters:

dir (FVector3) – direction to look with respect to the centroid

neighbor_surfaces(s)

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)

Get the surface area contribution of a vertex to this body

Parameters:

v (VertexHandle) – a vertex

get_vertex_volume(v)

Get the volume contribution of a vertex to this body

Parameters:

v (VertexHandle) – a vertex

get_vertex_mass(v)

Get the mass contribution of a vertex to this body

Parameters:

v (VertexHandle) – a vertex

find_interface(b)

Get the surfaces that define the interface between this body and another body

Parameters:

b (BodyHandle) – a body

contact_area(other)

Get the contacting surface area of this body with another body

Parameters:

other (BodyHandle) – a body

shared_vertices(other)

Get the vertices that define both this body and another body

Parameters:

other (BodyHandle) – a body

is_outside(pos)

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, cp_norm, stype=None)

Split into two bodies. The split is defined by a cut plane

Parameters:
  • cp_pos (FVector3) – position on the cut plane

  • cp_norm (FVector3) – cut plane normal

  • stype (SurfaceType, optional) – 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

body_force_comps: fVector3 | List[float] | None = None

Body force components

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()

Get a JSON string representation

static fromString(str)

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)

Get a registered type by name

register_type()

Registers a type with the engine.

Note that this occurs automatically, unless noReg==true in constructor.

get()

Get the type engine instance

add(i)

Add an instance

Parameters:

i (BodyHandle) – instance

remove(*args)

Overload 1:

Remove an instance

Parameters:

i (BodyHandle) – instance


Overload 2:

Remove instances

Parameters:

i (std::vector< TissueForge::models::vertex::BodyHandle,std::allocator< TissueForge::models::vertex::BodyHandle > >) – instances to remove

__call__(*args)

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, pos)

Create a body from a surface in the mesh and a position

Parameters:
extrude(base, normLen)

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) – surface

  • normLen (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 and Body 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()

Get a JSON string representation

ensure_available_vertices(numAlloc)

Ensure that there are a given number of allocated vertices

Parameters:

numAlloc (int) – a given number of allocated vertices

ensure_available_surfaces(numAlloc)

Ensure that there are a given number of allocated surfaces

Parameters:

numAlloc (int) – a given number of allocated surfaces

ensure_available_bodies(numAlloc)

Ensure that there are a given number of allocated bodies

Parameters:

numAlloc (int) – a given number of allocated bodies

create(*args)

Overload 1:

Create a vertex

Parameters:
  • obj (Vertex) – a vertex to populate

  • pid (int) – the id of the underlying particle


Overload 2:

Create vertices

Parameters:
  • objs (Vertex) – vertices to populate

  • pids (std::vector< unsigned int,std::allocator< unsigned int > >) – the ids of the underlying particles


Overload 3:

Create a surface

Parameters:

obj (Surface) – a surface to populate


Overload 4:

Create surfaces

Parameters:
  • objs (Surface) – surfaces to populate

  • numObjs (int) – number of surfaces


Overload 5:

Create a body

Parameters:

obj (Body) – a body to populate


Overload 6:

Create bodies

Parameters:
  • objs (Body) – bodies to populate

  • numObjs (int) – number of bodies

static get()

Get the mesh

lock()

Locks the mesh for thread-safe operations

unlock()

Unlocks the mesh for thread-safe operations

find_vertex(pos, tol=0.0001)

Find a vertex in this mesh

Parameters:
  • pos (FVector3) – position to look

  • tol (float, optional) – distance tolerance

Return type:

Vertex

Returns:

a vertex within the distance tolerance of the position, otherwise NULL

get_vertex_by_pid(pid)

Get the vertex for a given particle id

Parameters:

pid (int) – particle id

get_vertex(idx)

Get the vertex at a location in the list of vertices

Parameters:

idx (int) – location in the list

get_surface(idx)

Get the surface at a location in the list of surfaces

Parameters:

idx (int) – location in the list

get_body(idx)

Get the body at a location in the list of bodies

Parameters:

idx (int) – location in the list

validate()

Validate state of the mesh

Return type:

boolean

Returns:

true if in a valid state

make_dirty()

Manually notify that the mesh has been changed

connected(*args)

Overload 1:

Check whether two vertices are connected

Parameters:
  • v1 (Vertex) – first vertex

  • v2 (Vertex) – second vertex

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)

Overload 1:

Remove a vertex from the mesh; all dependent surfaces and bodies are also removed

Parameters:

v (Vertex) – a vertex


Overload 2:

Remove vertices from the mesh; all dependent surfaces and bodies are also removed

Parameters:
  • v (Vertex) – vertices

  • numObjs (int) – number of vertices


Overload 3:

Remove a surface from the mesh; all dependent bodies are also removed

Parameters:

s (Surface) – a surface


Overload 4:

Remove surfaces from the mesh; all dependent bodies are also removed

Parameters:
  • s (Surface) – surfaces

  • numObjs (int) – number of surfaces


Overload 5:

Remove a body from the mesh

Parameters:

b (Body) – a body


Overload 6:

Remove bodies from the mesh

Parameters:
  • b (Body) – bodies

  • numObjs (int) – number of bodies

__str__() str

Return str(self).

Actors

class tissue_forge.models.vertex.solver.Adhesion(_lam=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)

Overload 1:

Calculate the energy of a source object acting on a target object

Parameters:
  • source (Surface) – source object

  • target (Vertex) – target object

  • e – energy


Overload 2:

Calculate the energy of a source object acting on a target object

Parameters:
  • source (Body) – source object

  • target (Vertex) – target object

  • e – energy

force(*args)

Overload 1:

Calculate the force that a source object exerts on a target object

Parameters:
  • source (Surface) – source object

  • target (Vertex) – target object

  • f – force


Overload 2:

Calculate the force that a source object exerts on a target object

Parameters:
  • source (Body) – source object

  • target (Vertex) – target object

  • f – force

class tissue_forge.models.vertex.solver.BodyForce(*args, **kwargs)

Imposes a body force on Body instances

property comps

Force components

energy(source, target)

Calculate the energy of a source object acting on a target object

Parameters:
  • source (Body) – source object

  • target (Vertex) – target object

  • e – energy

force(source, target)

Calculate the force that a source object exerts on a target object

Parameters:
  • source (Body) – source object

  • target (Vertex) – target object

  • f – force

class tissue_forge.models.vertex.solver.EdgeTension(lam=0, order=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, target)

Calculate the energy of a source object acting on a target object

Parameters:
  • source (Surface) – source object

  • target (Vertex) – target object

  • e – energy

force(source, target)

Calculate the force that a source object exerts on a target object

Parameters:
  • source (Surface) – source object

  • target (Vertex) – target object

  • f – force

class tissue_forge.models.vertex.solver.NormalStress(_mag=0)

Models a stress acting on a Surface along its normal

property mag

Magnitude

energy(source, target)

Calculate the energy of a source object acting on a target object

Parameters:
  • source (Surface) – source object

  • target (Vertex) – target object

  • e – energy

force(source, target)

Calculate the force that a source object exerts on a target object

Parameters:
  • source (Surface) – source object

  • target (Vertex) – target object

  • f – force

class tissue_forge.models.vertex.solver.PerimeterConstraint(_lam=0, _constr=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 \right)^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, target)

Calculate the energy of a source object acting on a target object

Parameters:
  • source (Surface) – source object

  • target (Vertex) – target object

  • e – energy

force(source, target)

Calculate the force that a source object exerts on a target object

Parameters:
  • source (Surface) – source object

  • target (Vertex) – target object

  • f – force

class tissue_forge.models.vertex.solver.SurfaceAreaConstraint(_lam=0, _constr=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 \right)^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)

Overload 1:

Calculate the energy of a source object acting on a target object

Parameters:
  • source (Surface) – source object

  • target (Vertex) – target object

  • e – energy


Overload 2:

Calculate the energy of a source object acting on a target object

Parameters:
  • source (Body) – source object

  • target (Vertex) – target object

  • e – energy

force(*args)

Overload 1:

Calculate the force that a source object exerts on a target object

Parameters:
  • source (Surface) – source object

  • target (Vertex) – target object

  • f – force


Overload 2:

Calculate the force that a source object exerts on a target object

Parameters:
  • source (Body) – source object

  • target (Vertex) – target object

  • f – force

class tissue_forge.models.vertex.solver.SurfaceTraction(*args, **kwargs)

Models a traction force

property comps

Force components

energy(source, target)

Calculate the energy of a source object acting on a target object

Parameters:
  • source (Surface) – source object

  • target (Vertex) – target object

  • e – energy

force(source, target)

Calculate the force that a source object exerts on a target object

Parameters:
  • source (Surface) – source object

  • target (Vertex) – target object

  • f – force

class tissue_forge.models.vertex.solver.VolumeConstraint(_lam=0, _constr=0)

Imposes a volume constraint.

The volume constraint is implemented for three-dimensional objects as minimization of the Hamiltonian,

\[\lambda \left( V - V_o \right)^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, target)

Calculate the energy of a source object acting on a target object

Parameters:
  • source (Body) – source object

  • target (Vertex) – target object

  • e – energy

force(source, target)

Calculate the force that a source object exerts on a target object

Parameters:
  • source (Body) – source object

  • target (Vertex) – target object

  • f – force

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, type1, type2)

Bind an actor to a pair of object types

Parameters:
  • a (MeshObjTypePairActor) – actor

  • type1 (MeshObjType) – first object type

  • type2 (MeshObjType) – second object type

Mesh Generators

tissue_forge.models.vertex.solver.create_quad_mesh(*args, **kwargs)

Populate the mesh with quadrilateral surfaces.

Requires an initialized solver.

Parameters:
  • stype (SurfaceType) – surface type

  • startPos (FVector3) – starting position

  • num_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, optional) – axis name of the first direction (e.g., “x”)

  • ax_2 (string, optional) – 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)

Populate the mesh with parallelepiped bodies.

Requires an initialized solver.

Parameters:
  • btype (BodyType) – body type

  • stype (SurfaceType) – surface type

  • startPos (FVector3) – starting position

  • num_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, optional) – axis name of the first direction (e.g., “x”)

  • ax_2 (string, optional) – 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)

Populate the mesh with hexagonal surfaces.

Requires an initialized solver.

Parameters:
  • stype (SurfaceType) – surface type

  • startPos (FVector3) – starting position

  • num_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, optional) – axis name of the first direction (e.g., “x”)

  • ax_2 (string, optional) – 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)

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 type

  • stype (SurfaceType) – surface type

  • startPos (FVector3) – starting position

  • num_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, optional) – axis name of the first direction (e.g., “x”)

  • ax_2 (string, optional) – 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=0.0001, surfaceDemoteAreaCf=0.0001, bodyDemoteVolumeCf=0.0001, _edgeSplitDistCf=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()

Get a JSON string representation

static fromString(s)

Create an instance from a JSON string representation

Parameters:

s (string) – JSON string representation

do_quality()

Perform quality operations work

working()

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()

Clear the log

static log(event)

Add a log event to the log

Parameters:

event (MeshLogEvent) – a log event

static events()

Get the list of log events

static getForwardLogging()

Test whether the logger is fowarding log events to the main Tissue Forge logger

static setForwardLogging(_forward)

Set whether to foward log events to the main Tissue Forge logger

Parameters:

_forward (boolean) – flag indicating whether to foward log events

static getLogLevel()

Get the current log level

static setLogLevel(_level)

Set the current log level

Parameters:

_level (int) – the current log level