CubbyFlow::PhysicsAnimation Class Referenceabstract

Abstract base class for physics-based animation. More...

#include <Core/Animation/PhysicsAnimation.h>

Inheritance diagram for CubbyFlow::PhysicsAnimation:
CubbyFlow::Animation CubbyFlow::GridFluidSolver2 CubbyFlow::GridFluidSolver3 CubbyFlow::ParticleSystemSolver2 CubbyFlow::ParticleSystemSolver3 CubbyFlow::GridSmokeSolver2 CubbyFlow::LevelSetLiquidSolver2 CubbyFlow::PICSolver2 CubbyFlow::GridSmokeSolver3 CubbyFlow::LevelSetLiquidSolver3 CubbyFlow::PICSolver3 CubbyFlow::SPHSolver2 CubbyFlow::SPHSolver3

Public Member Functions

 PhysicsAnimation ()
 Default constructor. More...
 
virtual ~PhysicsAnimation ()
 Destructor. 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 ()
 
virtual ~Animation ()
 
void Update (const Frame &frame)
 Updates animation state for given frame. More...
 

Protected Member Functions

virtual void OnAdvanceTimeStep (double timeIntervalInSeconds)=0
 Called when a single time-step should be advanced. More...
 
virtual unsigned int GetNumberOfSubTimeSteps (double timeIntervalInSeconds) const
 Returns the required number of sub-timesteps for given time interval. More...
 
virtual void OnInitialize ()
 Called at frame 0 to initialize the physics state. More...
 

Detailed Description

Abstract base class for physics-based animation.

This class represents physics-based animation by adding time-integration specific functions to Animation class.

Constructor & Destructor Documentation

◆ PhysicsAnimation()

CubbyFlow::PhysicsAnimation::PhysicsAnimation ( )

Default constructor.

◆ ~PhysicsAnimation()

virtual CubbyFlow::PhysicsAnimation::~PhysicsAnimation ( )
virtual

Destructor.

Member Function Documentation

◆ AdvanceSingleFrame()

void CubbyFlow::PhysicsAnimation::AdvanceSingleFrame ( )

Advances a single frame.

◆ GetCurrentFrame()

Frame CubbyFlow::PhysicsAnimation::GetCurrentFrame ( ) const

Returns current frame.

◆ GetCurrentTimeInSeconds()

double CubbyFlow::PhysicsAnimation::GetCurrentTimeInSeconds ( ) const

Returns current time in seconds.

This function returns the current time which is calculated by adding current frame + sub-timesteps it passed.

◆ GetIsUsingFixedSubTimeSteps()

bool CubbyFlow::PhysicsAnimation::GetIsUsingFixedSubTimeSteps ( ) const

Returns true if fixed sub-timestepping is used.

When performing a time-integration, it is often required to take sub-timestepping for better results. The sub-stepping can be either fixed rate or adaptive, and this function returns which feature is currently selected.

Returns
True if using fixed sub time steps, false otherwise.

◆ GetNumberOfFixedSubTimeSteps()

unsigned int CubbyFlow::PhysicsAnimation::GetNumberOfFixedSubTimeSteps ( ) const

Returns the number of fixed sub-timesteps.

When performing a time-integration, it is often required to take sub-timestepping for better results. The sub-stepping can be either fixed rate or adaptive, and this function returns the number of fixed sub-steps.

Returns
The number of fixed sub-timesteps.

◆ GetNumberOfSubTimeSteps()

virtual unsigned int CubbyFlow::PhysicsAnimation::GetNumberOfSubTimeSteps ( double  timeIntervalInSeconds) const
protectedvirtual

Returns the required number of sub-timesteps for given time interval.

The required number of sub-timestep can be different depending on the physics model behind the implementation. Override this function to implement own logic for model specific sub-timestepping for given time interval.

Parameters
[in]timeIntervalInSecondsThe time interval in seconds.
Returns
The required number of sub-timesteps.

Reimplemented in CubbyFlow::GridFluidSolver2, CubbyFlow::GridFluidSolver3, CubbyFlow::SPHSolver2, and CubbyFlow::SPHSolver3.

◆ OnAdvanceTimeStep()

virtual void CubbyFlow::PhysicsAnimation::OnAdvanceTimeStep ( double  timeIntervalInSeconds)
protectedpure virtual

Called when a single time-step should be advanced.

When Animation::update function is called, this class will internally subdivide a frame into sub-steps if needed. Each sub-step, or time-step, is then taken to move forward in time. This function is called for each time-step, and a subclass that inherits PhysicsAnimation class should implement this function for its own physics model.

Parameters
[in]timeIntervalInSecondsThe time interval in seconds

Implemented in CubbyFlow::GridFluidSolver2, CubbyFlow::GridFluidSolver3, CubbyFlow::ParticleSystemSolver2, and CubbyFlow::ParticleSystemSolver3.

◆ OnInitialize()

virtual void CubbyFlow::PhysicsAnimation::OnInitialize ( )
protectedvirtual

Called at frame 0 to initialize the physics state.

Inheriting classes can override this function to setup initial condition for the simulation.

Reimplemented in CubbyFlow::GridFluidSolver2, CubbyFlow::GridFluidSolver3, CubbyFlow::ParticleSystemSolver2, CubbyFlow::ParticleSystemSolver3, CubbyFlow::PICSolver3, and CubbyFlow::PICSolver2.

◆ SetCurrentFrame()

void CubbyFlow::PhysicsAnimation::SetCurrentFrame ( const Frame frame)

Sets current frame cursor (but do not invoke update()).

◆ SetIsUsingFixedSubTimeSteps()

void CubbyFlow::PhysicsAnimation::SetIsUsingFixedSubTimeSteps ( bool  isUsing)

Sets true if fixed sub-timestepping is used.

When performing a time-integration, it is often required to take sub-timestepping for better results. The sub-stepping can be either fixed rate or adaptive, and this function sets which feature should be selected.

Parameters
[in]isUsingTrue to enable fixed sub-stepping.

◆ SetNumberOfFixedSubTimeSteps()

void CubbyFlow::PhysicsAnimation::SetNumberOfFixedSubTimeSteps ( unsigned int  numberOfSteps)

Sets the number of fixed sub-timesteps.

When performing a time-integration, it is often required to take sub-timestepping for better results. The sub-stepping can be either fixed rate or adaptive, and this function sets the number of fixed sub-steps.

Parameters
[in]numberOfStepsThe number of fixed sub-timesteps.

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