27#ifndef _MDCORE_INCLUDE_TFPARTICLE_H_
28#define _MDCORE_INCLUDE_TFPARTICLE_H_
29#include "tf_platform.h"
45#define CLUSTER_PARTLIST_INCR 50
56 typedef enum ParticleTypeFlags {
57 PARTICLE_TYPE_NONE = 0,
58 PARTICLE_TYPE_INERTIAL = 1 << 0,
59 PARTICLE_TYPE_DISSAPATIVE = 1 << 1,
62 typedef enum ParticleDynamics {
63 PARTICLE_NEWTONIAN = 0,
64 PARTICLE_OVERDAMPED = 1,
68 typedef enum ParticleFlags {
70 PARTICLE_GHOST = 1 << 0,
71 PARTICLE_CLUSTER = 1 << 1,
72 PARTICLE_BOUND = 1 << 2,
73 PARTICLE_FROZEN_X = 1 << 3,
74 PARTICLE_FROZEN_Y = 1 << 4,
75 PARTICLE_FROZEN_Z = 1 << 5,
76 PARTICLE_FROZEN = PARTICLE_FROZEN_X | PARTICLE_FROZEN_Y | PARTICLE_FROZEN_Z,
77 PARTICLE_LARGE = 1 << 6,
85 struct ClusterParticleHandle;
112 TF_ALIGNED(FPTYPE, 16) f[4];
117 FPTYPE number_density;
133 TF_ALIGNED(FPTYPE, 16) v[4];
138 FPTYPE inv_number_density;
145 TF_ALIGNED(FPTYPE, 16) x[4];
150 uint32_t creation_time;
157 TF_ALIGNED(
FVector3, 16) persistent_force;
253 void set_global_position(
const FVector3& pos);
295 #define VERIFY_PARTICLES() Particle_Verify()
297 #define VERIFY_PARTICLES()
337 ParticleHandle(
const int &
id) : id(id) {}
339 virtual std::string str()
const;
341 virtual ParticleHandle* fission();
471 const FPTYPE& childRatio,
508 const FPTYPE& childRatio,
509 const std::vector<FPTYPE>& speciesRatios,
610 std::vector<int32_t>
neighborIds(
const FPTYPE &distance,
const std::vector<ParticleType> &types);
617 std::vector<int32_t>
neighborIds(
const FPTYPE &distance=-FPTYPE_ONE);
631 std::vector<int32_t>
neighborIds(
const std::vector<ParticleType> &types);
651 std::vector<struct TissueForge::BondHandle>
getBonds();
654 std::vector<struct TissueForge::AngleHandle>
getAngles();
770 static const int MAX_NAME = 64;
839 char name2[MAX_NAME];
931 unsigned int nr_parts=0,
932 std::vector<FVector3> *positions=NULL,
933 std::vector<FVector3> *velocities=NULL,
934 std::vector<int> *clusterIds=NULL
948 bool has(
const int32_t &pid);
980 virtual std::string str()
const;
1088 const FPTYPE& childRatio,
1089 const std::vector<FPTYPE>* speciesRatios=NULL,
1101 std::vector<int> Particles_New(
1102 std::vector<ParticleType*> types,
1103 std::vector<FVector3> *positions=NULL,
1104 std::vector<FVector3> *velocities=NULL,
1105 std::vector<int> *clusterIds=NULL
1108 std::vector<int> Particles_New(
1110 unsigned int nr_parts=0,
1111 std::vector<FVector3> *positions=NULL,
1112 std::vector<FVector3> *velocities=NULL,
1113 std::vector<int> *clusterIds=NULL
1133 CAPI_FUNC(
bool) ParticleType_checkRegistered(
ParticleType *type);
1164 os << p.str().c_str();
1170 os << p.str().c_str();
Definition tfMatrix3.h:35
Include Python header, disable linking to pythonX_d.lib on Windows in debug mode.
Definition tfAngleConfig.h:26
unsigned int * Particle_Colors
Definition tfParticle.h:1130
Particle * Particle_Get(ParticleHandle *pypart)
ParticleType * ParticleType_ForEngine(struct engine *e, FPTYPE mass, FPTYPE charge, const char *name, const char *name2)
ParticleType * ParticleType_FindFromName(const char *name)
Get a registered particle type by type name.
HRESULT Particle_Verify()
HRESULT Particle_Become(Particle *part, ParticleType *type)
ParticleType * ParticleType_New(const char *_name)
The cluster analogue to :class:Particle.
Definition tfCluster.h:40
The cluster analogue to :class:ParticleHandle.
Definition tfCluster.h:102
The cluster analogue to :class:ParticleType.
Definition tfCluster.h:48
A handle to a particle.
Definition tfParticle.h:313
std::vector< int32_t > neighborIds(const std::vector< ParticleType > &types)
Gets a list of nearby particles ids within the global cutoff distance.
void setMass(const FPTYPE &mass)
std::vector< struct TissueForge::AngleHandle > getAngles()
virtual ParticleHandle * split(const FPTYPE &childRatio)
Splits a single particle into two with sizes according to a given ratio.
ParticleList neighbors(const FPTYPE &distance, const std::vector< ParticleType > &types)
Gets a list of nearby particles.
virtual ParticleHandle * split(const FVector3 &childDirection)
Splits a single particle into two along a given direction.
virtual ParticleHandle * split()
Splits a single particle into two.
std::vector< int32_t > neighborIds(const FPTYPE &distance=-FPTYPE_ONE)
Gets a list of nearby particles ids of all types.
virtual ParticleHandle * split(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,...
ParticleList neighbors(const FPTYPE &distance, const TissueForge::ParticleTypeList &types)
Gets a list of nearby particles.
std::vector< struct TissueForge::BondHandle > getBonds()
ParticleList neighbors(const std::vector< ParticleType > &types)
Gets a list of nearby particles within the global cutoff distance.
void setFrozenX(const bool frozen)
void setForceInit(FVector3 force)
rendering::Style * getStyle()
std::vector< struct TissueForge::DihedralHandle > getDihedrals()
ParticleList neighbors(const FPTYPE &distance)
Gets a list of nearby particles of all types.
void setRadius(const FPTYPE &radius)
void setFrozenY(const bool frozen)
void setCharge(const FPTYPE &charge)
HRESULT destroy()
Destroys the particle and removes it from inventory.
void setFrozenZ(const bool frozen)
std::vector< int32_t > neighborIds(const FPTYPE &distance, const std::vector< ParticleType > &types)
Gets a list of nearby particles ids.
void setFrozen(const bool frozen)
int id
Definition tfParticle.h:315
ParticleList neighbors(const TissueForge::ParticleTypeList &types)
Gets a list of nearby particles within the global cutoff distance.
void setPosition(FVector3 position)
virtual FMatrix3 virial(FPTYPE *radius=NULL)
Computes the virial tensor. Optionally pass a distance to include a neighborhood.
virtual ParticleHandle * split(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,...
virtual ParticleHandle * split(const std::vector< FPTYPE > &speciesRatios)
Splits a single particle into two and allocates species according to given ratios.
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 > getBondedNeighborIds()
Gets a list of all bonded neighbor ids.
Particle * get()
Gets the actual particle of this handle.
Definition tfParticle.h:329
FVector3 relativePosition(const FVector3 &origin, const bool &comp_bc=true)
Computes the relative position with respect to an origin while optionally account for boundary condit...
void setStyle(rendering::Style *style)
FPTYPE distance(ParticleHandle *_other)
Calculates the distance to another particle.
ParticleList getBondedNeighbors()
Gets a list of all bonded neighbors.
HRESULT become(ParticleType *type)
Dynamically changes the type of an object. We can change the type of a ParticleType-derived object to...
void setVelocity(FVector3 velocity)
std::vector< int32_t > neighborIds(const FPTYPE &distance, const TissueForge::ParticleTypeList &types)
Gets a list of nearby particles ids.
state::StateVector * getSpecies()
FVector3 sphericalPosition(Particle *particle=NULL, FVector3 *origin=NULL)
Calculates the particle's coordinates in spherical coordinates.
FVector3 & getForceInit()
Definition tfParticle.h:101
int id
Definition tfParticle.h:182
struct state::StateVector * state_vector
Definition tfParticle.h:243
int16_t typeId
Definition tfParticle.h:185
int32_t * parts
Definition tfParticle.h:209
FPTYPE q
Definition tfParticle.h:170
std::string toString()
Get a JSON string representation.
HRESULT addpart(int32_t uid)
static Particle * fromString(const std::string &str)
Create from a JSON string representation.
int32_t clusterId
Definition tfParticle.h:188
uint16_t size_parts
Definition tfParticle.h:215
FPTYPE radius
Definition tfParticle.h:164
struct ParticleHandle * _handle
Definition tfParticle.h:199
FPTYPE imass
Definition tfParticle.h:161
uint16_t flags
Definition tfParticle.h:191
struct ParticleHandle * handle()
Get a handle for this particle.
FPTYPE mass
Definition tfParticle.h:167
uint16_t nr_parts
Definition tfParticle.h:212
rendering::Style * style
Definition tfParticle.h:236
HRESULT removepart(int32_t uid)
A special list with convenience methods for working with sets of particles.
Definition tfParticleList.h:52
Structure containing information on each particle type.
Definition tfParticle.h:768
ParticleType * newType(const char *_name)
Particle type constructor.
bool has(ParticleHandle *part)
TissueForge::ParticleHandle * operator()(const std::string &str, int *clusterId=NULL)
Particle constructor.
virtual HRESULT registerType()
Registers a type with the engine.
uint32_t type_flags
Definition tfParticle.h:778
FPTYPE radius
Default radius of particles.
Definition tfParticle.h:801
virtual ParticleType * get()
Get the type engine instance.
std::string toString()
Get a JSON string representation.
TissueForge::ParticleHandle * operator()(FVector3 *position=NULL, FVector3 *velocity=NULL, int *clusterId=NULL)
Particle constructor.
rendering::Style * style
style pointer, optional.
Definition tfParticle.h:854
void setFrozenZ(const bool &frozen)
std::vector< int > factory(unsigned int nr_parts=0, std::vector< FVector3 > *positions=NULL, std::vector< FVector3 > *velocities=NULL, std::vector< int > *clusterIds=NULL)
Particle factory constructor, for making lots of particles quickly.
FPTYPE kinetic_energy
Kinetic energy of all particles of this type.
Definition tfParticle.h:806
FPTYPE getTargetTemperature()
FPTYPE eps
Definition tfParticle.h:827
void setTargetTemperature(const FPTYPE &temperature)
FPTYPE target_energy
Target energy of all particles of this type.
Definition tfParticle.h:816
FPTYPE charge
Default charge of particles.
Definition tfParticle.h:796
void setFrozen(const bool &frozen)
TissueForge::ParticleList parts
list of particles that belong to this type.
Definition tfParticle.h:844
std::vector< int32_t > getPartIds()
TissueForge::ParticleList & items()
Get all particles of this type.
bool isRegistered()
Tests whether this type is registered.
FPTYPE minimum_radius
Default minimum radius of this type.
Definition tfParticle.h:824
virtual void on_register()
A callback for when a type is registered.
Definition tfParticle.h:963
void setFrozenY(const bool &frozen)
void setFrozenX(const bool &frozen)
int16_t id
Definition tfParticle.h:773
uint16_t particle_flags
Definition tfParticle.h:784
HRESULT del_part(int32_t id)
static std::set< short int > particleTypeIds()
Get all current particle type ids, excluding clusters.
static ParticleType * fromString(const std::string &str)
Create from a JSON string representation.
FPTYPE potential_energy
Potential energy of all particles of this type.
Definition tfParticle.h:811
unsigned char dynamics
Default dynamics of particles of this type.
Definition tfParticle.h:832
bool has(const int32_t &pid)
FPTYPE mass
Default mass of particles.
Definition tfParticle.h:789
TissueForge::ParticleTypeList types
list of particle types that belong to this type.
Definition tfParticle.h:849
HRESULT addpart(int32_t id)
A special list with convenience methods for working with sets of particle types.
Definition tfParticleTypeList.h:41
Definition tfEngine.h:164
The Tissue Forge style type.
Definition tfStyle.h:46
Definition tfSpeciesList.h:37
A state vector of an object.
Definition tfStateVector.h:50
int32_t HRESULT
Definition tf_port.h:255