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

A special list with convenience methods for working with sets of particles. More...

#include <tfParticleList.h>

Public Member Functions

void free ()
 
HRESULT reserve (size_t _nr_parts)
 Reserve enough storage for a given number of items.
 
uint16_t insert (int32_t item)
 
uint16_t insert (const ParticleHandle *particle)
 Inserts the given particle into the list, returns the index of the item.
 
uint16_t remove (int32_t id)
 looks for the item with the given id and deletes it form the list
 
uint16_t extend (const ParticleList &other)
 inserts the contents of another list
 
bool has (const int32_t &pid)
 
bool has (ParticleHandle *part)
 
ParticleHandleitem (const int32_t &i)
 looks for the item at the given index and returns it if found, otherwise returns NULL
 
int32_t operator[] (const size_t &i)
 
std::vector< int32_t > vector ()
 
FMatrix3 getVirial ()
 
FPTYPE getRadiusOfGyration ()
 
FVector3 getCenterOfMass ()
 
FVector3 getCentroid ()
 
FMatrix3 getMomentOfInertia ()
 
std::vector< FVector3getPositions ()
 
std::vector< FVector3getVelocities ()
 
std::vector< FVector3getForces ()
 
std::vector< FVector3sphericalPositions (FVector3 *origin=NULL)
 Get the spherical coordinates of each particle.
 
bool getOwnsData () const
 Get whether the list owns its data.
 
void setOwnsData (const bool &_flag)
 Set whether the list owns its data.
 
bool getMutable () const
 Get whether the list is mutable.
 
void setMutable (const bool &_flag)
 Set whether the list is mutable.
 
 ParticleList (uint16_t init_size, uint16_t flags=PARTICLELIST_OWNDATA|PARTICLELIST_MUTABLE)
 
 ParticleList (ParticleHandle *part)
 
 ParticleList (std::vector< ParticleHandle > particles)
 
 ParticleList (std::vector< ParticleHandle * > particles)
 
 ParticleList (uint16_t nr_parts, int32_t *parts)
 
 ParticleList (const ParticleList &other)
 
 ParticleList (const std::vector< int32_t > &pids)
 
std::string toString ()
 Get a JSON string representation.
 

Static Public Member Functions

static ParticleList all ()
 returns an instance populated with all current particles
 
static ParticleListfromString (const std::string &str)
 Create from a JSON string representation.
 

Public Attributes

int32_tparts
 
int32_t nr_parts
 
int32_t size_parts
 
uint16_t flags
 

Detailed Description

A special list with convenience methods for working with sets of particles.

Member Function Documentation

◆ all()

static ParticleList TissueForge::ParticleList::all ( )
static

returns an instance populated with all current particles

Returns
ParticleList*

◆ extend()

uint16_t TissueForge::ParticleList::extend ( const ParticleList & other)

inserts the contents of another list

Parameters
otheranother list

◆ fromString()

static ParticleList * TissueForge::ParticleList::fromString ( const std::string & str)
static

Create from a JSON string representation.

Parameters
str
Returns
ParticleList*

◆ has() [1/2]

bool TissueForge::ParticleList::has ( const int32_t & pid)

Test whether the list has an id

◆ has() [2/2]

bool TissueForge::ParticleList::has ( ParticleHandle * part)

Test whether the list has a particle

◆ insert()

uint16_t TissueForge::ParticleList::insert ( const ParticleHandle * particle)

Inserts the given particle into the list, returns the index of the item.

Parameters
particleparticle to insert
Returns
uint16_t

◆ item()

ParticleHandle * TissueForge::ParticleList::item ( const int32_t & i)

looks for the item at the given index and returns it if found, otherwise returns NULL

Parameters
iindex of lookup
Returns
ParticleHandle*

◆ operator[]()

get an item at a given index

◆ remove()

uint16_t TissueForge::ParticleList::remove ( int32_t id)

looks for the item with the given id and deletes it form the list

Parameters
idid to remove
Returns
uint16_t

◆ reserve()

HRESULT TissueForge::ParticleList::reserve ( size_t _nr_parts)

Reserve enough storage for a given number of items.

Parameters
_nr_partsnumber of items
Returns
HRESULT

◆ setMutable()

void TissueForge::ParticleList::setMutable ( const bool & _flag)

Set whether the list is mutable.

Parameters
flagflag signifying whether the list is mutable

◆ setOwnsData()

void TissueForge::ParticleList::setOwnsData ( const bool & _flag)

Set whether the list owns its data.

Parameters
flagflag signifying whether the list owns its data

◆ sphericalPositions()

std::vector< FVector3 > TissueForge::ParticleList::sphericalPositions ( FVector3 * origin = NULL)

Get the spherical coordinates of each particle.

Parameters
originoptional origin of coordinates; default is center of universe
Returns
std::vector<FVector3>

◆ toString()

std::string TissueForge::ParticleList::toString ( )

Get a JSON string representation.

Returns
std::string

◆ vector()

std::vector< int32_t > TissueForge::ParticleList::vector ( )

returns the list as a vector


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