Lagrangian Liquid Simulation
Master Thesis project on simulation of liquids using Lagrangian approach and SPH
Particle Class Reference

base particle class to all others, it is used and extended to represent fluid and rigid bodies More...

#include <Particle.h>

Inheritance diagram for Particle:

List of all members.

Public Member Functions

 Particle ()
 ctor
 Particle (const Particle &_particle)
 copy ctor
 Particle (const int _id, const ngl::Real _mass, const ngl::Vector _position, const ngl::Colour _colour, const ngl::Real _radius, const bool _moveable=true, const ngl::Vector _velocity=0, const ngl::Vector _acceleration=0, const ngl::Vector _netForce=0)
 ctor
 ~Particle ()
 dtor
int getId () const
 return the id
void setId (const int _id)
 sets the id
ngl::Real getMass () const
 return the mass
ngl::Vector getLastPosition () const
 return the last position
ngl::Vector getPosition () const
 return the current position
void setPosition (const ngl::Vector _p)
 sets the position
void updatePosition (const ngl::Vector _p)
 update the position to a new value
ngl::Vector getLastVelocity () const
 return the last velocity
ngl::Vector getVelocity () const
 return the current velocity
void setVelocity (const ngl::Vector _v)
 sets the velocity
void updateVelocity (const ngl::Vector _v)
 update the velocity to a new value
void resetForce ()
 reset all the forces
ngl::Vector getNetForce () const
 return the net force
void accumulateNetForce (const ngl::Vector _f)
 add in a force to the accumulated force
ngl::Vector getLastAcceleration () const
 return the last acceleration
ngl::Vector getAcceleration () const
 return the current acceleration
void setAcceleration (const ngl::Vector _a)
 set the acceleration
void updateAcceleration (const ngl::Vector _a)
 update the acceleration
bool getMoveable () const
 return whether the particle is static
void setMoveable (const bool _f)
 set a flag to determine whether the particle is static
ngl::Real getRadius () const
 return the radius
void setRadius (const ngl::Real _c)
 set the radius
ngl::Colour getColour () const
 return the current colour
void setColour (const ngl::Colour _c)
 set the colour

Protected Attributes

int m_id
 unique id of the particle
ngl::Real m_mass
 mass of the particle
ngl::Vector m_lastPosition
 last position of the particle
ngl::Vector m_position
 position of the particle
ngl::Vector m_lastVelocity
 last velocity of the particle
ngl::Vector m_velocity
 velocity of the particle
ngl::Vector m_lastAcceleration
 last acceleration of the particle
ngl::Vector m_acceleration
 acceleration of the particle
ngl::Vector m_netForce
 net force on the particle
ngl::Real m_moveable
 flag for moveability
ngl::Real m_radius
 collision sphere radius
ngl::Colour m_colour
 colour of particle for rendering

Detailed Description

base particle class to all others, it is used and extended to represent fluid and rigid bodies

Definition at line 20 of file Particle.h.


Constructor & Destructor Documentation

Particle::Particle ( )

ctor

Definition at line 6 of file Particle.cpp.

{
    Particle::Particle(0, 0, 0, 0, 0);
}
Particle::Particle ( const Particle _particle)

copy ctor

Parameters:
[in]_particlethe copied object

Definition at line 11 of file Particle.cpp.

References getAcceleration(), getColour(), getId(), getMass(), getMoveable(), getNetForce(), getPosition(), getRadius(), getVelocity(), m_acceleration, m_colour, m_id, m_lastAcceleration, m_lastPosition, m_lastVelocity, m_mass, m_moveable, m_netForce, m_position, m_radius, and m_velocity.

{
    m_id = _particle.getId();

    m_mass = _particle.getMass();

    m_position = _particle.getPosition();
    m_lastPosition = m_position;

    m_velocity = _particle.getVelocity();
    m_lastVelocity = m_velocity;

    m_acceleration = _particle.getAcceleration();
    m_lastAcceleration = m_acceleration;

    m_netForce = _particle.getNetForce();

    m_moveable = _particle.getMoveable();

    m_radius = _particle.getRadius();

    m_colour = _particle.getColour();
}

Here is the call graph for this function:

Particle::Particle ( const int  _id,
const ngl::Real  _mass,
const ngl::Vector  _position,
const ngl::Colour  _colour,
const ngl::Real  _radius,
const bool  _moveable = true,
const ngl::Vector  _velocity = 0,
const ngl::Vector  _acceleration = 0,
const ngl::Vector  _netForce = 0 
)

ctor

Parameters:
[in]_idthe id of the particle
[in]_massthe mass of the particle
[in]_positionthe position of the particle
[in]_colourthe colour of the particle
[in]_radiusthe radius of the particle
[in]_moveableflag to determine whether particle is static
[in]_velocitythe velocity of the particle
[in]_accelerationthe acceleration of the particle
[in]_netForcethe net force acting on the partcile

Definition at line 36 of file Particle.cpp.

{
    //init params
    m_id = _id;

    m_mass = _mass;

    m_position = _position;
    m_lastPosition = m_position;

    m_velocity = _velocity;
    m_lastVelocity = m_velocity;

    m_acceleration = _acceleration;
    m_lastAcceleration = m_acceleration;

    m_netForce = _netForce;

    m_moveable = _moveable;

    m_radius = _radius;

    m_colour = _colour;
}
Particle::~Particle ( )

dtor

Definition at line 71 of file Particle.cpp.

{
}

Member Function Documentation

void Particle::accumulateNetForce ( const ngl::Vector  _f) [inline]

add in a force to the accumulated force

Parameters:
[in]_fthe force to add

Definition at line 102 of file Particle.h.

References m_netForce.

{ m_netForce += _f; }
ngl::Vector Particle::getAcceleration ( ) const [inline]

return the current acceleration

Definition at line 108 of file Particle.h.

References m_acceleration.

{ return m_acceleration; }

Here is the caller graph for this function:

ngl::Colour Particle::getColour ( ) const [inline]

return the current colour

Definition at line 133 of file Particle.h.

References m_colour.

{ return m_colour; }

Here is the caller graph for this function:

int Particle::getId ( ) const [inline]

return the id

Definition at line 57 of file Particle.h.

References m_id.

{ return m_id; }

Here is the caller graph for this function:

ngl::Vector Particle::getLastAcceleration ( ) const [inline]

return the last acceleration

Definition at line 105 of file Particle.h.

References m_lastAcceleration.

{ return m_lastAcceleration; }

Here is the caller graph for this function:

ngl::Vector Particle::getLastPosition ( ) const [inline]

return the last position

Definition at line 67 of file Particle.h.

References m_lastPosition.

{ return m_lastPosition; }
ngl::Vector Particle::getLastVelocity ( ) const [inline]

return the last velocity

Definition at line 81 of file Particle.h.

References m_lastVelocity.

{ return m_lastVelocity; }
ngl::Real Particle::getMass ( ) const [inline]

return the mass

Definition at line 64 of file Particle.h.

References m_mass.

{ return m_mass; }

Here is the caller graph for this function:

bool Particle::getMoveable ( ) const [inline]

return whether the particle is static

Definition at line 119 of file Particle.h.

References m_moveable.

{ return m_moveable; }

Here is the caller graph for this function:

ngl::Vector Particle::getNetForce ( ) const [inline]

return the net force

Definition at line 98 of file Particle.h.

References m_netForce.

{ return m_netForce; }

Here is the caller graph for this function:

ngl::Vector Particle::getPosition ( ) const [inline]

return the current position

Definition at line 70 of file Particle.h.

References m_position.

{ return m_position; }

Here is the caller graph for this function:

ngl::Real Particle::getRadius ( ) const [inline]

return the radius

Definition at line 126 of file Particle.h.

References m_radius.

{ return m_radius; }

Here is the caller graph for this function:

ngl::Vector Particle::getVelocity ( ) const [inline]

return the current velocity

Definition at line 84 of file Particle.h.

References m_velocity.

{ return m_velocity; }

Here is the caller graph for this function:

void Particle::resetForce ( ) [inline]

reset all the forces

Reimplemented in FluidParticle.

Definition at line 95 of file Particle.h.

References m_netForce.

{ m_netForce = 0; }
void Particle::setAcceleration ( const ngl::Vector  _a)

set the acceleration

Parameters:
[in]_athe new acceleration

Definition at line 107 of file Particle.cpp.

References m_acceleration, and m_lastAcceleration.

{
    //set velocities to new value
    m_lastAcceleration = _a;
    m_acceleration = _a;
}

Here is the caller graph for this function:

void Particle::setColour ( const ngl::Colour  _c) [inline]

set the colour

Parameters:
[in]_cthe new colour

Definition at line 137 of file Particle.h.

References m_colour.

{ m_colour = _c; }
void Particle::setId ( const int  _id) [inline]

sets the id

Parameters:
[in]_idthe id

Definition at line 61 of file Particle.h.

References m_id.

{ m_id = _id; }

Here is the caller graph for this function:

void Particle::setMoveable ( const bool  _f) [inline]

set a flag to determine whether the particle is static

Parameters:
[in]_fthe flag to determine whether particle is static

Definition at line 123 of file Particle.h.

References m_moveable.

{ m_moveable = _f; }
void Particle::setPosition ( const ngl::Vector  _p)

sets the position

Parameters:
[in]_pthe new position

Definition at line 75 of file Particle.cpp.

References m_lastPosition, and m_position.

{
    //set positions to new value
    m_lastPosition = _p;
    m_position = _p;
}

Here is the caller graph for this function:

void Particle::setRadius ( const ngl::Real  _c) [inline]

set the radius

Parameters:
[in]_cthe radius

Definition at line 130 of file Particle.h.

References m_radius.

{ m_radius = _c; }
void Particle::setVelocity ( const ngl::Vector  _v)

sets the velocity

Parameters:
[in]_vthe new velocity

Definition at line 91 of file Particle.cpp.

References m_lastVelocity, and m_velocity.

{
    //set velocities to new value
    m_lastVelocity = _v;
    m_velocity = _v;
}

Here is the caller graph for this function:

void Particle::updateAcceleration ( const ngl::Vector  _a)

update the acceleration

Parameters:
[in]_athe new acceleration

Definition at line 114 of file Particle.cpp.

References m_acceleration, and m_lastAcceleration.

{
    //save current value
    m_lastAcceleration = m_acceleration;

    //update to new value
    m_acceleration = _a;
}
void Particle::updatePosition ( const ngl::Vector  _p)

update the position to a new value

Parameters:
[in]_pthe new position

Definition at line 82 of file Particle.cpp.

References m_lastPosition, and m_position.

{
    //save current value
    m_lastPosition = m_position;

    //update to new value
    m_position = _p;
}

Here is the caller graph for this function:

void Particle::updateVelocity ( const ngl::Vector  _v)

update the velocity to a new value

Parameters:
[in]_vthe new velocity

Definition at line 98 of file Particle.cpp.

References m_lastVelocity, and m_velocity.

{
    //save current value
    m_lastVelocity = m_velocity;

    //update to new value
    m_velocity = _v;
}

Here is the caller graph for this function:


Member Data Documentation

ngl::Vector Particle::m_acceleration [protected]

acceleration of the particle

Definition at line 162 of file Particle.h.

ngl::Colour Particle::m_colour [protected]

colour of particle for rendering

Definition at line 174 of file Particle.h.

int Particle::m_id [protected]

unique id of the particle

Definition at line 141 of file Particle.h.

ngl::Vector Particle::m_lastAcceleration [protected]

last acceleration of the particle

Definition at line 159 of file Particle.h.

ngl::Vector Particle::m_lastPosition [protected]

last position of the particle

Definition at line 147 of file Particle.h.

ngl::Vector Particle::m_lastVelocity [protected]

last velocity of the particle

Definition at line 153 of file Particle.h.

ngl::Real Particle::m_mass [protected]

mass of the particle

Definition at line 144 of file Particle.h.

ngl::Real Particle::m_moveable [protected]

flag for moveability

Definition at line 168 of file Particle.h.

ngl::Vector Particle::m_netForce [protected]

net force on the particle

Definition at line 165 of file Particle.h.

ngl::Vector Particle::m_position [protected]

position of the particle

Definition at line 150 of file Particle.h.

ngl::Real Particle::m_radius [protected]

collision sphere radius

Definition at line 171 of file Particle.h.

ngl::Vector Particle::m_velocity [protected]

velocity of the particle

Definition at line 156 of file Particle.h.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator