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

handles integration to find next position and velocity of particles More...

#include <Integration.h>

List of all members.

Public Member Functions

 Integration (const IntegrationType _integrationType, const ngl::Real _timestep)
 ctor
void integrateNext (Particle &io_currentParticle)
 integrate next velocity and position of a particle
IntegrationType getIntegrationType () const
 get the integration method
void setIntegrationType (const IntegrationType _v)
 sets the integration method
void setIntegrationType (const int _v)
 set the integration method of the simulation
ngl::Real getTimestep () const
 get the timestep of the simulation
void setTimestep (const ngl::Real _v)
 set the timestep of the simulation

Private Member Functions

void evaluateSemiImplicitEuler (Particle &io_currentParticle)
 integrate a particle using semi implicit euler
void evaluateLeapfrog (Particle &io_currentParticle)
 integrate a particle using leapfrog

Private Attributes

IntegrationType m_integrationType
 integration method
ngl::Real m_timestep
 timestep of simulation

Detailed Description

handles integration to find next position and velocity of particles

Definition at line 23 of file Integration.h.


Constructor & Destructor Documentation

Integration::Integration ( const IntegrationType  _integrationType,
const ngl::Real  _timestep 
)

ctor

Parameters:
[in]_integrationTypethe integration method
[in]_timestepthe timestep of the simulation

Definition at line 7 of file Integration.cpp.

{
    m_integrationType = _integrationType;
    m_timestep = _timestep;
}

Member Function Documentation

void Integration::evaluateLeapfrog ( Particle io_currentParticle) [private]

integrate a particle using leapfrog

Parameters:
[in,out]io_currentParticlethe particle that is being affected

Definition at line 36 of file Integration.cpp.

References Particle::getAcceleration(), Particle::getLastAcceleration(), Particle::getPosition(), Particle::getVelocity(), m_timestep, Particle::updatePosition(), and Particle::updateVelocity().

{
    //modified leapfrog from http://en.wikipedia.org/wiki/Leapfrog_integration
    io_currentParticle.updateVelocity(io_currentParticle.getVelocity() + (((io_currentParticle.getLastAcceleration() + io_currentParticle.getAcceleration()) / 2.0) * m_timestep));

    io_currentParticle.updatePosition(io_currentParticle.getPosition() + (io_currentParticle.getVelocity() * m_timestep) + ((io_currentParticle.getLastAcceleration() / 2.0) * m_timestep * m_timestep));
}

Here is the call graph for this function:

Here is the caller graph for this function:

void Integration::evaluateSemiImplicitEuler ( Particle io_currentParticle) [private]

integrate a particle using semi implicit euler

Parameters:
[in,out]io_currentParticlethe particle that is being affected

Definition at line 28 of file Integration.cpp.

References Particle::getAcceleration(), Particle::getPosition(), Particle::getVelocity(), m_timestep, Particle::updatePosition(), and Particle::updateVelocity().

{
    //semi implicit euler from http://en.wikipedia.org/wiki/Semi-implicit_Euler
    io_currentParticle.updateVelocity(io_currentParticle.getVelocity() + (io_currentParticle.getAcceleration() * m_timestep));

    io_currentParticle.updatePosition(io_currentParticle.getPosition() + (io_currentParticle.getVelocity() * m_timestep));
}

Here is the call graph for this function:

Here is the caller graph for this function:

IntegrationType Integration::getIntegrationType ( ) const [inline]

get the integration method

Definition at line 40 of file Integration.h.

References m_integrationType.

{ return m_integrationType; }
ngl::Real Integration::getTimestep ( ) const [inline]

get the timestep of the simulation

Definition at line 51 of file Integration.h.

References m_timestep.

{ return m_timestep; }

Here is the caller graph for this function:

void Integration::integrateNext ( Particle io_currentParticle)

integrate next velocity and position of a particle

Parameters:
[in,out]io_currentParticlethe particle that is being affected

Definition at line 16 of file Integration.cpp.

References evaluateLeapfrog(), evaluateSemiImplicitEuler(), LEAPFROG, m_integrationType, and SEMI_IMPLICIT_EULER.

{
    //calls user-chosen integrator
    switch (m_integrationType)
    {
        case SEMI_IMPLICIT_EULER: { evaluateSemiImplicitEuler(io_currentParticle); break; }
        case LEAPFROG: { evaluateLeapfrog(io_currentParticle); break; }

        default : break;
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void Integration::setIntegrationType ( const int  _v) [inline]

set the integration method of the simulation

Parameters:
[in]_vnew integration method

Definition at line 48 of file Integration.h.

References m_integrationType.

void Integration::setIntegrationType ( const IntegrationType  _v) [inline]

sets the integration method

Parameters:
[in]_vthe new integration method

Definition at line 44 of file Integration.h.

References m_integrationType.

Here is the caller graph for this function:

void Integration::setTimestep ( const ngl::Real  _v) [inline]

set the timestep of the simulation

Parameters:
[in]_vnew timestep

Definition at line 55 of file Integration.h.

References m_timestep.

{ m_timestep = _v; }

Here is the caller graph for this function:


Member Data Documentation

integration method

Definition at line 60 of file Integration.h.

ngl::Real Integration::m_timestep [private]

timestep of simulation

Definition at line 63 of file Integration.h.


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