Fluid: Optimization for smoke simulation (multigrid)

The solver will now automatically detect static scenes (no moving obstacles) and use a slightly faster pressure solve in those cases.
This commit is contained in:
Sebastián Barschkis
2020-03-07 19:56:51 +01:00
parent 9867a82072
commit 5539b68009
3 changed files with 9 additions and 2 deletions

View File

@@ -1171,6 +1171,11 @@ void solvePressureSystem(Grid<Real> &rhs,
maxIter = 100;
pmg = gMapMG[parent];
// Release MG from previous step if present (e.g. if previous solve was with MGStatic)
if (pmg && preconditioner == PcMGDynamic) {
releaseMG(parent);
pmg = nullptr;
}
if (!pmg) {
pmg = new GridMg(pressure.getSize());
gMapMG[parent] = pmg;