
About SPlisHSPlasH¶
SPlisHSPlasH is an open-source library for the physically-based simulation of fluids. The simulation in this library is based on the Smoothed Particle Hydrodynamics (SPH) method which is a popular meshless Lagrangian approach to simulate complex fluid effects. The SPH formalism allows an efficient computation of a certain quantity of a fluid particle by considering only a finite set of neighboring particles. One of the most important research topics in the field of SPH methods is the simulation of incompressible fluids. SPlisHSPlasH implements current state-of-the-art pressure solvers (WCSPH, PCISPH, PBF, IISPH, DFSPH, PF) to simulate incompressibility. Moreover, the library provides different methods to simulate viscosity, surface tension and vorticity.
Main features¶
an open-source SPH fluid simulation (2D & 3D)
neighborhood search on CPU or GPU
supports vectorization using AVX
Python binding (thanks to Stefan Jeske)
supports embedded Python scripts
several implicit pressure solvers (WCSPH, PCISPH, PBF, IISPH, DFSPH, PF)
explicit and implicit viscosity methods
current surface tension approaches
different vorticity methods
computation of drag forces
support for multi-phase simulations
simulation of deformable solids
rigid-fluid coupling with static and dynamic bodies
two-way coupling with deformable solids
fluid emitters
scripted animation fields
a json-based scene file importer
automatic surface sampling
a tool for volume sampling of closed geometries
partio file export of all particle data
VTK file export of all particle data (enables the data import in ParaView)
rigid body export
a Maya plugin to model and generate scene files
a ParaView plugin to import particle data
License¶
The MIT License (MIT)
Copyright (c) 2016-present, SPlisHSPlasH contributors
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Getting started¶
This page should give you a short overview of SPlisHSPlasH.
SPlisHSPlasH currently consists of a simulators and different tools which are introduced in the following:
SPHSimulator¶
This application reads a SPlisHSPlasH scene file and performs a simulation of the scene.
The scene file format is explained here.
Command line options:¶
-h, –help: Print help text.
-v, –version: Print version.
–no-cache: Disable caching of boundary samples/maps.
–state-file: Load a simulation state of the corresponding scene.
–output-dir: Output directory for log file and partio files.
–no-initial-pause: Disable caching of boundary samples/maps.
–no-gui: Disable graphical user interface. The simulation is run only in the command line without graphical output. The “stopAt” option must be set in the scene file or by the next parameter.
–stopAt arg: Sets or overwrites the stopAt parameter of the scene.
–param arg: Sets or overwrites a parameter of the scene.
Setting a fluid parameter:
: : Example: –param Fluid:viscosity:0.01
Setting a configuration parameter:
: Example: –param cflMethod:1
Hotkeys¶
Space: pause/contiunue simulation
r: reset simulation
w: wireframe rendering of meshes
m: recompute min and max values for color-coding the color field in the rendering process
i: print all field information of the selected particles to the console
s: save current simulation state
l: load simulation state (currently only Windows)
+: perform a single time step
ESC: exit
Python bindings¶
SPlisHSPlasH implements bindings for python using pybind11. See the getting started guide.
Impatient installation guide¶
In order to install, simply clone the repository and run pip install on the repository. It is recommended, that you set up a virtual environment for this, because cache files will be stored in the directory of the python installation along with models and scene files.
git clone https://github.com/InteractiveComputerGraphics/SPlisHSPlasH.git
pip install SPlisHSPlasH/
SPlisHSPlasH Scene Files¶
A SPlisHSPlasH scene file is a json file which can contain the following blocks:
Configuration
FluidBlocks
FluidModels
Emitters
RigidBodies
Fluid parameter block
Animation fields
Configuration¶
This part contains the general settings of the simulation and the pressure solver.
Example code:
"Configuration":
{
"pause": true,
"sim2D": false,
"timeStepSize": 0.001,
"numberOfStepsPerRenderUpdate": 2,
"particleRadius": 0.025,
"simulationMethod": 4,
"gravitation": [0.0,-9.81,0],
"cflMethod": 1,
"cflFactor": 1,
"cflMaxTimeStepSize": 0.005,
"maxIterations": 100,
"maxError": 0.01,
"maxIterationsV": 100,
"maxErrorV": 0.1,
"stiffness": 50000,
"exponent": 7,
"velocityUpdateMethod": 0,
"enableDivergenceSolver": true
}
General:¶
pause (bool): Pause simulation at beginning.
pauseAt (float): Pause simulation at the given time. When the value is negative, the simulation is not paused.
stopAt (float): Stop simulation at the given time and exit. When the value is negative, the simulation is not stopped.
cameraPosition (vec3): Initial position of the camera.
cameraLookat (vec3): Lookat point of the camera.
Visualization:¶
numberOfStepsPerRenderUpdate (int): Number of simulation steps per rendered frame
renderWalls (int):
0: None
1: Particles (all)
2: Particles (no walls)
3: Geometry (all)
4: Geometry (no walls)
Export¶
enablePartioExport (bool): Enable/disable partio export (default: false).
enableVTKExport (bool): Enable/disable VTK export (default: false).
enableRigidBodyExport (bool): Enable/disable rigid body export (default: false).
enableRigidBodyVTKExport (bool): Enable/disable rigid body VTK export (default: false).
dataExportFPS (float): Frame rate of particle and rigid body export (default: 25).
particleAttributes (string): A list of attribute names separated by “;” that should be exported in the particle files (e.g. “velocity;density”) (default: “velocity”).
enableStateExport (bool): Enable/disable export of complete simulation state (default: false).
stateExportFPS (float): Frame rate of simulation state export (default: 1).
Simulation:¶
timeStepSize (float): The initial time step size used for the time integration. If you use an adaptive time stepping, this size will change during the simulation (default: 0.001).
particleRadius (float): The radius of the particles in the simulation (all have the same radius) (default: 0.025).
sim2D (bool): If this parameter is set to true, a 2D simulation is performend instead of a 3D simulation (default: false).
enableZSort (bool): Enable z-sort to improve cache hits and therefore to improve the performance (default: true).
gravitation (vec3): Vector to define the gravitational acceleration (default: [0,-9.81,0]).
maxIterations (int): Maximal number of iterations of the pressure solver (default: 100).
maxError (float): Maximal density error in percent which the pressure solver tolerates (default: 0.01).
boundaryHandlingMethod (int): The boundary handling method that is used in the simulation (default: 2, Volume Maps):
0: particle-based boundaries (Akinci et al. 2012)
1: density maps (Koschier et al. 2017)
2: volume maps (Bender et al. 2019)
simulationMethod (int): The pressure solver method used in the simulation (default: 4, DFSPH):
0: Weakly compressible SPH for free surface flows (WCSPH)
1: Predictive-corrective incompressible SPH (PCISPH)
2: Position based fluids (PBF)
3: Implicit incompressible SPH (IISPH)
4: Divergence-free smoothed particle hydrodynamics (DFSPH)
5: Projective Fluids (dynamic boundaries not supported yet)
6: Implicit compressible SPH (ICSPH)
WCSPH parameters:¶
stiffness (float): Stiffness coefficient of the equation of state.
exponent (float): Exponent in the equation of state.
PBF parameters:¶
velocityUpdateMethod (int):
0: First Order Update
1: Second Order Update
DFSPH parameters:¶
enableDivergenceSolver (bool): Turn divergence solver on/off.
maxIterationsV (int): Maximal number of iterations of the divergence solver.
maxErrorV (float): Maximal divergence error in percent which the pressure solver tolerates.
Projective Fluids parameters:¶
stiffness (float): Stiffness coefficient used by the pressure solver.
ICSPH parameters:¶
lambda (float): Stiffness coefficient of the equation of state.
pressureClamping (bool): Enable pressure clamping.
Kernel:¶
kernel (int): Kernel function used in the SPH model.
For a 3D simulation:
0: Cubic spline
1: Wendland quintic C2
2: Poly6
3: Spiky
4: Precomputed cubic spline (faster than cubic spline)
For a 2D simulation:
0: Cubic spline
1: Wendland quintic C2
gradKernel (int): Gradient of the kernel function used in the SPH model.
For a 3D simulation:
0: Cubic spline
1: Wendland quintic C2
2: Poly6
3: Spiky
4: Precomputed cubic spline (faster than cubic spline)
For a 2D simulation:
0: Cubic spline
1: Wendland quintic C2
CFL:¶
cflMethod (int): CFL method used for adaptive time stepping.
0: No adaptive time stepping
1: Use CFL condition
2: Use CFL condition and consider number of pressure solver iterations
cflFactor (float): Factor to scale the CFL time step size.
cflMinTimeStepSize (float): Min. allowed time step size.
cflMaxTimeStepSize (float): Max. allowed time step size.
FluidBlocks¶
In this part the user can define multiple axis-aligned blocks of fluid particles.
Example code:
"FluidBlocks": [
{
"denseMode": 0,
"start": [-2.0, 0.0, -1],
"end": [-0.5, 1.5, 1],
"translation": [1.0, 0.0, 0.0],
"scale": [1, 1, 1]
}
]
start (vec3): Minimum coordinate of the box which defines the fluid block.
end (vec3): Maximum coordinate of the box which defines the fluid block.
translation (vec3): Translation vector of the block.
scale (vec3): Scaling vector of the block.
denseMode (int):
0: regular sampling
1: more dense sampling
2: dense sampling
initialVelocity (vec3): The initial velocity is set for all particles in the block.
initialAngularVelocity (vec3): The initial angular velocity of the block.
id (string): This id is used in the “Fluid parameter block” (see below) to define the properties of the fluid block. If no id is defined, then the standard id “Fluid” is used.
FluidModels¶
This part can be used to import one or more partio particle files in the scene.
Example code:
"FluidModels": [
{
"particleFile": "../models/bunny.bgeo",
"translation": [-2.0, 0.1, 0.0],
"rotationAxis": [0, 1, 0],
"rotationAngle": 3.14159265359,
"scale": 1
}
]
particleFile (string):
Path of the partio file which contains the particle sampling or
Path of an OBJ file containing a closed mesh which is automatically sampled by SPlisHSPlasH. If you choose this option, you can define the sampling mode (denseMode), the resolution of the signed distance field which is used for the sampling (resolutionSDF) and if the signed distance field should be inverted (invert).
denseMode (int):
0: regular sampling (default)
1: more dense sampling
2: dense sampling
invert (bool): Invert the signed distance field, flips inside/outside (default: false)
resolutionSDF (vec3): Resolution of the signed distance field (defaut: [20,20,20])
translation (vec3): Translation vector of the fluid model.
scale (vec3): Scaling vector of the fluid model.
rotationAxis (vec3): Axis used to rotate the particle data after loading.
rotationAngle (float): Rotation angle for the initial rotation of the particle data.
id: This id is used in the “Fluid parameter block” (see below) to define the properties of the fluid block. If no id is defined, then the standard id “Fluid” is used.
initialVelocity (vec3): The initial velocity is set for all particles in the fluid model.
initialAngularVelocity (vec3): The initial angular velocity of the fluid model.
visMesh (string): Path of an OBJ file containing a high resolution mesh which is used by the tool MeshSkinning to generate a sequence of deformed meshes (more info about this can be found in the documentation of the tool).
Emitters¶
In this part the user can define one or more emitters which generate fluid particles.
Example code:
"Emitters": [
{
"width": 5,
"height": 5,
"translation": [-1,0.75,0.0],
"rotationAxis": [0, 1, 0],
"rotationAngle": 3.1415926535897932384626433832795,
"velocity": 2,
"emitStartTime": 2,
"emitEndTime": 6,
"type": 0
}
]
type (int): Defines the shape of the emitter (default: 0).
0: box
1: circle
width (int): Width of the box or radius of the circle emitter in number of particles (default: 5).
height (int): Height of the box in number of particles (is only used for type 0) (default: 5).
translation (vec3): Translation vector of the emitter (default: [0,0,0]).
rotationAxis (vec3): Axis used to rotate the emitter. Note that in 2D simulations the axis is always set to [0,0,1] (default: [0,0,1]).
rotationAngle (float): Rotation angle for the initial rotation of the emitter (default: 0).
velocity (float): Initial velocity of the emitted particles in direction of the emitter (default: 1).
id: This id is used in the “Fluid parameter block” (see below) to define the properties of the fluid block. If no id is defined, then the standard id “Fluid” is used (default: “Fluid”).
emitStartTime (float): Start time of the emitter (default: 0).
emitEndTime (float): End time of the emitter (default: REAL_MAX).
RigidBodies¶
Here, the static and dynamic rigid bodies are defined which define the boundary in the scene. In case of dynamic rigid bodies, the PositionBasedDynamics library is used for their simulation. Note that in this case the PositionBasedDynamics library also reads this json scene files and picks out the relevant parts. That means if you want to define for example a hinge joint or a motor, then just use the json format of PositionBasedDynamics in this scene file.
Example code:
"RigidBodies": [
{
"geometryFile": "../models/UnitBox.obj",
"translation": [0,2,0],
"rotationAxis": [1, 0, 0],
"rotationAngle": 0,
"scale": [2.5, 4, 1.0],
"color": [0.1, 0.4, 0.6, 1.0],
"isDynamic": false,
"isWall": true,
"mapInvert": true,
"mapThickness": 0.0,
"mapResolution": [20,20,20],
"samplingMode": 1
}
]
geometryFile (string): Path to a OBJ file which contains the geometry of the body.
particleFile (string): Path to a partio file which contains a surface sampling of the body. Note that the surface sampling is done automatically if this parameter is missing.
translation (vec3): Translation vector of the rigid body.
scale (vec3): Scaling vector of the rigid body.
rotationAxis (vec3): Axis used to rotate the rigid body after loading.
rotationAngle (float): Rotation angle for the initial rotation of the rigid body.
isDynamic (bool): Defines if the body is static or dynamic.
isWall (bool): Defines if this is a wall. Walls are typically not rendered. This is the only difference.
color (vec4): RGBA color of the body.
mapInvert (bool): Invert the map when using density or volume maps, flips inside/outside (default: false)
mapThickness (float): Additional thickness of a volume or density map (default: 0.0)
mapResolution (vec3): Resolution of a volume or density map (defaut: [20,20,20])
samplingMode (int): Surface sampling mode. 0 Poisson disk sampling, 1 Regular triangle sampling (default: 0).
Materials¶
"Materials": [
{
"id": "Fluid",
"density0": 1000,
"colorField": "velocity",
"colorMapType": 1,
"renderMinValue": 0.0,
"renderMaxValue": 5.0,
"xsph": 0.0,
"xsphBoundary": 0.0,
"surfaceTension": 0.2,
"surfaceTensionMethod": 0,
"viscosity": 0.01,
"viscosityMethod": 1,
"vorticityMethod": 1,
"vorticity": 0.15,
"viscosityOmega": 0.05,
"inertiaInverse": 0.5,
"maxEmitterParticles": 1000,
"emitterReuseParticles": false,
"emitterBoxMin": [-4.0,-1.0,-4.0],
"emitterBoxMax": [0.0,4,4.0]
}
]
General¶
id (string): Defines the id of the material. You have to give the same id to a FluidBlock, a FluidModel or an Emitter if they should have the defined material behavior.
density0 (float): Rest density of the corresponding fluid.
xsph (float): Coefficient (in [0,1]) for the XSPH velocity filter in the fluid (default: 0.0).
xsphBoundary (float): Coefficient (in [0,1]) for the XSPH velocity filter at the boundary (default: 0.0).
Particle Coloring¶
colorField (string): Choose vector or scalar field for particle coloring.
colorMapType (int): Selection of a color map for coloring the scalar/vector field.
0: None
1: Jet
2: Plasma
3: CoolWarm
4: BlueWhiteRed
5: Seismic
renderMinValue (float): Minimal value used for color-coding the color field in the rendering process.
renderMaxValue (float): Maximal value used for color-coding the color field in the rendering process.
Viscosity¶
viscosityMethod (int): Viscosity method
0: None
1: Standard
2: Bender and Koschier 2017
3: Peer et al. 2015
4: Peer et al. 2016
5: Takahashi et al. 2015 (improved)
6: Weiler et al. 2018
viscosity (float): Coefficient for the viscosity force computation
“Standard” and “Weiler et al. 2018” use the kinematic viscosity as parameter
“Bender and Koschier 2017” and “Peer et al. 2015/2016” use a coefficient in [0,1]
viscoMaxIter (int): (Implicit solvers) Max. iterations of the viscosity solver.
viscoMaxError (float): (Implicit solvers) Max. error of the viscosity solver.
viscoMaxIterOmega (int): (Peer et al. 2016) Max. iterations of the vorticity diffusion solver.
viscoMaxErrorOmega (float): (Peer et al. 2016) Max. error of the vorticity diffusion solver.
viscosityBoundary (float): (Weiler et al. 2018) Coefficient for the viscosity force computation at the boundary.
Vorticity¶
vorticityMethod (int): Vorticity method
0: None
1: Micropolar model
2: Vorticity confinement
vorticity (float): Coefficient for the vorticity force computation
viscosityOmega (float): (Micropolar model) Viscosity coefficient for the angular velocity field.
inertiaInverse (float): (Micropolar model) Inverse microinertia used in the micropolar model.
Drag force¶
dragMethod (int): Drag force method
0: None
1: Macklin et al. 2014
2: Gissler et al. 2017
drag (float): Coefficient for the drag force computation
Surface tension¶
surfaceTensionMethod (int): Surface tension method
0: None
1: Becker & Teschner 2007
2: Akinci et al. 2013
3: He et al. 2014
surfaceTension (float): Coefficient for the surface tension computation
Elasticity¶
elasticityMethod (int): Elasticity method
0: None
1: Becker et al. 2009
2: Peer et al. 2018
youngsModulus (float): Young’s modulus - coefficient for the stiffness of the material (default: 100000.0)
poissonsRatio (float): Poisson’s ratio - measure of the Poisson effect (default: 0.3)
alpha (float): Coefficent for zero-energy modes suppression method (default: 0.0)
elasticityMaxIter (int): (Peer et al. 2018) Maximum solver iterations (default: 100)
elasticityMaxError (float): (Peer et al. 2019) Maximum elasticity error allowed by the solver (default: 1.0e-4)
Emitters¶
maxEmitterParticles (int): Maximum number of particles the emitter generates. Note that reused particles (see below) are not counted here.
emitterReuseParticles (bool): Reuse particles if they are outside of the bounding box defined by emitterBoxMin, emitterBoxMax
emitterBoxMin (vec3): Minimum coordinates of an axis-aligned box (used in combination with emitterReuseParticles)
emitterBoxMax (vec3): Maximum coordinates of an axis-aligned box (used in combination with emitterReuseParticles)
Animation fields¶
In this part the user can define one or more animation fields which animate fluid particles. The user can define math expressions for the components of the field quantity. The typical math terms like cos,sin,… can be used.
Available expression variables:
t: Current time.
dt: Current time step size.
x, y, z: Position of the particle which is in the animation field.
vx, vy, vz: Velocity of the particle which is in the animation field.
valuex, valuey, valuez: Value of the field quantity of the particle which is in the animation field.
Example:
"particleField": "angular velocity",
"expression_x": "valuex + cos(2*t)"
This means that in each step we add cos(2*t) to the x-component of the angular velocity.
Example code:
"AnimationFields": [
{
"particleField": "velocity",
"translation": [-0.5, -0.5, 0],
"rotationAxis": [0, 0, 1],
"rotationAngle": 0.0,
"scale": [0.5, 0.25, 0.8],
"shapeType": 0,
"expression_x": "cos(2*t)*0.1",
"expression_y": "",
"expression_z": ""
}
]
shapeType (int): Defines the shape of the animation field (default: 0).
0: box
1: sphere
2: cylinder
particleField (string): Defines the field quantity that should be modified by the field (e.g. velocity, angular velocity, position) (default: velocity)
translation (vec3): Translation vector of the animation field (default: [0,0,0]).
rotationAxis (vec3): Axis used to rotate the animation field (default: [0,0,1]).
rotationAngle (float): Rotation angle for the initial rotation of the animation field (default: 0).
scale (vec3): Scaling vector of the animation field.
shapeType=0 (box): This vector defines the width, height, depth of the box.
shapeType=1 (sphere): The x-component of the vector defines the radius of the sphere. The other components are ignored.
shapeType=2 (cylinder): The x- and y-component of the vector defines the height and radius of the cylinder, repectively. The z-component is ignored.
expression_x (string): Math expression for the x-component of the field quantity (default=””).
expression_y (string): Math expression for the y-component of the field quantity (default=””).
expression_z (string): Math expression for the z-component of the field quantity (default=””).
Replicability¶
The SPlisHSPlasH library implements the SPH methods developed by our and other research groups (build instructions can be found here). This allows to reproduce the research results of the corresponding publications. Inspired by the Graphics Replicability Stamp Initiative we started to add scenes to the repository to reproduce some of the results in our papers:
Jan Bender, Tassilo Kugelstadt, Marcel Weiler, Dan Koschier, “Implicit Frictional Boundary Handling for SPH”, IEEE Transactions on Visualization and Computer Graphics, 2020
Figure 7.a) can be replicated by loading the scene: data/Scenes/GridModel_Akinci2012.json
Figure 7.b) can be replicated by loading the scene: data/Scenes/GridModel_Bender2019.json
Installation Instructions - Linux¶
Ubuntu Fresh Install¶
Installation List¶
sudo apt install git cmake xorg-dev freeglut3-dev build-essential
Python Bindings¶
If you plan on using the python bindings by specifying -DUSE_PYTHON_BINDINGS=On
, then you should also have a working python installation in your path. This installs an additional tool pipx
, which allows the installation of packages as executables in virtualized environments.
sudo apt install python3-dev python3-pip python3-venv
python3 -m pip install pipx
python3 -m pipx ensurepath
Alternatively to this you may also install other Python Distributions such as Anaconda (personal preference).
Building Instructions¶
git clone https://github.com/InteractiveComputerGraphics/SPlisHSPlasH.git
cd SPlisHSPlasH
mkdir build && cd build
cmake -DCMAKE_BUILD_TYPE=Release -DUSE_PYTHON_BINDINGS=<On|Off> ..
make -j 4
Run Executable¶
cd ../bin
./SPHSimulator ../data/Scenes/DoubleDamBreak.json
On some systems it may be necessary to define an OpenGL override like so
cd ../bin
MESA_GL_VERSION_OVERRIDE=3.3 ./SPHSimulator ../data/Scenes/DoubleDamBreak.json
The command loads the selected scene. To start the simulation disable the pause mode by clicking the checkbox or pressing [Space]. More hotkeys are listed here.
Using Bindings¶
Assuming that the python bindings were generated in the default location Project Root/build/lib/pysplishsplash.cpython-38-x86_64-linux-gnu.so
, you can use the bindings by adding this path to sys.path
within your python script, or by calling your scripts within the directory containing the .so
file. You can test that the bindings work using the following command.
cd lib
python3 -c "import pysplishsplash"
Installing Bindings¶
If you followed the above instructions for building SPlisHSPlasH using CMake and generated the python bindings, then these commands should work automatically.
Note: You don’t have to clone the repository again. This only shows, that the command should be run in the project root directory. It is also recommended, that you create and activate a virtual environment before installing, so that your base python installation is not affected by any new generated files.
git clone https://github.com/InteractiveComputerGraphics/SPlisHSPlasH.git
cd SPlisHSPlasH
python setup.py bdist_wheel
pip install build/dist/*.whl
If you specified any additional CMake variables in the form of -DVAR_NAME=Value
, you can just append them after bdist_wheel
Alternatively you may also run the following command, which essentially combines all of the above commands into a single command.
pip install git+https://github.com/InteractiveComputerGraphics/SPlisHSPlasH.git
Drawbacks: You lose the ability for incremental rebuilds, i.e. if you want to modify the source code and build the bindings anew, you would have to build the entire project every time.
Installation Instructions - Windows¶
Visual Studio¶
Python Bindings¶
If you plan on using the python bindings by specifying -DUSE_PYTHON_BINDINGS=On
, then you should also have a working Python installation in your path. Moreover, you require the Python Package Installer (pip).
Building Instructions¶
First, clone the repository by
git clone https://github.com/InteractiveComputerGraphics/SPlisHSPlasH.git
Then run cmake-gui and set “Where is the source code:” to the [SPlisHSPlasH-dir] and “Where to build the binaries:” to [SPlisHSPlasH-dir]/build.
Now run Configure and select the correct Visual Studio version. Ensure that you choose a x64 build on a 64bit system. Finally, run Generate and open the project. Now you can build the project in Visual Studio. Note that you have to select the “Release” build, if you want to have an optimized executable.
Run Executable¶
Execute “bin/SPHSimulator.exe” to start the simulator and select a scene file to run the simulation. Alternatively, you can start the simulation in the command line:
./SPHSimulator ../data/Scenes/DoubleDamBreak.json
The command loads the selected scene. To start the simulation disable the pause mode by clicking the checkbox or pressing [Space]. More hotkeys are listed here.
Using Bindings¶
Assuming that the python bindings were generated in the default location [SPlisHSPlasH-dir]/build/lib/pysplishsplash.cp37-win_amd64.pyd, you can use the bindings by adding this path to sys.path
within your python script, or by calling your scripts within the directory containing the .pyd
file. You can test that the bindings work using the following command.
cd lib
python3 -c "import pysplishsplash"
Installing Bindings¶
If you followed the above instructions for building SPlisHSPlasH using CMake and generated the python bindings, then these commands should work automatically.
Note: You don’t have to clone the repository again. This only shows, that the command should be run in the project root directory. It is also recommended, that you create and activate a virtual environment before installing, so that your base python installation is not affected by any new generated files.
git clone https://github.com/InteractiveComputerGraphics/SPlisHSPlasH.git
cd SPlisHSPlasH
python setup.py bdist_wheel
pip install build/dist/pySPlisHSPlasH-2.8.3-cp37-cp37m-win_amd64.whl
If you specified any additional CMake variables in the form of -DVAR_NAME=Value
, you can just append them after bdist_wheel
Alternatively you may also run the following command, which essentially combines all of the above commands into a single command.
pip install git+https://github.com/InteractiveComputerGraphics/SPlisHSPlasH.git
Drawbacks: You lose the ability for incremental rebuilds, i.e. if you want to modify the source code and build the bindings anew, you would have to build the entire project every time.
CMake Options¶
This page should give you a short overview over the CMake options of SPlisHSPlasH.
USE_DOUBLE_PRECISION¶
If this flag is enabled, then all computations with floating point values are performed using double precision (double). Otherwise single precision (float) is used.
USE_AVX¶
SPlishSPlasH supports the usage of AVX (Advanced Vector Extensions) which is an extension of modern CPUs to perform a single instruction on multiple data. The extension allows to perform eight floating point operations in parallel. Enabling AVX significantly improves the performance of the simulator. Currently, the following methods have AVS support:
DFSPH
the micropolar vorticity model
the standard viscosity model
the viscosity model of Weiler et al.
USE_OpenMP¶
Enable the OpenMP parallelization which lets the simulation run in parallel on all available cores of the CPU.
USE_GPU_NEIGHBORHOOD_SEARCH¶
As default SPlisHSPlasH uses CompactNSearch as neighborhood search which performs all operations on the CPU. However, with this flag you can switch to cuNSearch which is our GPU neighborhood search. In case you want to use the GPU method, you have to install Cuda.
USE_IMGUI¶
We just reimplemented the GUI using imgui instead of AntTweakBar. If you want to try out the new GUI, enable this flag.
USE_PYTHON_BINDINGS¶
Generate a shared library object which can be imported into python scripts and exposes C++ functionality to the python interpreter. Default:On Options:<On|Off>
USE_DEBUG_TOOLS¶
Adds a debug tools tab to the graphical user interface which allows to generate additional particle data for debugging. Note that generating the additional data will slightly decrease the performance of the simulation.
Software Architecture¶
SPlisHSPlasH follows a very intuitive and modular design approach. We want to illustrate part of the software architecture in conjunction with the simplified class diagram above. Note, that this documentation only covers the simulation part of SPlisHSPlasH. The whole software architecture follows a similar design pattern as the Model View Controller.
The Simulation class¶
The simulation class is the main part of the software. It contains the currently used simulation method (TimeStep
), all fluids (FluidModel
), all boundaries (BoundaryModel
), and a AnimationFieldSystem
. It is defined as a singleton, thus only one simulation instance exists during the runtime. The simulation instance contains:
exactly one
TimeStep
instance, which defines the simulation loop and contains the pressure solverany number of
FluidModel
instances each defining a different fluid phaseany number of
BoundaryModel
instances representing either dynamic rigid bodies or static boundariesexactly one
AnimationFieldSystem
instance which allows to animate particles in a predefined area
The simulation class also implements the following:
evaluation of the SPH kernel methods
update of the time step size using a CFL condition
uniform invocation of all
EmitterSystem
instancesinvocation of
AnimationFieldSystem
instancesaving & loading the current simulation state
Lastly, the simulation class also contains a well defined interface for the neighborhood search functionalities defined in CompactNSearch or cuNSearch, which are further needed in the respective algorithm implementations in e.g. the TimeStep or NonPressureForces.
The TimeStep class¶
The TimeStep class is a abstract base class for any subsequent derived simulation method one wants to implement. It implements the required interface for the simulation class, noteably the step()
function containing the simulation algorithm called in the main loop. During execution there exists exactly one instance of a TimeStep class. By default SPlisHSPlasH currently implements the following pressure solvers and the corresponding simulation algorithms:
WCSPH
PCISPH
PBF
IISPH
DFSPH
Projective Fluids
The FluidModel class¶
A FluidModel instance represents a fluid phase with its respective properties and applied effects to it. SPlisHSPlasH allows for arbitrary many FluidModels inside a simulation as long as there is at least one and they all have a different id (see scene file format). One FluidModel contains the following:
Physical parameters like rest density, mass, position, velocity, acceleration and current density
Simulation parameters like the number of particles, their state and ID
References to the applied non-pressure effects, one for each:
Drag
Elasticity
Surface tension
Viscosity
Vorticity
Emitter systems
Concerning the non-pressure effects, each FluidModel can only utilize up to one method per non-pressure effect, which will be directly included in the computation inside the computeNonPressureForces()
method of the Simulation
class. Thus having e.g. two different surface tension algorithms inside one FluidModel is not possible. However, it is possible to define e.g. two phases, which have a different viscosity model and only one regarding surface tension effects.
The emitters are only stored inside the FluidModels since they are assigned to a fixed FluidModel. Their functionalities are uniformly executed by the Simulation class in the emitParticles()
step usually invoked at the end of the simulation loop of the current TimeStep instance.
The BoundaryModel class¶
The BoundaryModel class provides a useful base class for any boundary handling methods. It stores a RigidBodyObject
reference representing the object of the boundary. This can be a stationary or dynamic rigid body, whose coupling effects are handled uniformly. Note that RigidBodyObject
is an abstract class providing an interface for the two derived classes StaticRigidBody
and PBDRigidBody
. The first is handled internally and represent stationary objects. The latter describes a moving rigid body which is simulated externally by the PositionBasedDynamics library. SPlisHSPlasH implements three different boundary models:
Particle-based rigid-fluid coupling [Akinci et al. 2012]
Density maps [Koschier and Bender 2017]
Volume maps [Bender et al. 2019]
Finally, SPlisHSPlasH defines a boundary as a list of rigid bodies in conjunction with a rigid-fluid coupling algorithm.
Implementing a new non-pressure force method¶
Non-pressure forces (e.g. viscosity, vorticity, surface tension or drag forces) are all implemented in the same way in SPlisHSPlasH. In the following we explain the implementation of such a method using as example a new viscosity method.
SPlisHSPlasH organizes the viscosities in /SPlisHSPlasH/Viscosity/
and thus any changes or additions are intended to take place in this directory. The user can add new viscosity methods by creating new or copying and modifying existing viscosity class files and registering these inside the build system and the source code.
Creating a new class¶
If you want to create a new viscosity class from scratch, you should consider reading the doxygen documentation on the ViscosityBase
class and several of its derived classes. In short, every viscosity method inherits from the base class ViscosityBase
, which itself inherits from NonPressureForceBase
. A minimal working derived class would look like this:
MyViscosity.h
#ifndef __MyViscosity_h__
#define __MyViscosity_h__
#include "SPlisHSPlasH/Common.h"
#include "SPlisHSPlasH/FluidModel.h"
#include "ViscosityBase.h"
namespace SPH
{
class MyViscosity : public ViscosityBase
{
protected:
virtual void initParameters();
public:
MyViscosity(FluidModel *model);
virtual ~MyViscosity(void);
static NonPressureForceBase* creator(FluidModel* model) { return new MyViscosity(model); }
virtual void step();
virtual void reset();
};
}
#endif
MyViscosity.cpp
#include "MyViscosity.h"
MyViscosity::MyViscosity(FluidModel *model) :
ViscosityBase(model)
{
[...]
}
MyViscosity::~MyViscosity(void)
{
[...]
}
void MyViscosity::initParameters()
{
ViscosityBase::initParameters();
[...]
}
void MyViscosity::step()
{
[...]
}
void MyViscosity::reset()
{
[...]
}
including the following:
a constructor with
FluidModel*
as the sole parameterMyViscosity(FluidModel *model)
a
initParameters()
method calling the base class method for parameter setupa step function
void step()
called in each timestep for the associated fluida reset function
void reset()
called on every reset of the simulation
Customizing your class¶
Neighborhood search sort¶
The user is also free to add and save additional per particle data inside the viscosity method, but has to ensure that these are also included in the neighborhood search sort. Sorting is required if the data is used over multiple simulations steps. The neighborhood search performs a z-sort every n steps to improve the number of cache hits. Since all particles are resorted, also their data must be resorted. For this, the user has to override the performNeighborhoodSearchSort()
method. A minimal example would look like the following:
void MyViscosity::performNeighborhoodSearchSort()
{
Simulation *sim = Simulation::getCurrent();
auto const& d = sim->getNeighborhoodSearch()->point_set(m_model->getPointSetIndex());
d.sort_field(&m_myParticleViscosityData[0]);
}
Additional particle fields¶
For visualization and/or debugging purposes, the user may also want to subject the particle data to SPlisHSPlasH’s particle informations. To do this, the user has to add the particle data field to the list of fields inside each FluidModel
. This can be for example done in the constructor by adding the addField(const FieldDescription &field)
of the corresponding FluidModel
. The fields can be used to define the color of a particle, they can be exported to bgeo or ParaView and in the simulator the user can output the field data of the selected particles by pressing “i”.
For more information, please refer to the doxygen documentation and maybe take a look at the already existing implementations. Adding a field has the following form:
model->addField({ "myFieldName", <FieldType>, <lambda expression returning reference to the data field>}, <save state (boolean)>);
Here is an example:
model->addField({ "myFieldName", FieldType::Vector3, [&](const unsigned int i) -> Real* { return &m_myFieldValues[i][0]; }, true });
The field name is used in the GUI and when exporting the data. The boolean at the end determines if this field should be stored when the simulation state is saved. This should only be done if the value is not recomputed in each simulation step so that the value of the last step is required.
Also don’t forget to remove the field, when the instance of the viscosity method is destroyed:
m_model->removeFiledByName("myFieldName");
Deferred initialization¶
The user can override the deferredInit()
method. 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 deferredInit()
function should initialize all values which depend on these parameters.
void MyViscosity::deferredInit()
{
initMyViscosity();
}
Registering the viscosity method¶
To add our new viscosity method, we have to integrate it into the build process and the source code.
Adding to the build process¶
Simply add the class files MyViscosity.h
and MyViscosity.cpp
to the CMakeLists.txt
in the /SPlisHSPlasH/
directory. This can be done by adding the relative file paths to the respective variables VISCOSITY_HEADER_FILES
and VISCOSITY_SOURCE_FILES
:
set(VISCOSITY_HEADER_FILES
[...]
Viscosity/MyViscosity.h
)
set(VISCOSITY_SOURCE_FILES
[...]
Viscosity/MyViscosity.cpp
)
Integration in the source code¶
Any non-pressure force method is registered in the file NonPressureForceRegistration.cpp
, which can be found in the /SPlisHSPlasH/
directory. Adding our new viscosity method is done by adding the following line to the function void Simulation::registerNonpressureForces()
:
addViscosityMethod("My viscosity method", MyViscosity::creator);
and including Viscosity/MyViscosity.h
.
After these additions and building SPlisHSPlasH, our new viscosity method is available inside the simulation.
Implementing a new particle/rigid body data exporter¶
All exporters are implemented in the same way in SPlisHSPlasH. In the following we explain the implementation of such an exporter method using as example a new rigid body exporter.
SPlisHSPlasH organizes the exporters in /Simulator/Exporter/
and thus any changes or additions are intended to take place in this directory. The user can add new data exporters by creating new or copying and modifying existing exporter class files and registering these inside the build system and the source code.
Creating a new class¶
If you want to create a new exporter class from scratch, you should take a look at existing exporters in SPlisHSPlasH. In short, every exporter inherits from the base class ExporterBase
. A minimal working derived class would look like this:
RigidBodyExporter_MyFormat.h
#ifndef __RigidBodyExporter_MyFormat_h__
#define __RigidBodyExporter_MyFormat_h__
#include "ExporterBase.h"
namespace SPH
{
/** \brief Rigid body exporter for the OBJ format.
*/
class RigidBodyExporter_MyFormat : public ExporterBase
{
protected:
bool m_isFirstFrame;
std::string m_exportPath;
public:
RigidBodyExporter_MyFormat(SimulatorBase* base);
RigidBodyExporter_MyFormat(const RigidBodyExporter_MyFormat&) = delete;
RigidBodyExporter_MyFormat& operator=(const RigidBodyExporter_MyFormat&) = delete;
virtual ~RigidBodyExporter_MyFormat(void);
virtual void init(const std::string& outputPath);
virtual void step(const unsigned int frame);
virtual void reset();
virtual void setActive(const bool active);
};
}
#endif
RigidBodyExporter_MyFormat.cpp
#include "RigidBodyExporter_MyFormat.h"
#include <Utilities/Logger.h>
#include <Utilities/FileSystem.h>
#include "SPlisHSPlasH/Simulation.h"
using namespace SPH;
using namespace Utilities;
RigidBodyExporter_MyFormat::RigidBodyExporter_MyFormat(SimulatorBase* base) :
ExporterBase(base)
{
m_isFirstFrame = true;
}
RigidBodyExporter_MyFormat::~RigidBodyExporter_MyFormat(void)
{
}
void RigidBodyExporter_MyFormat::init(const std::string& outputPath)
{
// define output path for the data
m_exportPath = FileSystem::normalizePath(outputPath + "/my_format");
}
void RigidBodyExporter_MyFormat::step(const unsigned int frame)
{
// check if the exporter is active
if (!m_active)
return;
// check if we have a static model
bool isStatic = true;
for (unsigned int i = 0; i < sim->numberOfBoundaryModels(); i++)
{
BoundaryModel* bm = sim->getBoundaryModel(i);
if (bm->getRigidBodyObject()->isDynamic())
{
isStatic = false;
break;
}
}
// If we have a static model, write the data only for the first frame.
// Otherwise each frame is exported.
if (m_isFirstFrame || !isStatic)
{
[...]
}
m_isFirstFrame = false;
}
void RigidBodyExporter_MyFormat::reset()
{
m_isFirstFrame = true;
}
void RigidBodyExporter_MyFormat::setActive(const bool active)
{
ExporterBase::setActive(active);
// create output folder
if (m_active)
FileSystem::makeDirs(m_exportPath);
}
including the following:
a constructor with
SimulatorBase*
as the sole parameterRigidBodyExporter_MyFormat(SimulatorBase* base)
a
init(const std::string& outputPath)
method which should define the export path,outputPath
contains the path of the current output directory of SPlisHSPlasHa step function
void step()
called for each frame that should be exporteda reset function
void reset()
called on every reset of the simulationa function
void setActive(const bool active)
which is called when the user activates the exporter
In our example the exporter path is defined int the function init
. When the user activates the exporter, e.g. in the GUI, the corresponding directory is created. In the function step
the rigid body data can be written. Note that we added some code so that static rigid bodies are only exported once and not for each frame since they never change.
Registering the exporter¶
To add our new exporter, we have to integrate it into the build process and the source code.
Adding to the build process¶
Simply add the class files RigidBodyExporter_MyFormat.h
and RigidBodyExporter_MyFormat.cpp
to the CMakeLists.txt
in the /Simulator/
directory. This can be done by adding the relative file paths to the respective variables EXPORTER_HEADRE_FILES
and EXPORTER_SOURCE_FILES
:
set(EXPORTER_HEADER_FILES
[...]
Exporter/RigidBodyExporter_MyFormat.h
)
set(EXPORTER_SOURCE_FILES
[...]
Exporter/RigidBodyExporter_MyFormat.cpp
)
Integration in the source code¶
Any exporter is registered in the file ExporterRegistration.cpp
, which can be found in the /Simulator/
directory. Adding our new exporter is done by adding the following line to the function void SimulatorBase::createExporters()
:
addRigidBodyExporter("enableRigidBodyMyFormatExport", "Rigid Body MyFormat Exporter", "Enable/disable rigid body My Format export.", new RigidBodyExporter_MyFormat(this));
and including Exporter/RigidBodyExporter_MyFormat.h
. The first string defines a key which can be used in the json scene files to activate your exporter. The second string defines the name of your exporter which will appear in the GUI. This name can also be used to activate your exporter in C++ or Python. The last string contains a description of the exporter which is used as tool tip in the GUI.
After these additions and building SPlisHSPlasH, our new exporter is available inside the simulation.
Implementing a new exporter in Python¶
You can also implement a new exporter using our Python interface. You can find an example here: pySPlisHSPlasH\examples\custom_exporter.py
.
Creating Pressure Solvers¶
SPlisHSPlasH organizes the pressure solvers in their respective folders inside the /SPlisHSPlasH/
directory. For example DFSPH can be found inside /SPlisHSPlasH/DFSPH/
. We highly suggest the user to follow our file organization scheme. The user can also add new pressure solvers by by creating new or copying and modifying existing classes and then adding them to the build system plus additionally registering in the source code.
Note that we do not strictly distinguish the pressure solver from the simulation algorithm. Each TimeStep
class implements a whole time step including the pressure solver. The non-pressure forces are decoupled in their respective classes and only implicitly called. Thus for implementing a new pressure solver, we suggest copying the files from for example WCSPH and replacing the pressure solver by your own one. Note further, that we usually decouple data from the algorithm with the SimulationData
classes. We strongly recommend doing the same with your implementation.
Creating a new class¶
Again, we want to stress that copying and modifying existent methods is easier than writing a new class from scratch. However, if you want to do so, be sure to implement every abstract method inherited from TimeStep
. These include:
void step()
, the simulation step functionvoid resize()
, a method to initialize and resize any used field
Albeit being not necessary, the user may also want to override/redefine the following methods:
void init()
, the initialization method. It is important to callTimeStep::init()
inside this methodvoid reset()
, the method invoked on every reset commandvoid computeDensities()
, if the user does not want to utilize the given density computation
A minimal working example of a derive class is shown below:
TimeStepMyPressureSolver.h
#ifndef __TimeStepMyPressureSolver_h__
#define __TimeStepMyPressureSolver_h__
#include "SPlisHSPlasH/Common.h"
#include "SPlisHSPlasH/TimeStep.h"
#include "SPlisHSPlasH/SPHKernels.h"
namespace SPH
{
class TimeStepMyPressureSolver : public TimeStep
{
public:
TimeStepMyPressureSolver();
virtual ~TimeStepMyPressureSolver();
virtual void step();
virtual void resize();
};
}
#endif
TimeStepMyPressureSolve.cpp
#include "TimeStepMyPressureSolve.h"
using namespace SPH;
using namespace GenParam;
TimeStepMyPressureSolve::TimeStepMyPressureSolve() :
TimeStep()
{
[...]
}
TimeStepMyPressureSolve::~TimeStepMyPressureSolve(void)
{
[...]
}
void TimeStepMyPressureSolve::step()
{
[...]
}
void TimeStepMyPressureSolve::resize()
{
[...]
}
SPlisHSPlasH assumes your simulation method allows for operator splitting, thus usually dividing the simulation into non-pressure forces and the pressure solver plus advection. The latter is subject of the TimeStep class. It is still possible to implement these together inside your own TimeStep class, but it contradicts SPlisHSPlasH’s design principles. Since the step()
method is forwarded to the main loop by the simulation class, its purpose is to define the simulation algorithm. For guidance, we also provide a simple SPH simulation algorithm outline:
void TimeStepWCSPH::step()
{
Simulation *sim = Simulation::getCurrent();
const unsigned int nModels = sim->numberOfFluidModels();
TimeManager *tm = TimeManager::getCurrent ();
const Real h = tm->getTimeStepSize();
// 1. Perform a neighborhood search
performNeighborhoodSearch();
// 2. Compute non-pressure forces and SPH densities
for (unsigned int fluidModelIndex = 0; fluidModelIndex < nModels; fluidModelIndex++)
{
clearAccelerations(fluidModelIndex);
computeDensities(fluidModelIndex);
}
sim->computeNonPressureForces();
// 3. Compute pressure forces
computePressureForces();
// 4. Update time step tize with CFL condition
sim->updateTimeStepSize();
// 5. Advect particles
advectParticles();
// 6. Emit and/or animate particles if necessary
sim->emitParticles();
sim->animateParticles();
// 7. Advect time
tm->setTime(tm->getTime() + h);
}
where computeDensities(...)
and clearAcceleration(...)
are already defined by the base class.
We recommend the user to split the simulation algorithm and its data into two separate classes as it is the case for our already implemented ones.
Registering the pressure solver¶
To add our new simulation method, we have to integrate it into the build process and the source code.
Adding to the build process¶
Simply add all of your class files to the CMakeLists.txt
in the /SPlisHSPlasH/
directory. We suggest creating new variables for the header and source files and adding these to the add_library()
as well as to new source_group()
calls. A possible implementation following our class file conventions would look like the following:
set(MYPRESSURESOLVER_HEADER_FILES
MyPressureSolver/SimulationDataMyPressureSolver.h
MyPressureSolver/TimeStepMyPressureSolver.h
)
set(MYPRESSURESOLVER_SOURCE_FILES
MyPressureSolver/SimulationDataMyPressureSolver.cpp
MyPressureSolver/TimeStepMyPressureSolver.cpp
)
add_library(SPlisHPlasH
[...]
${MYPRESSURESOLVER_HEADER_FILES}
${MYPRESSURESOLVER_SOURCE_FILES}
)
source_group("Header Files\\MyPressureSolver" FILES ${MYPRESSURESOLVER_HEADER_FILES})
source_group("Source Files\\MyPressureSolver" FILES ${MYPRESSURESOLVER_SOURCE_FILES})
Integration in the source code¶
Any timestep method and thus any pressure solver is registered in the Simulation.h
and Simulation.cpp
files, which can be found in the /SPlisHSPlasH/
directory. Adding a new method comprises of the following steps:
Adding a new enum in
SimulationMethods
Creating a new static variable
static int ENUM_SIMULATION_MYPRESSURESOLVER
for the GenericParameter system and initializing it inSimulation.cpp
Including
SPlisHSPlasH/MyPressureSolver/TimeStepMyPressureSolver.h
inSimulation.cpp
Adding a new enum value for
SIMULATION_METHOD
insideSimulation::initParameters()
using the following line:
enumParam->addEnumValue("MyPressureSolverName", ENUM_SIMULATION_MYPRESSURESOLVER);
Adding the pressure solver to
Simulation::setSimulationMethod(...)
, thus making it available for the simulation using the following:
else if (method == SimulationMethods::MyPressureSolver)
{
m_timeStep = new TimeStepMyPressureSolver();
m_timeStep->init();
setValue(Simulation::KERNEL_METHOD, <desired standard SPH kernel>);
setValue(Simulation::GRAD_KERNEL_METHOD, <desired standard SPH gradient kernel>);
}
After these additions and building SPlisHSPlasH, our new pressure solver is available inside the simulation.
Macros¶
SPlisHSPlasH defines useful macros to e.g. iterate over all neighboring particles inside the neighborhood of the current one. These can be found in Simulation.h
. In the following, we want to give a short overview over these macros. For further information, please refer to the api documentation.
Looping over fluid neighbors¶
An essential part of SPH computation is to use the properties of neighboring particles to compute the desired value. SPlisHSPlasH provides macros iterating over every fluid neighbor, which can be used like predefined for-loop constructs. These include the following:
forall_fluid_neigbors¶
#define forall_fluid_neighbors(code) \
for (unsigned int pid = 0; pid < nFluids; pid++) \
{ \
FluidModel *fm_neighbor = sim->getFluidModelFromPointSet(pid); \
for (unsigned int j = 0; j < sim->numberOfNeighbors(fluidModelIndex, pid, i); j++) \
{ \
const unsigned int neighborIndex = sim->getNeighbor(fluidModelIndex, pid, i, j); \
const Vector3r &xj = fm_neighbor->getPosition(neighborIndex); \
code \
} \
}
forall_fluid_neigbors
loops over every fluid particle (in all fluid phases) in the neighborhood region of the current one. Note that this does not include boundary particles. The user can use this macro by writing the desired code inside the brackets. For the usage of most of the macros, some additional variables have to be predefined. These include in this case:
Simulation *sim = Simulation::getCurrent()
, the current simulation instanceunsigned int nFluids
, the amount of FluidModel instancesunsigned int fluidModelIndex
, the index of the FluidModel of the current particleunsigned int i
, the index of the current particle inside the FluidModel with index fluidModelIndex
Further, this macro also defines certain variables, which can be accessed inside the code given to the macro:
unsigned int pid
, the index of the FluidModel of the neighboring particleFluidModel *fm_neighbor
, the FluidModel reference of the neighboring particleconst unsigned int neighborIndex
, the particle index of the neighboring particleconst Vector3r &xj
, the position of the neighboring particle
Henceforth, we denote the required additional variables by Requires and the by the macro defined ones by Defines.
forall_fluid_neighbors_in_same_phase¶
#define forall_fluid_neighbors_in_same_phase(code) \
for (unsigned int j = 0; j < sim->numberOfNeighbors(fluidModelIndex, fluidModelIndex, i); j++) \
{ \
const unsigned int neighborIndex = sim->getNeighbor(fluidModelIndex, fluidModelIndex, i, j); \
const Vector3r &xj = model->getPosition(neighborIndex); \
code \
}
forall_fluid_neighbors_in_same_phase
loops over every fluid particle in the neighborhood region considering only neighbors from the same FluidModel as the current one.
Requires:
Simulation *sim = Simulation::getCurrent()
unsigned int fluidModelIndex
unsigned int i
Defines:
const unsigned int neighborIndex
const Vector3r &xj
Looping over boundaries¶
forall_boundary_neighbors¶
#define forall_boundary_neighbors(code) \
for (unsigned int pid = nFluids; pid < sim->numberOfPointSets(); pid++) \
{ \
BoundaryModel_Akinci2012 *bm_neighbor = static_cast<BoundaryModel_Akinci2012*>(sim->getBoundaryModelFromPointSet(pid)); \
for (unsigned int j = 0; j < sim->numberOfNeighbors(fluidModelIndex, pid, i); j++) \
{ \
const unsigned int neighborIndex = sim->getNeighbor(fluidModelIndex, pid, i, j); \
const Vector3r &xj = bm_neighbor->getPosition(neighborIndex); \
code \
} \
}
forall_boundary_neighbors
loops over all boundary neighbors casting them to the Akinci 2012 boundary model.
Requires:
Simulation *sim = Simulation::getCurrent()
unsigned int nFluids
unsigned int fluidModelIndex
unsigned int i
Defines:
unsigned int pid
, the index of the FluidModel associated with the BoundaryModelBoundaryModel_Akinci2012 *bm_neighbor
, the BoundaryModel reference of the neighboring particleconst unsigned int neighborIndex
, the particle index of the neighboring particleconst Vector3r &xj
, the position of the neigboring particle
forall_density_maps¶
#define forall_density_maps(code) \
for (unsigned int pid = 0; pid < nBoundaries; pid++) \
{ \
BoundaryModel_Koschier2017 *bm_neighbor = static_cast<BoundaryModel_Koschier2017*>(sim->getBoundaryModel(pid)); \
const Real rho = bm_neighbor->getBoundaryDensity(fluidModelIndex, i); \
if (rho != 0.0) \
{ \
const Vector3r &gradRho = bm_neighbor->getBoundaryDensityGradient(fluidModelIndex, i).cast<Real>(); \
const Vector3r &xj = bm_neighbor->getBoundaryXj(fluidModelIndex, i); \
code \
} \
}
forall_density_maps
loops over all boundary neighbors casting them to the Koschier 2017 boundary model.
Requires:
Simulation *sim = Simulation::getCurrent()
unsigned int nBoundaries
unsigned int fluidModelIndex
unsigned int i
Defines:
unsigned int pid
BoundaryModel_Koschier2017 *bm_neighbor
const Real rho
, the boundary density given by the density mapconst Vector3r &gradRho
, the boundary density gradientconst Vector3r &xj
forall_volume_maps¶
#define forall_volume_maps(code) \
for (unsigned int pid = 0; pid < nBoundaries; pid++) \
{ \
BoundaryModel_Bender2019 *bm_neighbor = static_cast<BoundaryModel_Bender2019*>(sim->getBoundaryModel(pid)); \
const Real Vj = bm_neighbor->getBoundaryVolume(fluidModelIndex, i); \
if (Vj > 0.0) \
{ \
const Vector3r &xj = bm_neighbor->getBoundaryXj(fluidModelIndex, i); \
code \
} \
}
forall_volume_maps
loops over all boundary neighbors casting them to the Bender 2019 boundary model.
Requires:
Simulation *sim = Simulation::getCurrent()
unsigned int nBoundaries
unsigned int fluidModelIndex
unsigned int i
Defines:
unsigned int pid
BoundaryModel_Koschier2019 *bm_neighbor
const Real Vj
, the boundary volume given by the volume mapconst Vector3r &xj
AVX variants¶
SPlisHSPlasH also defines versions using AVX optimizations for some of the macros. These can be used if the respective CMake option is set in the building process. Note that many of the aforementioned by the macro defined variables are given in AVX compatible data types, if you choose to use the AVX version of these macros.
pySPlisHSPlasH¶
Python bindings for the SPlisHSPlasH library¶
Requirements¶
Currently the generation of python bindings is only tested on
Linux Debian, gcc 8.3, Python 3.7/3.8 (Anaconda), CMake 3.13
Windows 10, Visual Studio 15/17/19, Python 3.7/3.8 (Anaconda), CMake 3.13
Note that the compiler, the python installation as well as cmake have to be available from the command line for the installation process to work. MacOS builds should work but have not been tested.
Installation¶
In order to install it is advised that you create a new virtual environment so that any faults during installation can not mess up your python installation. This is done as follows for
conda
conda create --name venv python=3.7
conda activate venv
virtualenv
python3 -m virtualenv venv --python=python3.7
source venv/bin/activate
Now you can clone the repository by
git clone https://github.com/InteractiveComputerGraphics/SPlisHSPlasH.git
And finally you should be able to install SPlisHSPlasH using pip.
The trailing slash is important otherwise pip will try to download the package, which is not supported yet at least.
Also note, that pip install SPlisHSPlasH
should be called from one directory above the cloned source directory and not within the directory itself.
pip install SPlisHSPlasH/
While pip install
is useful if SPlisHSPlasH should only be installed once, for development purposes it might be more sensible to build differently.
Change into the SPlisHSPlasH directory and build a python wheel file as follows
cd SPlisHSPlasH
python setup.py bdist_wheel
pip install -I build/dist/*.whl
When building a new version of SPlisHSPlasH simply run these commands again and the installation will be updated. The compile times will be lower, because the build files from previous installations remain. If you are getting compile errors please try to compile the pysplishsplash target of the CMake project separately.
Now check your installation by running
python -c "import pysplishsplash"
Note: You may have to install numpy. Future releases may already contain numpy as a dependency.
pip install numpy
I want to see something very very quickly¶
If you’re very impatient, just run the following command after installing
splash
You will be prompted to select a preconfigured scene file which will then be run in a User Interface. For more options and functionality run. The keybindings in the GUI are the same as for the regular SPlisHSPlasH version.
splash --help
Minimal working example¶
The following examples should work, if SPlisHSPlasH was installed correctly. If you want to load other scene files, be sure to place them into the SPlisHSPlasH data directory structure.
With GUI
import pysplishsplash as sph
def main():
base = sph.Exec.SimulatorBase()
base.init()
gui = sph.GUI.Simulator_GUI_imgui(base)
base.setGui(gui)
base.run()
if __name__ == "__main__":
main()
Without GUI
import pysplishsplash as sph
def main():
base = sph.Exec.SimulatorBase()
base.init(useGui=False)
base.setValueFloat(base.STOP_AT, 10.0) # Important to have the dot to denote a float
base.run()
if __name__ == "__main__":
main()
Outputting the results to a specific directory without GUI
import pysplishsplash as sph
from pysplishsplash.Extras import Scenes
import os
def main():
base = sph.Exec.SimulatorBase()
output_dir = os.path.abspath("where/you/want/the/data")
base.init(useGui=False, outputDir=output_dir, sceneFile=Scenes.DoubleDamBreak)
base.setValueFloat(base.STOP_AT, 20.0) # Important to have the dot to denote a float
base.setValueBool(base.VTK_EXPORT, True)
# Uncomment the next line to set the output FPS value (must be float)
# base.setValueFloat(base.DATA_EXPORT_FPS, 10000.)
base.run()
if __name__ == "__main__":
main()
SPHSimulator.py¶
If you want to start the simulator in the same way as the C++ version, just use the SPHSimulator.py in the examples directory.
Modifying other properties¶
The bindings cover most of the public interface of the SPlisHSPlasH library. As such, it is possible to change components of the simulation dynamically. In the following example, the second cube in the well known double dam break scenario is replaced with a slightly larger cube.
import pysplishsplash
import pysplishsplash.Utilities.SceneLoaderStructs as Scene
def main():
base = pysplishsplash.Exec.SimulatorBase()
args = base.init()
gui = pysplishsplash.GUI.Simulator_GUI_imgui(base)
base.setGui(gui)
scene = base.getScene()
add_block = Scene.FluidBlock('Fluid', Scene.Box([0.0, 0.0, 0.0], [1.0, 1.0, 1.0]), 0, [0.0, 0.0, 0.0])
scene.fluidBlocks[1] = add_block # In Place construction not supported yet
base.run()
if __name__ == "__main__":
main()
Embedded Python¶
Build with embedded Python support¶
To enable the embedded Python support just activate the CMake option USE_EMBEDDED_PYTHON which is by default turned off. Please ensure that CMake finds the Python interpreter. This can be achieved by setting the PYTHON_EXECUTABLE to the file path of the python interpreter.
Run simulator with embedded Python support¶
Make sure that the environment variables PYTHONHOME and PYTHONPATH are set to the directory of your Python installation. Also make sure that the pythonXX.dll (where XX defines the version) is in your path.
When running the simulator with embedded Python support, the new tab ‘Scripts’ should appear in the GUI. Here you can load a script file or reload it.
Alternatively, you can load the Python script directly in a scene. Just use the json key scriptFile
in the scene file to define the location of the script. If a relative path is used, the simulator assumes that it is relative to the scene file.
Writing a script¶
First, you have to import the module splishsplash
, e.g. by: import splishsplash as sph
When the script is loaded, the simulator will call the function init()
automatically. If you defined a function step()
, it will be called in each simulation step. If you defined a function reset()
, it will be called when the simulation is reset. Moreover, you can define additional functions that can be called using the GUI.
init(base)¶
If this function is defined, it is called automatically when the script is loaded or reloaded. The parameter base contains the current SimulationBase object.
step()¶
If this function is defined, it is called automatically in each simulation step.
reset()¶
If this function is defined, it is called automatically in each simulation reset.
Additional commands¶
Additional commands that can be executed via the GUI (buttons will be added) can be defined by a list of strings. The list must be called function_list
and must contain the names of functions that should be called, e.g.
function_list = ['command', 'command2']
Example¶
This is a simple example script which prints the current simulation time, the position of particle 0 and a counter value in each step:
import splishsplash as sph
import numpy as np
counter = 0
function_list = ['command', 'command2']
def init(base):
global counter
print("init test")
counter = 1
def step():
global counter
sim = sph.Simulation.getCurrent()
fluid = sim.getFluidModel(0)
tm = sph.TimeManager.getCurrent()
print(fluid.getPosition(0))
print(tm.getTime())
print(counter)
counter += 1
print("---")
def reset():
print("reset test")
def command():
print("tst cmd")
def command2():
print("tst cmd2")
Creating Scenes¶
Loading the empty scene¶
Right now the easiest way to create a custom scene without specifying a Scene.json
file, is to load the predefined empty scene.
import pysplishsplash as sph
import pysplishsplash.Utilities.SceneLoaderStructs as Scenes
base = sph.Exec.SimulatorBase()
base.init(sceneFile=Scenes.Empty)
This scene will set the default simulation method to be DFSPH
and some other default values, which can all be changed later on.
Recreating the double dam break scenario¶
In order to recreate the double dam break scenario, we need to add a bounding box as well as two fluid cubes. The bounding box can be added as follows
scene = base.getScene()
scene.boundaryModels.append(Scenes.BoundaryData(meshFile="../models/UnitBox.obj", translation=[0., 3.0, 0.], scale=[4., 6., 4.], color=[0.1, 0.4, 0.5, 1.0], isWall=True, mapInvert=True, mapResolution=[25, 25, 25]))
The two fluid blocks can at the end be added using
scene.fluidBlocks.append(Scenes.FluidBlock(id='Fluid', box=Scenes.Box([-1.5, 0.0, -1.5], [-0.5, 2.0, -0.5]), mode=0, initialVelocity=[0.0, 0.0, 0.0]))
scene.fluidBlocks.append(Scenes.FluidBlock(id='Fluid', box=Scenes.Box([0.5, 0.0, 0.5], [1.5, 2.0, 1.5]), mode=0, initialVelocity=[0.0, 0.0, 0.0]))
This will recreate a somewhat larger scene than the default double dam break
Putting it all together¶
The following shows a script detailing how to build and run a custom double dam break. Follow the instruction from before to activate/ deactivate the GUI.
import pysplishsplash as sph
import pysplishsplash.Utilities.SceneLoaderStructs as Scenes
def main():
# Set up the simulator
base = sph.Exec.SimulatorBase()
base.init(useGui=True, sceneFile=sph.Extras.Scenes.Empty)
# Create a simulator
gui = sph.GUI.Simulator_GUI_imgui(base)
base.setGui(gui)
# Get the scene and add objects
scene = base.getScene()
scene.boundaryModels.append(Scenes.BoundaryData(meshFile="../models/UnitBox.obj", translation=[0., 3.0, 0.], scale=[4., 6., 4.], color=[0.1, 0.4, 0.5, 1.0], isWall=True, mapInvert=True, mapResolution=[25, 25, 25]))
scene.fluidBlocks.append(Scenes.FluidBlock(id='Fluid', box=Scenes.Box([-1.5, 0.0, -1.5], [-0.5, 2.0, -0.5]), mode=0, initialVelocity=[0.0, 0.0, 0.0]))
scene.fluidBlocks.append(Scenes.FluidBlock(id='Fluid', box=Scenes.Box([0.5, 0.0, 0.5], [1.5, 2.0, 1.5]), mode=0, initialVelocity=[0.0, 0.0, 0.0]))
# Run the GUI
base.run()
if __name__ == "__main__":
main()
Loading a scene from file¶
Loading a scene from a file is as simple as simply specifying a custom scene file in the init function. This must be an absolute path!
custom_scene = os.path.abspath("scene.json")
base.init(sceneFile=custom_scene)
If you want to use a gui to locate the scene file you may want to use tkinter
import tkinter as tk
from tkinter import filedialog
tk.Tk().withdraw() # Dont show main window
custom_scene = filedialog.askopenfilename()
base.init(sceneFile=custom_scene)
Restrictions¶
When modifying simulation parameters this is the recommended structure, as modification will only work after
base.initSimulation()
has been called.
base.initSimulation()
sim = sph.Simulation.getCurrent()
sim.setValue...()
base.runSimulation()
base.cleanup()
setValue...()
andgetValue...()
functions cannot accept vectors as arguments yet
FoamGenerator¶
The foam generator is a command line tool to generate spray, foam and bubble particles in a postprocessing step which improves the visual realism of the simulation results. It takes a sequences of particle files and generates a sequence of new particles representing spray, foam and air bubbles. These additional particles are advected using the velocity field of the fluid. Below are two examples which were generated using the foam generator tool:
||
|
| —- | —- |
The tool implements the methods of:
Markus Ihmsen, Nadir Akinci, Gizem Akinci, Matthias Teschner. Unified spray, foam and air bubbles for particle-based fluids. The Visual Computer 28(6), 2012
Jan Bender, Dan Koschier, Tassilo Kugelstadt and Marcel Weiler. Turbulent Micropolar SPH Fluids with Foam. IEEE Transactions on Visualization and Computer Graphics 25(6), 2019
Parameters for foam generation¶
The foam generator first analyzes the complete simulation data before the generation starts. During this analysis the tool determines the maximum values per frame for the potentials as proposed by Bender et al. [2019]. The resulting values are used for an automatic configuration of the parameters –ta, –wc, –vo and the limits. If you want to set these parameters manually (like in the original method of Ihmsen et al. [2012]), then you have to use the command line parameter “–no-auto” and set the parameters –ta, –wc, –vo and –limits.
Bounding box¶
Moreover, it is possible to define a bounding box for the foam particles. Foam particles are advected only using the velocity field of the fluid. However, there is no boundary handling since this would be quite expensive. Hence, particles can go through the boundary. A simple solution is to define a bounding box and clamp the particles which leave the box or kill these particles or steal their lifetime.
Frame rate¶
We recommend to generate the fluid sequence with 50 fps. Therefore, by default the time step size of the generator is set to 0.02s. If you use another frame rate, you have to adapt this parameter.
Further parameters¶
The parameter –buoyancy defines the buoyancy of air bubbles. Higher values let them go up faster.
The parameter –drag defines the coefficient of a drag force between the fluid particles and the foam particles.
The parameter –foamscale defines how many foam particles are generated per frame.
The parameter –lifetime defines the minimum and maximum lifetime of the foam particles in seconds.
The parameter –skipframes allows you the skip frames when writing the foam data, e.g. if you have a 50fps fluid sequence and want to write a 25fps foam sequence.
The parameters –splittypes and –splitgenerators can be used if you want to split the output in spray, foam and air bubble particles.
Command line options:¶
-h, –help: Print help
-i, –input arg: Input file (partio)
-o, –output arg: Output file (partio or vtk)
-q, –query: Query mode: determines max/avg values
–no-auto: Disable automatic mode. Limits and factors ta, wc, vo must be set manually.
–splittypes: Output each foam type to a different file
–splitgenerators: Output different foam files depending on which potential generated the foam. Overrides –splittypes.
-s, –startframe arg: Start frame (default: 1)
-e, –endframe arg: End frame
-r, –radius arg: Particle radius (default: 0.025)
-t, –timestepsize arg: Time step size (default: 0.02)
-k, –kernel arg: 0: Cubic spline, 1: Ihmsen et al. 2012 (default: 0)
-l, –limits arg: Limits (min/max) for potentials (trapped air, wave crest, vorticity, kinetic energy) (default: 5,20,2,8,5,20,5,50)
–lifetime arg: Lifetime (min/max) (default: 2.0,5.0)
-b, –buoyancy arg: Buoyancy (default: 2.0)
-d, –drag arg: Drag (default: 0.8)
–ta arg: Trapped air factor (default: 4000)
–wc arg: Wave crest factor (default: 50000)
–vo arg: Vorticity factor (default: 4000)
–bbsize arg: minimum and maximum coordinates of and axis aligned bounding-box (minX, minY, minZ, maxX, maxY, maxZ)
–bbtype arg: chose how the bounding-box is used [kill | lifesteal | clamp]. Use in combination with –bbsize.
–skipframes arg: number of frames to skip when writing foam (default: 0)
-f, –foamscale arg: Global multiplier for number of generated foam particles (default: 1000)
Example:¶
FoamGenerator -s 1 -e 500 -r 0.025 --foamscale 1000 -i output\DamBreakModelDragons\partio\ParticleData_Fluid_#.bgeo -o output\DamBreakModelDragons\foam\foam_#.bgeo
MeshSkinning¶
MeshSkinning is a command line tool to generate a sequence of deformed meshes from a sequence of particle files of an elastic model. When simulating an elastic solid using SPlisHSPlasH, we only get particle data. If this data is exported using the PartioExported, the MeshSkinning tool is able to generate deformed triangle meshes in a post-processing step. The tool requires a triangle mesh of the reference configuration of the deformable solid. This mesh is then deformed according to the particle data.
Below are two examples which were generated using the mesh skinning tool:
||
|
| —- | —- |
The tool implements the methods of:
Tassilo Kugelstadt, Jan Bender, José Antonio Fernández-Fernández, Stefan Rhys Jeske, Fabian Löschner, and Andreas Longva. Fast Corotated Elastic SPH Solids with Implicit Zero-Energy Mode Control. Proceedings of the ACM on Computer Graphics and Interactive Techniques, 2021
Parameters¶
The mesh skinning tool can either use the scene file as input. Then you have to define the required triangle mesh in the scene file for each elastic model:
"visMesh": "../models/beam.obj"
All transformations and required info is then automatically extracted from the scene file (assuming that the partio files are located in the output folder) which is the simplest way to use this tool.
Alternatively you can also define everything manually. Then you have to provide the partio path, mesh file as well as translation, rotation and scaling of the mesh file to fit the reference configuration of the particles.
Command line options:¶
-i, –input arg: Input file
-o, –output arg: Output file
-m, –mesh arg: Mesh file
–scene arg: Scene file (all settings are imported from the scene file)
–partioPath arg: Path of the partio files (when using a scene file). If not set, it is assumed that the files are in the standard output path.
–scale arg: Scaling of input geometry (e.g. –scale “2 1 2”) (default: 1 1 1)
-t, –translation arg: Translation of input geometry (e.g. –translation “2 1 2”) (default: 1 1 1)
–axis arg: Rotation axis of input geometry (e.g. –axis “1 0 0”) (default: 1 0 0)
–angle arg: Angle of input geometry (e.g. –angle 1) (default: 0.0)
-s, –startframe arg: Start frame (default: 1)
-e, –endframe arg: End frame
-r, –radius arg: Particle radius (default: 0.025)
–supportRadiusFactor arg: The support radius is defined as factor*particleRadius (default: 6.0)
–maxNeighbors arg: The maximum number of neighbors that are used for the interpolation. (default: 60)
–splitting: Read a scene which used the object splitting export option.
–overwrite: Overwrite existing files.
-h, –help: Print help
Example:¶
MeshSkinning --splitting --overwrite --scene ..\data\Scenes\Beam.json
partio2vtk¶
A tool to convert partion files in vtk files. In this way the particle data which is exported from SPlisHSPlasH can be converted to the vtk format. This is useful to import the data in ParaView for visualization.
PartioViewer¶
The simulators can export the particle simulation data using the partio file format. The PartioViewer can read such a file and render the particle data using OpenGL. This tool is able to handle multiphase data and rigid body data. It can create image sequences and movies (using ffmpeg).
To visualize a sequence of partio files or a single file, call (the index in the file name is used for the sequence):
PartioViewer fluid_data_1.bgeo
This tool is also able to read a complete output directory:
PartioViewer output/DamBreakModel
In this case the tool searches for the partio files of multiple phases in the subdirectory “partio” and for rigid body data in “rigid_bodies”.
Note: To generate videos you must tell PartioViewer where it can find the ffmpeg executable.
Command line options:¶
-h, –help: Print help
–renderSequence: Render a sequence from startFrame to endFrame as jpeg.
–renderVideo: Render a sequence from startFrame to endFrame as video.This function requires ffmpeg which must be in the PATH or the ffmpegPath parameter must be set.
–noOverwrite: Do not overwrite existing frames when using –renderSequence option. Existing frames are not loaded at all which accelerates the image sequence generation.
-o, –outdir arg: Output directory for images
–rbData arg: Rigid body data to visualize (bin file)
–ffmpegPath arg: Path of the ffmpeg excutable.
–width arg: Width of the image in pixels. (default: 1024)
–height arg: Height of the image in pixels. (default: 768)
–fps arg: Frame rate of video. (default: 25)
-r, –radius arg: Particle radius (default: 0.025)
-s, –startFrame arg: Start frame (only used if value is >= 0) (default: -1)
-e, –endFrame arg: End frame (only used if value is >= 0) (default: -1)
–colorField arg: Name of field that is used for the color. (default: velocity)
–colorMapType arg: Color map (0=None, 1=Jet, 2=Plasma) (default: 1)
–renderMinValue arg: Min value of field. (default: 0.0)
–renderMaxValue arg: Max value of field. (default: 10.0)
–camPos arg: Camera position (e.g. –camPos “0 1 5”) (default: 0 3 10)
–camLookat arg: Camera lookat (e.g. –camLookat “0 0 0”) (default: 0 0 0)
Hotkeys¶
Space: pause/contiunue simulation
r: reset simulation
w: wireframe rendering of meshes
i: print all field information of the selected particles to the console
s: save current frame as jpg image
v: generate video
j: generate image sequence
+: step to next frame
-: step to previous frame
ESC: exit
SurfaceSampling¶
A popular boundary handling method which is also implemented in SPlisHSPlasH uses a particle sampling of the surfaces of all boundary objects. This command line tool can generate such a surface sampling. Note that the same surface sampling is also integrated in the simulators and the samplings are generated automatically if they are required. However, if you want to generate a surface sampling manually, then you can use this tool.
VolumeSampling¶
The simulator can load particle data from partio files. This particle data then defines the initial configuration of the particles in the simulation. The VolumeSampling tool allows you to sample a volumetric object with particle data. This means you can load an OBJ file with a closed surface geometry and sample the interior with particles using different methods. Especially when simulating elastic solids a good sampling is beneficial as shown by Kugelstadt et al. [2021].
Below are two examples which were generated using the volume sampling tool:
| |
|
| ———————————————————— | ———————————————————— |
The tool implements the methods of:
M. Jiang, Y. Zhou, R. Wang, R. Southern, J. J. Zhang. Blue noise sampling using an SPH-based method. ACM Transactions on Graphics, 2015
Tassilo Kugelstadt, Jan Bender, José Antonio Fernández-Fernández, Stefan Rhys Jeske, Fabian Löschner, and Andreas Longva. Fast Corotated Elastic SPH Solids with Implicit Zero-Energy Mode Control. Proceedings of the ACM on Computer Graphics and Interactive Techniques, 2021
Command line options:¶
-h, –help: Print help
-i, –input arg: Input file (obj)
-o, –output arg: Output file (bgeo or vtk)
-r, –radius arg: Particle radius (default: 0.025)
-s, –scale arg: Scaling of input geometry (e.g. –scale “2 1 2”) (default: 1 1 1)
-m, –mode arg: Mode (regular=0, almost dense=1, dense=2, Jiang et al. 2015=3, Kugelstadt et al. 2021=4) (default: 4)
–region arg: Region to fill with particles (e.g. –region “0 0 0 1 1 1”)
–steps arg: SPH time steps (default: 100)
–cflFactor arg: CFL factor (default: 0.25)
–viscosity arg: Viscosity coefficient (XSPH) (default: 0.25)
–cohesion arg: Cohesion coefficient
–adhesion arg: Adhesion coefficient
–stiffness arg: Stiffness coefficient (only mode 3) (default: 10000.0)
–dt arg: Time step size (only mode 3) (default: 0.0005)
–res arg: Resolution of the Signed Distance Field (e.g. –res “30 30 30”)
–invert: Invert the SDF to sample the outside of the object in the bounding box/region
–no-cache: Disable caching of SDF.
Example:¶
VolumeSampling.exe --mode 4 -i ..\data\models\bunny.obj -o bunny.vtk
Library API¶
Class Hierarchy¶
-
- Namespace Eigen
- Namespace Eigen::internal
- Namespace SPH
- Struct FieldDescription
- Class AdhesionKernel
- Class AnimationField
- Class AnimationFieldSystem
- Class BinaryFileReader
- Class BinaryFileWriter
- Class BlockJacobiPreconditioner3D
- Class BoundaryModel
- Class BoundaryModel_Akinci2012
- Class BoundaryModel_Bender2019
- Class BoundaryModel_Koschier2017
- Class CohesionKernel
- Class CubicKernel
- Class CubicKernel2D
- Class DebugTools
- Class DragBase
- Class DragForce_Gissler2017
- Class DragForce_Macklin2014
- Class Elasticity_Becker2009
- Class Elasticity_Kugelstadt2021
- Class Elasticity_Peer2018
- Class ElasticityBase
- Class Emitter
- Class EmitterSystem
- Class FluidModel
- Class GaussQuadrature
- Class JacobiPreconditioner1D
- Class JacobiPreconditioner3D
- Class MathFunctions
- Class MathFunctions_AVX
- Class MatrixReplacement
- Class MicropolarModel_Bender2017
- Class NonPressureForceBase
- Class PoissonDiskSampling
- Class Poly6Kernel
- Template Class PrecomputedKernel
- Class RegularSampling2D
- Class RegularTriangleSampling
- Class RigidBodyObject
- Class SimpleQuadrature
- Class Simulation
- Struct Simulation::FluidInfo
- Struct Simulation::NonPressureForceMethod
- Class SimulationDataDFSPH
- Class SimulationDataICSPH
- Class SimulationDataIISPH
- Class SimulationDataPBF
- Class SimulationDataPCISPH
- Class SimulationDataPF
- Class SimulationDataWCSPH
- Class SpikyKernel
- Class StaticRigidBody
- Class SurfaceTension_Akinci2013
- Class SurfaceTension_Becker2007
- Class SurfaceTension_He2014
- Class SurfaceTension_ZorillaRitter2020
- Class SurfaceTensionBase
- Class TimeIntegration
- Class TimeManager
- Class TimeStep
- Class TimeStepDFSPH
- Class TimeStepICSPH
- Class TimeStepIISPH
- Class TimeStepPBF
- Class TimeStepPCISPH
- Class TimeStepPF
- Class TimeStepWCSPH
- Class TriangleMesh
- Class Viscosity_Bender2017
- Class Viscosity_Peer2015
- Class Viscosity_Peer2016
- Class Viscosity_Standard
- Class Viscosity_Takahashi2015
- Class Viscosity_Weiler2018
- Class ViscosityBase
- Class VorticityBase
- Class VorticityConfinement
- Class WendlandQuinticC2Kernel
- Class WendlandQuinticC2Kernel2D
- Class XSPH
- Enum BoundaryHandlingMethods
- Enum FieldType
- Enum ParticleState
- Enum SimulationMethods
- Enum SurfaceSamplingMode
- Namespace Utilities
- Struct AverageCount
- Struct AverageTime
- Struct MeshFaceIndices
- Struct TimingHelper
- Class ConsoleSink
- Class Counting
- Class FileSink
- Class FileSystem
- Class IDFactory
- Class Logger
- Class LogSink
- Class LogStream
- Class OBJLoader
- Class PartioReaderWriter
- Class SceneLoader
- Struct SceneLoader::AnimationFieldData
- Struct SceneLoader::BoundaryData
- Struct SceneLoader::Box
- Struct SceneLoader::EmitterData
- Struct SceneLoader::FluidBlock
- Struct SceneLoader::FluidData
- Struct SceneLoader::MaterialData
- Struct SceneLoader::Scene
- Class SceneWriter
- Class SDFFunctions
- Class StringTools
- Class SystemInfo
- Class Timing
- Class VolumeSampling
- Class WindingNumbers
- Enum LogLevel
- Template Class AlignmentAllocator
- Template Struct AlignmentAllocator::rebind
- Class Matrix3f8
- Class Quaternion8f
- Class Scalarf8
- Class Vector3f8
- Namespace Eigen
File Hierarchy¶
-
- Directory SPlisHSPlasH
- File AnimationField.cpp
- File AnimationField.h
- File AnimationFieldSystem.cpp
- File AnimationFieldSystem.h
- File BoundaryModel.cpp
- File BoundaryModel.h
- File BoundaryModel_Akinci2012.cpp
- File BoundaryModel_Akinci2012.h
- File BoundaryModel_Bender2019.cpp
- File BoundaryModel_Bender2019.h
- File BoundaryModel_Koschier2017.cpp
- File BoundaryModel_Koschier2017.h
- File Common.h
- File Emitter.cpp
- File Emitter.h
- File EmitterSystem.cpp
- File EmitterSystem.h
- File FluidModel.cpp
- File FluidModel.h
- File NeighborhoodSearch.h
- File NonPressureForceBase.cpp
- File NonPressureForceBase.h
- File NonPressureForceRegistration.cpp
- File RigidBodyObject.h
- File Simulation.cpp
- File Simulation.h
- File SPHKernels.cpp
- File SPHKernels.h
- File StaticRigidBody.h
- File TimeManager.cpp
- File TimeManager.h
- File TimeStep.cpp
- File TimeStep.h
- File TriangleMesh.cpp
- File TriangleMesh.h
- File XSPH.cpp
- File XSPH.h
- Directory Utilities
- File BinaryFileReaderWriter.h
- File Counting.h
- File FileSystem.h
- File Logger.h
- File OBJLoader.h
- File PartioReaderWriter.cpp
- File PartioReaderWriter.h
- File StringTools.h
- File SystemInfo.h
- File Timing.h
- File AVX_math.h
- File CholeskyAVXSolver.cpp
- File CholeskyAVXSolver.h
- File DebugTools.cpp
- File DebugTools.h
- File DragBase.cpp
- File DragBase.h
- File DragForce_Gissler2017.cpp
- File DragForce_Gissler2017.h
- File DragForce_Macklin2014.cpp
- File DragForce_Macklin2014.h
- File Elasticity_Becker2009.cpp
- File Elasticity_Becker2009.h
- File Elasticity_Kugelstadt2021.cpp
- File Elasticity_Kugelstadt2021.h
- File Elasticity_Peer2018.cpp
- File Elasticity_Peer2018.h
- File ElasticityBase.cpp
- File ElasticityBase.h
- File GaussQuadrature.cpp
- File GaussQuadrature.h
- File MathFunctions.cpp
- File MathFunctions.h
- File MatrixFreeSolver.h
- File MicropolarModel_Bender2017.cpp
- File MicropolarModel_Bender2017.h
- File PoissonDiskSampling.cpp
- File PoissonDiskSampling.h
- File RegularSampling2D.cpp
- File RegularSampling2D.h
- File RegularTriangleSampling.cpp
- File RegularTriangleSampling.h
- File SceneLoader.cpp
- File SceneLoader.h
- File SceneWriter.cpp
- File SceneWriter.h
- File SDFFunctions.cpp
- File SDFFunctions.h
- File SimpleQuadrature.cpp
- File SimpleQuadrature.h
- File SimulationDataDFSPH.cpp
- File SimulationDataDFSPH.h
- File SimulationDataICSPH.cpp
- File SimulationDataICSPH.h
- File SimulationDataIISPH.cpp
- File SimulationDataIISPH.h
- File SimulationDataPBF.cpp
- File SimulationDataPBF.h
- File SimulationDataPCISPH.cpp
- File SimulationDataPCISPH.h
- File SimulationDataPF.cpp
- File SimulationDataPF.h
- File SimulationDataWCSPH.cpp
- File SimulationDataWCSPH.h
- File SurfaceSampling.h
- File SurfaceTension_Akinci2013.cpp
- File SurfaceTension_Akinci2013.h
- File SurfaceTension_Becker2007.cpp
- File SurfaceTension_Becker2007.h
- File SurfaceTension_He2014.cpp
- File SurfaceTension_He2014.h
- File SurfaceTension_ZorillaRitter2020.cpp
- File SurfaceTension_ZorillaRitter2020.h
- File SurfaceTension_ZorillaRitter2020_haltonVec323.h
- File SurfaceTensionBase.cpp
- File SurfaceTensionBase.h
- File TimeIntegration.cpp
- File TimeIntegration.h
- File TimeStepDFSPH.cpp
- File TimeStepDFSPH.h
- File TimeStepICSPH.cpp
- File TimeStepICSPH.h
- File TimeStepIISPH.cpp
- File TimeStepIISPH.h
- File TimeStepPBF.cpp
- File TimeStepPBF.h
- File TimeStepPCISPH.cpp
- File TimeStepPCISPH.h
- File TimeStepPF.cpp
- File TimeStepPF.h
- File TimeStepWCSPH.cpp
- File TimeStepWCSPH.h
- File Viscosity_Bender2017.cpp
- File Viscosity_Bender2017.h
- File Viscosity_Peer2015.cpp
- File Viscosity_Peer2015.h
- File Viscosity_Peer2016.cpp
- File Viscosity_Peer2016.h
- File Viscosity_Standard.cpp
- File Viscosity_Standard.h
- File Viscosity_Takahashi2015.cpp
- File Viscosity_Takahashi2015.h
- File Viscosity_Weiler2018.cpp
- File Viscosity_Weiler2018.h
- File ViscosityBase.cpp
- File ViscosityBase.h
- File VolumeSampling.cpp
- File VolumeSampling.h
- File VorticityBase.cpp
- File VorticityBase.h
- File VorticityConfinement.cpp
- File VorticityConfinement.h
- File WindingNumbers.cpp
- File WindingNumbers.h
- Directory SPlisHSPlasH
Full API¶
Namespaces¶
Namespace @61¶
Namespace chrono¶
Namespace Eigen::internal¶
Contents
Namespace GenParam¶
Namespace std¶
Classes and Structs¶
Template Struct AlignmentAllocator::rebind¶
Defined in File AVX_math.h
Nested Relationships¶
This struct is a nested type of Template Class AlignmentAllocator.
Template Struct generic_product_impl< MatrixReplacement, Rhs, SparseShape, DenseShape, GemvProduct >¶
Defined in File MatrixFreeSolver.h
Inheritance Relationships¶
Base Type¶
public generic_product_impl_base< MatrixReplacement, Rhs, generic_product_impl< MatrixReplacement, Rhs > >
Struct Documentation¶
Template Struct traits< SPH::MatrixReplacement >¶
Defined in File MatrixFreeSolver.h
Struct Documentation¶
-
template<>
struct traits<SPH::MatrixReplacement> : public Eigen::internal::traits<SystemMatrixType>¶
Struct Elasticity_Kugelstadt2021::ElasticObject¶
Defined in File Elasticity_Kugelstadt2021.h
Nested Relationships¶
This struct is a nested type of Class Elasticity_Kugelstadt2021.
Struct Documentation¶
-
struct ElasticObject
Public Functions
-
inline ElasticObject()
-
inline ~ElasticObject()
Public Members
-
std::string m_md5
-
std::vector<unsigned int> m_particleIndices
-
unsigned int m_nFixed
-
std::shared_ptr<Factorization> m_factorization
-
std::vector<Quaternionr, Eigen::aligned_allocator<Quaternionr>> m_quats
-
inline ElasticObject()
Struct Elasticity_Kugelstadt2021::Factorization¶
Defined in File Elasticity_Kugelstadt2021.h
Nested Relationships¶
This struct is a nested type of Class Elasticity_Kugelstadt2021.
Struct Documentation¶
-
struct Factorization
Public Members
-
Real m_dt
-
Real m_mu
-
Eigen::SparseMatrix<Real, Eigen::RowMajor> m_DT_K
-
Eigen::SparseMatrix<Real, Eigen::RowMajor> m_D
-
Eigen::SparseMatrix<Real, Eigen::ColMajor> m_matHTH
-
Eigen::SparseMatrix<Real, Eigen::ColMajor> m_matL
-
Eigen::SparseMatrix<Real, Eigen::ColMajor> m_matLT
-
Eigen::VectorXi m_permInd
-
Eigen::VectorXi m_permInvInd
-
Real m_dt
Struct PoissonDiskSampling::CellPosHasher¶
Defined in File PoissonDiskSampling.h
Nested Relationships¶
This struct is a nested type of Class PoissonDiskSampling.
Struct PoissonDiskSampling::HashEntry¶
Defined in File PoissonDiskSampling.h
Nested Relationships¶
This struct is a nested type of Class PoissonDiskSampling.
Struct Documentation¶
-
struct HashEntry
Struct to store the hash entry (spatial hashing)
Public Functions
-
inline HashEntry()
Public Members
-
std::vector<unsigned int> samples
-
unsigned int startIndex
-
inline HashEntry()
Struct PoissonDiskSampling::InitialPointInfo¶
Defined in File PoissonDiskSampling.h
Nested Relationships¶
This struct is a nested type of Class PoissonDiskSampling.
Struct Simulation::FluidInfo¶
Defined in File Simulation.h
Nested Relationships¶
This struct is a nested type of Class Simulation.
Struct Documentation¶
-
struct FluidInfo
Fluid object information
Public Functions
-
inline bool hasSameParticleSampling(const FluidInfo &other)
Public Members
-
int type
-
int numParticles
-
AlignedBox3r box
-
std::string id
-
std::string samplesFile
-
std::string visMeshFile
-
Vector3r translation
-
Matrix3r rotation
-
Vector3r scale
-
Vector3r initialVelocity
-
Vector3r initialAngularVelocity
-
unsigned char mode
-
bool invert
-
std::array<unsigned int, 3> resolutionSDF
-
unsigned int emitter_width
-
unsigned int emitter_height
-
Real emitter_velocity
-
Real emitter_emitStartTime
-
Real emitter_emitEndTime
-
unsigned int emitter_type
-
inline bool hasSameParticleSampling(const FluidInfo &other)
Struct Simulation::NonPressureForceMethod¶
Defined in File Simulation.h
Nested Relationships¶
This struct is a nested type of Class Simulation.
Struct Documentation¶
-
struct NonPressureForceMethod
Public Members
-
std::string m_name
-
std::function<NonPressureForceBase*(FluidModel*)> m_creator
-
int m_id
-
std::string m_name
Struct SceneLoader::AnimationFieldData¶
Defined in File SceneLoader.h
Nested Relationships¶
This struct is a nested type of Class SceneLoader.
Struct SceneLoader::BoundaryData¶
Defined in File SceneLoader.h
Nested Relationships¶
This struct is a nested type of Class SceneLoader.
Struct Documentation¶
-
struct BoundaryData
Struct to store a boundary object.
Public Members
-
std::string samplesFile
-
std::string meshFile
-
Vector3r translation
-
Matrix3r rotation
-
Vector3r scale
-
Real density
-
bool dynamic
-
bool isWall
-
Eigen::Matrix<float, 4, 1, Eigen::DontAlign> color
-
void *rigidBody
-
std::string mapFile
-
bool mapInvert
-
Real mapThickness
-
Eigen::Matrix<unsigned int, 3, 1, Eigen::DontAlign> mapResolution
-
unsigned int samplingMode
-
bool isAnimated
-
std::string samplesFile
Struct SceneLoader::Box¶
Defined in File SceneLoader.h
Nested Relationships¶
This struct is a nested type of Class SceneLoader.
Struct SceneLoader::EmitterData¶
Defined in File SceneLoader.h
Nested Relationships¶
This struct is a nested type of Class SceneLoader.
Struct SceneLoader::FluidBlock¶
Defined in File SceneLoader.h
Nested Relationships¶
This struct is a nested type of Class SceneLoader.
Struct SceneLoader::FluidData¶
Defined in File SceneLoader.h
Nested Relationships¶
This struct is a nested type of Class SceneLoader.
Struct Documentation¶
-
struct FluidData
Struct to store a fluid object.
Struct SceneLoader::MaterialData¶
Defined in File SceneLoader.h
Nested Relationships¶
This struct is a nested type of Class SceneLoader.
Struct SceneLoader::Scene¶
Defined in File SceneLoader.h
Nested Relationships¶
This struct is a nested type of Class SceneLoader.
Struct Documentation¶
-
struct Scene
Struct to store scene information.
Public Members
-
std::vector<BoundaryData*> boundaryModels
-
std::vector<FluidData*> fluidModels
-
std::vector<FluidBlock*> fluidBlocks
-
std::vector<EmitterData*> emitters
-
std::vector<AnimationFieldData*> animatedFields
-
std::vector<MaterialData*> materials
-
Real particleRadius
-
bool sim2D
-
Real timeStepSize
-
Vector3r camPosition
-
Vector3r camLookat
-
std::vector<BoundaryData*> boundaryModels
Template Class AlignmentAllocator¶
Defined in File AVX_math.h
Class Documentation¶
-
template<typename T, std::size_t N = 32>
class AlignmentAllocator¶ -
Public Functions
-
inline AlignmentAllocator()¶
-
template<typename T2>
inline AlignmentAllocator(const AlignmentAllocator<T2, N>&)¶
-
inline ~AlignmentAllocator()¶
-
inline const_pointer adress(const_reference r) const¶
-
inline void construct(pointer p, const value_type &wert)¶
-
inline bool operator!=(const AlignmentAllocator<T, N> &other) const¶
-
inline bool operator==(const AlignmentAllocator<T, N> &other) const¶
-
template<typename T2>
struct rebind¶ Public Types
-
typedef AlignmentAllocator<T2, N> other¶
-
typedef AlignmentAllocator<T2, N> other¶
-
inline AlignmentAllocator()¶
Class Quaternion8f¶
Defined in File AVX_math.h
Class Documentation¶
-
class Quaternion8f¶
Public Functions
-
inline Quaternion8f()¶
-
inline const Quaternion8f operator*(const Quaternion8f &a) const¶
-
inline void store(std::vector<Quaternionr> &qf) const¶
-
inline void store(Quaternionr *qf) const¶
-
inline void set(const Quaternionr *qf)¶
-
inline Quaternion8f()¶
Class Scalarf8¶
Defined in File AVX_math.h
Class AdhesionKernel¶
Defined in File SPHKernels.h
Class Documentation¶
-
class AdhesionKernel¶
Adhesion kernel used for the surface tension method of Akinci el al. [ATT13].
References:
[AAT13] Nadir Akinci, Gizem Akinci, and Matthias Teschner. Versatile surface tension and adhesion for sph fluids. ACM Trans. Graph., 32(6):182:1-182:8, November 2013. URL: http://doi.acm.org/10.1145/2508363.2508395
Public Static Functions
Class AnimationField¶
Defined in File AnimationField.h
Class Documentation¶
-
class AnimationField¶
Public Functions
-
AnimationField(const std::string &particleFieldName, const Vector3r &pos, const Matrix3r &rotation, const Vector3r &scale, const std::string expression[3], const unsigned int type = 0)¶
-
virtual ~AnimationField()¶
-
void step()¶
-
virtual void reset()¶
Protected Functions
- inline FORCE_INLINE bool inBox (const Vector3r &x, const Vector3r &xBox, const Matrix3r &rotBox, const Vector3r &scaleBox)
- inline FORCE_INLINE bool inCylinder (const Vector3r &x, const Vector3r &xCyl, const Matrix3r &rotCyl, const Real h, const Real r2)
- inline FORCE_INLINE bool inSphere (const Vector3r &x, const Vector3r &pos, const Matrix3r &rot, const Real radius)
- inline FORCE_INLINE bool inShape (const int type, const Vector3r &x, const Vector3r &pos, const Matrix3r &rot, const Vector3r &scale)
-
AnimationField(const std::string &particleFieldName, const Vector3r &pos, const Matrix3r &rotation, const Vector3r &scale, const std::string expression[3], const unsigned int type = 0)¶
Class AnimationFieldSystem¶
Defined in File AnimationFieldSystem.h
Class Documentation¶
-
class AnimationFieldSystem¶
Public Functions
-
AnimationFieldSystem()¶
-
virtual ~AnimationFieldSystem()¶
-
void addAnimationField(const std::string &particleFieldName, const Vector3r &pos, const Matrix3r &rotation, const Vector3r &scale, const std::string expression[3], const unsigned int type)¶
-
inline unsigned int numAnimationFields() const¶
-
inline std::vector<AnimationField*> &getAnimationFields()¶
-
void step()¶
-
void reset()¶
Protected Attributes
-
std::vector<AnimationField*> m_fields¶
-
AnimationFieldSystem()¶
Class BinaryFileReader¶
Defined in File BinaryFileReaderWriter.h
Class Documentation¶
-
class BinaryFileReader¶
Public Functions
-
inline bool openFile(const std::string &fileName)¶
-
inline void closeFile()¶
-
inline void readBuffer(char *buffer, size_t size)¶
-
inline void read(std::string &str)¶
-
template<typename T, int Options, typename StorageIndex>
inline void readSparseMatrix(Eigen::SparseMatrix<T, Options, StorageIndex> &m)¶
Public Members
-
std::ifstream m_file¶
-
inline bool openFile(const std::string &fileName)¶
Class BinaryFileWriter¶
Defined in File BinaryFileReaderWriter.h
Class Documentation¶
-
class BinaryFileWriter¶
Public Functions
-
inline bool openFile(const std::string &fileName)¶
-
inline void closeFile()¶
-
inline void writeBuffer(const char *buffer, size_t size)¶
-
inline void write(const std::string &str)¶
-
template<typename T, int Rows, int Cols>
inline void writeMatrixX(const Eigen::Matrix<T, Rows, Cols> &m)¶
-
template<typename T, int Options, typename StorageIndex>
inline void writeSparseMatrix(Eigen::SparseMatrix<T, Options, StorageIndex> &m)¶
Public Members
-
std::ofstream m_file¶
-
inline bool openFile(const std::string &fileName)¶
Class BlockJacobiPreconditioner3D¶
Defined in File MatrixFreeSolver.h
Class Documentation¶
-
class BlockJacobiPreconditioner3D¶
Matrix-free 3x3 block Jacobi preconditioner
Public Types
-
typedef SystemMatrixType::StorageIndex StorageIndex¶
Public Functions
-
inline BlockJacobiPreconditioner3D()¶
-
inline void init(const unsigned int dim, DiagonalMatrixElementFct fct, void *userData)¶
-
inline Eigen::Index rows() const¶
-
inline Eigen::Index cols() const¶
-
inline Eigen::ComputationInfo info()¶
-
template<typename MatType>
inline BlockJacobiPreconditioner3D &analyzePattern(const MatType&)¶
-
template<typename MatType>
inline BlockJacobiPreconditioner3D &factorize(const MatType &mat)¶
-
template<typename MatType>
inline BlockJacobiPreconditioner3D &compute(const MatType &mat)¶
-
template<typename Rhs>
inline const Eigen::Solve<BlockJacobiPreconditioner3D, Rhs> solve(const Eigen::MatrixBase<Rhs> &b) const¶
-
typedef SystemMatrixType::StorageIndex StorageIndex¶
Class BoundaryModel¶
Defined in File BoundaryModel.h
Inheritance Relationships¶
Derived Types¶
public SPH::BoundaryModel_Akinci2012
(Class BoundaryModel_Akinci2012)public SPH::BoundaryModel_Bender2019
(Class BoundaryModel_Bender2019)public SPH::BoundaryModel_Koschier2017
(Class BoundaryModel_Koschier2017)
Class Documentation¶
-
class BoundaryModel¶
The boundary model stores the information required for boundary handling.
Subclassed by SPH::BoundaryModel_Akinci2012, SPH::BoundaryModel_Bender2019, SPH::BoundaryModel_Koschier2017
Public Functions
-
BoundaryModel()¶
-
virtual ~BoundaryModel()¶
-
virtual void reset()¶
-
inline virtual void performNeighborhoodSearchSort()¶
-
inline virtual void saveState(BinaryFileWriter &binWriter)¶
-
inline virtual void loadState(BinaryFileReader &binReader)¶
-
inline RigidBodyObject *getRigidBodyObject()¶
- inline FORCE_INLINE void addForce (const Vector3r &pos, const Vector3r &f)
- inline FORCE_INLINE void getPointVelocity (const Vector3r &x, Vector3r &res)
-
void clearForceAndTorque()¶
-
BoundaryModel()¶
Class BoundaryModel_Akinci2012¶
Defined in File BoundaryModel_Akinci2012.h
Inheritance Relationships¶
Base Type¶
public SPH::BoundaryModel
(Class BoundaryModel)
Class Documentation¶
-
class BoundaryModel_Akinci2012 : public SPH::BoundaryModel¶
The boundary model stores the information required for boundary handling using the approach of Akinci et al. 2012 [AIA+12].
References:
[AIA+12] Nadir Akinci, Markus Ihmsen, Gizem Akinci, Barbara Solenthaler, and Matthias Teschner. Versatile rigid-fluid coupling for incompressible SPH. ACM Trans. Graph., 31(4):62:1-62:8, July 2012. URL: http://doi.acm.org/10.1145/2185520.2185558
Public Functions
-
BoundaryModel_Akinci2012()¶
-
virtual ~BoundaryModel_Akinci2012()¶
-
inline unsigned int numberOfParticles() const¶
-
inline unsigned int getPointSetIndex() const¶
-
inline bool isSorted() const¶
-
void computeBoundaryVolume()¶
-
void resize(const unsigned int numBoundaryParticles)¶
-
virtual void reset()¶
-
virtual void performNeighborhoodSearchSort()¶
-
virtual void saveState(BinaryFileWriter &binWriter)¶
-
virtual void loadState(BinaryFileReader &binReader)¶
-
void initModel(RigidBodyObject *rbo, const unsigned int numBoundaryParticles, Vector3r *boundaryParticles)¶
- inline FORCE_INLINE Vector3r & getPosition0 (const unsigned int i)
- inline FORCE_INLINE const Vector3r & getPosition0 (const unsigned int i) const
- inline FORCE_INLINE void setPosition0 (const unsigned int i, const Vector3r &pos)
- inline FORCE_INLINE Vector3r & getPosition (const unsigned int i)
- inline FORCE_INLINE const Vector3r & getPosition (const unsigned int i) const
- inline FORCE_INLINE void setPosition (const unsigned int i, const Vector3r &pos)
- inline FORCE_INLINE Vector3r & getVelocity (const unsigned int i)
- inline FORCE_INLINE const Vector3r & getVelocity (const unsigned int i) const
- inline FORCE_INLINE void setVelocity (const unsigned int i, const Vector3r &vel)
- inline FORCE_INLINE const Real & getVolume (const unsigned int i) const
- inline FORCE_INLINE Real & getVolume (const unsigned int i)
- inline FORCE_INLINE void setVolume (const unsigned int i, const Real &val)
Class BoundaryModel_Bender2019¶
Defined in File BoundaryModel_Bender2019.h
Inheritance Relationships¶
Base Type¶
public SPH::BoundaryModel
(Class BoundaryModel)
Class Documentation¶
-
class BoundaryModel_Bender2019 : public SPH::BoundaryModel¶
The boundary model stores the information required for boundary handling using the approach of Bender et al. 2019 [BKWK19].
References:
[BKWK19] Jan Bender, Tassilo Kugelstadt, Marcel Weiler, and Dan Koschier. Volume maps: an implicit boundary representation for SPH. In Proceedings of ACM SIGGRAPH Conference on Motion, Interaction and Games, MIG ‘19. ACM, 2019. URL: https://dl.acm.org/doi/10.1145/3359566.3360077
Public Functions
-
BoundaryModel_Bender2019()¶
-
virtual ~BoundaryModel_Bender2019()¶
-
void initModel(RigidBodyObject *rbo)¶
-
virtual void reset()¶
-
inline Discregrid::DiscreteGrid *getMap()¶
-
inline void setMap(Discregrid::DiscreteGrid *map)¶
- inline FORCE_INLINE const Real & getBoundaryVolume (const unsigned int fluidIndex, const unsigned int i) const
- inline FORCE_INLINE Real & getBoundaryVolume (const unsigned int fluidIndex, const unsigned int i)
- inline FORCE_INLINE void setBoundaryVolume (const unsigned int fluidIndex, const unsigned int i, const Real &val)
- inline FORCE_INLINE Vector3r & getBoundaryXj (const unsigned int fluidIndex, const unsigned int i)
- inline FORCE_INLINE const Vector3r & getBoundaryXj (const unsigned int fluidIndex, const unsigned int i) const
- inline FORCE_INLINE void setBoundaryXj (const unsigned int fluidIndex, const unsigned int i, const Vector3r &val)
Class BoundaryModel_Koschier2017¶
Defined in File BoundaryModel_Koschier2017.h
Inheritance Relationships¶
Base Type¶
public SPH::BoundaryModel
(Class BoundaryModel)
Class Documentation¶
-
class BoundaryModel_Koschier2017 : public SPH::BoundaryModel¶
The boundary model stores the information required for boundary handling using the approach of Koschier and Bender 2017 [KB17].
References:
[KB17] Dan Koschier and Jan Bender. Density maps for improved SPH boundary handling. In ACM SIGGRAPH/Eurographics Symposium on Computer Animation, 1-10. July 2017. URL: http://dx.doi.org/10.1145/3099564.3099565
Public Functions
-
BoundaryModel_Koschier2017()¶
-
virtual ~BoundaryModel_Koschier2017()¶
-
void initModel(RigidBodyObject *rbo)¶
-
virtual void reset()¶
-
inline Discregrid::DiscreteGrid *getMap()¶
-
inline void setMap(Discregrid::DiscreteGrid *map)¶
- inline FORCE_INLINE const Real & getBoundaryDensity (const unsigned int fluidIndex, const unsigned int i) const
- inline FORCE_INLINE Real & getBoundaryDensity (const unsigned int fluidIndex, const unsigned int i)
- inline FORCE_INLINE void setBoundaryDensity (const unsigned int fluidIndex, const unsigned int i, const Real &val)
- inline FORCE_INLINE Vector3r & getBoundaryDensityGradient (const unsigned int fluidIndex, const unsigned int i)
- inline FORCE_INLINE const Vector3r & getBoundaryDensityGradient (const unsigned int fluidIndex, const unsigned int i) const
- inline FORCE_INLINE void setBoundaryDensityGradient (const unsigned int fluidIndex, const unsigned int i, const Vector3r &val)
- inline FORCE_INLINE Vector3r & getBoundaryXj (const unsigned int fluidIndex, const unsigned int i)
- inline FORCE_INLINE const Vector3r & getBoundaryXj (const unsigned int fluidIndex, const unsigned int i) const
- inline FORCE_INLINE void setBoundaryXj (const unsigned int fluidIndex, const unsigned int i, const Vector3r &val)
Class CohesionKernel¶
Defined in File SPHKernels.h
Class Documentation¶
-
class CohesionKernel¶
Cohesion kernel used for the surface tension method of Akinci el al. [ATT13].
References:
[AAT13] Nadir Akinci, Gizem Akinci, and Matthias Teschner. Versatile surface tension and adhesion for sph fluids. ACM Trans. Graph., 32(6):182:1-182:8, November 2013. URL: http://doi.acm.org/10.1145/2508363.2508395
Class DebugTools¶
Defined in File DebugTools.h
Class Documentation¶
-
class DebugTools : public ParameterObject¶
Public Functions
-
DebugTools()¶
-
~DebugTools()¶
-
void init()¶
-
void cleanup()¶
-
void step()¶
-
void reset()¶
-
void performNeighborhoodSearchSort()¶
-
void emittedParticles(FluidModel *model, const unsigned int startIndex)¶
Public Static Attributes
-
static int DETERMINE_THREAD_IDS = -1¶
-
static int DETERMINE_NUM_NEIGHBORS = -1¶
-
static int DETERMINE_VELOCITY_CHANGES = -1¶
Protected Functions
-
virtual void initParameters()¶
-
void determineThreadIds()¶
-
void determineNumNeighbors()¶
-
void determineVelocityChanges()¶
-
DebugTools()¶
Class DragBase¶
Defined in File DragBase.h
Inheritance Relationships¶
Base Type¶
public SPH::NonPressureForceBase
(Class NonPressureForceBase)
Derived Types¶
public SPH::DragForce_Gissler2017
(Class DragForce_Gissler2017)public SPH::DragForce_Macklin2014
(Class DragForce_Macklin2014)
Class Documentation¶
-
class DragBase : public SPH::NonPressureForceBase¶
Base class for all drag force methods.
Subclassed by SPH::DragForce_Gissler2017, SPH::DragForce_Macklin2014
Public Static Attributes
-
static int DRAG_COEFFICIENT = -1¶
Protected Functions
-
virtual void initParameters()¶
-
static int DRAG_COEFFICIENT = -1¶
Class DragForce_Gissler2017¶
Defined in File DragForce_Gissler2017.h
Inheritance Relationships¶
Base Type¶
public SPH::DragBase
(Class DragBase)
Class Documentation¶
-
class DragForce_Gissler2017 : public SPH::DragBase¶
This class implements the drag force computation introduced by Gissler et al. [GBP+17].
References:
[GPB+17] Christoph Gissler, Stefan Band, Andreas Peer, Markus Ihmsen, and Matthias Teschner. Approximate air-fluid interactions for SPH. In Virtual Reality Interactions and Physical Simulations, 1-10. April 2017. URL: http://dx.doi.org/10.2312/vriphys.20171081
Public Functions
-
DragForce_Gissler2017(FluidModel *model)¶
-
virtual ~DragForce_Gissler2017(void)¶
-
virtual void step()¶
-
virtual void reset()¶
Public Static Functions
-
static inline NonPressureForceBase *creator(FluidModel *model)¶
Protected Attributes
Class DragForce_Macklin2014¶
Defined in File DragForce_Macklin2014.h
Inheritance Relationships¶
Base Type¶
public SPH::DragBase
(Class DragBase)
Class Documentation¶
-
class DragForce_Macklin2014 : public SPH::DragBase¶
This class implements the drag force computation introduced by Macklin et al. [MMCK14].
References:
[MMCK14] Miles Macklin, Matthias Müller, Nuttapong Chentanez, and Tae-Yong Kim. Unified Particle Physics for Real-Time Applications. ACM Trans. Graph., 33(4):1-12, 2014. URL: http://doi.acm.org/10.1145/2601097.2601152
Public Functions
-
DragForce_Macklin2014(FluidModel *model)¶
-
virtual ~DragForce_Macklin2014(void)¶
-
virtual void step()¶
-
virtual void reset()¶
Public Static Functions
-
static inline NonPressureForceBase *creator(FluidModel *model)¶
Class Elasticity_Becker2009¶
Defined in File Elasticity_Becker2009.h
Inheritance Relationships¶
Base Type¶
public SPH::ElasticityBase
(Class ElasticityBase)
Class Documentation¶
-
class Elasticity_Becker2009 : public SPH::ElasticityBase¶
This class implements the corotated SPH method for deformable solids introduced by Becker et al. [BIT09].
References:
[BIT09] Markus Becker, Markus Ihmsen, and Matthias Teschner. Corotated SPH for deformable solids. In Proceedings of Eurographics Conference on Natural Phenomena, 27-34. 2009. URL: http://dx.doi.org/10.2312EG/DL/conf/EG2009/nph/027-034
Public Functions
-
Elasticity_Becker2009(FluidModel *model)¶
-
virtual ~Elasticity_Becker2009(void)¶
-
virtual void step()¶
-
virtual void reset()¶
-
virtual void performNeighborhoodSearchSort()¶
-
virtual void saveState(BinaryFileWriter &binWriter)¶
-
virtual void loadState(BinaryFileReader &binReader)¶
Public Static Functions
-
static inline NonPressureForceBase *creator(FluidModel *model)¶
Public Static Attributes
-
static int ALPHA = -1¶
Protected Functions
-
void initValues()¶
-
void computeRotations()¶
-
void computeStress()¶
-
void computeForces()¶
-
virtual void initParameters()¶
- inline FORCE_INLINE void symMatTimesVec (const Vector6r &M, const Vector3r &v, Vector3r &res)
Class Elasticity_Kugelstadt2021¶
Defined in File Elasticity_Kugelstadt2021.h
Nested Relationships¶
Inheritance Relationships¶
Base Type¶
public SPH::ElasticityBase
(Class ElasticityBase)
Class Documentation¶
-
class Elasticity_Kugelstadt2021 : public SPH::ElasticityBase¶
This class implements the implicit SPH formulation for incompressible linearly elastic solids introduced by Kugelstadt et al. [KBF+21].
References:
[KBF+21] Tassilo Kugelstadt, Jan Bender, José Antonio Fernández-Fernández, Stefan Rhys Jeske, Fabian Löschner, Andreas Longva. Fast Corotated Elastic SPH Solids with Implicit Zero-Energy Mode Control. Proceedings of the ACM on Computer Graphics and Interactive Techniques, 2021. URL: http://dx.doi.org/10.1145/3480142
Public Functions
-
Elasticity_Kugelstadt2021(FluidModel *model)¶
-
virtual ~Elasticity_Kugelstadt2021(void)¶
-
virtual void step()¶
Perform a step of the elasticity solver.
-
virtual void reset()¶
-
virtual void performNeighborhoodSearchSort()¶
-
virtual void saveState(BinaryFileWriter &binWriter)¶
-
virtual void loadState(BinaryFileReader &binReader)¶
-
void computeRotations()¶
Extract rotation matrices from deformation gradients.
Public Static Functions
-
static inline NonPressureForceBase *creator(FluidModel *model)¶
Public Static Attributes
-
static int ITERATIONS_V = -1¶
-
static int MAX_ITERATIONS_V = -1¶
-
static int MAX_ERROR_V = -1¶
-
static int ALPHA = -1¶
-
static int MAX_NEIGHBORS = -1¶
Protected Types
-
typedef Eigen::SimplicialLLT<Eigen::SparseMatrix<double>, Eigen::Lower, Eigen::AMDOrdering<int>> SolverLLT¶
-
typedef Eigen::ConjugateGradient<MatrixReplacement, Eigen::Lower | Eigen::Upper, Eigen::IdentityPreconditioner> Solver¶
Protected Functions
-
void computeRHS(VectorXr &rhs)¶
Compute right hand side of the linear system of the volume solver (Eq. 30).
-
std::string computeMD5(const unsigned int objIndex)¶
Compute an MD4 check sum using the neighborhood structure in order to recognize known particle models (cache).
-
void initValues()¶
Initialize the particle neighborhoods in the reference configuration. Fix particles which lie in the user-defined bounding box. Find out if there are multiple separate objects in the phase. Finally, compute kernel gradient correction matrices and factorization.
-
void initSystem()¶
Initialize the solver for the linear system by either computing a factorization or loading a factorization from the cache.
Compute the factorization of the linear system matrix. This is only done once at the beginning of the simulation.
-
void findObjects()¶
Find separate objects by object id.
-
void computeMatrixL()¶
Compute kernel gradient correction matrices (Eq. 8).
-
void precomputeValues()¶
Precompute some values and products to improve the performance of the solvers.
-
void stepElasticitySolver()¶
Solve the linear system for the stretching forces including zero energy mode control using the precomputed matrix factorization.
-
void stepVolumeSolver()¶
Solver for the volume conservation forces (Eq. 30).
-
virtual void initParameters()¶
-
virtual 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.
- inline FORCE_INLINE void symMatTimesVec (const Vector6r &M, const Vector3r &v, Vector3r &res)
-
void rotationMatricesToAVXQuaternions()¶
Protected Attributes
-
std::vector<unsigned int> m_current_to_initial_index¶
-
std::vector<unsigned int> m_initial_to_current_index¶
-
std::vector<std::vector<unsigned int>> m_initialNeighbors¶
-
unsigned int m_iterationsV¶
-
unsigned int m_maxIterV¶
-
int m_maxNeighbors¶
-
unsigned int m_totalNeighbors¶
-
std::vector<ElasticObject*> m_objects¶
-
std::vector<unsigned int> m_precomputed_indices¶
-
struct ElasticObject¶
-
Public Members
-
std::string m_md5¶
-
std::vector<unsigned int> m_particleIndices¶
-
unsigned int m_nFixed¶
-
std::shared_ptr<Factorization> m_factorization¶
-
std::vector<Quaternionr, Eigen::aligned_allocator<Quaternionr>> m_quats¶
-
std::string m_md5¶
-
struct Factorization¶
Class Elasticity_Peer2018¶
Defined in File Elasticity_Peer2018.h
Inheritance Relationships¶
Base Type¶
public SPH::ElasticityBase
(Class ElasticityBase)
Class Documentation¶
-
class Elasticity_Peer2018 : public SPH::ElasticityBase¶
This class implements the implicit SPH formulation for incompressible linearly elastic solids introduced by Peer et al. [PGBT18].
References:
[PGBT18] Andreas Peer, Christoph Gissler, Stefan Band, and Matthias Teschner. An implicit SPH formulation for incompressible linearly elastic solids. Computer Graphics Forum, 2018. URL: http://dx.doi.org/10.1111/cgf.13317
Public Functions
-
Elasticity_Peer2018(FluidModel *model)¶
-
virtual ~Elasticity_Peer2018(void)¶
-
virtual void step()¶
-
virtual void reset()¶
-
virtual void performNeighborhoodSearchSort()¶
-
virtual void saveState(BinaryFileWriter &binWriter)¶
-
virtual void loadState(BinaryFileReader &binReader)¶
Public Static Functions
-
static inline NonPressureForceBase *creator(FluidModel *model)¶
Public Static Attributes
-
static int ITERATIONS = -1¶
-
static int MAX_ITERATIONS = -1¶
-
static int MAX_ERROR = -1¶
-
static int ALPHA = -1¶
Protected Types
-
typedef Eigen::ConjugateGradient<MatrixReplacement, Eigen::Lower | Eigen::Upper, Eigen::IdentityPreconditioner> Solver¶
Protected Functions
-
void initValues()¶
-
void computeMatrixL()¶
-
void computeRotations()¶
-
void computeRHS(VectorXr &rhs)¶
-
virtual void initParameters()¶
-
virtual 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.
- inline FORCE_INLINE void symMatTimesVec (const Vector6r &M, const Vector3r &v, Vector3r &res)
Class ElasticityBase¶
Defined in File ElasticityBase.h
Inheritance Relationships¶
Base Type¶
public SPH::NonPressureForceBase
(Class NonPressureForceBase)
Derived Types¶
public SPH::Elasticity_Becker2009
(Class Elasticity_Becker2009)public SPH::Elasticity_Kugelstadt2021
(Class Elasticity_Kugelstadt2021)public SPH::Elasticity_Peer2018
(Class Elasticity_Peer2018)
Class Documentation¶
-
class ElasticityBase : public SPH::NonPressureForceBase¶
Base class for all elasticity methods.
Subclassed by SPH::Elasticity_Becker2009, SPH::Elasticity_Kugelstadt2021, SPH::Elasticity_Peer2018
Public Static Attributes
-
static int YOUNGS_MODULUS = -1¶
-
static int POISSON_RATIO = -1¶
-
static int FIXED_BOX_MIN = -1¶
-
static int FIXED_BOX_MAX = -1¶
-
static int YOUNGS_MODULUS = -1¶
Class Emitter¶
Defined in File Emitter.h
Class Documentation¶
-
class Emitter¶
Public Functions
-
Emitter(FluidModel *model, const unsigned int width, const unsigned int height, const Vector3r &pos, const Matrix3r &rotation, const Real velocity, const unsigned int type = 0)¶
-
virtual ~Emitter()¶
-
void emitParticles(std::vector<unsigned int> &reusedParticles, unsigned int &indexReuse, unsigned int &numEmittedParticles)¶
-
void emitParticlesCircle(std::vector<unsigned int> &reusedParticles, unsigned int &indexReuse, unsigned int &numEmittedParticles)¶
-
void step(std::vector<unsigned int> &reusedParticles, unsigned int &indexReuse, unsigned int &numEmittedParticles)¶
-
virtual void reset()¶
-
void saveState(BinaryFileWriter &binWriter)¶
-
void loadState(BinaryFileReader &binReader)¶
-
inline const unsigned int getObjectId() const¶
-
inline void setObjectId(const unsigned int v)¶
Public Static Functions
Protected Functions
- inline FORCE_INLINE bool inBox (const Vector3r &x, const Vector3r &xBox, const Matrix3r &rotBox, const Vector3r &scaleBox)
- inline FORCE_INLINE bool inCylinder (const Vector3r &x, const Vector3r &xCyl, const Matrix3r &rotCyl, const Real h, const Real r2)
-
Emitter(FluidModel *model, const unsigned int width, const unsigned int height, const Vector3r &pos, const Matrix3r &rotation, const Real velocity, const unsigned int type = 0)¶
Class EmitterSystem¶
Defined in File EmitterSystem.h
Class Documentation¶
-
class EmitterSystem¶
Public Functions
-
EmitterSystem(FluidModel *model)¶
-
virtual ~EmitterSystem()¶
-
void enableReuseParticles(const Vector3r &boxMin = Vector3r(-1, -1, -1), const Vector3r &boxMax = Vector3r(1, 1, 1))¶
-
void disableReuseParticles()¶
-
void addEmitter(const unsigned int width, const unsigned int height, const Vector3r &pos, const Matrix3r &rotation, const Real velocity, const unsigned int type)¶
-
inline unsigned int numEmitters() const¶
-
inline unsigned int numReusedParticles() const¶
-
inline unsigned int numEmittedParticles() const¶
-
void step()¶
-
void reset()¶
-
void saveState(BinaryFileWriter &binWriter)¶
-
void loadState(BinaryFileReader &binReader)¶
Protected Functions
-
void reuseParticles()¶
Protected Attributes
-
FluidModel *m_model¶
-
bool m_reuseParticles¶
-
unsigned int m_numberOfEmittedParticles¶
-
unsigned int m_numReusedParticles¶
-
std::vector<unsigned int> m_reusedParticles¶
Protected Static Attributes
-
static const unsigned int m_maxParticlesToReusePerStep = 50000¶
-
EmitterSystem(FluidModel *model)¶
Class FluidModel¶
Defined in File FluidModel.h
Class Documentation¶
-
class FluidModel : public ParameterObject¶
The fluid model stores the particle and simulation information.
Public Functions
-
FluidModel()¶
-
FluidModel(const FluidModel&) = delete¶
-
FluidModel &operator=(const FluidModel&) = delete¶
-
virtual ~FluidModel()¶
-
void init()¶
-
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.
-
inline std::string getId() const¶
- inline FORCE_INLINE Real getDensity0 () const
-
inline unsigned int getPointSetIndex() const¶
-
void addField(const FieldDescription &field)¶
-
inline const std::vector<FieldDescription> &getFields()¶
-
inline const FieldDescription &getField(const unsigned int i)¶
-
const FieldDescription &getField(const std::string &name)¶
-
inline const unsigned int numberOfFields()¶
-
void removeFieldByName(const std::string &fieldName)¶
-
void setNumActiveParticles(const unsigned int num)¶
-
inline unsigned int numberOfParticles() const¶
-
inline EmitterSystem *getEmitterSystem()¶
-
virtual void reset()¶
-
void performNeighborhoodSearchSort()¶
-
void initModel(const std::string &id, const unsigned int nFluidParticles, Vector3r *fluidParticles, Vector3r *fluidVelocities, unsigned int *fluidObjectIds, const unsigned int nMaxEmitterParticles)¶
-
inline const unsigned int numParticles() const¶
-
unsigned int numActiveParticles() const¶
-
inline unsigned int getNumActiveParticles0() const¶
-
inline void setNumActiveParticles0(unsigned int val)¶
-
void emittedParticles(const unsigned int startIndex)¶
-
inline unsigned int getSurfaceTensionMethod() const¶
-
void setSurfaceTensionMethod(const std::string &val)¶
-
void setSurfaceTensionMethod(const unsigned int val)¶
-
inline unsigned int getViscosityMethod() const¶
-
void setViscosityMethod(const std::string &val)¶
-
void setViscosityMethod(const unsigned int val)¶
-
inline unsigned int getVorticityMethod() const¶
-
void setVorticityMethod(const std::string &val)¶
-
void setVorticityMethod(const unsigned int val)¶
-
inline unsigned int getDragMethod() const¶
-
void setDragMethod(const std::string &val)¶
-
void setDragMethod(const unsigned int val)¶
-
inline unsigned int getElasticityMethod() const¶
-
void setElasticityMethod(const std::string &val)¶
-
void setElasticityMethod(const unsigned int val)¶
-
inline SurfaceTensionBase *getSurfaceTensionBase()¶
-
inline ViscosityBase *getViscosityBase()¶
-
inline VorticityBase *getVorticityBase()¶
-
inline ElasticityBase *getElasticityBase()¶
-
void setDragMethodChangedCallback(std::function<void()> const &callBackFct)¶
-
void setSurfaceMethodChangedCallback(std::function<void()> const &callBackFct)¶
-
void setViscosityMethodChangedCallback(std::function<void()> const &callBackFct)¶
-
void setVorticityMethodChangedCallback(std::function<void()> const &callBackFct)¶
-
void setElasticityMethodChangedCallback(std::function<void()> const &callBackFct)¶
-
void computeSurfaceTension()¶
-
void computeViscosity()¶
-
void computeVorticity()¶
-
void computeDragForce()¶
-
void computeElasticity()¶
-
void computeXSPH()¶
-
void saveState(BinaryFileWriter &binWriter)¶
-
void loadState(BinaryFileReader &binReader)¶
- inline FORCE_INLINE Vector3r & getPosition0 (const unsigned int i)
- inline FORCE_INLINE const Vector3r & getPosition0 (const unsigned int i) const
- inline FORCE_INLINE void setPosition0 (const unsigned int i, const Vector3r &pos)
- inline FORCE_INLINE Vector3r & getPosition (const unsigned int i)
- inline FORCE_INLINE const Vector3r & getPosition (const unsigned int i) const
- inline FORCE_INLINE void setPosition (const unsigned int i, const Vector3r &pos)
- inline FORCE_INLINE Vector3r & getVelocity (const unsigned int i)
- inline FORCE_INLINE const Vector3r & getVelocity (const unsigned int i) const
- inline FORCE_INLINE void setVelocity (const unsigned int i, const Vector3r &vel)
- inline FORCE_INLINE Vector3r & getVelocity0 (const unsigned int i)
- inline FORCE_INLINE const Vector3r & getVelocity0 (const unsigned int i) const
- inline FORCE_INLINE void setVelocity0 (const unsigned int i, const Vector3r &vel)
- inline FORCE_INLINE Vector3r & getAcceleration (const unsigned int i)
- inline FORCE_INLINE const Vector3r & getAcceleration (const unsigned int i) const
- inline FORCE_INLINE void setAcceleration (const unsigned int i, const Vector3r &accel)
- inline FORCE_INLINE const Real getMass (const unsigned int i) const
- inline FORCE_INLINE Real & getMass (const unsigned int i)
- inline FORCE_INLINE void setMass (const unsigned int i, const Real mass)
- inline FORCE_INLINE const Real & getDensity (const unsigned int i) const
- inline FORCE_INLINE Real & getDensity (const unsigned int i)
- inline FORCE_INLINE void setDensity (const unsigned int i, const Real &val)
- inline FORCE_INLINE unsigned int & getParticleId (const unsigned int i)
- inline FORCE_INLINE const unsigned int & getParticleId (const unsigned int i) const
- inline FORCE_INLINE unsigned int & getObjectId (const unsigned int i)
- inline FORCE_INLINE const unsigned int & getObjectId (const unsigned int i) const
- inline FORCE_INLINE void setObjectId (const unsigned int i, const unsigned int val)
- inline FORCE_INLINE const ParticleState & getParticleState (const unsigned int i) const
- inline FORCE_INLINE ParticleState & getParticleState (const unsigned int i)
- inline FORCE_INLINE void setParticleState (const unsigned int i, const ParticleState &val)
- inline FORCE_INLINE const Real getVolume (const unsigned int i) const
- inline FORCE_INLINE Real & getVolume (const unsigned int i)
Public Static Attributes
-
static int NUM_PARTICLES = -1¶
-
static int NUM_REUSED_PARTICLES = -1¶
-
static int DENSITY0 = -1¶
-
static int DRAG_METHOD = -1¶
-
static int SURFACE_TENSION_METHOD = -1¶
-
static int VISCOSITY_METHOD = -1¶
-
static int VORTICITY_METHOD = -1¶
-
static int ELASTICITY_METHOD = -1¶
Protected Functions
-
virtual void initParameters()¶
-
void initMasses()¶
-
virtual void resizeFluidParticles(const unsigned int newSize)¶
Resize the arrays containing the particle data.
-
virtual void releaseFluidParticles()¶
Release the arrays containing the particle data.
Protected Attributes
-
std::string m_id¶
-
EmitterSystem *m_emitterSystem¶
-
std::vector<unsigned int> m_particleId¶
-
std::vector<unsigned int> m_objectId¶
-
std::vector<unsigned int> m_objectId0¶
-
std::vector<ParticleState> m_particleState¶
-
unsigned int m_surfaceTensionMethod¶
-
SurfaceTensionBase *m_surfaceTension¶
-
unsigned int m_viscosityMethod¶
-
ViscosityBase *m_viscosity¶
-
unsigned int m_vorticityMethod¶
-
VorticityBase *m_vorticity¶
-
unsigned int m_dragMethod¶
-
unsigned int m_elasticityMethod¶
-
ElasticityBase *m_elasticity¶
-
std::vector<FieldDescription> m_fields¶
-
std::function<void()> m_dragMethodChanged¶
-
std::function<void()> m_surfaceTensionMethodChanged¶
-
std::function<void()> m_viscosityMethodChanged¶
-
std::function<void()> m_vorticityMethodChanged¶
-
std::function<void()> m_elasticityMethodChanged¶
-
unsigned int m_pointSetIndex¶
-
unsigned int m_numActiveParticles¶
-
unsigned int m_numActiveParticles0¶
-
FluidModel()¶
Class JacobiPreconditioner1D¶
Defined in File MatrixFreeSolver.h
Class Documentation¶
-
class JacobiPreconditioner1D¶
Matrix-free Jacobi preconditioner
Public Types
-
typedef SystemMatrixType::StorageIndex StorageIndex¶
Public Functions
-
inline JacobiPreconditioner1D()¶
-
inline void init(const unsigned int dim, DiagonalMatrixElementFct fct, void *userData)¶
-
inline Eigen::Index rows() const¶
-
inline Eigen::Index cols() const¶
-
inline Eigen::ComputationInfo info()¶
-
template<typename MatType>
inline JacobiPreconditioner1D &analyzePattern(const MatType&)¶
-
template<typename MatType>
inline JacobiPreconditioner1D &factorize(const MatType &mat)¶
-
template<typename MatType>
inline JacobiPreconditioner1D &compute(const MatType &mat)¶
-
template<typename Rhs>
inline const Eigen::Solve<JacobiPreconditioner1D, Rhs> solve(const Eigen::MatrixBase<Rhs> &b) const¶
Protected Attributes
-
unsigned int m_dim¶
-
DiagonalMatrixElementFct m_diagonalElementFct¶
diagonal matrix element callback
-
void *m_userData¶
-
VectorXr m_invDiag¶
-
typedef SystemMatrixType::StorageIndex StorageIndex¶
Class JacobiPreconditioner3D¶
Defined in File MatrixFreeSolver.h
Class Documentation¶
-
class JacobiPreconditioner3D¶
Matrix-free Jacobi preconditioner
Public Types
-
typedef SystemMatrixType::StorageIndex StorageIndex¶
Public Functions
-
inline JacobiPreconditioner3D()¶
-
inline void init(const unsigned int dim, DiagonalMatrixElementFct fct, void *userData)¶
-
inline Eigen::Index rows() const¶
-
inline Eigen::Index cols() const¶
-
inline Eigen::ComputationInfo info()¶
-
template<typename MatType>
inline JacobiPreconditioner3D &analyzePattern(const MatType&)¶
-
template<typename MatType>
inline JacobiPreconditioner3D &factorize(const MatType &mat)¶
-
template<typename MatType>
inline JacobiPreconditioner3D &compute(const MatType &mat)¶
-
template<typename Rhs>
inline const Eigen::Solve<JacobiPreconditioner3D, Rhs> solve(const Eigen::MatrixBase<Rhs> &b) const¶
Protected Attributes
-
unsigned int m_dim¶
-
DiagonalMatrixElementFct m_diagonalElementFct¶
diagonal matrix element callback
-
void *m_userData¶
-
VectorXr m_invDiag¶
-
typedef SystemMatrixType::StorageIndex StorageIndex¶
Class MathFunctions¶
Defined in File MathFunctions.h
Class Documentation¶
-
class MathFunctions¶
Public Static Functions
-
static void extractRotation(const Matrix3r &A, Quaternionr &q, const unsigned int maxIter)¶
Implementation of the paper:
Matthias Müller, Jan Bender, Nuttapong Chentanez and Miles Macklin, “A Robust Method to Extract the Rotational Part of Deformations”, ACM SIGGRAPH Motion in Games, 2016
-
static void svdWithInversionHandling(const Matrix3r &A, Vector3r &sigma, Matrix3r &U, Matrix3r &VT)¶
Perform a singular value decomposition of matrix A: A = U * sigma * V^T. This function returns two proper rotation matrices U and V^T which do not contain a reflection. Reflections are corrected by the inversion handling proposed by Irving et al. 2004.
-
static void getOrthogonalVectors(const Vector3r &vec, Vector3r &x, Vector3r &y)¶
Returns two orthogonal vectors to vec which are also orthogonal to each other.
-
static void APD_Newton(const Matrix3r &F, Quaternionr &q)¶
computes the APD of 8 deformation gradients. (Alg. 3 from the paper: Kugelstadt et al. “Fast Corotated FEM using Operator Splitting”, CGF 2018)
-
static void extractRotation(const Matrix3r &A, Quaternionr &q, const unsigned int maxIter)¶
Class MathFunctions_AVX¶
Defined in File AVX_math.h
Class Documentation¶
-
class MathFunctions_AVX¶
Public Static Functions
-
static inline void APD_Newton_AVX(const Vector3f8 &F1, const Vector3f8 &F2, const Vector3f8 &F3, Quaternion8f &q)¶
computes the APD of 8 deformation gradients. (Alg. 3 from the paper: Kugelstadt et al. “Fast Corotated FEM using Operator Splitting”, CGF 2018)
-
static inline void APD_Newton_AVX(const Vector3f8 &F1, const Vector3f8 &F2, const Vector3f8 &F3, Quaternion8f &q)¶
Class MatrixReplacement¶
Defined in File MatrixFreeSolver.h
Class Documentation¶
-
class MatrixReplacement : public Eigen::EigenBase<MatrixReplacement>¶
Replacement of the matrix in the linear system which is required for a matrix-free solver.
Public Types
-
enum [anonymous]¶
Values:
-
enumerator ColsAtCompileTime¶
-
enumerator MaxColsAtCompileTime¶
-
enumerator IsRowMajor¶
-
enumerator ColsAtCompileTime¶
-
typedef int StorageIndex¶
Public Functions
-
inline Index rows() const¶
-
inline Index cols() const¶
-
template<typename Rhs>
inline Eigen::Product<MatrixReplacement, Rhs, Eigen::AliasFreeProduct> operator*(const Eigen::MatrixBase<Rhs> &x) const¶
-
inline MatrixReplacement(const unsigned int dim, MatrixVecProdFct fct, void *userData)¶
-
inline void *getUserData()¶
-
inline MatrixVecProdFct getMatrixVecProdFct()¶
Protected Attributes
-
unsigned int m_dim¶
-
void *m_userData¶
-
MatrixVecProdFct m_matrixVecProdFct¶
matrix vector product callback
-
enum [anonymous]¶
Class MicropolarModel_Bender2017¶
Defined in File MicropolarModel_Bender2017.h
Inheritance Relationships¶
Base Type¶
public SPH::VorticityBase
(Class VorticityBase)
Class Documentation¶
-
class MicropolarModel_Bender2017 : public SPH::VorticityBase¶
This class implements the micropolar material model introduced by Bender et al. [BKKW17].
References:
[BKKW17] Jan Bender, Dan Koschier, Tassilo Kugelstadt, and Marcel Weiler. A micropolar material model for turbulent SPH fluids. In ACM SIGGRAPH / Eurographics Symposium on Computer Animation, SCA ‘17. ACM, 2017. URL: http://doi.acm.org/10.1145/3099564.3099578
Public Functions
-
MicropolarModel_Bender2017(FluidModel *model)¶
-
virtual ~MicropolarModel_Bender2017(void)¶
-
virtual void step()¶
-
virtual void reset()¶
-
virtual void performNeighborhoodSearchSort()¶
- inline FORCE_INLINE const Vector3r & getAngularAcceleration (const unsigned int i) const
- inline FORCE_INLINE Vector3r & getAngularAcceleration (const unsigned int i)
- inline FORCE_INLINE void setAngularAcceleration (const unsigned int i, const Vector3r &val)
- inline FORCE_INLINE const Vector3r & getAngularVelocity (const unsigned int i) const
- inline FORCE_INLINE Vector3r & getAngularVelocity (const unsigned int i)
- inline FORCE_INLINE void setAngularVelocity (const unsigned int i, const Vector3r &val)
Public Static Functions
-
static inline NonPressureForceBase *creator(FluidModel *model)¶
Protected Functions
-
virtual void initParameters()¶
Class NonPressureForceBase¶
Defined in File NonPressureForceBase.h
Inheritance Relationships¶
Base Type¶
public ParameterObject
Derived Types¶
public SPH::DragBase
(Class DragBase)public SPH::ElasticityBase
(Class ElasticityBase)public SPH::SurfaceTensionBase
(Class SurfaceTensionBase)public SPH::ViscosityBase
(Class ViscosityBase)public SPH::VorticityBase
(Class VorticityBase)public SPH::XSPH
(Class XSPH)
Class Documentation¶
-
class NonPressureForceBase : public ParameterObject¶
Base class for all non-pressure force methods.
Subclassed by SPH::DragBase, SPH::ElasticityBase, SPH::SurfaceTensionBase, SPH::ViscosityBase, SPH::VorticityBase, SPH::XSPH
Public Functions
-
NonPressureForceBase(FluidModel *model)¶
-
NonPressureForceBase(const NonPressureForceBase&) = delete¶
-
NonPressureForceBase &operator=(const NonPressureForceBase&) = delete¶
-
virtual ~NonPressureForceBase(void)¶
-
virtual void step() = 0¶
-
inline virtual void reset()¶
-
inline virtual void performNeighborhoodSearchSort()¶
-
inline virtual void emittedParticles(const unsigned int startIndex)¶
-
inline virtual void saveState(BinaryFileWriter &binWriter)¶
-
inline virtual void loadState(BinaryFileReader &binReader)¶
-
inline FluidModel *getModel()¶
-
virtual void init()¶
-
inline virtual 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.
Protected Attributes
-
FluidModel *m_model¶
-
NonPressureForceBase(FluidModel *model)¶
Class PoissonDiskSampling¶
Defined in File PoissonDiskSampling.h
Nested Relationships¶
Class Documentation¶
-
class PoissonDiskSampling¶
This class implements a Poisson disk sampling for the surface of 3D models.
Public Functions
-
PoissonDiskSampling()¶
-
void sampleMesh(const unsigned int numVertices, const Vector3r *vertices, const unsigned int numFaces, const unsigned int *faces, const Real minRadius, const unsigned int numTrials, unsigned int distanceNorm, std::vector<Vector3r> &samples)¶
Performs the poisson sampling with the respective parameters. Compare http://graphics.cs.umass.edu/pubs/sa_2010.pdf
- Parameters
mesh – mesh data of sampled body
vertices – vertex data of sampled data
sampledVertices – sampled vertices that will be returned
minRadius – minimal distance of sampled vertices
numTestpointsPerFace – # of generated test points per face of body
distanceNorm – 0: euclidean norm, 1: approx geodesic distance
numTrials – # of iterations used to find samples
Public Static Functions
- static inline FORCE_INLINE int floor (const Real v)
-
struct HashEntry¶
Struct to store the hash entry (spatial hashing)
Public Functions
-
inline HashEntry()¶
-
inline HashEntry()¶
-
struct InitialPointInfo¶
Struct to store the information of the initial points.
-
PoissonDiskSampling()¶
Class Poly6Kernel¶
Defined in File SPHKernels.h
Class Documentation¶
-
class Poly6Kernel¶
Poly6 kernel.
Public Static Functions
-
static inline Real W(const Real r)¶
W(r,h) = (315/(64 pi h^9))(h^2-|r|^2)^3 = (315/(64 pi h^9))(h^2-r*r)^3
-
static inline Vector3r gradW(const Vector3r &r)¶
grad(W(r,h)) = r(-945/(32 pi h^9))(h^2-|r|^2)^2 = r(-945/(32 pi h^9))(h^2-r*r)^2
-
static inline Real W(const Real r)¶
Template Class PrecomputedKernel¶
Defined in File SPHKernels.h
Class Documentation¶
-
template<typename KernelType, unsigned int resolution = 10000u>
class PrecomputedKernel¶ Precomputed kernel which is based on a lookup table as described by Bender and Koschier [BK15,BK17].
The lookup tables can be used in combination with any kernel.
References:
[BK15] Jan Bender and Dan Koschier. Divergence-free smoothed particle hydrodynamics. In ACM SIGGRAPH / Eurographics Symposium on Computer Animation, SCA ‘15, 147-155. New York, NY, USA, 2015. ACM. URL: http://doi.acm.org/10.1145/2786784.2786796
[BK17] Jan Bender and Dan Koschier. Divergence-free SPH for incompressible and viscous fluids. IEEE Transactions on Visualization and Computer Graphics, 23(3):1193-1206, 2017. URL: http://dx.doi.org/10.1109/TVCG.2016.2578335
Public Static Functions
Class RegularSampling2D¶
Defined in File RegularSampling2D.h
Class Documentation¶
-
class RegularSampling2D¶
This class implements a per-triangle regular sampling for the surface of 3D models.
Public Functions
-
RegularSampling2D()¶
Public Static Functions
-
static void sampleMesh(const Matrix3r &rotation, const Vector3r &translation, const unsigned numVertices, const Vector3r *vertices, const unsigned int numFaces, const unsigned int *faces, const Real maxDistance, std::vector<Vector3r> &samples)¶
Performs the poisson sampling with the respective parameters. Compare http://graphics.cs.umass.edu/pubs/sa_2010.pdf
- Parameters
rotation – rotation of the mesh
translation – translation of the mesh
numVertices – number of mesh vertices
vertices – vertex data of sampled data
numFaces – number of faces in the mesh
faces – face data of sampled mesh
maxDistance – maximal distance of sampled vertices
samples – vector to store the samples
-
RegularSampling2D()¶
Class RegularTriangleSampling¶
Defined in File RegularTriangleSampling.h
Class Documentation¶
-
class RegularTriangleSampling¶
This class implements a per-triangle regular sampling for the surface of 3D models.
Public Functions
-
RegularTriangleSampling()¶
Public Static Functions
-
static void sampleMesh(const unsigned int numVertices, const Vector3r *vertices, const unsigned int numFaces, const unsigned int *faces, const Real maxDistance, std::vector<Vector3r> &samples)¶
Performs the poisson sampling with the respective parameters. Compare http://graphics.cs.umass.edu/pubs/sa_2010.pdf
- Parameters
numVertices – number of mesh vertices
vertices – vertex data of sampled data
numFaces – number of faces in the mesh
faces – face data of sampled mesh
maxDistance – maximal distance of sampled vertices
samples – vector to store the samples
-
RegularTriangleSampling()¶
Class RigidBodyObject¶
Defined in File RigidBodyObject.h
Inheritance Relationships¶
Derived Type¶
public SPH::StaticRigidBody
(Class StaticRigidBody)
Class Documentation¶
-
class RigidBodyObject¶
Base class for rigid body objects.
Subclassed by SPH::StaticRigidBody
Public Functions
-
inline RigidBodyObject()¶
-
inline virtual ~RigidBodyObject()¶
-
virtual bool isDynamic() const = 0¶
-
inline bool isAnimated() const¶
-
inline virtual void setIsAnimated(const bool b)¶
-
virtual Quaternionr const &getRotation() const = 0¶
-
virtual void setRotation(const Quaternionr &q) = 0¶
-
virtual void updateMeshTransformation() = 0¶
-
virtual const std::vector<unsigned int> &getFaces() const = 0¶
Protected Attributes
-
bool m_isAnimated¶
-
inline RigidBodyObject()¶
Class SimpleQuadrature¶
Defined in File SimpleQuadrature.h
Class Documentation¶
Class Simulation¶
Defined in File Simulation.h
Nested Relationships¶
Class Documentation¶
-
class 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 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, unsigned int *fluidObjectIds, 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 bool is2DSimulation()¶
-
inline bool zSortEnabled()¶
-
void initKernels()¶
-
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()¶
-
inline void setCachePath(const std::string &cachePath)¶
-
inline const std::string &getCachePath() const¶
-
inline void setUseCache(const bool useCache)¶
-
inline const bool getUseCache() const¶
-
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 Attributes
-
std::vector<FluidModel*> m_fluidModels¶
-
std::vector<BoundaryModel*> m_boundaryModels¶
-
NeighborhoodSearch *m_neighborhoodSearch¶
-
AnimationFieldSystem *m_animationFieldSystem¶
-
int m_cflMethod¶
-
int m_kernelMethod¶
-
int m_gradKernelMethod¶
-
SimulationMethods m_simulationMethod¶
-
bool m_sim2D¶
-
bool m_enableZSort¶
-
std::function<void()> m_simulationMethodChanged¶
-
int m_boundaryHandlingMethod¶
-
std::string m_cachePath¶
-
bool m_useCache¶
-
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 FluidInfo¶
Fluid object information
-
struct NonPressureForceMethod¶
Public Members
-
std::string m_name¶
-
std::function<NonPressureForceBase*(FluidModel*)> m_creator¶
-
int m_id¶
-
std::string m_name¶
-
typedef PrecomputedKernel<CubicKernel, 10000> PrecomputedCubicKernel¶
Class SimulationDataDFSPH¶
Defined in File SimulationDataDFSPH.h
Class Documentation¶
-
class SimulationDataDFSPH¶
Simulation data which is required by the method Divergence-free Smoothed Particle Hydrodynamics introduced by Bender and Koschier [BK15,BK17].
References:
[BK15] Jan Bender and Dan Koschier. Divergence-free smoothed particle hydrodynamics. In ACM SIGGRAPH / Eurographics Symposium on Computer Animation, SCA ‘15, 147-155. New York, NY, USA, 2015. ACM. URL: http://doi.acm.org/10.1145/2786784.2786796
[BK17] Jan Bender and Dan Koschier. Divergence-free SPH for incompressible and viscous fluids. IEEE Transactions on Visualization and Computer Graphics, 23(3):1193-1206, 2017. URL: http://dx.doi.org/10.1109/TVCG.2016.2578335
Public Functions
-
SimulationDataDFSPH()¶
-
virtual ~SimulationDataDFSPH()¶
-
virtual void init()¶
Initialize the arrays containing the particle data.
-
virtual void cleanup()¶
Release the arrays containing the particle data.
-
virtual void reset()¶
Reset the particle data.
-
void performNeighborhoodSearchSort()¶
Important: First call m_model->performNeighborhoodSearchSort() to call the z_sort of the neighborhood search.
-
void emittedParticles(FluidModel *model, const unsigned int startIndex)¶
- inline FORCE_INLINE const Real getFactor (const unsigned int fluidIndex, const unsigned int i) const
- inline FORCE_INLINE Real & getFactor (const unsigned int fluidIndex, const unsigned int i)
- inline FORCE_INLINE void setFactor (const unsigned int fluidIndex, const unsigned int i, const Real p)
- inline FORCE_INLINE const Real getDensityAdv (const unsigned int fluidIndex, const unsigned int i) const
- inline FORCE_INLINE Real & getDensityAdv (const unsigned int fluidIndex, const unsigned int i)
- inline FORCE_INLINE void setDensityAdv (const unsigned int fluidIndex, const unsigned int i, const Real d)
- inline FORCE_INLINE const Real getPressureRho2 (const unsigned int fluidIndex, const unsigned int i) const
- inline FORCE_INLINE Real & getPressureRho2 (const unsigned int fluidIndex, const unsigned int i)
- inline FORCE_INLINE void setPressureRho2 (const unsigned int fluidIndex, const unsigned int i, const Real p)
- inline FORCE_INLINE const Real getPressureRho2_V (const unsigned int fluidIndex, const unsigned int i) const
- inline FORCE_INLINE Real & getPressureRho2_V (const unsigned int fluidIndex, const unsigned int i)
- inline FORCE_INLINE void setPressureRho2_V (const unsigned int fluidIndex, const unsigned int i, const Real p)
- inline FORCE_INLINE Vector3r & getPressureAccel (const unsigned int fluidIndex, const unsigned int i)
- inline FORCE_INLINE const Vector3r & getPressureAccel (const unsigned int fluidIndex, const unsigned int i) const
- inline FORCE_INLINE void setPressureAccel (const unsigned int fluidIndex, const unsigned int i, const Vector3r &val)
Class SimulationDataICSPH¶
Defined in File SimulationDataICSPH.h
Class Documentation¶
-
class SimulationDataICSPH¶
Simulation data which is required by the method Implicit Compressible SPH introduced by Gissler et al. [GHB+20].
References:
[GHB+20] Christoph Gissler, Andreas Henne, Stefan Band, Andreas Peer and Matthias Teschner. An Implicit Compressible SPH Solver for Snow Simulation. ACM Transactions on Graphics, 39(4). URL: https://doi.org/10.1145/3386569.3392431
Public Functions
-
SimulationDataICSPH()¶
-
virtual ~SimulationDataICSPH()¶
-
virtual void init()¶
Initialize the arrays containing the particle data.
-
virtual void cleanup()¶
Release the arrays containing the particle data.
-
virtual void reset()¶
Reset the particle data.
-
void performNeighborhoodSearchSort()¶
Important: First call m_model->performNeighborhoodSearchSort() to call the z_sort of the neighborhood search.
-
void emittedParticles(FluidModel *model, const unsigned int startIndex)¶
- inline FORCE_INLINE const Real getAii (const unsigned int fluidIndex, const unsigned int i) const
- inline FORCE_INLINE Real & getAii (const unsigned int fluidIndex, const unsigned int i)
- inline FORCE_INLINE void setAii (const unsigned int fluidIndex, const unsigned int i, const Real aii)
- inline FORCE_INLINE const Real getDensityAdv (const unsigned int fluidIndex, const unsigned int i) const
- inline FORCE_INLINE Real & getDensityAdv (const unsigned int fluidIndex, const unsigned int i)
- inline FORCE_INLINE void setDensityAdv (const unsigned int fluidIndex, const unsigned int i, const Real d)
- inline FORCE_INLINE const Real getPressure (const unsigned int fluidIndex, const unsigned int i) const
- inline FORCE_INLINE Real & getPressure (const unsigned int fluidIndex, const unsigned int i)
- inline FORCE_INLINE void setPressure (const unsigned int fluidIndex, const unsigned int i, const Real p)
- inline FORCE_INLINE Vector3r & getPressureAccel (const unsigned int fluidIndex, const unsigned int i)
- inline FORCE_INLINE const Vector3r & getPressureAccel (const unsigned int fluidIndex, const unsigned int i) const
- inline FORCE_INLINE void setPressureAccel (const unsigned int fluidIndex, const unsigned int i, const Vector3r &val)
- inline FORCE_INLINE Vector3r & getPressureGradient (const unsigned int fluidIndex, const unsigned int i)
- inline FORCE_INLINE const Vector3r & getPressureGradient (const unsigned int fluidIndex, const unsigned int i) const
- inline FORCE_INLINE void setPressureGradient (const unsigned int fluidIndex, const unsigned int i, const Vector3r &val)
Class SimulationDataIISPH¶
Defined in File SimulationDataIISPH.h
Class Documentation¶
-
class SimulationDataIISPH¶
Simulation data which is required by the method Implicit Incompressible SPH introduced by Ihmsen et al. [ICS+14].
References:
[ICS+14] Markus Ihmsen, Jens Cornelis, Barbara Solenthaler, Christopher Horvath, and Matthias Teschner. Implicit incompressible SPH. IEEE Transactions on Visualization and Computer Graphics, 20(3):426-435, March 2014. URL: http://dx.doi.org/10.1109/TVCG.2013.105
Public Functions
-
SimulationDataIISPH()¶
-
virtual ~SimulationDataIISPH()¶
-
virtual void init()¶
Initialize the arrays containing the particle data.
-
virtual void cleanup()¶
Release the arrays containing the particle data.
-
virtual void reset()¶
Reset the particle data.
-
void performNeighborhoodSearchSort()¶
Important: First call m_model->performNeighborhoodSearchSort() to call the z_sort of the neighborhood search.
-
void emittedParticles(FluidModel *model, const unsigned int startIndex)¶
- inline FORCE_INLINE const Real getAii (const unsigned int fluidIndex, const unsigned int i) const
- inline FORCE_INLINE Real & getAii (const unsigned int fluidIndex, const unsigned int i)
- inline FORCE_INLINE void setAii (const unsigned int fluidIndex, const unsigned int i, const Real aii)
- inline FORCE_INLINE Vector3r & getDii (const unsigned int fluidIndex, const unsigned int i)
- inline FORCE_INLINE const Vector3r & getDii (const unsigned int fluidIndex, const unsigned int i) const
- inline FORCE_INLINE void setDii (const unsigned int fluidIndex, const unsigned int i, const Vector3r &val)
- inline FORCE_INLINE Vector3r & getDij_pj (const unsigned int fluidIndex, const unsigned int i)
- inline FORCE_INLINE const Vector3r & getDij_pj (const unsigned int fluidIndex, const unsigned int i) const
- inline FORCE_INLINE void setDij_pj (const unsigned int fluidIndex, const unsigned int i, const Vector3r &val)
- inline FORCE_INLINE const Real getDensityAdv (const unsigned int fluidIndex, const unsigned int i) const
- inline FORCE_INLINE Real & getDensityAdv (const unsigned int fluidIndex, const unsigned int i)
- inline FORCE_INLINE void setDensityAdv (const unsigned int fluidIndex, const unsigned int i, const Real d)
- inline FORCE_INLINE const Real getPressure (const unsigned int fluidIndex, const unsigned int i) const
- inline FORCE_INLINE Real & getPressure (const unsigned int fluidIndex, const unsigned int i)
- inline FORCE_INLINE void setPressure (const unsigned int fluidIndex, const unsigned int i, const Real p)
- inline FORCE_INLINE const Real getLastPressure (const unsigned int fluidIndex, const unsigned int i) const
- inline FORCE_INLINE Real & getLastPressure (const unsigned int fluidIndex, const unsigned int i)
- inline FORCE_INLINE void setLastPressure (const unsigned int fluidIndex, const unsigned int i, const Real p)
- inline FORCE_INLINE Vector3r & getPressureAccel (const unsigned int fluidIndex, const unsigned int i)
- inline FORCE_INLINE const Vector3r & getPressureAccel (const unsigned int fluidIndex, const unsigned int i) const
- inline FORCE_INLINE void setPressureAccel (const unsigned int fluidIndex, const unsigned int i, const Vector3r &val)
Protected Attributes
Class SimulationDataPBF¶
Defined in File SimulationDataPBF.h
Class Documentation¶
-
class SimulationDataPBF¶
Simulation data which is required by the method Position-Based Fluids introduced by Macklin and Mueller [MM13,BMO+14,BMM15].
References:
[MM13] Miles Macklin and Matthias Müller. Position based fluids. ACM Trans. Graph., 32(4):104:1-104:12, July 2013. URL: http://doi.acm.org/10.1145/2461912.2461984
[BMO+14] Jan Bender, Matthias Müller, Miguel A. Otaduy, Matthias Teschner, and Miles Macklin. A survey on position-based simulation methods in computer graphics. Computer Graphics Forum, 33(6):228-251, 2014. URL: http://dx.doi.org/10.1111/cgf.12346
[BMM15] Jan Bender, Matthias Müller, and Miles Macklin. Position-based simulation methods in computer graphics. In EUROGRAPHICS 2015 Tutorials. Eurographics Association, 2015. URL: http://dx.doi.org/10.2312/egt.20151045
Public Functions
-
SimulationDataPBF()¶
-
virtual ~SimulationDataPBF()¶
-
virtual void init()¶
Initialize the arrays containing the particle data.
-
virtual void cleanup()¶
Release the arrays containing the particle data.
-
virtual void reset()¶
Reset the particle data.
-
void performNeighborhoodSearchSort()¶
Important: First call m_model->performNeighborhoodSearchSort() to call the z_sort of the neighborhood search.
-
void emittedParticles(FluidModel *model, const unsigned int startIndex)¶
- inline FORCE_INLINE const Real & getLambda (const unsigned int fluidIndex, const unsigned int i) const
- inline FORCE_INLINE Real & getLambda (const unsigned int fluidIndex, const unsigned int i)
- inline FORCE_INLINE void setLambda (const unsigned int fluidIndex, const unsigned int i, const Real &val)
- inline FORCE_INLINE Vector3r & getDeltaX (const unsigned int fluidIndex, const unsigned int i)
- inline FORCE_INLINE const Vector3r & getDeltaX (const unsigned int fluidIndex, const unsigned int i) const
- inline FORCE_INLINE void setDeltaX (const unsigned int fluidIndex, const unsigned int i, const Vector3r &val)
- inline FORCE_INLINE Vector3r & getLastPosition (const unsigned int fluidIndex, const unsigned int i)
- inline FORCE_INLINE const Vector3r & getLastPosition (const unsigned int fluidIndex, const unsigned int i) const
- inline FORCE_INLINE void setLastPosition (const unsigned int fluidIndex, const unsigned int i, const Vector3r &pos)
- inline FORCE_INLINE Vector3r & getOldPosition (const unsigned int fluidIndex, const unsigned int i)
- inline FORCE_INLINE const Vector3r & getOldPosition (const unsigned int fluidIndex, const unsigned int i) const
- inline FORCE_INLINE void setOldPosition (const unsigned int fluidIndex, const unsigned int i, const Vector3r &pos)
Class SimulationDataPCISPH¶
Defined in File SimulationDataPCISPH.h
Class Documentation¶
-
class SimulationDataPCISPH¶
Simulation data which is required by the method Predictive-corrective Incompressible SPH introduced by Solenthaler and Pajarola [SP09].
References:
[SP09] B. Solenthaler and R. Pajarola. Predictive-corrective incompressible SPH. ACM Trans. Graph., 28(3):40:1-40:6, July 2009. URL: http://doi.acm.org/10.1145/1531326.1531346
Public Functions
-
SimulationDataPCISPH()¶
-
virtual ~SimulationDataPCISPH()¶
-
virtual void init()¶
Initialize the arrays containing the particle data.
-
virtual void cleanup()¶
Release the arrays containing the particle data.
-
virtual void reset()¶
Reset the particle data.
-
void performNeighborhoodSearchSort()¶
Important: First call m_model->performNeighborhoodSearchSort() to call the z_sort of the neighborhood search.
-
void emittedParticles(FluidModel *model, const unsigned int startIndex)¶
- inline FORCE_INLINE Vector3r & getPredictedPosition (const unsigned int fluidIndex, const unsigned int i)
- inline FORCE_INLINE const Vector3r & getPredictedPosition (const unsigned int fluidIndex, const unsigned int i) const
- inline FORCE_INLINE void setPredictedPosition (const unsigned int fluidIndex, const unsigned int i, const Vector3r &pos)
- inline FORCE_INLINE Vector3r & getPredictedVelocity (const unsigned int fluidIndex, const unsigned int i)
- inline FORCE_INLINE const Vector3r & getPredictedVelocity (const unsigned int fluidIndex, const unsigned int i) const
- inline FORCE_INLINE void setPredictedVelocity (const unsigned int fluidIndex, const unsigned int i, const Vector3r &vel)
- inline FORCE_INLINE const Real getDensityAdv (const unsigned int fluidIndex, const unsigned int i) const
- inline FORCE_INLINE Real & getDensityAdv (const unsigned int fluidIndex, const unsigned int i)
- inline FORCE_INLINE void setDensityAdv (const unsigned int fluidIndex, const unsigned int i, const Real d)
- inline FORCE_INLINE const Real getPressure (const unsigned int fluidIndex, const unsigned int i) const
- inline FORCE_INLINE Real & getPressure (const unsigned int fluidIndex, const unsigned int i)
- inline FORCE_INLINE void setPressure (const unsigned int fluidIndex, const unsigned int i, const Real p)
- inline FORCE_INLINE Vector3r & getPressureAccel (const unsigned int fluidIndex, const unsigned int i)
- inline FORCE_INLINE const Vector3r & getPressureAccel (const unsigned int fluidIndex, const unsigned int i) const
- inline FORCE_INLINE void setPressureAccel (const unsigned int fluidIndex, const unsigned int i, const Vector3r &val)
Class SimulationDataPF¶
Defined in File SimulationDataPF.h
Class Documentation¶
-
class SimulationDataPF¶
Simulation data which is required by the method Projective Fluids introduced by Weiler, Koschier and Bender [WKB16].
References:
[WKB16] Marcel Weiler, Dan Koschier, and Jan Bender. Projective fluids. In Proceedings of the 9th International Conference on Motion in Games, MIG ‘16, 79-84. New York, NY, USA, 2016. ACM. URL: http://doi.acm.org/10.1145/2994258.2994282
Public Functions
-
SimulationDataPF()¶
-
virtual ~SimulationDataPF()¶
-
virtual void init()¶
Initialize the arrays containing the particle data.
-
virtual void cleanup()¶
Release the arrays containing the particle data.
-
virtual void reset()¶
Reset the particle data.
-
void performNeighborhoodSearchSort()¶
Important: First call m_model->performNeighborhoodSearchSort() to call the z_sort of the neighborhood search.
-
void emittedParticles(FluidModel *model, const unsigned int startIndex)¶
- inline FORCE_INLINE const Vector3r getOldPosition (const unsigned int fluidIndex, const unsigned int i) const
- inline FORCE_INLINE Vector3r & getOldPosition (const unsigned int fluidIndex, const unsigned int i)
- inline FORCE_INLINE void setOldPosition (const unsigned int fluidIndex, const unsigned int i, const Vector3r p)
- inline FORCE_INLINE const unsigned int getNumFluidNeighbors (const unsigned int fluidIndex, const unsigned int i) const
- inline FORCE_INLINE unsigned int & getNumFluidNeighbors (const unsigned int fluidIndex, const unsigned int i)
- inline FORCE_INLINE void setNumFluidNeighbors (const unsigned int fluidIndex, const unsigned int i, const unsigned int n)
- inline FORCE_INLINE const Vector3r & getS (const unsigned int fluidIndex, const unsigned int i) const
- inline FORCE_INLINE Vector3r & getS (const unsigned int fluidIndex, const unsigned int i)
- inline FORCE_INLINE void setS (const unsigned int fluidIndex, const unsigned int i, const Vector3r &s)
- inline FORCE_INLINE const Vector3r & getDiag (const unsigned int fluidIndex, const unsigned int i) const
- inline FORCE_INLINE Vector3r & getDiag (const unsigned int fluidIndex, const unsigned int i)
- inline FORCE_INLINE void setDiag (const unsigned int fluidIndex, const unsigned int i, const Vector3r &s)
- inline FORCE_INLINE const unsigned int & getParticleOffset (const unsigned int fluidIndex) const
Class SimulationDataWCSPH¶
Defined in File SimulationDataWCSPH.h
Class Documentation¶
-
class SimulationDataWCSPH¶
Simulation data which is required by the method Weakly Compressible SPH for Free Surface Flows introduced by Becker and Teschner [BT07].
References:
[BT07] Markus Becker and Matthias Teschner. Weakly compressible SPH for free surface flows. In ACM SIGGRAPH/Eurographics Symposium on Computer Animation, SCA ‘07, 209-217. Aire-la-Ville, Switzerland, Switzerland, 2007. Eurographics Association. URL: http://dl.acm.org/citation.cfm?id=1272690.1272719
Public Functions
-
SimulationDataWCSPH()¶
-
virtual ~SimulationDataWCSPH()¶
-
virtual void init()¶
Initialize the arrays containing the particle data.
-
virtual void cleanup()¶
Release the arrays containing the particle data.
-
virtual void reset()¶
Reset the particle data.
-
void performNeighborhoodSearchSort()¶
Important: First call m_model->performNeighborhoodSearchSort() to call the z_sort of the neighborhood search.
-
void emittedParticles(FluidModel *model, const unsigned int startIndex)¶
- inline FORCE_INLINE const Real getPressure (const unsigned int fluidIndex, const unsigned int i) const
- inline FORCE_INLINE Real & getPressure (const unsigned int fluidIndex, const unsigned int i)
- inline FORCE_INLINE void setPressure (const unsigned int fluidIndex, const unsigned int i, const Real p)
- inline FORCE_INLINE Vector3r & getPressureAccel (const unsigned int fluidIndex, const unsigned int i)
- inline FORCE_INLINE const Vector3r & getPressureAccel (const unsigned int fluidIndex, const unsigned int i) const
- inline FORCE_INLINE void setPressureAccel (const unsigned int fluidIndex, const unsigned int i, const Vector3r &val)
Class SpikyKernel¶
Defined in File SPHKernels.h
Class StaticRigidBody¶
Defined in File StaticRigidBody.h
Inheritance Relationships¶
Base Type¶
public SPH::RigidBodyObject
(Class RigidBodyObject)
Class Documentation¶
-
class StaticRigidBody : public SPH::RigidBodyObject¶
This class stores the information of a static rigid body which is not part of a rigid body simulation.
Public Functions
-
inline StaticRigidBody()¶
-
inline virtual bool isDynamic() const¶
-
inline virtual Quaternionr const &getRotation() const¶
-
inline virtual void setRotation(const Quaternionr &q)¶
-
inline Quaternionr const &getRotation0() const¶
-
inline void setRotation0(const Quaternionr &q)¶
-
inline void animate()¶
-
inline virtual const std::vector<unsigned int> &getFaces() const¶
-
inline TriangleMesh &getGeometry()¶
-
inline virtual void updateMeshTransformation()¶
-
inline void reset()¶
-
inline StaticRigidBody()¶
Class SurfaceTension_Akinci2013¶
Defined in File SurfaceTension_Akinci2013.h
Inheritance Relationships¶
Base Type¶
public SPH::SurfaceTensionBase
(Class SurfaceTensionBase)
Class Documentation¶
-
class SurfaceTension_Akinci2013 : public SPH::SurfaceTensionBase¶
This class implements the surface tension method introduced by Akinci et al. [ATT13].
References:
[AAT13] Nadir Akinci, Gizem Akinci, and Matthias Teschner. Versatile surface tension and adhesion for sph fluids. ACM Trans. Graph., 32(6):182:1-182:8, November 2013. URL: http://doi.acm.org/10.1145/2508363.2508395
Public Functions
-
SurfaceTension_Akinci2013(FluidModel *model)¶
-
virtual ~SurfaceTension_Akinci2013(void)¶
-
virtual void step()¶
-
virtual void reset()¶
-
void computeNormals()¶
-
virtual void performNeighborhoodSearchSort()¶
- inline FORCE_INLINE Vector3r & getNormal (const unsigned int i)
- inline FORCE_INLINE const Vector3r & getNormal (const unsigned int i) const
- inline FORCE_INLINE void setNormal (const unsigned int i, const Vector3r &val)
Public Static Functions
-
static inline NonPressureForceBase *creator(FluidModel *model)¶
Class SurfaceTension_Becker2007¶
Defined in File SurfaceTension_Becker2007.h
Inheritance Relationships¶
Base Type¶
public SPH::SurfaceTensionBase
(Class SurfaceTensionBase)
Class Documentation¶
-
class SurfaceTension_Becker2007 : public SPH::SurfaceTensionBase¶
This class implements the surface tension method introduced by Becker and Teschner [BT07].
References:
[BT07] Markus Becker and Matthias Teschner. Weakly compressible SPH for free surface flows. In ACM SIGGRAPH/Eurographics Symposium on Computer Animation, SCA ‘07, 209-217. Aire-la-Ville, Switzerland, Switzerland, 2007. Eurographics Association. URL: http://dl.acm.org/citation.cfm?id=1272690.1272719
Public Functions
-
SurfaceTension_Becker2007(FluidModel *model)¶
-
virtual ~SurfaceTension_Becker2007(void)¶
-
virtual void step()¶
-
virtual void reset()¶
Public Static Functions
-
static inline NonPressureForceBase *creator(FluidModel *model)¶
Class SurfaceTension_He2014¶
Defined in File SurfaceTension_He2014.h
Inheritance Relationships¶
Base Type¶
public SPH::SurfaceTensionBase
(Class SurfaceTensionBase)
Class Documentation¶
-
class SurfaceTension_He2014 : public SPH::SurfaceTensionBase¶
This class implements the surface tension method introduced by He et al. [HWZ+14].
References:
[HWZ+14] Xiaowei He, Huamin Wang, Fengjun Zhang, Hongan Wang, Guoping Wang, and Kun Zhou. Robust simulation of sparsely sampled thin features in SPH-based free surface flows. ACM Trans. Graph., 34(1):7:1-7:9, December 2014. URL: http://doi.acm.org/10.1145/2682630
Public Functions
-
SurfaceTension_He2014(FluidModel *model)¶
-
virtual ~SurfaceTension_He2014(void)¶
-
virtual void step()¶
-
virtual void reset()¶
-
virtual void performNeighborhoodSearchSort()¶
- inline FORCE_INLINE const Real getColor (const unsigned int i) const
- inline FORCE_INLINE Real & getColor (const unsigned int i)
- inline FORCE_INLINE void setColor (const unsigned int i, const Real p)
- inline FORCE_INLINE const Real getGradC2 (const unsigned int i) const
- inline FORCE_INLINE Real & getGradC2 (const unsigned int i)
- inline FORCE_INLINE void setGradC2 (const unsigned int i, const Real p)
Public Static Functions
-
static inline NonPressureForceBase *creator(FluidModel *model)¶
Class SurfaceTension_ZorillaRitter2020¶
Defined in File SurfaceTension_ZorillaRitter2020.h
Inheritance Relationships¶
Base Type¶
public SPH::SurfaceTensionBase
(Class SurfaceTensionBase)
Class Documentation¶
-
class SurfaceTension_ZorillaRitter2020 : public SPH::SurfaceTensionBase¶
This class implements the surface tension method introduced by Zorilla, Ritter, Sappl, Rauch, Harders: extended version 2020: https://doi.org/10.3390/computers9020023 and original version 2019: https://diglib.eg.org/handle/10.2312/cgvc20191260
Public Functions
-
SurfaceTension_ZorillaRitter2020(FluidModel *model)¶
-
virtual ~SurfaceTension_ZorillaRitter2020(void)¶
-
virtual void performNeighborhoodSearchSort() override¶
Public Static Functions
-
static inline NonPressureForceBase *creator(FluidModel *model)¶
-
static bool classifySurfaceParticle(double com, int non, double d_offset = 0.0)¶
Linear classifier. Divides into surface or non-surface particle. The function is equivalent to the network classifier. Also, inspect lines 344 to 348 in the cpp file for how to compute the required input.
- Parameters
com – normalized center of mass / number of neighbors
non – number of neighbors
d_offset – constant parameter d
- Returns
true if surface, false otherwise
-
SurfaceTension_ZorillaRitter2020(FluidModel *model)¶
Class SurfaceTensionBase¶
Defined in File SurfaceTensionBase.h
Inheritance Relationships¶
Base Type¶
public SPH::NonPressureForceBase
(Class NonPressureForceBase)
Derived Types¶
public SPH::SurfaceTension_Akinci2013
(Class SurfaceTension_Akinci2013)public SPH::SurfaceTension_Becker2007
(Class SurfaceTension_Becker2007)public SPH::SurfaceTension_He2014
(Class SurfaceTension_He2014)public SPH::SurfaceTension_ZorillaRitter2020
(Class SurfaceTension_ZorillaRitter2020)
Class Documentation¶
-
class SurfaceTensionBase : public SPH::NonPressureForceBase¶
Base class for all surface tension methods.
Subclassed by SPH::SurfaceTension_Akinci2013, SPH::SurfaceTension_Becker2007, SPH::SurfaceTension_He2014, SPH::SurfaceTension_ZorillaRitter2020
Protected Functions
-
virtual void initParameters()¶
-
virtual void initParameters()¶
Class TimeIntegration¶
Defined in File TimeIntegration.h
Class Documentation¶
-
class TimeIntegration¶
Class for the position-based fluids time integration.
Public Static Functions
-
static void semiImplicitEuler(const Real h, const Real mass, Vector3r &position, Vector3r &velocity, const Vector3r &acceleration)¶
Perform an integration step for a particle using the semi-implicit Euler (symplectic Euler) method:
\[\begin{split}\begin{align*} \mathbf{v}(t+h) &= \mathbf{v}(t) + \mathbf{a}(t) h\\ \mathbf{x}(t+h) &= \mathbf{x}(t) + \mathbf{v}(t+h) h \end{align*}\end{split}\]- Parameters
h – time step size
mass – mass of the particle
position – position of the particle
velocity – velocity of the particle
acceleration – acceleration of the particle
-
static void velocityUpdateFirstOrder(const Real h, const Real mass, const Vector3r &position, const Vector3r &oldPosition, Vector3r &velocity)¶
Perform a velocity update (first order) for the linear velocity:
\[\begin{equation*} \mathbf{v}(t+h) = \frac{1}{h} (\mathbf{p}(t+h) - \mathbf{p}(t) \end{equation*}\]- Parameters
h – time step size
mass – mass of the particle
position – new position \(\mathbf{p}(t+h)\) of the particle
oldPosition – position \(\mathbf{p}(t)\) of the particle before the time step
velocity – resulting velocity of the particle
-
static void semiImplicitEuler(const Real h, const Real mass, Vector3r &position, Vector3r &velocity, const Vector3r &acceleration)¶
Class TimeManager¶
Defined in File TimeManager.h
Class Documentation¶
-
class TimeManager¶
Class to manage the current simulation time and the time step size. This class is a singleton.
Public Functions
-
TimeManager()¶
-
~TimeManager()¶
-
void saveState(BinaryFileWriter &binWriter)¶
-
void loadState(BinaryFileReader &binReader)¶
Public Static Functions
-
static TimeManager *getCurrent()¶
-
static void setCurrent(TimeManager *tm)¶
-
static bool hasCurrent()¶
-
TimeManager()¶
Class TimeStep¶
Defined in File TimeStep.h
Inheritance Relationships¶
Base Type¶
public ParameterObject
Derived Types¶
public SPH::TimeStepDFSPH
(Class TimeStepDFSPH)public SPH::TimeStepICSPH
(Class TimeStepICSPH)public SPH::TimeStepIISPH
(Class TimeStepIISPH)public SPH::TimeStepPBF
(Class TimeStepPBF)public SPH::TimeStepPCISPH
(Class TimeStepPCISPH)public SPH::TimeStepPF
(Class TimeStepPF)public SPH::TimeStepWCSPH
(Class TimeStepWCSPH)
Class Documentation¶
-
class TimeStep : public ParameterObject¶
Base class for the simulation methods.
Subclassed by SPH::TimeStepDFSPH, SPH::TimeStepICSPH, SPH::TimeStepIISPH, SPH::TimeStepPBF, SPH::TimeStepPCISPH, SPH::TimeStepPF, SPH::TimeStepWCSPH
Public Functions
-
TimeStep()¶
-
virtual ~TimeStep(void)¶
-
void computeDensities(const unsigned int fluidModelIndex)¶
Determine densities of all fluid particles.
-
virtual void step() = 0¶
-
virtual void reset()¶
-
virtual void init()¶
-
virtual void resize() = 0¶
-
inline virtual void emittedParticles(FluidModel *model, const unsigned int startIndex)¶
-
inline virtual void saveState(BinaryFileWriter &binWriter)¶
-
inline virtual void loadState(BinaryFileReader &binReader)¶
Public Static Attributes
-
static int SOLVER_ITERATIONS = -1¶
-
static int MIN_ITERATIONS = -1¶
-
static int MAX_ITERATIONS = -1¶
-
static int MAX_ERROR = -1¶
Protected Functions
-
void clearAccelerations(const unsigned int fluidModelIndex)¶
Clear accelerations and add gravitation.
-
virtual void initParameters()¶
-
void approximateNormal(Discregrid::DiscreteGrid *map, const Eigen::Vector3d &x, Eigen::Vector3d &n, const unsigned int dim)¶
-
void computeVolumeAndBoundaryX(const unsigned int fluidModelIndex, const unsigned int i, const Vector3r &xi)¶
-
void computeVolumeAndBoundaryX()¶
-
void computeDensityAndGradient(const unsigned int fluidModelIndex, const unsigned int i, const Vector3r &xi)¶
-
void computeDensityAndGradient()¶
-
TimeStep()¶
Class TimeStepDFSPH¶
Defined in File TimeStepDFSPH.h
Inheritance Relationships¶
Base Type¶
public SPH::TimeStep
(Class TimeStep)
Class Documentation¶
-
class TimeStepDFSPH : public SPH::TimeStep¶
This class implements the Divergence-free Smoothed Particle Hydrodynamics approach introduced by Bender and Koschier [BK15,BK17,KBST19].
References:
[BK15] Jan Bender and Dan Koschier. Divergence-free smoothed particle hydrodynamics. In ACM SIGGRAPH / Eurographics Symposium on Computer Animation, SCA ‘15, 147-155. New York, NY, USA, 2015. ACM. URL: http://doi.acm.org/10.1145/2786784.2786796
[BK17] Jan Bender and Dan Koschier. Divergence-free SPH for incompressible and viscous fluids. IEEE Transactions on Visualization and Computer Graphics, 23(3):1193-1206, 2017. URL: http://dx.doi.org/10.1109/TVCG.2016.2578335
[KBST19] Dan Koschier, Jan Bender, Barbara Solenthaler, and Matthias Teschner. Smoothed particle hydrodynamics for physically-based simulation of fluids and solids. In Eurographics 2019 - Tutorials. Eurographics Association, 2019. URL: https://interactivecomputergraphics.github.io/SPH-Tutorial
Public Functions
-
TimeStepDFSPH()¶
-
virtual ~TimeStepDFSPH(void)¶
-
virtual void step()¶
perform a simulation step
-
virtual void reset()¶
-
virtual void resize()¶
Public Static Attributes
-
static int SOLVER_ITERATIONS_V = -1¶
-
static int MAX_ITERATIONS_V = -1¶
-
static int MAX_ERROR_V = -1¶
-
static int USE_DIVERGENCE_SOLVER = -1¶
Protected Functions
-
void computeDFSPHFactor(const unsigned int fluidModelIndex)¶
-
void pressureSolve()¶
-
void divergenceSolve()¶
-
void computeDensityAdv(const unsigned int fluidModelIndex, const unsigned int index, const Real h, const Real density0)¶
Compute rho_adv,i^(0) (see equation in Section 3.3 in [BK17]) using the velocities after the non-pressure forces were applied.
-
void computeDensityChange(const unsigned int fluidModelIndex, const unsigned int index, const Real h)¶
Compute rho_adv,i^(0) (see equation (9) in Section 3.2 [BK17]) using the velocities after the non-pressure forces were applied.
-
void computePressureAccel(const unsigned int fluidModelIndex, const unsigned int i, const Real density0, std::vector<std::vector<Real>> &pressure_rho2, const bool applyBoundaryForces = false)¶
Compute pressure accelerations using the current pressure values of the particles
-
void performNeighborhoodSearch()¶
Perform the neighborhood search for all fluid particles.
-
virtual void emittedParticles(FluidModel *model, const unsigned int startIndex)¶
-
virtual void initParameters()¶
Init all generic parameters
Class TimeStepICSPH¶
Defined in File TimeStepICSPH.h
Inheritance Relationships¶
Base Type¶
public SPH::TimeStep
(Class TimeStep)
Class Documentation¶
-
class TimeStepICSPH : public SPH::TimeStep¶
This class implements the Implicit Compressible SPH approach introduced by Gissler et al. [GHB+20].
References:
[GHB+20] Christoph Gissler, Andreas Henne, Stefan Band, Andreas Peer and Matthias Teschner. An Implicit Compressible SPH Solver for Snow Simulation. ACM Transactions on Graphics, 39(4). URL: https://doi.org/10.1145/3386569.3392431
Public Functions
-
TimeStepICSPH()¶
-
virtual ~TimeStepICSPH(void)¶
-
virtual void step()¶
-
virtual void reset()¶
-
virtual void resize()¶
-
inline const SimulationDataICSPH &getSimulationData()¶
Protected Functions
-
void computeDensityAdv(const unsigned int fluidModelIndex)¶
Compute rho_adv, i ^ (0) (see equation(6) in[GHB + 20]) using the velocities after the non-pressure forces were applied.
-
void compute_aii(const unsigned int fluidModelIndex)¶
-
void pressureSolve()¶
-
void integration(const unsigned int fluidModelIndex)¶
-
void computePressureAccels(const unsigned int fluidModelIndex)¶
Determine the pressure accelerations when the pressure is already known.
-
void performNeighborhoodSearch()¶
Perform the neighborhood search for all fluid particles.
-
virtual void initParameters()¶
-
virtual void emittedParticles(FluidModel *model, const unsigned int startIndex)¶
Class TimeStepIISPH¶
Defined in File TimeStepIISPH.h
Inheritance Relationships¶
Base Type¶
public SPH::TimeStep
(Class TimeStep)
Class Documentation¶
-
class TimeStepIISPH : public SPH::TimeStep¶
This class implements the Implicit Incompressible SPH approach introduced by Ihmsen et al. [ICS+14].
References:
[ICS+14] Markus Ihmsen, Jens Cornelis, Barbara Solenthaler, Christopher Horvath, and Matthias Teschner. Implicit incompressible SPH. IEEE Transactions on Visualization and Computer Graphics, 20(3):426-435, March 2014. URL: http://dx.doi.org/10.1109/TVCG.2013.105
Public Functions
-
TimeStepIISPH()¶
-
virtual ~TimeStepIISPH(void)¶
-
virtual void step()¶
-
virtual void reset()¶
-
virtual void resize()¶
-
inline const SimulationDataIISPH &getSimulationData()¶
Protected Functions
-
void predictAdvection(const unsigned int fluidModelIndex)¶
-
void pressureSolve()¶
-
void integration(const unsigned int fluidModelIndex)¶
-
void computePressureAccels(const unsigned int fluidModelIndex)¶
Determine the pressure accelerations when the pressure is already known.
-
void performNeighborhoodSearch()¶
Perform the neighborhood search for all fluid particles.
-
virtual void emittedParticles(FluidModel *model, const unsigned int startIndex)¶
Class TimeStepPBF¶
Defined in File TimeStepPBF.h
Inheritance Relationships¶
Base Type¶
public SPH::TimeStep
(Class TimeStep)
Class Documentation¶
-
class TimeStepPBF : public SPH::TimeStep¶
This class implements the position-based fluids approach introduced by Macklin and Mueller [MM13,BMO+14,BMM15].
References:
[MM13] Miles Macklin and Matthias Müller. Position based fluids. ACM Trans. Graph., 32(4):104:1-104:12, July 2013. URL: http://doi.acm.org/10.1145/2461912.2461984
[BMO+14] Jan Bender, Matthias Müller, Miguel A. Otaduy, Matthias Teschner, and Miles Macklin. A survey on position-based simulation methods in computer graphics. Computer Graphics Forum, 33(6):228-251, 2014. URL: http://dx.doi.org/10.1111/cgf.12346
[BMM15] Jan Bender, Matthias Müller, and Miles Macklin. Position-based simulation methods in computer graphics. In EUROGRAPHICS 2015 Tutorials. Eurographics Association, 2015. URL: http://dx.doi.org/10.2312/egt.20151045
Public Functions
-
TimeStepPBF()¶
Initialize the simulation data required for this method.
-
virtual ~TimeStepPBF(void)¶
-
virtual void step()¶
Perform a simulation step.
-
virtual void reset()¶
Reset the simulation method.
-
virtual void resize()¶
Public Static Attributes
-
static int VELOCITY_UPDATE_METHOD = -1¶
-
static int ENUM_PBF_FIRST_ORDER = -1¶
-
static int ENUM_PBF_SECOND_ORDER = -1¶
Protected Functions
-
void pressureSolve()¶
Perform a position-based correction step for the following density constraint:\(C(\mathbf{x}) = \left (\frac{\rho_i}{\rho_0} - 1 \right )= 0\)
-
void performNeighborhoodSearch()¶
Perform the neighborhood search for all fluid particles.
-
virtual void emittedParticles(FluidModel *model, const unsigned int startIndex)¶
-
virtual void initParameters()¶
Protected Attributes
-
SimulationDataPBF m_simulationData¶
-
unsigned int m_counter¶
-
int m_velocityUpdateMethod¶
Class TimeStepPCISPH¶
Defined in File TimeStepPCISPH.h
Inheritance Relationships¶
Base Type¶
public SPH::TimeStep
(Class TimeStep)
Class Documentation¶
-
class TimeStepPCISPH : public SPH::TimeStep¶
This class implements the Predictive-corrective Incompressible SPH approach introduced by Solenthaler and Pajarola [SP09].
References:
[SP09] B. Solenthaler and R. Pajarola. Predictive-corrective incompressible SPH. ACM Trans. Graph., 28(3):40:1-40:6, July 2009. URL: http://doi.acm.org/10.1145/1531326.1531346
Public Functions
-
TimeStepPCISPH()¶
-
virtual ~TimeStepPCISPH(void)¶
-
virtual void step()¶
-
virtual void reset()¶
-
virtual void resize()¶
Protected Functions
-
void pressureSolve()¶
-
void performNeighborhoodSearch()¶
Perform the neighborhood search for all fluid particles.
-
virtual void emittedParticles(FluidModel *model, const unsigned int startIndex)¶
Class TimeStepPF¶
Defined in File TimeStepPF.h
Inheritance Relationships¶
Base Type¶
public SPH::TimeStep
(Class TimeStep)
Class Documentation¶
-
class TimeStepPF : public SPH::TimeStep¶
This class implements the Projective Fluids approach introduced by Weiler, Koschier and Bender [WKB16].
References:
[WKB16] Marcel Weiler, Dan Koschier, and Jan Bender. Projective fluids. In Proceedings of the 9th International Conference on Motion in Games, MIG ‘16, 79-84. New York, NY, USA, 2016. ACM. URL: http://doi.acm.org/10.1145/2994258.2994282
Public Functions
-
TimeStepPF()¶
-
virtual ~TimeStepPF(void)¶
-
virtual void step() override¶
-
virtual void reset() override¶
-
virtual void resize() override¶
Public Static Attributes
-
static int STIFFNESS = -1¶
Protected Types
-
using Solver = Eigen::ConjugateGradient<MatrixReplacement, Eigen::Lower | Eigen::Upper, JacobiPreconditioner3D>¶
Protected Functions
-
void preparePreconditioner()¶
-
void initialGuessForPositions(const unsigned int fluidModelIndex)¶
-
void solvePDConstraints()¶
-
void addAccellerationToVelocity()¶
-
void matrixFreeRHS(const VectorXr &x, VectorXr &result)¶
compute the right hand side of the system in a matrix-free fashion and store the result in result
-
void performNeighborhoodSearch()¶
Perform the neighborhood search for all fluid particles.
-
virtual void emittedParticles(FluidModel *model, const unsigned int startIndex) override¶
-
virtual void initParameters() override¶
Protected Attributes
-
SimulationDataPF m_simulationData¶
-
unsigned int m_counter¶
-
unsigned int m_numActiveParticlesTotal¶
Protected Static Functions
- static FORCE_INLINE void diagonalMatrixElement (const unsigned int row, Vector3r &result, void *userData)
Class TimeStepWCSPH¶
Defined in File TimeStepWCSPH.h
Inheritance Relationships¶
Base Type¶
public SPH::TimeStep
(Class TimeStep)
Class Documentation¶
-
class TimeStepWCSPH : public SPH::TimeStep¶
This class implements the Weakly Compressible SPH for Free Surface Flows approach introduced by Becker and Teschner [BT07].
References:
[BT07] Markus Becker and Matthias Teschner. Weakly compressible SPH for free surface flows. In ACM SIGGRAPH/Eurographics Symposium on Computer Animation, SCA ‘07, 209-217. Aire-la-Ville, Switzerland, Switzerland, 2007. Eurographics Association. URL: http://dl.acm.org/citation.cfm?id=1272690.1272719
Public Functions
-
TimeStepWCSPH()¶
-
virtual ~TimeStepWCSPH(void)¶
-
virtual void step()¶
-
virtual void reset()¶
-
virtual void resize()¶
Protected Functions
-
void computePressureAccels(const unsigned int fluidModelIndex)¶
Determine the pressure accelerations when the pressure is already known.
-
void performNeighborhoodSearch()¶
Perform the neighborhood search for all fluid particles.
-
virtual void emittedParticles(FluidModel *model, const unsigned int startIndex)¶
-
virtual void initParameters()¶
Class TriangleMesh¶
Defined in File TriangleMesh.h
Class Documentation¶
-
class TriangleMesh¶
Data structure for a triangle mesh with normals and vertex normals.
Public Types
-
typedef std::vector<unsigned int> Faces¶
Public Functions
-
TriangleMesh()¶
-
~TriangleMesh()¶
-
void release()¶
-
void initMesh(const unsigned int nPoints, const unsigned int nFaces)¶
-
void addFace(const unsigned int *const indices)¶
Add a new face.
-
void addFace(const int *const indices)¶
Add a new face.
-
inline unsigned int numVertices() const¶
-
inline unsigned int numFaces() const¶
-
void updateNormals()¶
-
void updateVertexNormals()¶
-
typedef std::vector<unsigned int> Faces¶
Class Viscosity_Bender2017¶
Defined in File Viscosity_Bender2017.h
Inheritance Relationships¶
Base Type¶
public SPH::ViscosityBase
(Class ViscosityBase)
Class Documentation¶
-
class Viscosity_Bender2017 : public SPH::ViscosityBase¶
This class implements the implicit simulation method for viscous fluids introduced by Bender and Koschier [BK17].
References:
[BK17] Jan Bender and Dan Koschier. Divergence-free SPH for incompressible and viscous fluids. IEEE Transactions on Visualization and Computer Graphics, 23(3):1193-1206, 2017. URL: http://dx.doi.org/10.1109/TVCG.2016.2578335
Public Functions
-
Viscosity_Bender2017(FluidModel *model)¶
-
virtual ~Viscosity_Bender2017(void)¶
-
virtual void step()¶
-
virtual void reset()¶
-
virtual void performNeighborhoodSearchSort()¶
-
void computeTargetStrainRate()¶
-
void computeViscosityFactor()¶
- inline FORCE_INLINE void viscoGradientMultTransposeRightOpt (const Eigen::Matrix< Real, 6, 3 > &a, const Eigen::Matrix< Real, 6, 3 > &b, Matrix6r &c)
Matrix product
- inline FORCE_INLINE const Vector6r & getTargetStrainRate (const unsigned int i) const
- inline FORCE_INLINE Vector6r & getTargetStrainRate (const unsigned int i)
- inline FORCE_INLINE void setTargetStrainRate (const unsigned int i, const Vector6r &val)
- inline FORCE_INLINE const Matrix6r & getViscosityFactor (const unsigned int i) const
- inline FORCE_INLINE Matrix6r & getViscosityFactor (const unsigned int i)
- inline FORCE_INLINE void setViscosityFactor (const unsigned int i, const Matrix6r &val)
- inline FORCE_INLINE const Vector6r & getViscosityLambda (const unsigned int i) const
- inline FORCE_INLINE Vector6r & getViscosityLambda (const unsigned int i)
- inline FORCE_INLINE void setViscosityLambda (const unsigned int i, const Vector6r &val)
Public Static Functions
-
static inline NonPressureForceBase *creator(FluidModel *model)¶
Public Static Attributes
-
static int ITERATIONS = -1¶
-
static int MAX_ITERATIONS = -1¶
-
static int MAX_ERROR = -1¶
Protected Functions
-
virtual void initParameters()¶
Class Viscosity_Peer2015¶
Defined in File Viscosity_Peer2015.h
Inheritance Relationships¶
Base Type¶
public SPH::ViscosityBase
(Class ViscosityBase)
Class Documentation¶
-
class Viscosity_Peer2015 : public SPH::ViscosityBase¶
This class implements the implicit simulation method for viscous fluids introduced by Peer et al. [PICT15].
References:
[PICT15] A. Peer, M. Ihmsen, J. Cornelis, and M. Teschner. An Implicit Viscosity Formulation for SPH Fluids. ACM Trans. Graph., 34(4):1-10, 2015. URL: http://doi.acm.org/10.1145/2766925
Public Functions
-
Viscosity_Peer2015(FluidModel *model)¶
-
virtual ~Viscosity_Peer2015(void)¶
-
virtual void step()¶
-
virtual void reset()¶
-
virtual void performNeighborhoodSearchSort()¶
- inline FORCE_INLINE const Matrix3r & getTargetNablaV (const unsigned int i) const
- inline FORCE_INLINE Matrix3r & getTargetNablaV (const unsigned int i)
- inline FORCE_INLINE void setTargetNablaV (const unsigned int i, const Matrix3r &val)
Public Static Functions
-
static inline NonPressureForceBase *creator(FluidModel *model)¶
- static FORCE_INLINE void diagonalMatrixElement (const unsigned int row, Real &result, void *userData)
Public Static Attributes
-
static int ITERATIONS = -1¶
-
static int MAX_ITERATIONS = -1¶
-
static int MAX_ERROR = -1¶
Protected Types
-
typedef Eigen::ConjugateGradient<MatrixReplacement, Eigen::Lower | Eigen::Upper, JacobiPreconditioner1D> Solver¶
Class Viscosity_Peer2016¶
Defined in File Viscosity_Peer2016.h
Inheritance Relationships¶
Base Type¶
public SPH::ViscosityBase
(Class ViscosityBase)
Class Documentation¶
-
class Viscosity_Peer2016 : public SPH::ViscosityBase¶
This class implements the implicit simulation method for viscous fluids introduced by Peer and Teschner [PT16].
References:
[PT16] Andreas Peer and Matthias Teschner. Prescribed Velocity Gradients for Highly Viscous SPH Fluids with Vorticity Diffusion. IEEE Transactions on Visualization and Computer Graphics, 2016. URL: https://doi.org/10.1109/TVCG.2016.2636144
Public Functions
-
Viscosity_Peer2016(FluidModel *model)¶
-
virtual ~Viscosity_Peer2016(void)¶
-
virtual void step()¶
-
virtual void reset()¶
-
virtual void performNeighborhoodSearchSort()¶
- inline FORCE_INLINE const Matrix3r & getTargetNablaV (const unsigned int i) const
- inline FORCE_INLINE Matrix3r & getTargetNablaV (const unsigned int i)
- inline FORCE_INLINE void setTargetNablaV (const unsigned int i, const Matrix3r &val)
- inline FORCE_INLINE const Vector3r & getOmega (const unsigned int i) const
- inline FORCE_INLINE Vector3r & getOmega (const unsigned int i)
- inline FORCE_INLINE void setOmega (const unsigned int i, const Vector3r &val)
Public Static Functions
-
static inline NonPressureForceBase *creator(FluidModel *model)¶
- static FORCE_INLINE void diagonalMatrixElementV (const unsigned int row, Real &result, void *userData)
- static FORCE_INLINE void diagonalMatrixElementOmega (const unsigned int row, Real &result, void *userData)
Public Static Attributes
-
static int ITERATIONS_V = -1¶
-
static int ITERATIONS_OMEGA = -1¶
-
static int MAX_ITERATIONS_V = -1¶
-
static int MAX_ERROR_V = -1¶
-
static int MAX_ITERATIONS_OMEGA = -1¶
-
static int MAX_ERROR_OMEGA = -1¶
Protected Types
-
typedef Eigen::ConjugateGradient<MatrixReplacement, Eigen::Lower | Eigen::Upper, JacobiPreconditioner1D> Solver¶
Class Viscosity_Standard¶
Defined in File Viscosity_Standard.h
Inheritance Relationships¶
Base Type¶
public SPH::ViscosityBase
(Class ViscosityBase)
Class Documentation¶
-
class Viscosity_Standard : public SPH::ViscosityBase¶
This class implements the standard method for viscosity descibed e.g. by Ihmsen et al. [IOS+14].
The method evaluates the term
\(\nu \nabla^2 \mathbf{v}\) and uses an approximation of the kernel Laplacian to improve the stability. This approximation is given in [IOS+14].References:
[IOS+14] Markus Ihmsen, Jens Orthmann, Barbara Solenthaler, Andreas Kolb, and Matthias Teschner. SPH Fluids in Computer Graphics. In Sylvain Lefebvre and Michela Spagnuolo, editors, Eurographics 2014 - State of the Art Reports. The Eurographics Association, 2014. URL: http://dx.doi.org/10.2312/egst.20141034
Public Functions
-
Viscosity_Standard(FluidModel *model)¶
-
virtual ~Viscosity_Standard(void)¶
-
virtual void step()¶
-
virtual void reset()¶
Public Static Functions
-
static inline NonPressureForceBase *creator(FluidModel *model)¶
Public Static Attributes
-
static int VISCOSITY_COEFFICIENT_BOUNDARY = -1¶
Protected Functions
-
virtual void initParameters()¶
Class Viscosity_Takahashi2015¶
Defined in File Viscosity_Takahashi2015.h
Inheritance Relationships¶
Base Type¶
public SPH::ViscosityBase
(Class ViscosityBase)
Class Documentation¶
-
class Viscosity_Takahashi2015 : public SPH::ViscosityBase¶
This class implements a variant of the implicit simulation method for viscous fluids introduced by Takahashi et al. [TDF+15]. In the original work of Takahashi et al. the second-ring neighbors are required to create the matrix of the linear system. In contrast we use a meshless conjugate gradient solver which performs the required matrix-vector multiplication in two sequential loops. In this way only the one-ring neighbors are required in each loop which increases the performance significantly.
Thanks to Anreas Peer who helped us with the implementation.
References:
[TDF+15] T. Takahashi, Y. Dobashi, I. Fujishiro, T. Nishita, and M.C. Lin. Implicit Formulation for SPH-based Viscous Fluids. Computer Graphics Forum, 34(2):493-502, 2015. URL: http://dx.doi.org/10.1111/cgf.12578
Public Functions
-
Viscosity_Takahashi2015(FluidModel *model)¶
-
virtual ~Viscosity_Takahashi2015(void)¶
-
virtual void step()¶
-
virtual void reset()¶
-
virtual void performNeighborhoodSearchSort()¶
- inline FORCE_INLINE const Matrix3r & getViscousStress (const unsigned int i) const
- inline FORCE_INLINE Matrix3r & getViscousStress (const unsigned int i)
- inline FORCE_INLINE void setViscousStress (const unsigned int i, const Matrix3r &val)
- inline FORCE_INLINE const Vector3r & getAccel (const unsigned int i) const
- inline FORCE_INLINE Vector3r & getAccel (const unsigned int i)
- inline FORCE_INLINE void setAccel (const unsigned int i, const Vector3r &val)
Public Static Functions
-
static inline NonPressureForceBase *creator(FluidModel *model)¶
- static FORCE_INLINE void diagonalMatrixElement (const unsigned int row, Real &result, void *userData)
Public Static Attributes
-
static int ITERATIONS = -1¶
-
static int MAX_ITERATIONS = -1¶
-
static int MAX_ERROR = -1¶
Protected Types
-
typedef Eigen::ConjugateGradient<MatrixReplacement, Eigen::Lower | Eigen::Upper, Eigen::IdentityPreconditioner> Solver¶
Protected Functions
-
virtual void initParameters()¶
Protected Static Functions
-
static void computeViscosityAcceleration(Viscosity_Takahashi2015 *visco, const Real *v)¶
Class Viscosity_Weiler2018¶
Defined in File Viscosity_Weiler2018.h
Inheritance Relationships¶
Base Type¶
public SPH::ViscosityBase
(Class ViscosityBase)
Class Documentation¶
-
class Viscosity_Weiler2018 : public SPH::ViscosityBase¶
This class implements the implicit Laplace viscosity method introduced by Weiler et al. 2018 [WKBB18].
References:
[WKBB18] Marcel Weiler, Dan Koschier, Magnus Brand, and Jan Bender. A physically consistent implicit viscosity solver for SPH fluids. Computer Graphics Forum (Eurographics), 2018. URL: https://doi.org/10.1111/cgf.13349
Public Functions
-
Viscosity_Weiler2018(FluidModel *model)¶
-
virtual ~Viscosity_Weiler2018(void)¶
-
virtual void step()¶
-
virtual void reset()¶
-
virtual void performNeighborhoodSearchSort()¶
- inline FORCE_INLINE const Vector3r & getVDiff (const unsigned int i) const
- inline FORCE_INLINE Vector3r & getVDiff (const unsigned int i)
- inline FORCE_INLINE void setVDiff (const unsigned int i, const Vector3r &val)
-
void computeRHS(VectorXr &b, VectorXr &g)¶
-
void applyForces(const VectorXr &x)¶
Public Static Functions
-
static inline NonPressureForceBase *creator(FluidModel *model)¶
Public Static Attributes
-
static int ITERATIONS = -1¶
-
static int MAX_ITERATIONS = -1¶
-
static int MAX_ERROR = -1¶
-
static int VISCOSITY_COEFFICIENT_BOUNDARY = -1¶
Protected Types
-
typedef Eigen::ConjugateGradient<MatrixReplacement, Eigen::Lower | Eigen::Upper, BlockJacobiPreconditioner3D> Solver¶
Protected Functions
-
virtual void initParameters()¶
Protected Static Functions
- static FORCE_INLINE void diagonalMatrixElement (const unsigned int row, Matrix3r &result, void *userData)
Class ViscosityBase¶
Defined in File ViscosityBase.h
Inheritance Relationships¶
Base Type¶
public SPH::NonPressureForceBase
(Class NonPressureForceBase)
Derived Types¶
public SPH::Viscosity_Bender2017
(Class Viscosity_Bender2017)public SPH::Viscosity_Peer2015
(Class Viscosity_Peer2015)public SPH::Viscosity_Peer2016
(Class Viscosity_Peer2016)public SPH::Viscosity_Standard
(Class Viscosity_Standard)public SPH::Viscosity_Takahashi2015
(Class Viscosity_Takahashi2015)public SPH::Viscosity_Weiler2018
(Class Viscosity_Weiler2018)
Class Documentation¶
-
class ViscosityBase : public SPH::NonPressureForceBase¶
Base class for all viscosity methods.
Subclassed by SPH::Viscosity_Bender2017, SPH::Viscosity_Peer2015, SPH::Viscosity_Peer2016, SPH::Viscosity_Standard, SPH::Viscosity_Takahashi2015, SPH::Viscosity_Weiler2018
Public Static Attributes
-
static int VISCOSITY_COEFFICIENT = -1¶
Protected Functions
-
virtual void initParameters()¶
-
static int VISCOSITY_COEFFICIENT = -1¶
Class VorticityBase¶
Defined in File VorticityBase.h
Inheritance Relationships¶
Base Type¶
public SPH::NonPressureForceBase
(Class NonPressureForceBase)
Derived Types¶
public SPH::MicropolarModel_Bender2017
(Class MicropolarModel_Bender2017)public SPH::VorticityConfinement
(Class VorticityConfinement)
Class Documentation¶
-
class VorticityBase : public SPH::NonPressureForceBase¶
Base class for all vorticity methods.
Subclassed by SPH::MicropolarModel_Bender2017, SPH::VorticityConfinement
Public Static Attributes
-
static int VORTICITY_COEFFICIENT = -1¶
Protected Functions
-
virtual void initParameters()¶
-
static int VORTICITY_COEFFICIENT = -1¶
Class VorticityConfinement¶
Defined in File VorticityConfinement.h
Inheritance Relationships¶
Base Type¶
public SPH::VorticityBase
(Class VorticityBase)
Class Documentation¶
-
class VorticityConfinement : public SPH::VorticityBase¶
This class implements the vorticity confinement method introduced by Macklin and Mueller [MM13].
References:
[MM13] Miles Macklin and Matthias Müller. Position based fluids. ACM Trans. Graph., 32(4):104:1-104:12, July 2013. URL: http://doi.acm.org/10.1145/2461912.2461984
Public Functions
-
VorticityConfinement(FluidModel *model)¶
-
virtual ~VorticityConfinement(void)¶
-
virtual void step()¶
-
virtual void reset()¶
-
virtual void performNeighborhoodSearchSort()¶
- inline FORCE_INLINE const Vector3r & getAngularVelocity (const unsigned int i) const
- inline FORCE_INLINE Vector3r & getAngularVelocity (const unsigned int i)
- inline FORCE_INLINE void setAngularVelocity (const unsigned int i, const Vector3r &val)
Public Static Functions
-
static inline NonPressureForceBase *creator(FluidModel *model)¶
Class WendlandQuinticC2Kernel¶
Defined in File SPHKernels.h
Class WendlandQuinticC2Kernel2D¶
Defined in File SPHKernels.h
Class XSPH¶
Defined in File XSPH.h
Inheritance Relationships¶
Base Type¶
public SPH::NonPressureForceBase
(Class NonPressureForceBase)
Class Documentation¶
-
class XSPH : public SPH::NonPressureForceBase¶
This class implements the XSPH method descibed by J. J. Monaghan [Mon92].
References:
[Mon92] J. J. Monaghan. Smoothed Particle Hydrodynamics. Annual Review of Astronomy and Astrophysics, 1992, 30, 543-574. URL: https://www.annualreviews.org/doi/10.1146/annurev.aa.30.090192.002551
Public Functions
-
XSPH(FluidModel *model)¶
-
virtual ~XSPH(void)¶
-
virtual void step()¶
-
virtual void reset()¶
Protected Functions
-
virtual void initParameters()¶
Class ConsoleSink¶
Defined in File Logger.h
Inheritance Relationships¶
Base Type¶
public Utilities::LogSink
(Class LogSink)
Class Counting¶
Defined in File Counting.h
Class Documentation¶
-
class Counting¶
Public Static Functions
-
static inline void reset()¶
- static inline FORCE_INLINE void increaseCounter (const std::string &name, const Real increaseBy)
- static inline FORCE_INLINE void printAverageCounts ()
- static inline FORCE_INLINE void printCounterSums ()
Public Static Attributes
-
static std::unordered_map<std::string, AverageCount> m_averageCounts¶
-
static inline void reset()¶
Class FileSink¶
Defined in File Logger.h
Inheritance Relationships¶
Base Type¶
public Utilities::LogSink
(Class LogSink)
Class FileSystem¶
Defined in File FileSystem.h
Class Documentation¶
-
class FileSystem¶
This class implements different file system functions.
Public Static Functions
-
static inline std::string getFilePath(const std::string &path)¶
-
static inline std::string getFileName(const std::string &path)¶
-
static inline std::string getFileNameWithExt(const std::string &path)¶
-
static inline std::string getFileExt(const std::string &path)¶
-
static inline bool isRelativePath(const std::string &path)¶
-
static inline int makeDir(const std::string &path)¶
-
static inline int makeDirs(const std::string &path)¶
Make all subdirectories.
-
static inline std::string normalizePath(const std::string &path)¶
-
static inline bool fileExists(const std::string &fileName)¶
-
static inline std::string getProgramPath()¶
-
static inline bool copyFile(const std::string &source, const std::string &dest)¶
-
static inline bool isFile(const std::string &path)¶
-
static inline bool isDirectory(const std::string &path)¶
-
static inline bool getFilesInDirectory(const std::string &path, std::vector<std::string> &res)¶
-
static inline std::string getFileMD5(const std::string &filename)¶
Compute the MD5 hash of a file.
-
static inline bool writeMD5File(const std::string &fileName, const std::string &md5File)¶
Write the MD5 hash of a file to the md5File.
-
static inline bool checkMD5(const std::string &md5Hash, const std::string &md5File)¶
Compare an MD5 hash with the hash stored in an MD5 file.
-
static inline std::string getFilePath(const std::string &path)¶
Class IDFactory¶
Defined in File Timing.h
Class LogSink¶
Defined in File Logger.h
Inheritance Relationships¶
Derived Types¶
public Utilities::ConsoleSink
(Class ConsoleSink)public Utilities::FileSink
(Class FileSink)
Class LogStream¶
Defined in File Logger.h
Class OBJLoader¶
Defined in File OBJLoader.h
Class PartioReaderWriter¶
Defined in File PartioReaderWriter.h
Class Documentation¶
-
class PartioReaderWriter¶
Class for reading and writing partio files.
Public Static Functions
-
static bool readParticles(const std::string &fileName, const Vector3r &translation, const Matrix3r &rotation, const Real scale, std::vector<Vector3r> &pos, std::vector<Vector3r> &vel)¶
-
static bool readParticles(const std::string &fileName, const Vector3r &translation, const Matrix3r &rotation, const Real scale, std::vector<Vector3r> &positions, std::vector<Vector3r> &velocities, Real &particleRadius)¶
-
static bool readParticles(const std::string &fileName, const Vector3r &translation, const Matrix3r &rotation, const Real scale, std::vector<Vector3r> &pos, std::vector<Vector3r> &vel)¶
Class SceneLoader¶
Defined in File SceneLoader.h
Nested Relationships¶
Class Documentation¶
-
class SceneLoader¶
Importer of SPlisHSPlasH scene files.
Public Functions
-
inline nlohmann::json &getJSONData()¶
-
template<typename T, int size>
inline bool readVector(const nlohmann::json &j, Eigen::Matrix<T, size, 1, Eigen::DontAlign> &vec)¶
-
template<typename T>
inline bool readValue(const std::string §ion, const std::string &key, T &v)¶
-
inline bool hasValue(const std::string §ion, const std::string &key)¶
-
template<typename T, int size>
inline bool readVector(const std::string §ion, const std::string &key, Eigen::Matrix<T, size, 1, Eigen::DontAlign> &vec)¶
-
void readMaterialParameterObject(const std::string &key, GenParam::ParameterObject *paramObj)¶
-
void readParameterObject(const std::string &key, GenParam::ParameterObject *paramObj)¶
-
template<>
bool readValue(const nlohmann::json &j, bool &v)¶
-
template<>
bool readValue(const nlohmann::json &j, bool &v)
Protected Functions
-
void readParameterObject(nlohmann::json &config, GenParam::ParameterObject *paramObj)¶
Protected Attributes
-
nlohmann::json m_jsonData¶
-
struct AnimationFieldData¶
Struct to store an animation field object.
-
struct BoundaryData¶
Struct to store a boundary object.
Public Members
-
std::string samplesFile¶
-
std::string meshFile¶
-
bool dynamic¶
-
bool isWall¶
-
Eigen::Matrix<float, 4, 1, Eigen::DontAlign> color¶
-
void *rigidBody¶
-
std::string mapFile¶
-
bool mapInvert¶
-
Eigen::Matrix<unsigned int, 3, 1, Eigen::DontAlign> mapResolution¶
-
unsigned int samplingMode¶
-
bool isAnimated¶
-
std::string samplesFile¶
-
struct Box¶
Struct for an AABB.
-
struct EmitterData¶
Struct to store an emitter object.
-
struct FluidBlock¶
Struct to store a fluid block.
-
struct FluidData¶
Struct to store a fluid object.
-
struct MaterialData¶
Struct to store particle coloring information.
-
struct Scene¶
Struct to store scene information.
Public Members
-
std::vector<BoundaryData*> boundaryModels¶
-
std::vector<FluidBlock*> fluidBlocks¶
-
std::vector<EmitterData*> emitters¶
-
std::vector<AnimationFieldData*> animatedFields¶
-
std::vector<MaterialData*> materials¶
-
bool sim2D¶
-
std::vector<BoundaryData*> boundaryModels¶
-
inline nlohmann::json &getJSONData()¶
Class SceneWriter¶
Defined in File SceneWriter.h
Class Documentation¶
-
class SceneWriter¶
Importer of SPlisHSPlasH scene files.
Public Functions
-
inline SceneWriter(const nlohmann::json &config)¶
-
void writeScene(const char *fileName)¶
-
template<typename T>
inline bool writeVector(nlohmann::json &j, const std::string &key, const Eigen::Matrix<T, 3, 1, Eigen::DontAlign> &vec)¶
-
template<typename T, int size>
inline bool readVector(const std::string §ion, const std::string &key, Eigen::Matrix<T, size, 1, Eigen::DontAlign> &vec)¶
-
void updateMaterialParameterConfig(const std::string &key, GenParam::ParameterObject *paramObj)¶
-
template<typename T>
inline void updateMaterialParameterConfig(const std::string &id, const std::string &key, const T &v)¶
-
void writeParameterObject(const std::string &key, GenParam::ParameterObject *paramObj)¶
Protected Functions
-
void writeParameterObject(nlohmann::json &config, GenParam::ParameterObject *paramObj)¶
Protected Attributes
-
nlohmann::json m_jsonData¶
-
inline SceneWriter(const nlohmann::json &config)¶
Class SDFFunctions¶
Defined in File SDFFunctions.h
Class Documentation¶
-
class SDFFunctions¶
Functions for generating and querying an SDF.
Public Static Functions
-
static Discregrid::CubicLagrangeDiscreteGrid *generateSDF(const unsigned int numVertices, const Vector3r *vertices, const unsigned int numFaces, const unsigned int *faces, const AlignedBox3r &bbox, const std::array<unsigned int, 3> &resolution, const bool invert = false)¶
Generate SDF from mesh.
-
static AlignedBox3r computeBoundingBox(const unsigned int numVertices, const Vector3r *vertices)¶
Compute the bounding box of a mesh.
-
static Discregrid::CubicLagrangeDiscreteGrid *generateSDF(const unsigned int numVertices, const Vector3r *vertices, const unsigned int numFaces, const unsigned int *faces, const AlignedBox3r &bbox, const std::array<unsigned int, 3> &resolution, const bool invert = false)¶
Class StringTools¶
Defined in File StringTools.h
Class Documentation¶
-
class StringTools¶
Tools to handle std::string objects.
Public Static Functions
-
static inline void tokenize(const std::string &str, std::vector<std::string> &tokens, const std::string &delimiters = " ")¶
-
template<typename T>
static inline std::string to_string_with_precision(const T val, const int n = 6)¶ converts a value to a string with a given precistion
-
template<typename T>
static inline std::string real2String(const T r)¶ converts a double or a float to a string
-
static inline std::string to_upper(const std::string &str)¶
-
static inline void tokenize(const std::string &str, std::vector<std::string> &tokens, const std::string &delimiters = " ")¶
Class SystemInfo¶
Defined in File SystemInfo.h
Class Timing¶
Defined in File Timing.h
Class Documentation¶
-
class Timing¶
Class for time measurements.
Public Static Functions
-
static inline void reset()¶
- static inline FORCE_INLINE void startTiming (const std::string &name=std::string(""))
- static inline FORCE_INLINE double stopTiming (bool print=true)
- static inline FORCE_INLINE double stopTiming (bool print, int &id)
- static inline FORCE_INLINE void printAverageTimes ()
- static inline FORCE_INLINE void printTimeSums ()
Public Static Attributes
-
static bool m_dontPrintTimes¶
-
static unsigned int m_startCounter¶
-
static unsigned int m_stopCounter¶
-
static std::stack<TimingHelper> m_timingStack¶
-
static std::unordered_map<int, AverageTime> m_averageTimes¶
-
static inline void reset()¶
Class VolumeSampling¶
Defined in File VolumeSampling.h
Class Documentation¶
-
class VolumeSampling¶
This class implements a volume sampling of 3D models.
Public Static Functions
-
static void sampleMesh(const unsigned int numVertices, const Vector3r *vertices, const unsigned int numFaces, const unsigned int *faces, const Real radius, const AlignedBox3r *region, const std::array<unsigned int, 3> &resolution, const bool invert, const unsigned int sampleMode, std::vector<Vector3r> &samples)¶
Performs the volume sampling with the respective parameters.
- Parameters
numVertices – number of vertices
vertices – vertex data
numFaces – number of faces
faces – index list of faces
radius – radius of sampled particles
region – defines a subregion of the mesh to be sampled (nullptr if not used)
resolution – resolution of the used SDF
invert – defines if the mesh should be inverted and the outside is sampled
sampleMode – 0=regular, 1=almost dense, 2=dense
samples – sampled vertices that will be returned
-
static void sampleMesh(const unsigned int numVertices, const Vector3r *vertices, const unsigned int numFaces, const unsigned int *faces, const Real radius, const AlignedBox3r *region, const std::array<unsigned int, 3> &resolution, const bool invert, const unsigned int sampleMode, std::vector<Vector3r> &samples)¶
Class WindingNumbers¶
Defined in File WindingNumbers.h
Class Documentation¶
-
class WindingNumbers¶
Public Static Functions
-
static Real computeGeneralizedWindingNumber(const Vector3r &p, const Vector3r &a, const Vector3r &b, const Vector3r &c)¶
Determine the winding number for a point p and a triangle abc.
-
static Real computeGeneralizedWindingNumber(const Vector3r &p, const SPH::TriangleMesh &mesh)¶
Determine the winding number of a point p in a triangle mesh.
-
static Real computeGeneralizedWindingNumber(const Vector3r &p, const Vector3r &a, const Vector3r &b, const Vector3r &c)¶
Class Vector3f8¶
Defined in File AVX_math.h
Class Documentation¶
-
class Vector3f8¶
Functions¶
Template Function constant8f¶
Defined in File AVX_math.h
Function getTime¶
Defined in File AnimationField.cpp
Function Documentation¶
-
Real SPH::TimeManager::getTime()
Variables¶
Variable haltonVec323¶
Variable SPH::gaussian_abscissae_1¶
Defined in File GaussQuadrature.cpp
Variable SPH::gaussian_n_1¶
Defined in File GaussQuadrature.cpp
Variable SPH::gaussian_weights_1¶
Defined in File GaussQuadrature.cpp
Variable Utilities::logger¶
Defined in File Logger.h
Defines¶
Define _USE_MATH_DEFINES¶
Defined in File DragForce_Gissler2017.cpp
Define _USE_MATH_DEFINES¶
Defined in File PoissonDiskSampling.cpp
Define Documentation¶
-
_USE_MATH_DEFINES
Define _USE_MATH_DEFINES¶
Defined in File WindingNumbers.cpp
Define Documentation¶
-
_USE_MATH_DEFINES
Define compute_Vj_gradW_samephase¶
Defined in File FluidModel.h
Define forall_boundary_neighbors¶
Defined in File Simulation.h
Define forall_density_maps¶
Defined in File Simulation.h
Define forall_fluid_neighbors¶
Defined in File Simulation.h
Define forall_fluid_neighbors_in_same_phase¶
Defined in File Simulation.h
Define forall_volume_maps¶
Defined in File Simulation.h
Define INCREASE_COUNTER¶
Defined in File Counting.h
Define PD_USE_DIAGONAL_PRECONDITIONER¶
Defined in File TimeStepPF.h
Define RealVectorParameterType¶
Defined in File Common.h
Define USE_BLOCKDIAGONAL_PRECONDITIONER¶
Defined in File Viscosity_Weiler2018.h
Define Vec3Block¶
Defined in File TimeStepPF.cpp
Define Documentation¶
Warning
doxygendefine: Cannot find define “Vec3Block” in doxygen xml output for project “SPlisHSPlasH” from directory: ./doxyoutput/xml
Typedefs¶
Typedef AlignedBox2r¶
Defined in File Common.h
Typedef AlignedBox3r¶
Defined in File Common.h
Typedef AngleAxisr¶
Defined in File Common.h
Typedef AtomicRealVec¶
Defined in File TimeStepPF.cpp
Typedef Documentation¶
Warning
doxygentypedef: Cannot find typedef “AtomicRealVec” in doxygen xml output for project “SPlisHSPlasH” from directory: ./doxyoutput/xml
Typedef Matrix2r¶
Defined in File Common.h
Typedef Matrix3f¶
Defined in File Common.h
Typedef Matrix3r¶
Defined in File Common.h
Typedef Matrix4r¶
Defined in File Common.h
Typedef Matrix5r¶
Defined in File Common.h
Typedef Matrix6r¶
Defined in File Common.h
Typedef MatrixXr¶
Defined in File Common.h
Typedef NeighborhoodSearch¶
Defined in File NeighborhoodSearch.h
Typedef Quaternionr¶
Defined in File Common.h
Typedef SystemMatrixType¶
Defined in File MatrixFreeSolver.h
Typedef Vector2i¶
Defined in File Common.h
Typedef Vector2r¶
Defined in File Common.h
Typedef Vector3f¶
Defined in File Common.h
Typedef Vector3r¶
Defined in File Common.h
Typedef Vector4f¶
Defined in File Common.h
Typedef Vector4r¶
Defined in File Common.h
Typedef Vector5r¶
Defined in File Common.h
Typedef Vector6r¶
Defined in File Common.h
Typedef VectorXr¶
Defined in File Common.h
Typedef Documentation¶
-
using SPH::TimeStepPF::VectorXr = Eigen::Matrix<Real, -1, 1>
References¶
- AAT13
Nadir Akinci, Gizem Akinci, and Matthias Teschner. Versatile surface tension and adhesion for sph fluids. ACM Trans. Graph., 32(6):182:1–182:8, November 2013. URL: http://doi.acm.org/10.1145/2508363.2508395, doi:10.1145/2508363.2508395.
- AIA+12
Nadir Akinci, Markus Ihmsen, Gizem Akinci, Barbara Solenthaler, and Matthias Teschner. Versatile rigid-fluid coupling for incompressible sph. ACM Trans. Graph., 31(4):62:1–62:8, July 2012. URL: http://doi.acm.org/10.1145/2185520.2185558, doi:10.1145/2185520.2185558.
- BIT09
Markus Becker, Markus Ihmsen, and Matthias Teschner. Corotated SPH for deformable solids. In Proceedings of Eurographics Conference on Natural Phenomena, 27–34. 2009. URL: http://dx.doi.org/10.2312EG/DL/conf/EG2009/nph/027-034, doi:10.2312EG/DL/conf/EG2009/nph/027-034.
- BT07
Markus Becker and Matthias Teschner. Weakly compressible sph for free surface flows. In ACM SIGGRAPH/Eurographics Symposium on Computer Animation, SCA ‘07, 209–217. Aire-la-Ville, Switzerland, Switzerland, 2007. Eurographics Association. URL: http://dl.acm.org/citation.cfm?id=1272690.1272719.
- BK15
Jan Bender and Dan Koschier. Divergence-free smoothed particle hydrodynamics. In ACM SIGGRAPH / Eurographics Symposium on Computer Animation, SCA ‘15, 147–155. New York, NY, USA, 2015. ACM. URL: http://doi.acm.org/10.1145/2786784.2786796, doi:10.1145/2786784.2786796.
- BK17
Jan Bender and Dan Koschier. Divergence-free sph for incompressible and viscous fluids. IEEE Transactions on Visualization and Computer Graphics, 23(3):1193–1206, 2017. URL: http://dx.doi.org/10.1109/TVCG.2016.2578335, doi:10.1109/TVCG.2016.2578335.
- BKKW17
Jan Bender, Dan Koschier, Tassilo Kugelstadt, and Marcel Weiler. A micropolar material model for turbulent sph fluids. In ACM SIGGRAPH / Eurographics Symposium on Computer Animation, SCA ‘17. ACM, 2017. URL: http://doi.acm.org/10.1145/3099564.3099578, doi:10.1145/3099564.3099578.
- BKWK19
Jan Bender, Tassilo Kugelstadt, Marcel Weiler, and Dan Koschier. Volume maps: an implicit boundary representation for sph. In Proceedings of ACM SIGGRAPH Conference on Motion, Interaction and Games, MIG ‘19. ACM, 2019. URL: https://dl.acm.org/doi/10.1145/3359566.3360077, doi:10.1145/3359566.3360077.
- BMullerM15
Jan Bender, Matthias Müller, and Miles Macklin. Position-based simulation methods in computer graphics. In EUROGRAPHICS 2015 Tutorials. Eurographics Association, 2015. URL: http://dx.doi.org/10.2312/egt.20151045, doi:10.2312/egt.20151045.
- BMullerO+14
Jan Bender, Matthias Müller, Miguel A. Otaduy, Matthias Teschner, and Miles Macklin. A survey on position-based simulation methods in computer graphics. Computer Graphics Forum, 33(6):228–251, 2014. URL: http://dx.doi.org/10.1111/cgf.12346, doi:10.1111/cgf.12346.
- DCB14
Crispin Deul, Patrick Charrier, and Jan Bender. Position-based rigid body dynamics. Computer Animation and Virtual Worlds, 2014. URL: http://dx.doi.org/10.1002/cav.1614, doi:10.1002/cav.1614.
- GBP+17
Christoph Gissler, Stefan Band, Andreas Peer, Markus Ihmsen, and Matthias Teschner. Approximate air-fluid interactions for sph. In Virtual Reality Interactions and Physical Simulations, 1–10. April 2017. URL: http://dx.doi.org/10.2312/vriphys.20171081, doi:10.2312/vriphys.20171081.
- HWZ+14
Xiaowei He, Huamin Wang, Fengjun Zhang, Hongan Wang, Guoping Wang, and Kun Zhou. Robust simulation of sparsely sampled thin features in sph-based free surface flows. ACM Trans. Graph., 34(1):7:1–7:9, December 2014. URL: http://doi.acm.org/10.1145/2682630, doi:10.1145/2682630.
- ICS+14
Markus Ihmsen, Jens Cornelis, Barbara Solenthaler, Christopher Horvath, and Matthias Teschner. Implicit incompressible sph. IEEE Transactions on Visualization and Computer Graphics, 20(3):426–435, March 2014. URL: http://dx.doi.org/10.1109/TVCG.2013.105, doi:10.1109/TVCG.2013.105.
- IOS+14
Markus Ihmsen, Jens Orthmann, Barbara Solenthaler, Andreas Kolb, and Matthias Teschner. SPH Fluids in Computer Graphics. In Sylvain Lefebvre and Michela Spagnuolo, editors, Eurographics 2014 - State of the Art Reports. The Eurographics Association, 2014. URL: http://dx.doi.org/10.2312/egst.20141034, doi:10.2312/egst.20141034.
- JZW+15
Min Jiang, Yahan Zhou, Rui Wang, Richard Southern, and Jian Jun Zhang. Blue noise sampling using an sph-based method. ACM Transactions on Graphics (TOG), 34(6):1–11, 2015.
- KB17
Dan Koschier and Jan Bender. Density maps for improved sph boundary handling. In ACM SIGGRAPH/Eurographics Symposium on Computer Animation, 1–10. July 2017. URL: http://dx.doi.org/10.1145/3099564.3099565, doi:10.1145/3099564.3099565.
- KBST19
Dan Koschier, Jan Bender, Barbara Solenthaler, and Matthias Teschner. Smoothed particle hydrodynamics for physically-based simulation of fluids and solids. In Eurographics 2019 - Tutorials. Eurographics Association, 2019. URL: https://interactivecomputergraphics.github.io/SPH-Tutorial, doi:10.2312/egt.20191035.
- KBFernandezFernandez+21
Tassilo Kugelstadt, Jan Bender, José Antonio Fernández-Fernández, Stefan Rhys Jeske, Fabian Löschner, and Andreas Longva. Fast corotated elastic sph solids with implicit zero-energy mode control. Proc. ACM Comput. Graph. Interact. Tech., 2021.
- MMuller13
Miles Macklin and Matthias Müller. Position based fluids. ACM Trans. Graph., 32(4):104:1–104:12, July 2013. URL: http://doi.acm.org/10.1145/2461912.2461984, doi:10.1145/2461912.2461984.
- MMullerCK14
Miles Macklin, Matthias Müller, Nuttapong Chentanez, and Tae-Yong Kim. Unified Particle Physics for Real-Time Applications. ACM Trans. Graph., 33(4):1–12, 2014. URL: http://doi.acm.org/10.1145/2601097.2601152, doi:10.1145/2601097.2601152.
- PICT15
A. Peer, M. Ihmsen, J. Cornelis, and M. Teschner. An Implicit Viscosity Formulation for SPH Fluids. ACM Trans. Graph., 34(4):1–10, 2015. URL: http://doi.acm.org/10.1145/2766925, doi:10.1145/2766925.
- PGBT17
Andreas Peer, Christoph Gissler, Stefan Band, and Matthias Teschner. An implicit sph formulation for incompressible linearly elastic solids. Computer Graphics Forum, 2017. URL: http://dx.doi.org/10.1111/cgf.13317, doi:10.1111/cgf.13317.
- PT16
Andreas Peer and Matthias Teschner. Prescribed velocity gradients for highly viscous SPH fluids with vorticity diffusion. IEEE Transactions on Visualization and Computer Graphics, pages 1–9, 2016. URL: http://dx.doi.org/10.1109/tvcg.2016.2636144, doi:10.1109/tvcg.2016.2636144.
- SB12
Hagit Schechter and Robert Bridson. Ghost sph for animating water. ACM Trans. Graph., 31(4):61:1–61:8, July 2012. URL: http://doi.acm.org/10.1145/2185520.2185557, doi:10.1145/2185520.2185557.
- SP09
B. Solenthaler and R. Pajarola. Predictive-corrective incompressible sph. ACM Trans. Graph., 28(3):40:1–40:6, July 2009. URL: http://doi.acm.org/10.1145/1531326.1531346, doi:10.1145/1531326.1531346.
- TDF+15
T. Takahashi, Y. Dobashi, I. Fujishiro, T. Nishita, and M.C. Lin. Implicit Formulation for SPH-based Viscous Fluids. Computer Graphics Forum, 34(2):493–502, 2015. URL: http://dx.doi.org/10.1111/cgf.12578, doi:10.1111/cgf.12578.
- WKB16
Marcel Weiler, Dan Koschier, and Jan Bender. Projective fluids. In Proceedings of the 9th International Conference on Motion in Games, MIG ‘16, 79–84. New York, NY, USA, 2016. ACM. URL: http://doi.acm.org/10.1145/2994258.2994282, doi:10.1145/2994258.2994282.
- WKBB18
Marcel Weiler, Dan Koschier, Magnus Brand, and Jan Bender. A physically consistent implicit viscosity solver for sph fluids. Computer Graphics Forum (Eurographics), 2018. URL: https://doi.org/10.1111/cgf.13349, doi:10.1111/cgf.13349.