Tissue Forge C++ 0.2.1
Interactive, particle-based physics, chemistry and biology modeling and simulation environment
Loading...
Searching...
No Matches
TissueForge::ParticleHandle Struct Reference

A handle to a particle. More...

#include <tfParticle.h>

Inheritance diagram for TissueForge::ParticleHandle:

Public Member Functions

Particlepart ()
 Gets the actual particle of this handle.
 
Particleget ()
 Gets the actual particle of this handle.
 
ParticleTypetype ()
 Gets the particle type of this handle.
 
 ParticleHandle (const int &id)
 
virtual std::string str () const
 
virtual ParticleHandlefission ()
 
virtual ParticleHandlesplit ()
 Splits a single particle into two.
 
virtual ParticleHandlesplit (const FVector3 &childDirection)
 Splits a single particle into two along a given direction.
 
virtual ParticleHandlesplit (const FPTYPE &childRatio)
 Splits a single particle into two with sizes according to a given ratio.
 
virtual ParticleHandlesplit (const std::vector< FPTYPE > &speciesRatios)
 Splits a single particle into two and allocates species according to given ratios.
 
virtual ParticleHandlesplit (const FVector3 &childDirection, const FPTYPE &childRatio, ParticleType *parentType=NULL, ParticleType *childType=NULL)
 Splits a single particle into two along a given direction, with sizes according to a given ratio, and and optionally with different resulting particle types.
 
virtual ParticleHandlesplit (const FVector3 &childDirection, const FPTYPE &childRatio, const std::vector< FPTYPE > &speciesRatios, ParticleType *parentType=NULL, ParticleType *childType=NULL)
 Splits a single particle into two along a given direction, with sizes according to a given ratio, allocates species according to given ratios, and optionally with different resulting particle types.
 
HRESULT destroy ()
 Destroys the particle and removes it from inventory.
 
FVector3 sphericalPosition (Particle *particle=NULL, FVector3 *origin=NULL)
 Calculates the particle's coordinates in spherical coordinates.
 
FVector3 relativePosition (const FVector3 &origin, const bool &comp_bc=true)
 Computes the relative position with respect to an origin while optionally account for boundary conditions.
 
virtual FMatrix3 virial (FPTYPE *radius=NULL)
 Computes the virial tensor. Optionally pass a distance to include a neighborhood.
 
HRESULT become (ParticleType *type)
 Dynamically changes the type of an object. We can change the type of a ParticleType-derived object to anyther pre-existing ParticleType-derived type. What this means is that if we have an object of say type A, we can change it to another type, say B, and and all of the forces and processes that acted on objects of type A stip and the forces and processes defined for type B now take over.
 
ParticleList neighbors (const FPTYPE &distance, const TissueForge::ParticleTypeList &types)
 Gets a list of nearby particles.
 
ParticleList neighbors (const FPTYPE &distance, const std::vector< ParticleType > &types)
 Gets a list of nearby particles.
 
ParticleList neighbors (const FPTYPE &distance)
 Gets a list of nearby particles of all types.
 
ParticleList neighbors (const TissueForge::ParticleTypeList &types)
 Gets a list of nearby particles within the global cutoff distance.
 
ParticleList neighbors (const std::vector< ParticleType > &types)
 Gets a list of nearby particles within the global cutoff distance.
 
std::vector< int32_t > neighborIds (const FPTYPE &distance, const TissueForge::ParticleTypeList &types)
 Gets a list of nearby particles ids.
 
std::vector< int32_t > neighborIds (const FPTYPE &distance, const std::vector< ParticleType > &types)
 Gets a list of nearby particles ids.
 
std::vector< int32_t > neighborIds (const FPTYPE &distance=-FPTYPE_ONE)
 Gets a list of nearby particles ids of all types.
 
std::vector< int32_t > neighborIds (const TissueForge::ParticleTypeList &types)
 Gets a list of nearby particles ids within the global cutoff distance.
 
std::vector< int32_t > neighborIds (const std::vector< ParticleType > &types)
 Gets a list of nearby particles ids within the global cutoff distance.
 
ParticleList getBondedNeighbors ()
 Gets a list of all bonded neighbors.
 
std::vector< int32_t > getBondedNeighborIds ()
 Gets a list of all bonded neighbor ids.
 
FPTYPE distance (ParticleHandle *_other)
 Calculates the distance to another particle.
 
std::vector< struct TissueForge::BondHandlegetBonds ()
 
std::vector< struct TissueForge::AngleHandlegetAngles ()
 
std::vector< struct TissueForge::DihedralHandlegetDihedrals ()
 
FPTYPE getCharge ()
 
void setCharge (const FPTYPE &charge)
 
FPTYPE getMass ()
 
void setMass (const FPTYPE &mass)
 
bool getFrozen ()
 
void setFrozen (const bool frozen)
 
bool getFrozenX ()
 
void setFrozenX (const bool frozen)
 
bool getFrozenY ()
 
void setFrozenY (const bool frozen)
 
bool getFrozenZ ()
 
void setFrozenZ (const bool frozen)
 
rendering::StylegetStyle ()
 
void setStyle (rendering::Style *style)
 
FPTYPE getAge ()
 
FPTYPE getRadius ()
 
void setRadius (const FPTYPE &radius)
 
FPTYPE getVolume ()
 
std::string getName ()
 
std::string getName2 ()
 
FVector3 getPosition ()
 
void setPosition (FVector3 position)
 
FVector3getVelocity ()
 
void setVelocity (FVector3 velocity)
 
FVector3 getForce ()
 
FVector3getForceInit ()
 
void setForceInit (FVector3 force)
 
int getId ()
 
int16_t getTypeId ()
 
int32_t getClusterId ()
 
uint16_t getFlags ()
 
state::StateVectorgetSpecies ()
 
 operator ClusterParticleHandle * ()
 

Public Attributes

int id
 

Detailed Description

A handle to a particle.

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

The partlist is always ordered by id, i.e. partlist[id] always points to the same particle, even though that particle may move from cell to cell.

This is a safe way to work with a particle.

Member Function Documentation

◆ become()

HRESULT TissueForge::ParticleHandle::become ( ParticleType * type)

Dynamically changes the type of an object. We can change the type of a ParticleType-derived object to anyther pre-existing ParticleType-derived type. What this means is that if we have an object of say type A, we can change it to another type, say B, and and all of the forces and processes that acted on objects of type A stip and the forces and processes defined for type B now take over.

Parameters
typenew particle type

◆ destroy()

HRESULT TissueForge::ParticleHandle::destroy ( )

Destroys the particle and removes it from inventory.

Subsequent references to a destroyed particle result in an error.

◆ distance()

FPTYPE TissueForge::ParticleHandle::distance ( ParticleHandle * _other)

Calculates the distance to another particle.

Parameters
_otheranother particle.

◆ get()

Particle * TissueForge::ParticleHandle::get ( )
inline

Gets the actual particle of this handle.

Alias for consistency with other objects.

◆ getAge()

FPTYPE TissueForge::ParticleHandle::getAge ( )

Particle age

◆ getAngles()

std::vector< struct TissueForge::AngleHandle > TissueForge::ParticleHandle::getAngles ( )

Get the angles attached to the particle.

◆ getBonds()

std::vector< struct TissueForge::BondHandle > TissueForge::ParticleHandle::getBonds ( )

Get the bonds attached to the particle.

◆ getCharge()

FPTYPE TissueForge::ParticleHandle::getCharge ( )

Particle charge

◆ getClusterId()

int32_t TissueForge::ParticleHandle::getClusterId ( )

Particle cluster id

◆ getDihedrals()

std::vector< struct TissueForge::DihedralHandle > TissueForge::ParticleHandle::getDihedrals ( )

Get the dihedrals attached to the particle.

◆ getFlags()

uint16_t TissueForge::ParticleHandle::getFlags ( )

Particle flags

◆ getForce()

FVector3 TissueForge::ParticleHandle::getForce ( )

Particle force

◆ getForceInit()

FVector3 & TissueForge::ParticleHandle::getForceInit ( )

Particle initial force

◆ getFrozen()

bool TissueForge::ParticleHandle::getFrozen ( )

Particle frozen state

◆ getFrozenX()

bool TissueForge::ParticleHandle::getFrozenX ( )

Particle frozen state along the x-direction

◆ getFrozenY()

bool TissueForge::ParticleHandle::getFrozenY ( )

Particle frozen state along the y-direction

◆ getFrozenZ()

bool TissueForge::ParticleHandle::getFrozenZ ( )

Particle frozen state along the z-direction

◆ getId()

int TissueForge::ParticleHandle::getId ( )

◆ getMass()

FPTYPE TissueForge::ParticleHandle::getMass ( )

Particle mass

◆ getName()

std::string TissueForge::ParticleHandle::getName ( )

Particle name

◆ getName2()

std::string TissueForge::ParticleHandle::getName2 ( )

Particle second name

◆ getPosition()

FVector3 TissueForge::ParticleHandle::getPosition ( )

Particle position

◆ getRadius()

FPTYPE TissueForge::ParticleHandle::getRadius ( )

Particle radius

◆ getSpecies()

state::StateVector * TissueForge::ParticleHandle::getSpecies ( )

Particle species, if any

◆ getStyle()

rendering::Style * TissueForge::ParticleHandle::getStyle ( )

Particle style

◆ getTypeId()

int16_t TissueForge::ParticleHandle::getTypeId ( )

Particle type id

◆ getVelocity()

FVector3 & TissueForge::ParticleHandle::getVelocity ( )

Particle velocity

◆ getVolume()

FPTYPE TissueForge::ParticleHandle::getVolume ( )

Particle volume

◆ neighborIds() [1/5]

std::vector< int32_t > TissueForge::ParticleHandle::neighborIds ( const FPTYPE & distance,
const std::vector< ParticleType > & types )

Gets a list of nearby particles ids.

Parameters
distancesearch distance
typeslist of particle types to search by

◆ neighborIds() [2/5]

std::vector< int32_t > TissueForge::ParticleHandle::neighborIds ( const FPTYPE & distance,
const TissueForge::ParticleTypeList & types )

Gets a list of nearby particles ids.

Parameters
distancesearch distance
typeslist of particle types to search by

◆ neighborIds() [3/5]

std::vector< int32_t > TissueForge::ParticleHandle::neighborIds ( const FPTYPE & distance = -FPTYPE_ONE)

Gets a list of nearby particles ids of all types.

Parameters
distancesearch distance; default is simulation cutoff

◆ neighborIds() [4/5]

std::vector< int32_t > TissueForge::ParticleHandle::neighborIds ( const std::vector< ParticleType > & types)

Gets a list of nearby particles ids within the global cutoff distance.

Parameters
typeslist of particle types to search by

◆ neighborIds() [5/5]

std::vector< int32_t > TissueForge::ParticleHandle::neighborIds ( const TissueForge::ParticleTypeList & types)

Gets a list of nearby particles ids within the global cutoff distance.

Parameters
typeslist of particle types to search by

◆ neighbors() [1/5]

ParticleList TissueForge::ParticleHandle::neighbors ( const FPTYPE & distance)

Gets a list of nearby particles of all types.

Parameters
distancesearch distance

◆ neighbors() [2/5]

ParticleList TissueForge::ParticleHandle::neighbors ( const FPTYPE & distance,
const std::vector< ParticleType > & types )

Gets a list of nearby particles.

Parameters
distancesearch distance
typeslist of particle types to search by

◆ neighbors() [3/5]

ParticleList TissueForge::ParticleHandle::neighbors ( const FPTYPE & distance,
const TissueForge::ParticleTypeList & types )

Gets a list of nearby particles.

Parameters
distancesearch distance
typeslist of particle types to search by

◆ neighbors() [4/5]

ParticleList TissueForge::ParticleHandle::neighbors ( const std::vector< ParticleType > & types)

Gets a list of nearby particles within the global cutoff distance.

Parameters
typeslist of particle types to search by

◆ neighbors() [5/5]

ParticleList TissueForge::ParticleHandle::neighbors ( const TissueForge::ParticleTypeList & types)

Gets a list of nearby particles within the global cutoff distance.

Parameters
typeslist of particle types to search by

◆ operator ClusterParticleHandle *()

TissueForge::ParticleHandle::operator ClusterParticleHandle * ( )

Limits casting to cluster by type

◆ part()

Particle * TissueForge::ParticleHandle::part ( )
inline

Gets the actual particle of this handle.

Returns
particle, if available

◆ relativePosition()

FVector3 TissueForge::ParticleHandle::relativePosition ( const FVector3 & origin,
const bool & comp_bc = true )

Computes the relative position with respect to an origin while optionally account for boundary conditions.

Parameters
originorigin
comp_bcflag to compensate for boundary conditions; default true

◆ setCharge()

void TissueForge::ParticleHandle::setCharge ( const FPTYPE & charge)

Set the particle charge

◆ setForceInit()

void TissueForge::ParticleHandle::setForceInit ( FVector3 force)

Set the particle initial force

◆ setFrozen()

void TissueForge::ParticleHandle::setFrozen ( const bool frozen)

Set the particle frozen state

◆ setFrozenX()

void TissueForge::ParticleHandle::setFrozenX ( const bool frozen)

Set the particle frozen state along the x-direction

◆ setFrozenY()

void TissueForge::ParticleHandle::setFrozenY ( const bool frozen)

Set the particle frozen state along the y-direction

◆ setFrozenZ()

void TissueForge::ParticleHandle::setFrozenZ ( const bool frozen)

Set the particle frozen state along the z-direction

◆ setMass()

void TissueForge::ParticleHandle::setMass ( const FPTYPE & mass)

Set the particle mass

◆ setPosition()

void TissueForge::ParticleHandle::setPosition ( FVector3 position)

Set the particle position

◆ setRadius()

void TissueForge::ParticleHandle::setRadius ( const FPTYPE & radius)

Set the particle radius

◆ setStyle()

void TissueForge::ParticleHandle::setStyle ( rendering::Style * style)

Set the prticle style

◆ setVelocity()

void TissueForge::ParticleHandle::setVelocity ( FVector3 velocity)

Set the particle velocity

◆ sphericalPosition()

FVector3 TissueForge::ParticleHandle::sphericalPosition ( Particle * particle = NULL,
FVector3 * origin = NULL )

Calculates the particle's coordinates in spherical coordinates.

By default, calculations are made with respect to the center of the universe.

Parameters
particlea particle to use as the origin, optional
origina point to use as the origin, optional

◆ split() [1/6]

virtual ParticleHandle * TissueForge::ParticleHandle::split ( )
virtual

Splits a single particle into two.

The new particle is placed along a randomly selected orientation.

The two resulting particles have the same mass and volume.

If species are attached to the split particle, then the amount of species is allocated to the two resulting particles such that their species concentrations are the same as the split particle. Species are conserved.

The two resulting particles have the type of the split particle.

The two resulting particles are placed in contact.

The center of mass of the two resulting particles is the same as that of the split particle.

The combined mass and volume of the two resulting particles are the same as those of the split particle.

Returns
new particle

◆ split() [2/6]

virtual ParticleHandle * TissueForge::ParticleHandle::split ( const FPTYPE & childRatio)
virtual

Splits a single particle into two with sizes according to a given ratio.

The new particle is placed along a randomly selected orientation.

The new particle has a mass and volume equal to those of the split particle multiplied by a ratio.

If species are attached to the split particle, then the amount of species is allocated to the two resulting particles such that their species concentrations are the same as the split particle. Species are conserved.

The two resulting particles have the type of the split particle.

The two resulting particles are placed in contact.

The center of mass of the two resulting particles is the same as that of the split particle.

The combined mass and volume of the two resulting particles are the same as those of the split particle.

Parameters
childRatioratio of the child particle volume to the split particle volume. Must be in (0, 1).
Returns
new particle

◆ split() [3/6]

virtual ParticleHandle * TissueForge::ParticleHandle::split ( const FVector3 & childDirection)
virtual

Splits a single particle into two along a given direction.

The new particle is placed along the orientation of the passed direction.

The two resulting particles have the same mass and volume.

If species are attached to the split particle, then the amount of species is allocated to the two resulting particles such that their species concentrations are the same as the split particle. Species are conserved.

The two resulting particles have the type of the split particle.

The two resulting particles are placed in contact.

The center of mass of the two resulting particles is the same as that of the split particle.

The combined mass and volume of the two resulting particles are the same as those of the split particle.

Parameters
childDirectiondirection along which the particle is split.
Returns
new particle

◆ split() [4/6]

virtual ParticleHandle * TissueForge::ParticleHandle::split ( const FVector3 & childDirection,
const FPTYPE & childRatio,
const std::vector< FPTYPE > & speciesRatios,
ParticleType * parentType = NULL,
ParticleType * childType = NULL )
virtual

Splits a single particle into two along a given direction, with sizes according to a given ratio, allocates species according to given ratios, and optionally with different resulting particle types.

The new particle is placed along the orientation of the passed direction.

The new particle has a mass and volume equal to those of the split particle multiplied by a ratio.

If species are attached to the split particle, then the amount of species is allocated to the two resulting particles such that the total amount in the new particles is equal to
the total amount of the split particle multiplied by a ratio. Species are conserved.

The two resulting particles have the type of the split particle unless otherwise specified.

The two resulting particles are placed in contact.

The center of mass of the two resulting particles is the same as that of the split particle.

The combined mass and volume of the two resulting particles are the same as those of the split particle.

Parameters
childDirectiondirection along which the particle is split.
childRatioratio of the child particle volume to the split particle volume. Must be in (0, 1).
speciesRatiosratio of the child particle total species amount to the split particle total species amount. Each must be in (0, 1).
parentTypeoptional type of the split particle after the split
childTypeoptional type of the new particle
Returns
new particle

◆ split() [5/6]

virtual ParticleHandle * TissueForge::ParticleHandle::split ( const FVector3 & childDirection,
const FPTYPE & childRatio,
ParticleType * parentType = NULL,
ParticleType * childType = NULL )
virtual

Splits a single particle into two along a given direction, with sizes according to a given ratio, and and optionally with different resulting particle types.

The new particle is placed along the orientation of the passed direction.

The new particle has a mass and volume equal to those of the split particle multiplied by a ratio.

If species are attached to the split particle, then the amount of species is allocated to the two resulting particles such that the total amount in the new particles is equal to
the total amount of the split particle multiplied by a ratio. Species are conserved.

The two resulting particles have the type of the split particle unless otherwise specified.

The two resulting particles are placed in contact.

The center of mass of the two resulting particles is the same as that of the split particle.

The combined mass and volume of the two resulting particles are the same as those of the split particle.

Parameters
childDirectiondirection along which the particle is split.
childRatioratio of the child particle volume to the split particle volume. Must be in (0, 1).
parentTypeoptional type of the split particle after the split
childTypeoptional type of the new particle
Returns
new particle

◆ split() [6/6]

virtual ParticleHandle * TissueForge::ParticleHandle::split ( const std::vector< FPTYPE > & speciesRatios)
virtual

Splits a single particle into two and allocates species according to given ratios.

The new particle is placed along a randomly selected orientation.

The two resulting particles have the same mass and volume.

If species are attached to the split particle, then the amount of species is allocated to the two resulting particles such that the total amount in the new particles is equal to
the total amount of the split particle multiplied by a ratio. Species are conserved.

The two resulting particles have the type of the split particle.

The two resulting particles are placed in contact.

The center of mass of the two resulting particles is the same as that of the split particle.

The combined mass and volume of the two resulting particles are the same as those of the split particle.

Parameters
speciesRatiosratio of the child particle total species amount to the split particle total species amount. Each must be in (0, 1).
Returns
new particle

◆ virial()

virtual FMatrix3 TissueForge::ParticleHandle::virial ( FPTYPE * radius = NULL)
virtual

Computes the virial tensor. Optionally pass a distance to include a neighborhood.

Parameters
radiusA distance to define a neighborhood, optional

Member Data Documentation

◆ id

int TissueForge::ParticleHandle::id

The documentation for this struct was generated from the following files: