Basic 3-D particle system solver. More...

#include <Core/Solver/Particle/ParticleSystemSolver3.hpp>

Inheritance diagram for CubbyFlow::ParticleSystemSolver3:
CubbyFlow::PhysicsAnimation CubbyFlow::Animation CubbyFlow::SPHSolver3 CubbyFlow::PCISPHSolver3

Classes

class  Builder
 Front-end to create ParticleSystemSolver3 objects step by step. More...
 

Public Member Functions

 ParticleSystemSolver3 ()
 Constructs an empty solver. More...
 
 ParticleSystemSolver3 (double radius, double mass)
 Constructs a solver with particle parameters. More...
 
 ParticleSystemSolver3 (const ParticleSystemSolver3 &)=delete
 Deleted copy constructor. More...
 
 ParticleSystemSolver3 (ParticleSystemSolver3 &&) noexcept=delete
 Deleted move constructor. More...
 
 ~ParticleSystemSolver3 () override=default
 Default virtual destructor. More...
 
ParticleSystemSolver3operator= (const ParticleSystemSolver3 &)=delete
 Deleted copy assignment operator. More...
 
ParticleSystemSolver3operator= (ParticleSystemSolver3 &&) noexcept=delete
 Deleted move assignment operator. More...
 
double GetDragCoefficient () const
 Returns the drag coefficient. More...
 
void SetDragCoefficient (double newDragCoefficient)
 Sets the drag coefficient. More...
 
double GetRestitutionCoefficient () const
 Gets the restitution coefficient. More...
 
void SetRestitutionCoefficient (double newRestitutionCoefficient)
 Sets the restitution coefficient. More...
 
const Vector3DGetGravity () const
 Returns the gravity. More...
 
void SetGravity (const Vector3D &newGravity)
 Sets the gravity. More...
 
const ParticleSystemData3PtrGetParticleSystemData () const
 Returns the particle system data. More...
 
const Collider3PtrGetCollider () const
 Returns the collider. More...
 
void SetCollider (const Collider3Ptr &newCollider)
 Sets the collider. More...
 
const ParticleEmitter3PtrGetEmitter () const
 Returns the emitter. More...
 
void SetEmitter (const ParticleEmitter3Ptr &newEmitter)
 Sets the emitter. More...
 
const VectorField3PtrGetWind () const
 Returns the wind field. More...
 
void SetWind (const VectorField3Ptr &newWind)
 Sets the wind. More...
 
- Public Member Functions inherited from CubbyFlow::PhysicsAnimation
 PhysicsAnimation ()
 Default constructor. More...
 
 PhysicsAnimation (const PhysicsAnimation &)=default
 Default copy constructor. More...
 
 PhysicsAnimation (PhysicsAnimation &&) noexcept=default
 Default move constructor. More...
 
virtual ~PhysicsAnimation ()=default
 Default virtual destructor. More...
 
PhysicsAnimationoperator= (const PhysicsAnimation &)=default
 Default copy assignment operator. More...
 
PhysicsAnimationoperator= (PhysicsAnimation &&) noexcept=default
 Default move assignment operator. More...
 
bool GetIsUsingFixedSubTimeSteps () const
 Returns true if fixed sub-timestepping is used. More...
 
void SetIsUsingFixedSubTimeSteps (bool isUsing)
 Sets true if fixed sub-timestepping is used. More...
 
unsigned int GetNumberOfFixedSubTimeSteps () const
 Returns the number of fixed sub-timesteps. More...
 
void SetNumberOfFixedSubTimeSteps (unsigned int numberOfSteps)
 Sets the number of fixed sub-timesteps. More...
 
void AdvanceSingleFrame ()
 Advances a single frame. More...
 
Frame GetCurrentFrame () const
 Returns current frame. More...
 
void SetCurrentFrame (const Frame &frame)
 Sets current frame cursor (but do not invoke update()). More...
 
double GetCurrentTimeInSeconds () const
 Returns current time in seconds. More...
 
- Public Member Functions inherited from CubbyFlow::Animation
 Animation ()=default
 Default constructor. More...
 
 Animation (const Animation &)=default
 Default copy constructor. More...
 
 Animation (Animation &&) noexcept=default
 Default move constructor. More...
 
virtual ~Animation ()=default
 Default virtual destructor. More...
 
Animationoperator= (const Animation &)=default
 Default copy assignment operator. More...
 
Animationoperator= (Animation &&) noexcept=default
 Default move assignment operator. More...
 
void Update (const Frame &frame)
 Updates animation state for given frame. More...
 

Static Public Member Functions

static Builder GetBuilder ()
 Returns builder fox ParticleSystemSolver3. More...
 

Protected Member Functions

void OnInitialize () override
 Initializes the simulator. More...
 
void OnAdvanceTimeStep (double timeStepInSeconds) override
 Called to advance a single time-step. More...
 
virtual void AccumulateForces (double timeStepInSeconds)
 Accumulates forces applied to the particles. More...
 
virtual void OnBeginAdvanceTimeStep (double timeStepInSeconds)
 Called when a time-step is about to begin. More...
 
virtual void OnEndAdvanceTimeStep (double timeStepInSeconds)
 Called after a time-step is completed. More...
 
void ResolveCollision ()
 Resolves any collisions occurred by the particles. More...
 
void ResolveCollision (ArrayView1< Vector3D > newPositions, ArrayView1< Vector3D > newVelocities)
 
void SetParticleSystemData (const ParticleSystemData3Ptr &newParticles)
 Assign a new particle system data. More...
 
- Protected Member Functions inherited from CubbyFlow::PhysicsAnimation
virtual unsigned int GetNumberOfSubTimeSteps (double timeIntervalInSeconds) const
 Returns the required number of sub-timesteps for given time interval. More...
 

Detailed Description

Basic 3-D particle system solver.

This class implements basic particle system solver. It includes gravity, air drag, and collision. But it does not compute particle-to-particle interaction. Thus, this solver is suitable for performing simple spray-like simulations with low computational cost. This class can be further extend to add more sophisticated simulations, such as SPH, to handle particle-to-particle intersection.

See also
SPHSolver3

Constructor & Destructor Documentation

◆ ParticleSystemSolver3() [1/4]

CubbyFlow::ParticleSystemSolver3::ParticleSystemSolver3 ( )

Constructs an empty solver.

◆ ParticleSystemSolver3() [2/4]

CubbyFlow::ParticleSystemSolver3::ParticleSystemSolver3 ( double  radius,
double  mass 
)

Constructs a solver with particle parameters.

◆ ParticleSystemSolver3() [3/4]

CubbyFlow::ParticleSystemSolver3::ParticleSystemSolver3 ( const ParticleSystemSolver3 )
delete

Deleted copy constructor.

◆ ParticleSystemSolver3() [4/4]

CubbyFlow::ParticleSystemSolver3::ParticleSystemSolver3 ( ParticleSystemSolver3 &&  )
deletenoexcept

Deleted move constructor.

◆ ~ParticleSystemSolver3()

CubbyFlow::ParticleSystemSolver3::~ParticleSystemSolver3 ( )
overridedefault

Default virtual destructor.

Member Function Documentation

◆ AccumulateForces()

virtual void CubbyFlow::ParticleSystemSolver3::AccumulateForces ( double  timeStepInSeconds)
protectedvirtual

Accumulates forces applied to the particles.

Reimplemented in CubbyFlow::SPHSolver3.

◆ GetBuilder()

static Builder CubbyFlow::ParticleSystemSolver3::GetBuilder ( )
static

Returns builder fox ParticleSystemSolver3.

◆ GetCollider()

const Collider3Ptr& CubbyFlow::ParticleSystemSolver3::GetCollider ( ) const

Returns the collider.

◆ GetDragCoefficient()

double CubbyFlow::ParticleSystemSolver3::GetDragCoefficient ( ) const

Returns the drag coefficient.

◆ GetEmitter()

const ParticleEmitter3Ptr& CubbyFlow::ParticleSystemSolver3::GetEmitter ( ) const

Returns the emitter.

◆ GetGravity()

const Vector3D& CubbyFlow::ParticleSystemSolver3::GetGravity ( ) const

Returns the gravity.

◆ GetParticleSystemData()

const ParticleSystemData3Ptr& CubbyFlow::ParticleSystemSolver3::GetParticleSystemData ( ) const

Returns the particle system data.

This function returns the particle system data. The data is created when this solver is constructed and also owned by the solver.

Returns
The particle system data.

◆ GetRestitutionCoefficient()

double CubbyFlow::ParticleSystemSolver3::GetRestitutionCoefficient ( ) const

Gets the restitution coefficient.

◆ GetWind()

const VectorField3Ptr& CubbyFlow::ParticleSystemSolver3::GetWind ( ) const

Returns the wind field.

◆ OnAdvanceTimeStep()

void CubbyFlow::ParticleSystemSolver3::OnAdvanceTimeStep ( double  timeStepInSeconds)
overrideprotectedvirtual

Called to advance a single time-step.

Implements CubbyFlow::PhysicsAnimation.

◆ OnBeginAdvanceTimeStep()

virtual void CubbyFlow::ParticleSystemSolver3::OnBeginAdvanceTimeStep ( double  timeStepInSeconds)
protectedvirtual

Called when a time-step is about to begin.

Reimplemented in CubbyFlow::SPHSolver3, and CubbyFlow::PCISPHSolver3.

◆ OnEndAdvanceTimeStep()

virtual void CubbyFlow::ParticleSystemSolver3::OnEndAdvanceTimeStep ( double  timeStepInSeconds)
protectedvirtual

Called after a time-step is completed.

Reimplemented in CubbyFlow::SPHSolver3.

◆ OnInitialize()

void CubbyFlow::ParticleSystemSolver3::OnInitialize ( )
overrideprotectedvirtual

Initializes the simulator.

Reimplemented from CubbyFlow::PhysicsAnimation.

◆ operator=() [1/2]

ParticleSystemSolver3& CubbyFlow::ParticleSystemSolver3::operator= ( const ParticleSystemSolver3 )
delete

Deleted copy assignment operator.

◆ operator=() [2/2]

ParticleSystemSolver3& CubbyFlow::ParticleSystemSolver3::operator= ( ParticleSystemSolver3 &&  )
deletenoexcept

Deleted move assignment operator.

◆ ResolveCollision() [1/2]

void CubbyFlow::ParticleSystemSolver3::ResolveCollision ( )
protected

Resolves any collisions occurred by the particles.

◆ ResolveCollision() [2/2]

void CubbyFlow::ParticleSystemSolver3::ResolveCollision ( ArrayView1< Vector3D newPositions,
ArrayView1< Vector3D newVelocities 
)
protected

Resolves any collisions occurred by the particles where the particle state is given by the position and velocity arrays.

◆ SetCollider()

void CubbyFlow::ParticleSystemSolver3::SetCollider ( const Collider3Ptr newCollider)

Sets the collider.

◆ SetDragCoefficient()

void CubbyFlow::ParticleSystemSolver3::SetDragCoefficient ( double  newDragCoefficient)

Sets the drag coefficient.

The drag coefficient controls the amount of air-drag. The coefficient should be a positive number and 0 means no drag force.

Parameters
[in]newDragCoefficientThe new drag coefficient.

◆ SetEmitter()

void CubbyFlow::ParticleSystemSolver3::SetEmitter ( const ParticleEmitter3Ptr newEmitter)

Sets the emitter.

◆ SetGravity()

void CubbyFlow::ParticleSystemSolver3::SetGravity ( const Vector3D newGravity)

Sets the gravity.

◆ SetParticleSystemData()

void CubbyFlow::ParticleSystemSolver3::SetParticleSystemData ( const ParticleSystemData3Ptr newParticles)
protected

Assign a new particle system data.

◆ SetRestitutionCoefficient()

void CubbyFlow::ParticleSystemSolver3::SetRestitutionCoefficient ( double  newRestitutionCoefficient)

Sets the restitution coefficient.

The restitution coefficient controls the bounciness of a particle when it hits a collider surface. The range of the coefficient should be 0 to 1 – 0 means no bounce back and 1 means perfect reflection.

Parameters
[in]newRestitutionCoefficientThe new restitution coefficient.

◆ SetWind()

void CubbyFlow::ParticleSystemSolver3::SetWind ( const VectorField3Ptr newWind)

Sets the wind.

Wind can be applied to the particle system by setting a vector field to the solver.

Parameters
[in]newWindThe new wind.

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