Core 1.0
DiscSystem Class Reference

A particle system constrained to an implicit surface. More...

#include <discsystem.h>

Public Member Functions

 DiscSystem (const AnalyticScalarField *, const double &, int)
 Creates a particle system constrained to an implicit surface.
 
 ~DiscSystem ()
 Destroy a particle system.
 
void Steps (int=1)
 Update the particle system.
 
void Cast ()
 Cast all the particles on the implicit surface.
 
Circle operator() (int) const
 Get the i-th particle.
 
Circleoperator() (int)
 Get the i-th particle.
 
void AddParticle (const Vector &, const double &)
 Insert a new particle in the list.
 
int Size () const
 Get the number of particles.
 

Protected Member Functions

void Cast (int)
 Cast a particle on the implicit surface.
 
void Step (int)
 Particle update.
 
int Closest (int, int *, double *) const
 Find the neighbors closest to a particle.
 
void Compute (int, Vector &, double &, bool &, bool &, int, int *)
 Computes the position and radius derivatives with respect to time.
 
void SplitParticle (int)
 Split a particle into two slighly perturbed ones.
 
void DeleteParticle (int)
 Delete a particle.
 

Protected Attributes

DynamicArrayIndex subd
 Voxel subdivision of space required for an efficient determination of neighbor relations between particles.
 
QVector< Circleparticles
 Array of particles.
 
double time_step = 1.0
 Step size for numerical integration.
 
const AnalyticScalarFieldfunction = nullptr
 Reference to function.
 
double ir = 1.0
 Initial radius.
 

Static Protected Attributes

static const double Beta = 10.0
 Used in computation of the variation of radius.
 
static const double Gamma = 4.0
 Equilibrium speed.
 
static const double Delta = 0.7
 Percentage of nominal radius, used as minimum radius.
 
static const double Rho = 10.0
 Coefficient for radius term.
 
static const double WH_PHI = 10.0
 For gradient feedback term.
 
static const double DeltaT = 0.1
 Time step.
 
static const double sigma = 1.5
 Coefficient for splitting particles.
 
static const double epsilon = 0.001
 Gradient epsilon for vanishing gradient.
 

Detailed Description

A particle system constrained to an implicit surface.

This class implements Witkin-Heckbert particle system over an implicit surface. It may be used to generate a cloud of vertices located almost uniformly over the implicit surface.

Constructor & Destructor Documentation

◆ DiscSystem()

DiscSystem::DiscSystem ( const AnalyticScalarField * f,
const double & r,
int n )

Creates a particle system constrained to an implicit surface.

Parameters
fImplicit surface class.
rRadius of the particles.
nSpatial subdivision used to speed up particle update.

◆ ~DiscSystem()

DiscSystem::~DiscSystem ( )

Destroy a particle system.

This function destroys the internal acceleration data-structures but does not destroy the implicit function.

Member Function Documentation

◆ AddParticle()

void DiscSystem::AddParticle ( const Vector & p,
const double & r )

Insert a new particle in the list.

This function hides the particles-poll mechanism that keeps track of indices of previously deleted indices to be reused. The gradient of the field function at the location of the particle is computed internally.

Parameters
pCenter of new particle.
rRadius of particle.

◆ Cast()

void DiscSystem::Cast ( int i)
protected

Cast a particle on the implicit surface.

The particle is destroyed if gradient vanishes to null.

Parameters
iParticle identifier.

◆ Closest()

int DiscSystem::Closest ( int id,
int * cc,
double * ll ) const
protected

Find the neighbors closest to a particle.

These are saved in a cache to improve speed in calculations of repulsion forces.

◆ Compute()

void DiscSystem::Compute ( int id,
Vector & delta_P,
double & delta_rad,
bool & split_flag,
bool & death_flag,
int ncl,
int * close )
protected

Computes the position and radius derivatives with respect to time.

Parameters
idIndex of particle (should be called with ci[k] as argument).
delta_PVariation of the position of the particle (projected to tangent plane).
delta_radVariation of the radius of the particle.
split_flagSplitting flag.
death_flagDeath flag.
nclNumber of closest particles.
closeId of closest particles.

◆ DeleteParticle()

void DiscSystem::DeleteParticle ( int id)
protected

Delete a particle.

Parameters
idIndex.

◆ SplitParticle()

void DiscSystem::SplitParticle ( int i)
protected

Split a particle into two slighly perturbed ones.

Parameters
iIndex of particle.

◆ Step()

void DiscSystem::Step ( int i)
protected

Particle update.

Find the closest neighbors, and then computes Witkin and Hekbert parameters. Particle's behavior is modified according to those parameters.

Parameters
iIndex of particle.

◆ Steps()

void DiscSystem::Steps ( int n = 1)

Update the particle system.

Iteratively update all particles.

Parameters
nNumber of iterations.