Skip to content

Commit cb45119

Browse files
committed
- added support of embedded Python scripts (must be activated in CMake)
- added possibility to animate rigid bodies in Python - added Implicit Compressible SPH pressure solver by Gissler et al. 2020 - fixed bug in AnimationField (thanks to Lukas Westhofen) - improved stability of volume maps
1 parent 1f9ab8a commit cb45119

File tree

79 files changed

+2894
-247
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

79 files changed

+2894
-247
lines changed

Changelog.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
2.10.0
2+
- added support of embedded Python scripts (must be activated in CMake)
3+
- added possibility to animate rigid bodies in Python
4+
- added Implicit Compressible SPH pressure solver by Gissler et al. 2020
5+
- fixed bug in AnimationField (thanks to Lukas Westhofen)
6+
- improved stability of volume maps
7+
18
2.9.2
29
- added ParaView partio plugin
310
- extended tooltips by json key

GUI/OpenGL/Selection.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,9 @@ namespace SPH
111111
}
112112
index++;
113113

114-
posIter++;
115114
if (posIter == posEnd)
116115
break;
116+
posIter++;
117117
}
118118
}
119119
};

GUI/imgui/imguiParameters.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ void imguiParameters::createSubgroupParameters(const std::vector<std::pair<std::
188188
std::string helpText = param->description;
189189
if (param->readOnly)
190190
helpText += " (read-only)";
191-
else if (param->name != "")
191+
else if ((param->name != "") && (dynamic_cast<imguiParameters::imguiFunctionParameter*>(param) == nullptr)) // no key help text for function parameters
192192
helpText += "\n\nkey in scene file:\n" + param->name;
193193

194194
ImGuiInputTextFlags flags = 0;
@@ -287,7 +287,8 @@ void imguiParameters::createParameterObjectGUI(ParameterObject* paramObj)
287287
std::string group = paramBase->getGroup();
288288
std::string subgroup = "";
289289
if ((group == "WCSPH") || (group == "PCISPH") || (group == "PBF") ||
290-
(group == "IISPH") || (group == "DFSPH") || (group == "PF") ||
290+
(group == "IISPH") || (group == "DFSPH") || (group == "PF") ||
291+
(group == "ICSPH") ||
291292
(group == "CFL") || (group == "Kernel"))
292293
{
293294
subgroup = group;

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ SPlisHSPlasH implements:
5959
* neighborhood search on CPU or GPU
6060
* supports vectorization using AVX
6161
* Python binding (thanks to Stefan Jeske)
62+
* supports embedded Python scripts
6263
* several implicit pressure solvers (WCSPH, PCISPH, PBF, IISPH, DFSPH, PF)
6364
* explicit and implicit viscosity methods
6465
* current surface tension approaches
@@ -88,6 +89,7 @@ The SPlisHSPlasH library implements the following pressure solvers:
8889
* Implicit incompressible SPH (IISPH)
8990
* Divergence-free smoothed particle hydrodynamics (DFSPH)
9091
* Projective Fluids (PF)
92+
* Implicit compressible SPH (ICSPH)
9193

9294
## Boundary Handling
9395

@@ -192,6 +194,7 @@ The following videos were generated using the SPlisHSPlasH library:
192194
* 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.
193195
* Jan Bender, Matthias Müller, and Miles Macklin. Position-based simulation methods in computer graphics. In EUROGRAPHICS 2015 Tutorials. Eurographics Association, 2015.
194196
* Christoph Gissler, Stefan Band, Andreas Peer, Markus Ihmsen and Matthias Teschner. Approximate Air-Fluid Interactions for SPH. In Proceedings of Virtual Reality Interactions and Physical Simulations, 2017
197+
* C. Gissler, A. Henne, S. Band, A. Peer and M. Teschner. An Implicit Compressible SPH Solver for Snow Simulation, ACM Transactions on Graphics 39(4), 2020.
195198
* 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.
196199
* 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.
197200
* Markus Ihmsen, Jens Orthmann, Barbara Solenthaler, Andreas Kolb, and Matthias Teschner. SPH Fluids in Computer Graphics. In Eurographics 2014 - State of the Art Reports. The Eurographics Association, 2014.

SPlisHSPlasH/AnimationField.cpp

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,13 +75,22 @@ void AnimationField::step()
7575
{
7676
const Vector3r &xi = fm->getPosition(i);
7777
const Vector3r &vi = fm->getVelocity(i);
78+
79+
const Eigen::Vector3d xi_double = xi.cast<double>();
80+
const Eigen::Vector3d vi_double = vi.cast<double>();
81+
7882
if (inShape(m_type, xi, m_x, m_rotation, m_scale))
7983
{
8084
Eigen::Map<Vector3r> value((Real*) particleField->getFct(i));
81-
te_variable vars[] = { {"t", &t}, {"dt", &dt},
82-
{"x", &xi[0]}, {"y", &xi[1]}, {"z", &xi[2]},
83-
{"vx", &vi[0]}, {"vy", &vi[1]}, {"vz", &vi[2]},
84-
{"valuex", &value[0]}, {"valuey", &value[1]}, {"valuez", &value[2]},
85+
const Eigen::Vector3d value_double = Vector3r(value).cast<double>();
86+
87+
const double t_double = static_cast<double>(t);
88+
const double dt_double = static_cast<double>(dt);
89+
90+
te_variable vars[] = { {"t", &t_double}, {"dt", &dt_double},
91+
{"x", &xi_double[0]}, {"y", &xi_double[1]}, {"z", &xi_double[2]},
92+
{"vx", &vi_double[0]}, {"vy", &vi_double[1]}, {"vz", &vi_double[2]},
93+
{"valuex", &value_double[0]}, {"valuey", &value_double[1]}, {"valuez", &value_double[2]},
8594
};
8695
const int numVars = 11;
8796
int err;

SPlisHSPlasH/BoundaryModel.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ namespace SPH
7777

7878
FORCE_INLINE void getPointVelocity(const Vector3r &x, Vector3r &res)
7979
{
80-
if (m_rigidBody->isDynamic())
80+
if (m_rigidBody->isDynamic() || m_rigidBody->isAnimated())
8181
res = m_rigidBody->getAngularVelocity().cross(x - m_rigidBody->getPosition()) + m_rigidBody->getVelocity();
8282
else
8383
res.setZero();

SPlisHSPlasH/BoundaryModel_Akinci2012.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ void BoundaryModel_Akinci2012::reset()
3434

3535
// Note:
3636
// positions and velocities are already updated by updateBoundaryParticles
37-
if (!m_rigidBody->isDynamic())
37+
if (!m_rigidBody->isDynamic() && !m_rigidBody->isAnimated())
3838
{
3939
// reset velocities and accelerations
4040
for (int j = 0; j < (int)numberOfParticles(); j++)
@@ -106,15 +106,15 @@ void BoundaryModel_Akinci2012::initModel(RigidBodyObject *rbo, const unsigned in
106106
m_rigidBody = rbo;
107107

108108
NeighborhoodSearch *neighborhoodSearch = Simulation::getCurrent()->getNeighborhoodSearch();
109-
m_pointSetIndex = neighborhoodSearch->add_point_set(&m_x[0][0], m_x.size(), m_rigidBody->isDynamic(), false, true, this);
109+
m_pointSetIndex = neighborhoodSearch->add_point_set(&m_x[0][0], m_x.size(), m_rigidBody->isDynamic() || m_rigidBody->isAnimated(), false, true, this);
110110
}
111111

112112
void BoundaryModel_Akinci2012::performNeighborhoodSearchSort()
113113
{
114114
const unsigned int numPart = numberOfParticles();
115115

116116
// sort static boundaries only once
117-
if ((numPart == 0) || (!m_rigidBody->isDynamic() && m_sorted))
117+
if ((numPart == 0) || (!m_rigidBody->isDynamic() && !m_rigidBody->isAnimated() && m_sorted))
118118
return;
119119

120120
NeighborhoodSearch *neighborhoodSearch = Simulation::getCurrent()->getNeighborhoodSearch();

SPlisHSPlasH/CMakeLists.txt

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,16 @@ set(PF_SOURCE_FILES
6060
PF/TimeStepPF.cpp
6161
)
6262

63+
set(ICSPH_HEADER_FILES
64+
ICSPH/SimulationDataICSPH.h
65+
ICSPH/TimeStepICSPH.h
66+
)
67+
68+
set(ICSPH_SOURCE_FILES
69+
ICSPH/SimulationDataICSPH.cpp
70+
ICSPH/TimeStepICSPH.cpp
71+
)
72+
6373
set(SURFACETENSION_HEADER_FILES
6474
SurfaceTension/SurfaceTensionBase.h
6575
SurfaceTension/SurfaceTension_Becker2007.h
@@ -231,6 +241,9 @@ add_library(SPlisHSPlasH
231241
${PF_HEADER_FILES}
232242
${PF_SOURCE_FILES}
233243

244+
${ICSPH_HEADER_FILES}
245+
${ICSPH_SOURCE_FILES}
246+
234247
${VISCOSITY_HEADER_FILES}
235248
${VISCOSITY_SOURCE_FILES}
236249

@@ -284,6 +297,8 @@ source_group("Header Files\\DFSPH" FILES ${DFSPH_HEADER_FILES})
284297
source_group("Source Files\\DFSPH" FILES ${DFSPH_SOURCE_FILES})
285298
source_group("Header Files\\PF" FILES ${PF_HEADER_FILES})
286299
source_group("Source Files\\PF" FILES ${PF_SOURCE_FILES})
300+
source_group("Header Files\\ICSPH" FILES ${ICSPH_HEADER_FILES})
301+
source_group("Source Files\\ICSPH" FILES ${ICSPH_SOURCE_FILES})
287302
source_group("Header Files\\Viscosity" FILES ${VISCOSITY_HEADER_FILES})
288303
source_group("Source Files\\Viscosity" FILES ${VISCOSITY_SOURCE_FILES})
289304
source_group("Header Files\\SurfaceTension" FILES ${SURFACETENSION_HEADER_FILES})

SPlisHSPlasH/DFSPH/SimulationDataDFSPH.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,10 @@ void SimulationDataDFSPH::performNeighborhoodSearchSort()
8383
if (numPart != 0)
8484
{
8585
auto const& d = sim->getNeighborhoodSearch()->point_set(fm->getPointSetIndex());
86-
d.sort_field(&m_factor[i][0]);
86+
//d.sort_field(&m_factor[i][0]);
8787
d.sort_field(&m_kappa[i][0]);
8888
d.sort_field(&m_kappaV[i][0]);
89-
d.sort_field(&m_density_adv[i][0]);
89+
//d.sort_field(&m_density_adv[i][0]);
9090
}
9191
}
9292
}

SPlisHSPlasH/FluidModel.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ namespace SPH
7070
name(n), type(t), getFct(fct), storeData(s) { }
7171
};
7272

73-
enum class ParticleState { Active = 0, AnimatedByEmitter, AnimatedByVM };
73+
enum class ParticleState { Active = 0, AnimatedByEmitter };
7474

7575
/** \brief The fluid model stores the particle and simulation information
7676
*/

0 commit comments

Comments
 (0)