Core 1.0
Dla Class Reference

A base diffusion limited aggregation class. More...

#include <dla.h>

Inheritance diagram for Dla:
ParticleSet

Public Member Functions

 Dla (const double &)
 Initialize the DLA structure.
 Dla (const QVector< Vector > &, const double &)
 Initialize the structure with a given set of seeds.
 ~Dla ()
 Empty.
void Add (int=1)
 Add particles to the cluster.
bool Try ()
 Seed a random particle away from the cluster, randomly moves and checks collision with the cluster.
double Radius () const
 Return the radius of the particles.
QVector< Vector > GetCenters () const
 Return the centers of the spheres.
Public Member Functions inherited from ParticleSet
 ParticleSet ()
 Empty constructor.
 ParticleSet (const double &)
 Create an empty set of particles.
 ParticleSet (const Vector &, const double &)
 Create a set of particles.
 ParticleSet (const QVector< Vector > &, const double &)
 Create a set of particles.
int Size () const
 Return the number of particles.
Sphere At (int) const
 Get the k-th particle.
double Radius () const
 Return the radius of the particles.
QVector< Vector > GetCenters () const
 Return the centers of the particles.
Sphere GetSphere () const
 Computes the bounding sphere of the centers of the particles.
Box GetBox () const
 Computes the bounding box of the centers of the particles.
void Append (const Vector &)
 Add a new particle to the set.
bool Intersect (const Sphere &) const
 Check the intersection between the cluster and a sphere.
bool Intersect (const Box &) const
 Check the intersection between the cluster and a box.

Public Attributes

int nfar = 0
 Record of number of particles that moved too far away.
int nhit = 0
 Collisions.
int ntry = 0
 Number of growth tries.

Protected Attributes

Box box = Box::Null
 Bounding box of the particles.
QVector< int > v
 Tree structure topology, i.e., index of the collided particle during cluster growth.
Protected Attributes inherited from ParticleSet
QVector< Vector > points
 Set of particles.
double r = 0.0
 Radius of particles.

Detailed Description

A base diffusion limited aggregation class.

Constructor & Destructor Documentation

◆ Dla() [1/2]

Dla::Dla ( const double & r)
explicit

Initialize the DLA structure.

Parameters
rRadius of particles.

◆ Dla() [2/2]

Dla::Dla ( const QVector< Vector > & s,
const double & r )
explicit

Initialize the structure with a given set of seeds.

Parameters
sSet of seeds.
rRadius of particles.

Member Function Documentation

◆ Add()

void Dla::Add ( int n = 1)

Add particles to the cluster.

For each particle, repeatedly performs a random walk until one particle collides with the cluster and aggregates.

Parameters
nNumber of particles to add.
See also
Dla::Try()

◆ Try()

bool Dla::Try ( )

Seed a random particle away from the cluster, randomly moves and checks collision with the cluster.

The particle starts on a sphere around the cluster and performs at most one thousand steps. It stops if it escapes too far from the cluster. The random walk uses the global random number generator of the sphere class, which cannot be controlled from the class.

Returns
Returns true if the particle collided with the cluster and was added to it, false if it escaped or if it did not hit the cluster after the maximum number of steps.