Class Simulation

Nested Relationships

Nested Types

Inheritance Relationships

Base Type

  • public ParameterObject

Class Documentation

class SPH::Simulation : public ParameterObject

Class to manage the current simulation time and the time step size. This class is a singleton.

Public Types

typedef PrecomputedKernel<CubicKernel, 10000> PrecomputedCubicKernel

Public Functions

Simulation()
Simulation(const Simulation&) = delete
Simulation &operator=(const Simulation&) = delete
~Simulation()
void init(const Real particleRadius, const bool sim2D)
void deferredInit()

This function is called after the simulation scene is loaded and all parameters are initialized. While reading a scene file several parameters can change. The deferred init function should initialize all values which depend on these parameters.

void reset()
void addFluidModel(const std::string &id, const unsigned int nFluidParticles, Vector3r *fluidParticles, Vector3r *fluidVelocities, const unsigned int nMaxEmitterParticles)
inline FluidModel *getFluidModel(const unsigned int index)
inline FluidModel *getFluidModelFromPointSet(const unsigned int pointSetIndex)
inline const unsigned int numberOfFluidModels() const
void addBoundaryModel(BoundaryModel *bm)
inline BoundaryModel *getBoundaryModel(const unsigned int index)
inline BoundaryModel *getBoundaryModelFromPointSet(const unsigned int pointSetIndex)
inline const unsigned int numberOfBoundaryModels() const
void updateBoundaryVolume()
inline AnimationFieldSystem *getAnimationFieldSystem()
inline BoundaryHandlingMethods getBoundaryHandlingMethod() const
inline void setBoundaryHandlingMethod(BoundaryHandlingMethods val)
inline int getKernel() const
void setKernel(int val)
inline int getGradKernel() const
void setGradKernel(int val)
inline int isSimulationInitialized() const
void setSimulationInitialized(int val)
inline FORCE_INLINE Real W_zero () const
inline FORCE_INLINE Real W (const Vector3r &r) const
inline FORCE_INLINE Vector3r gradW (const Vector3r &r)
inline int getSimulationMethod() const
void setSimulationMethod(const int val)
void setSimulationMethodChangedCallback(std::function<void()> const &callBackFct)
inline TimeStep *getTimeStep()
inline bool is2DSimulation()
inline bool zSortEnabled()
void initKernels()
void setParticleRadius(Real val)
inline Real getParticleRadius() const
inline Real getSupportRadius() const
void updateTimeStepSize()

Update time step size depending on the chosen method.

void updateTimeStepSizeCFL()

Update time step size by CFL condition.

virtual void performNeighborhoodSearch()

Perform the neighborhood search for all fluid particles.

void performNeighborhoodSearchSort()
void computeNonPressureForces()
void animateParticles()
void emitParticles()
virtual void emittedParticles(FluidModel *model, const unsigned int startIndex)
inline NeighborhoodSearch *getNeighborhoodSearch()
void saveState(BinaryFileWriter &binWriter)
void loadState(BinaryFileReader &binReader)
inline void addDragMethod(const std::string &name, const std::function<NonPressureForceBase*(FluidModel*)> &creator)
inline std::vector<NonPressureForceMethod> &getDragMethods()
inline void addElasticityMethod(const std::string &name, const std::function<NonPressureForceBase*(FluidModel*)> &creator)
inline std::vector<NonPressureForceMethod> &getElasticityMethods()
inline void addSurfaceTensionMethod(const std::string &name, const std::function<NonPressureForceBase*(FluidModel*)> &creator)
inline std::vector<NonPressureForceMethod> &getSurfaceTensionMethods()
inline void addViscosityMethod(const std::string &name, const std::function<NonPressureForceBase*(FluidModel*)> &creator)
inline std::vector<NonPressureForceMethod> &getViscosityMethods()
inline void addVorticityMethod(const std::string &name, const std::function<NonPressureForceBase*(FluidModel*)> &creator)
inline std::vector<NonPressureForceMethod> &getVorticityMethods()
inline FORCE_INLINE unsigned int numberOfPointSets () const
inline FORCE_INLINE unsigned int numberOfNeighbors (const unsigned int pointSetIndex, const unsigned int neighborPointSetIndex, const unsigned int index) const
inline FORCE_INLINE unsigned int getNeighbor (const unsigned int pointSetIndex, const unsigned int neighborPointSetIndex, const unsigned int index, const unsigned int k) const
inline FORCE_INLINE const unsigned int * getNeighborList (const unsigned int pointSetIndex, const unsigned int neighborPointSetIndex, const unsigned int index) const

Public Static Functions

static Simulation *getCurrent()
static void setCurrent(Simulation *tm)
static bool hasCurrent()

Public Static Attributes

static int SIM_2D = -1
static int PARTICLE_RADIUS = -1
static int GRAVITATION = -1
static int CFL_METHOD = -1
static int CFL_FACTOR = -1
static int CFL_MIN_TIMESTEPSIZE = -1
static int CFL_MAX_TIMESTEPSIZE = -1
static int ENABLE_Z_SORT = -1
static int KERNEL_METHOD = -1
static int GRAD_KERNEL_METHOD = -1
static int ENUM_KERNEL_CUBIC = -1
static int ENUM_KERNEL_WENDLANDQUINTICC2 = -1
static int ENUM_KERNEL_POLY6 = -1
static int ENUM_KERNEL_SPIKY = -1
static int ENUM_KERNEL_PRECOMPUTED_CUBIC = -1
static int ENUM_KERNEL_CUBIC_2D = -1
static int ENUM_KERNEL_WENDLANDQUINTICC2_2D = -1
static int ENUM_GRADKERNEL_CUBIC = -1
static int ENUM_GRADKERNEL_WENDLANDQUINTICC2 = -1
static int ENUM_GRADKERNEL_POLY6 = -1
static int ENUM_GRADKERNEL_SPIKY = -1
static int ENUM_GRADKERNEL_PRECOMPUTED_CUBIC = -1
static int ENUM_GRADKERNEL_CUBIC_2D = -1
static int ENUM_GRADKERNEL_WENDLANDQUINTICC2_2D = -1
static int SIMULATION_METHOD = -1
static int ENUM_CFL_NONE = -1
static int ENUM_CFL_STANDARD = -1
static int ENUM_CFL_ITER = -1
static int ENUM_SIMULATION_WCSPH = -1
static int ENUM_SIMULATION_PCISPH = -1
static int ENUM_SIMULATION_PBF = -1
static int ENUM_SIMULATION_IISPH = -1
static int ENUM_SIMULATION_DFSPH = -1
static int ENUM_SIMULATION_PF = -1
static int ENUM_SIMULATION_ICSPH = -1
static int BOUNDARY_HANDLING_METHOD = -1
static int ENUM_AKINCI2012 = -1
static int ENUM_KOSCHIER2017 = -1
static int ENUM_BENDER2019 = -1

Protected Functions

virtual void initParameters()
void registerNonpressureForces()

Protected Attributes

std::vector<FluidModel*> m_fluidModels
std::vector<BoundaryModel*> m_boundaryModels
NeighborhoodSearch *m_neighborhoodSearch
AnimationFieldSystem *m_animationFieldSystem
int m_cflMethod
Real m_cflFactor
Real m_cflMinTimeStepSize
Real m_cflMaxTimeStepSize
int m_kernelMethod
int m_gradKernelMethod
Real m_W_zero
Real (*m_kernelFct)(const Vector3r&)
Vector3r (*m_gradKernelFct)(const Vector3r &r)
SimulationMethods m_simulationMethod
TimeStep *m_timeStep
Vector3r m_gravitation
Real m_particleRadius
Real m_supportRadius
bool m_sim2D
bool m_enableZSort
std::function<void()> m_simulationMethodChanged
int m_boundaryHandlingMethod
std::vector<NonPressureForceMethod> m_dragMethods
std::vector<NonPressureForceMethod> m_elasticityMethods
std::vector<NonPressureForceMethod> m_surfaceTensionMethods
std::vector<NonPressureForceMethod> m_vorticityMethods
std::vector<NonPressureForceMethod> m_viscoMethods
bool m_simulationIsInitialized
struct NonPressureForceMethod

Public Members

std::string m_name
std::function<NonPressureForceBase*(FluidModel*)> m_creator
int m_id