diff options
Diffstat (limited to 'extern/mantaflow/preprocessed')
-rw-r--r-- | extern/mantaflow/preprocessed/gitinfo.h | 2 | ||||
-rw-r--r-- | extern/mantaflow/preprocessed/grid.cpp | 153 | ||||
-rw-r--r-- | extern/mantaflow/preprocessed/grid.h | 60 | ||||
-rw-r--r-- | extern/mantaflow/preprocessed/grid.h.reg.cpp | 172 | ||||
-rw-r--r-- | extern/mantaflow/preprocessed/particle.h | 62 | ||||
-rw-r--r-- | extern/mantaflow/preprocessed/plugin/extforces.cpp | 28 | ||||
-rw-r--r-- | extern/mantaflow/preprocessed/plugin/secondaryparticles.cpp | 48 |
7 files changed, 380 insertions, 145 deletions
diff --git a/extern/mantaflow/preprocessed/gitinfo.h b/extern/mantaflow/preprocessed/gitinfo.h index 208d8008a7e..023974fd6cd 100644 --- a/extern/mantaflow/preprocessed/gitinfo.h +++ b/extern/mantaflow/preprocessed/gitinfo.h @@ -1,3 +1,3 @@ -#define MANTA_GIT_VERSION "commit 5fbd3d04381b21afce4a593d1fe2d9bc7bef5424" +#define MANTA_GIT_VERSION "commit b61bf9efa7a1d8ca98635076a7e9f2c4dacb2914" diff --git a/extern/mantaflow/preprocessed/grid.cpp b/extern/mantaflow/preprocessed/grid.cpp index f10052349d5..0ea3afb91f4 100644 --- a/extern/mantaflow/preprocessed/grid.cpp +++ b/extern/mantaflow/preprocessed/grid.cpp @@ -853,6 +853,147 @@ template<class T> struct knPermuteAxes : public KernelBase { int axis2; }; +struct knJoinVec : public KernelBase { + knJoinVec(Grid<Vec3> &a, const Grid<Vec3> &b, bool keepMax) + : KernelBase(&a, 0), a(a), b(b), keepMax(keepMax) + { + runMessage(); + run(); + } + inline void op(IndexInt idx, Grid<Vec3> &a, const Grid<Vec3> &b, bool keepMax) const + { + Real a1 = normSquare(a[idx]); + Real b1 = normSquare(b[idx]); + a[idx] = (keepMax) ? max(a1, b1) : min(a1, b1); + } + inline Grid<Vec3> &getArg0() + { + return a; + } + typedef Grid<Vec3> type0; + inline const Grid<Vec3> &getArg1() + { + return b; + } + typedef Grid<Vec3> type1; + inline bool &getArg2() + { + return keepMax; + } + typedef bool type2; + void runMessage() + { + debMsg("Executing kernel knJoinVec ", 3); + debMsg("Kernel range" + << " x " << maxX << " y " << maxY << " z " << minZ << " - " << maxZ << " ", + 4); + }; + void operator()(const tbb::blocked_range<IndexInt> &__r) const + { + for (IndexInt idx = __r.begin(); idx != (IndexInt)__r.end(); idx++) + op(idx, a, b, keepMax); + } + void run() + { + tbb::parallel_for(tbb::blocked_range<IndexInt>(0, size), *this); + } + Grid<Vec3> &a; + const Grid<Vec3> &b; + bool keepMax; +}; +struct knJoinInt : public KernelBase { + knJoinInt(Grid<int> &a, const Grid<int> &b, bool keepMax) + : KernelBase(&a, 0), a(a), b(b), keepMax(keepMax) + { + runMessage(); + run(); + } + inline void op(IndexInt idx, Grid<int> &a, const Grid<int> &b, bool keepMax) const + { + a[idx] = (keepMax) ? max(a[idx], b[idx]) : min(a[idx], b[idx]); + } + inline Grid<int> &getArg0() + { + return a; + } + typedef Grid<int> type0; + inline const Grid<int> &getArg1() + { + return b; + } + typedef Grid<int> type1; + inline bool &getArg2() + { + return keepMax; + } + typedef bool type2; + void runMessage() + { + debMsg("Executing kernel knJoinInt ", 3); + debMsg("Kernel range" + << " x " << maxX << " y " << maxY << " z " << minZ << " - " << maxZ << " ", + 4); + }; + void operator()(const tbb::blocked_range<IndexInt> &__r) const + { + for (IndexInt idx = __r.begin(); idx != (IndexInt)__r.end(); idx++) + op(idx, a, b, keepMax); + } + void run() + { + tbb::parallel_for(tbb::blocked_range<IndexInt>(0, size), *this); + } + Grid<int> &a; + const Grid<int> &b; + bool keepMax; +}; +struct knJoinReal : public KernelBase { + knJoinReal(Grid<Real> &a, const Grid<Real> &b, bool keepMax) + : KernelBase(&a, 0), a(a), b(b), keepMax(keepMax) + { + runMessage(); + run(); + } + inline void op(IndexInt idx, Grid<Real> &a, const Grid<Real> &b, bool keepMax) const + { + a[idx] = (keepMax) ? max(a[idx], b[idx]) : min(a[idx], b[idx]); + } + inline Grid<Real> &getArg0() + { + return a; + } + typedef Grid<Real> type0; + inline const Grid<Real> &getArg1() + { + return b; + } + typedef Grid<Real> type1; + inline bool &getArg2() + { + return keepMax; + } + typedef bool type2; + void runMessage() + { + debMsg("Executing kernel knJoinReal ", 3); + debMsg("Kernel range" + << " x " << maxX << " y " << maxY << " z " << minZ << " - " << maxZ << " ", + 4); + }; + void operator()(const tbb::blocked_range<IndexInt> &__r) const + { + for (IndexInt idx = __r.begin(); idx != (IndexInt)__r.end(); idx++) + op(idx, a, b, keepMax); + } + void run() + { + tbb::parallel_for(tbb::blocked_range<IndexInt>(0, size), *this); + } + Grid<Real> &a; + const Grid<Real> &b; + bool keepMax; +}; + template<class T> Grid<T> &Grid<T>::safeDivide(const Grid<T> &a) { knGridSafeDiv<T>(*this, a); @@ -928,6 +1069,18 @@ void Grid<T>::permuteAxesCopyToGrid(int axis0, int axis1, int axis2, Grid<T> &ou "Permuted grids must have the same dimensions!"); knPermuteAxes<T>(*this, out, axis0, axis1, axis2); } +template<> void Grid<Vec3>::join(const Grid<Vec3> &a, bool keepMax) +{ + knJoinVec(*this, a, keepMax); +} +template<> void Grid<int>::join(const Grid<int> &a, bool keepMax) +{ + knJoinInt(*this, a, keepMax); +} +template<> void Grid<Real>::join(const Grid<Real> &a, bool keepMax) +{ + knJoinReal(*this, a, keepMax); +} template<> Real Grid<Real>::getMax() const { diff --git a/extern/mantaflow/preprocessed/grid.h b/extern/mantaflow/preprocessed/grid.h index 6abe3a2b08a..fe386cfc269 100644 --- a/extern/mantaflow/preprocessed/grid.h +++ b/extern/mantaflow/preprocessed/grid.h @@ -966,10 +966,38 @@ template<class T> class Grid : public GridBase { } } + //! join other grid by either keeping min or max value at cell + void join(const Grid<T> &a, bool keepMax = true); + static PyObject *_W_27(PyObject *_self, PyObject *_linargs, PyObject *_kwds) + { + try { + PbArgs _args(_linargs, _kwds); + Grid *pbo = dynamic_cast<Grid *>(Pb::objFromPy(_self)); + bool noTiming = _args.getOpt<bool>("notiming", -1, 0); + pbPreparePlugin(pbo->getParent(), "Grid::join", !noTiming); + PyObject *_retval = 0; + { + ArgLocker _lock; + const Grid<T> &a = *_args.getPtr<Grid<T>>("a", 0, &_lock); + bool keepMax = _args.getOpt<bool>("keepMax", 1, true, &_lock); + pbo->_args.copy(_args); + _retval = getPyNone(); + pbo->join(a, keepMax); + pbo->_args.check(); + } + pbFinalizePlugin(pbo->getParent(), "Grid::join", !noTiming); + return _retval; + } + catch (std::exception &e) { + pbSetError("Grid::join", e.what()); + return 0; + } + } + // common compound operators //! get absolute max value in grid Real getMaxAbs() const; - static PyObject *_W_27(PyObject *_self, PyObject *_linargs, PyObject *_kwds) + static PyObject *_W_28(PyObject *_self, PyObject *_linargs, PyObject *_kwds) { try { PbArgs _args(_linargs, _kwds); @@ -994,7 +1022,7 @@ template<class T> class Grid : public GridBase { //! get max value in grid Real getMax() const; - static PyObject *_W_28(PyObject *_self, PyObject *_linargs, PyObject *_kwds) + static PyObject *_W_29(PyObject *_self, PyObject *_linargs, PyObject *_kwds) { try { PbArgs _args(_linargs, _kwds); @@ -1019,7 +1047,7 @@ template<class T> class Grid : public GridBase { //! get min value in grid Real getMin() const; - static PyObject *_W_29(PyObject *_self, PyObject *_linargs, PyObject *_kwds) + static PyObject *_W_30(PyObject *_self, PyObject *_linargs, PyObject *_kwds) { try { PbArgs _args(_linargs, _kwds); @@ -1044,7 +1072,7 @@ template<class T> class Grid : public GridBase { //! calculate L1 norm of grid content Real getL1(int bnd = 0); - static PyObject *_W_30(PyObject *_self, PyObject *_linargs, PyObject *_kwds) + static PyObject *_W_31(PyObject *_self, PyObject *_linargs, PyObject *_kwds) { try { PbArgs _args(_linargs, _kwds); @@ -1070,7 +1098,7 @@ template<class T> class Grid : public GridBase { //! calculate L2 norm of grid content Real getL2(int bnd = 0); - static PyObject *_W_31(PyObject *_self, PyObject *_linargs, PyObject *_kwds) + static PyObject *_W_32(PyObject *_self, PyObject *_linargs, PyObject *_kwds) { try { PbArgs _args(_linargs, _kwds); @@ -1096,7 +1124,7 @@ template<class T> class Grid : public GridBase { //! set all boundary cells to constant value (Dirichlet) void setBound(T value, int boundaryWidth = 1); - static PyObject *_W_32(PyObject *_self, PyObject *_linargs, PyObject *_kwds) + static PyObject *_W_33(PyObject *_self, PyObject *_linargs, PyObject *_kwds) { try { PbArgs _args(_linargs, _kwds); @@ -1124,7 +1152,7 @@ template<class T> class Grid : public GridBase { //! set all boundary cells to last inner value (Neumann) void setBoundNeumann(int boundaryWidth = 1); - static PyObject *_W_33(PyObject *_self, PyObject *_linargs, PyObject *_kwds) + static PyObject *_W_34(PyObject *_self, PyObject *_linargs, PyObject *_kwds) { try { PbArgs _args(_linargs, _kwds); @@ -1151,7 +1179,7 @@ template<class T> class Grid : public GridBase { //! get data pointer of grid std::string getDataPointer(); - static PyObject *_W_34(PyObject *_self, PyObject *_linargs, PyObject *_kwds) + static PyObject *_W_35(PyObject *_self, PyObject *_linargs, PyObject *_kwds) { try { PbArgs _args(_linargs, _kwds); @@ -1176,7 +1204,7 @@ template<class T> class Grid : public GridBase { //! debugging helper, print grid from python. skip boundary of width bnd void printGrid(int zSlice = -1, bool printIndex = false, int bnd = 1); - static PyObject *_W_35(PyObject *_self, PyObject *_linargs, PyObject *_kwds) + static PyObject *_W_36(PyObject *_self, PyObject *_linargs, PyObject *_kwds) { try { PbArgs _args(_linargs, _kwds); @@ -1244,7 +1272,7 @@ class MACGrid : public Grid<Vec3> { { mType = (GridType)(TypeMAC | TypeVec3); } - static int _W_36(PyObject *_self, PyObject *_linargs, PyObject *_kwds) + static int _W_37(PyObject *_self, PyObject *_linargs, PyObject *_kwds) { PbClass *obj = Pb::objFromPy(_self); if (obj) @@ -1326,7 +1354,7 @@ class MACGrid : public Grid<Vec3> { //! set all boundary cells of a MAC grid to certain value (Dirchlet). Respects staggered grid //! locations optionally, only set normal components void setBoundMAC(Vec3 value, int boundaryWidth, bool normalOnly = false); - static PyObject *_W_37(PyObject *_self, PyObject *_linargs, PyObject *_kwds) + static PyObject *_W_38(PyObject *_self, PyObject *_linargs, PyObject *_kwds) { try { PbArgs _args(_linargs, _kwds); @@ -1367,7 +1395,7 @@ class FlagGrid : public Grid<int> { { mType = (GridType)(TypeFlags | TypeInt); } - static int _W_38(PyObject *_self, PyObject *_linargs, PyObject *_kwds) + static int _W_39(PyObject *_self, PyObject *_linargs, PyObject *_kwds) { PbClass *obj = Pb::objFromPy(_self); if (obj) @@ -1547,7 +1575,7 @@ class FlagGrid : public Grid<int> { const std::string &inflow = " ", const std::string &outflow = " ", Grid<Real> *phiWalls = 0x00); - static PyObject *_W_39(PyObject *_self, PyObject *_linargs, PyObject *_kwds) + static PyObject *_W_40(PyObject *_self, PyObject *_linargs, PyObject *_kwds) { try { PbArgs _args(_linargs, _kwds); @@ -1581,7 +1609,7 @@ class FlagGrid : public Grid<int> { //! set fluid flags inside levelset (liquids) void updateFromLevelset(LevelsetGrid &levelset); - static PyObject *_W_40(PyObject *_self, PyObject *_linargs, PyObject *_kwds) + static PyObject *_W_41(PyObject *_self, PyObject *_linargs, PyObject *_kwds) { try { PbArgs _args(_linargs, _kwds); @@ -1608,7 +1636,7 @@ class FlagGrid : public Grid<int> { //! set all cells (except obs/in/outflow) to type (fluid by default) void fillGrid(int type = TypeFluid); - static PyObject *_W_41(PyObject *_self, PyObject *_linargs, PyObject *_kwds) + static PyObject *_W_42(PyObject *_self, PyObject *_linargs, PyObject *_kwds) { try { PbArgs _args(_linargs, _kwds); @@ -1637,7 +1665,7 @@ class FlagGrid : public Grid<int> { //! warning for large grids! only regular int returned (due to python interface) //! optionally creates mask in RealGrid (1 where flag matches, 0 otherwise) int countCells(int flag, int bnd = 0, Grid<Real> *mask = NULL); - static PyObject *_W_42(PyObject *_self, PyObject *_linargs, PyObject *_kwds) + static PyObject *_W_43(PyObject *_self, PyObject *_linargs, PyObject *_kwds) { try { PbArgs _args(_linargs, _kwds); diff --git a/extern/mantaflow/preprocessed/grid.h.reg.cpp b/extern/mantaflow/preprocessed/grid.h.reg.cpp index 70c4d8de453..9fe3e7298fa 100644 --- a/extern/mantaflow/preprocessed/grid.h.reg.cpp +++ b/extern/mantaflow/preprocessed/grid.h.reg.cpp @@ -8,11 +8,11 @@ namespace Manta { #ifdef _C_FlagGrid static const Pb::Register _R_26("FlagGrid", "FlagGrid", "Grid<int>"); template<> const char *Namify<FlagGrid>::S = "FlagGrid"; -static const Pb::Register _R_27("FlagGrid", "FlagGrid", FlagGrid::_W_38); -static const Pb::Register _R_28("FlagGrid", "initDomain", FlagGrid::_W_39); -static const Pb::Register _R_29("FlagGrid", "updateFromLevelset", FlagGrid::_W_40); -static const Pb::Register _R_30("FlagGrid", "fillGrid", FlagGrid::_W_41); -static const Pb::Register _R_31("FlagGrid", "countCells", FlagGrid::_W_42); +static const Pb::Register _R_27("FlagGrid", "FlagGrid", FlagGrid::_W_39); +static const Pb::Register _R_28("FlagGrid", "initDomain", FlagGrid::_W_40); +static const Pb::Register _R_29("FlagGrid", "updateFromLevelset", FlagGrid::_W_41); +static const Pb::Register _R_30("FlagGrid", "fillGrid", FlagGrid::_W_42); +static const Pb::Register _R_31("FlagGrid", "countCells", FlagGrid::_W_43); #endif #ifdef _C_Grid static const Pb::Register _R_32("Grid<int>", "Grid<int>", "GridBase"); @@ -35,92 +35,95 @@ static const Pb::Register _R_47("Grid<int>", "clamp", Grid<int>::_W_23); static const Pb::Register _R_48("Grid<int>", "stomp", Grid<int>::_W_24); static const Pb::Register _R_49("Grid<int>", "permuteAxes", Grid<int>::_W_25); static const Pb::Register _R_50("Grid<int>", "permuteAxesCopyToGrid", Grid<int>::_W_26); -static const Pb::Register _R_51("Grid<int>", "getMaxAbs", Grid<int>::_W_27); -static const Pb::Register _R_52("Grid<int>", "getMax", Grid<int>::_W_28); -static const Pb::Register _R_53("Grid<int>", "getMin", Grid<int>::_W_29); -static const Pb::Register _R_54("Grid<int>", "getL1", Grid<int>::_W_30); -static const Pb::Register _R_55("Grid<int>", "getL2", Grid<int>::_W_31); -static const Pb::Register _R_56("Grid<int>", "setBound", Grid<int>::_W_32); -static const Pb::Register _R_57("Grid<int>", "setBoundNeumann", Grid<int>::_W_33); -static const Pb::Register _R_58("Grid<int>", "getDataPointer", Grid<int>::_W_34); -static const Pb::Register _R_59("Grid<int>", "printGrid", Grid<int>::_W_35); -static const Pb::Register _R_60("Grid<Real>", "Grid<Real>", "GridBase"); +static const Pb::Register _R_51("Grid<int>", "join", Grid<int>::_W_27); +static const Pb::Register _R_52("Grid<int>", "getMaxAbs", Grid<int>::_W_28); +static const Pb::Register _R_53("Grid<int>", "getMax", Grid<int>::_W_29); +static const Pb::Register _R_54("Grid<int>", "getMin", Grid<int>::_W_30); +static const Pb::Register _R_55("Grid<int>", "getL1", Grid<int>::_W_31); +static const Pb::Register _R_56("Grid<int>", "getL2", Grid<int>::_W_32); +static const Pb::Register _R_57("Grid<int>", "setBound", Grid<int>::_W_33); +static const Pb::Register _R_58("Grid<int>", "setBoundNeumann", Grid<int>::_W_34); +static const Pb::Register _R_59("Grid<int>", "getDataPointer", Grid<int>::_W_35); +static const Pb::Register _R_60("Grid<int>", "printGrid", Grid<int>::_W_36); +static const Pb::Register _R_61("Grid<Real>", "Grid<Real>", "GridBase"); template<> const char *Namify<Grid<Real>>::S = "Grid<Real>"; -static const Pb::Register _R_61("Grid<Real>", "Grid", Grid<Real>::_W_9); -static const Pb::Register _R_62("Grid<Real>", "save", Grid<Real>::_W_10); -static const Pb::Register _R_63("Grid<Real>", "load", Grid<Real>::_W_11); -static const Pb::Register _R_64("Grid<Real>", "clear", Grid<Real>::_W_12); -static const Pb::Register _R_65("Grid<Real>", "copyFrom", Grid<Real>::_W_13); -static const Pb::Register _R_66("Grid<Real>", "getGridType", Grid<Real>::_W_14); -static const Pb::Register _R_67("Grid<Real>", "add", Grid<Real>::_W_15); -static const Pb::Register _R_68("Grid<Real>", "sub", Grid<Real>::_W_16); -static const Pb::Register _R_69("Grid<Real>", "setConst", Grid<Real>::_W_17); -static const Pb::Register _R_70("Grid<Real>", "addConst", Grid<Real>::_W_18); -static const Pb::Register _R_71("Grid<Real>", "addScaled", Grid<Real>::_W_19); -static const Pb::Register _R_72("Grid<Real>", "mult", Grid<Real>::_W_20); -static const Pb::Register _R_73("Grid<Real>", "multConst", Grid<Real>::_W_21); -static const Pb::Register _R_74("Grid<Real>", "safeDivide", Grid<Real>::_W_22); -static const Pb::Register _R_75("Grid<Real>", "clamp", Grid<Real>::_W_23); -static const Pb::Register _R_76("Grid<Real>", "stomp", Grid<Real>::_W_24); -static const Pb::Register _R_77("Grid<Real>", "permuteAxes", Grid<Real>::_W_25); -static const Pb::Register _R_78("Grid<Real>", "permuteAxesCopyToGrid", Grid<Real>::_W_26); -static const Pb::Register _R_79("Grid<Real>", "getMaxAbs", Grid<Real>::_W_27); -static const Pb::Register _R_80("Grid<Real>", "getMax", Grid<Real>::_W_28); -static const Pb::Register _R_81("Grid<Real>", "getMin", Grid<Real>::_W_29); -static const Pb::Register _R_82("Grid<Real>", "getL1", Grid<Real>::_W_30); -static const Pb::Register _R_83("Grid<Real>", "getL2", Grid<Real>::_W_31); -static const Pb::Register _R_84("Grid<Real>", "setBound", Grid<Real>::_W_32); -static const Pb::Register _R_85("Grid<Real>", "setBoundNeumann", Grid<Real>::_W_33); -static const Pb::Register _R_86("Grid<Real>", "getDataPointer", Grid<Real>::_W_34); -static const Pb::Register _R_87("Grid<Real>", "printGrid", Grid<Real>::_W_35); -static const Pb::Register _R_88("Grid<Vec3>", "Grid<Vec3>", "GridBase"); +static const Pb::Register _R_62("Grid<Real>", "Grid", Grid<Real>::_W_9); +static const Pb::Register _R_63("Grid<Real>", "save", Grid<Real>::_W_10); +static const Pb::Register _R_64("Grid<Real>", "load", Grid<Real>::_W_11); +static const Pb::Register _R_65("Grid<Real>", "clear", Grid<Real>::_W_12); +static const Pb::Register _R_66("Grid<Real>", "copyFrom", Grid<Real>::_W_13); +static const Pb::Register _R_67("Grid<Real>", "getGridType", Grid<Real>::_W_14); +static const Pb::Register _R_68("Grid<Real>", "add", Grid<Real>::_W_15); +static const Pb::Register _R_69("Grid<Real>", "sub", Grid<Real>::_W_16); +static const Pb::Register _R_70("Grid<Real>", "setConst", Grid<Real>::_W_17); +static const Pb::Register _R_71("Grid<Real>", "addConst", Grid<Real>::_W_18); +static const Pb::Register _R_72("Grid<Real>", "addScaled", Grid<Real>::_W_19); +static const Pb::Register _R_73("Grid<Real>", "mult", Grid<Real>::_W_20); +static const Pb::Register _R_74("Grid<Real>", "multConst", Grid<Real>::_W_21); +static const Pb::Register _R_75("Grid<Real>", "safeDivide", Grid<Real>::_W_22); +static const Pb::Register _R_76("Grid<Real>", "clamp", Grid<Real>::_W_23); +static const Pb::Register _R_77("Grid<Real>", "stomp", Grid<Real>::_W_24); +static const Pb::Register _R_78("Grid<Real>", "permuteAxes", Grid<Real>::_W_25); +static const Pb::Register _R_79("Grid<Real>", "permuteAxesCopyToGrid", Grid<Real>::_W_26); +static const Pb::Register _R_80("Grid<Real>", "join", Grid<Real>::_W_27); +static const Pb::Register _R_81("Grid<Real>", "getMaxAbs", Grid<Real>::_W_28); +static const Pb::Register _R_82("Grid<Real>", "getMax", Grid<Real>::_W_29); +static const Pb::Register _R_83("Grid<Real>", "getMin", Grid<Real>::_W_30); +static const Pb::Register _R_84("Grid<Real>", "getL1", Grid<Real>::_W_31); +static const Pb::Register _R_85("Grid<Real>", "getL2", Grid<Real>::_W_32); +static const Pb::Register _R_86("Grid<Real>", "setBound", Grid<Real>::_W_33); +static const Pb::Register _R_87("Grid<Real>", "setBoundNeumann", Grid<Real>::_W_34); +static const Pb::Register _R_88("Grid<Real>", "getDataPointer", Grid<Real>::_W_35); +static const Pb::Register _R_89("Grid<Real>", "printGrid", Grid<Real>::_W_36); +static const Pb::Register _R_90("Grid<Vec3>", "Grid<Vec3>", "GridBase"); template<> const char *Namify<Grid<Vec3>>::S = "Grid<Vec3>"; -static const Pb::Register _R_89("Grid<Vec3>", "Grid", Grid<Vec3>::_W_9); -static const Pb::Register _R_90("Grid<Vec3>", "save", Grid<Vec3>::_W_10); -static const Pb::Register _R_91("Grid<Vec3>", "load", Grid<Vec3>::_W_11); -static const Pb::Register _R_92("Grid<Vec3>", "clear", Grid<Vec3>::_W_12); -static const Pb::Register _R_93("Grid<Vec3>", "copyFrom", Grid<Vec3>::_W_13); -static const Pb::Register _R_94("Grid<Vec3>", "getGridType", Grid<Vec3>::_W_14); -static const Pb::Register _R_95("Grid<Vec3>", "add", Grid<Vec3>::_W_15); -static const Pb::Register _R_96("Grid<Vec3>", "sub", Grid<Vec3>::_W_16); -static const Pb::Register _R_97("Grid<Vec3>", "setConst", Grid<Vec3>::_W_17); -static const Pb::Register _R_98("Grid<Vec3>", "addConst", Grid<Vec3>::_W_18); -static const Pb::Register _R_99("Grid<Vec3>", "addScaled", Grid<Vec3>::_W_19); -static const Pb::Register _R_100("Grid<Vec3>", "mult", Grid<Vec3>::_W_20); -static const Pb::Register _R_101("Grid<Vec3>", "multConst", Grid<Vec3>::_W_21); -static const Pb::Register _R_102("Grid<Vec3>", "safeDivide", Grid<Vec3>::_W_22); -static const Pb::Register _R_103("Grid<Vec3>", "clamp", Grid<Vec3>::_W_23); -static const Pb::Register _R_104("Grid<Vec3>", "stomp", Grid<Vec3>::_W_24); -static const Pb::Register _R_105("Grid<Vec3>", "permuteAxes", Grid<Vec3>::_W_25); -static const Pb::Register _R_106("Grid<Vec3>", "permuteAxesCopyToGrid", Grid<Vec3>::_W_26); -static const Pb::Register _R_107("Grid<Vec3>", "getMaxAbs", Grid<Vec3>::_W_27); -static const Pb::Register _R_108("Grid<Vec3>", "getMax", Grid<Vec3>::_W_28); -static const Pb::Register _R_109("Grid<Vec3>", "getMin", Grid<Vec3>::_W_29); -static const Pb::Register _R_110("Grid<Vec3>", "getL1", Grid<Vec3>::_W_30); -static const Pb::Register _R_111("Grid<Vec3>", "getL2", Grid<Vec3>::_W_31); -static const Pb::Register _R_112("Grid<Vec3>", "setBound", Grid<Vec3>::_W_32); -static const Pb::Register _R_113("Grid<Vec3>", "setBoundNeumann", Grid<Vec3>::_W_33); -static const Pb::Register _R_114("Grid<Vec3>", "getDataPointer", Grid<Vec3>::_W_34); -static const Pb::Register _R_115("Grid<Vec3>", "printGrid", Grid<Vec3>::_W_35); +static const Pb::Register _R_91("Grid<Vec3>", "Grid", Grid<Vec3>::_W_9); +static const Pb::Register _R_92("Grid<Vec3>", "save", Grid<Vec3>::_W_10); +static const Pb::Register _R_93("Grid<Vec3>", "load", Grid<Vec3>::_W_11); +static const Pb::Register _R_94("Grid<Vec3>", "clear", Grid<Vec3>::_W_12); +static const Pb::Register _R_95("Grid<Vec3>", "copyFrom", Grid<Vec3>::_W_13); +static const Pb::Register _R_96("Grid<Vec3>", "getGridType", Grid<Vec3>::_W_14); +static const Pb::Register _R_97("Grid<Vec3>", "add", Grid<Vec3>::_W_15); +static const Pb::Register _R_98("Grid<Vec3>", "sub", Grid<Vec3>::_W_16); +static const Pb::Register _R_99("Grid<Vec3>", "setConst", Grid<Vec3>::_W_17); +static const Pb::Register _R_100("Grid<Vec3>", "addConst", Grid<Vec3>::_W_18); +static const Pb::Register _R_101("Grid<Vec3>", "addScaled", Grid<Vec3>::_W_19); +static const Pb::Register _R_102("Grid<Vec3>", "mult", Grid<Vec3>::_W_20); +static const Pb::Register _R_103("Grid<Vec3>", "multConst", Grid<Vec3>::_W_21); +static const Pb::Register _R_104("Grid<Vec3>", "safeDivide", Grid<Vec3>::_W_22); +static const Pb::Register _R_105("Grid<Vec3>", "clamp", Grid<Vec3>::_W_23); +static const Pb::Register _R_106("Grid<Vec3>", "stomp", Grid<Vec3>::_W_24); +static const Pb::Register _R_107("Grid<Vec3>", "permuteAxes", Grid<Vec3>::_W_25); +static const Pb::Register _R_108("Grid<Vec3>", "permuteAxesCopyToGrid", Grid<Vec3>::_W_26); +static const Pb::Register _R_109("Grid<Vec3>", "join", Grid<Vec3>::_W_27); +static const Pb::Register _R_110("Grid<Vec3>", "getMaxAbs", Grid<Vec3>::_W_28); +static const Pb::Register _R_111("Grid<Vec3>", "getMax", Grid<Vec3>::_W_29); +static const Pb::Register _R_112("Grid<Vec3>", "getMin", Grid<Vec3>::_W_30); +static const Pb::Register _R_113("Grid<Vec3>", "getL1", Grid<Vec3>::_W_31); +static const Pb::Register _R_114("Grid<Vec3>", "getL2", Grid<Vec3>::_W_32); +static const Pb::Register _R_115("Grid<Vec3>", "setBound", Grid<Vec3>::_W_33); +static const Pb::Register _R_116("Grid<Vec3>", "setBoundNeumann", Grid<Vec3>::_W_34); +static const Pb::Register _R_117("Grid<Vec3>", "getDataPointer", Grid<Vec3>::_W_35); +static const Pb::Register _R_118("Grid<Vec3>", "printGrid", Grid<Vec3>::_W_36); #endif #ifdef _C_GridBase -static const Pb::Register _R_116("GridBase", "GridBase", "PbClass"); +static const Pb::Register _R_119("GridBase", "GridBase", "PbClass"); template<> const char *Namify<GridBase>::S = "GridBase"; -static const Pb::Register _R_117("GridBase", "GridBase", GridBase::_W_0); -static const Pb::Register _R_118("GridBase", "getSizeX", GridBase::_W_1); -static const Pb::Register _R_119("GridBase", "getSizeY", GridBase::_W_2); -static const Pb::Register _R_120("GridBase", "getSizeZ", GridBase::_W_3); -static const Pb::Register _R_121("GridBase", "getSize", GridBase::_W_4); -static const Pb::Register _R_122("GridBase", "is3D", GridBase::_W_5); -static const Pb::Register _R_123("GridBase", "is4D", GridBase::_W_6); -static const Pb::Register _R_124("GridBase", "getSizeT", GridBase::_W_7); -static const Pb::Register _R_125("GridBase", "getStrideT", GridBase::_W_8); +static const Pb::Register _R_120("GridBase", "GridBase", GridBase::_W_0); +static const Pb::Register _R_121("GridBase", "getSizeX", GridBase::_W_1); +static const Pb::Register _R_122("GridBase", "getSizeY", GridBase::_W_2); +static const Pb::Register _R_123("GridBase", "getSizeZ", GridBase::_W_3); +static const Pb::Register _R_124("GridBase", "getSize", GridBase::_W_4); +static const Pb::Register _R_125("GridBase", "is3D", GridBase::_W_5); +static const Pb::Register _R_126("GridBase", "is4D", GridBase::_W_6); +static const Pb::Register _R_127("GridBase", "getSizeT", GridBase::_W_7); +static const Pb::Register _R_128("GridBase", "getStrideT", GridBase::_W_8); #endif #ifdef _C_MACGrid -static const Pb::Register _R_126("MACGrid", "MACGrid", "Grid<Vec3>"); +static const Pb::Register _R_129("MACGrid", "MACGrid", "Grid<Vec3>"); template<> const char *Namify<MACGrid>::S = "MACGrid"; -static const Pb::Register _R_127("MACGrid", "MACGrid", MACGrid::_W_36); -static const Pb::Register _R_128("MACGrid", "setBoundMAC", MACGrid::_W_37); +static const Pb::Register _R_130("MACGrid", "MACGrid", MACGrid::_W_37); +static const Pb::Register _R_131("MACGrid", "setBoundMAC", MACGrid::_W_38); #endif static const Pb::Register _R_7("GridType_TypeNone", 0); static const Pb::Register _R_8("GridType_TypeReal", 1); @@ -247,6 +250,9 @@ void PbRegister_file_7() KEEP_UNUSED(_R_126); KEEP_UNUSED(_R_127); KEEP_UNUSED(_R_128); + KEEP_UNUSED(_R_129); + KEEP_UNUSED(_R_130); + KEEP_UNUSED(_R_131); } } } // namespace Manta
\ No newline at end of file diff --git a/extern/mantaflow/preprocessed/particle.h b/extern/mantaflow/preprocessed/particle.h index 2d41397a961..d9dd3f49c38 100644 --- a/extern/mantaflow/preprocessed/particle.h +++ b/extern/mantaflow/preprocessed/particle.h @@ -469,6 +469,7 @@ template<class S> class ParticleSystem : public ParticleBase { const int integrationMode, const bool deleteInObstacle = true, const bool stopInObstacle = true, + const bool skipNew = false, const ParticleDataImpl<int> *ptype = NULL, const int exclude = 0); static PyObject *_W_9(PyObject *_self, PyObject *_linargs, PyObject *_kwds) @@ -486,13 +487,20 @@ template<class S> class ParticleSystem : public ParticleBase { const int integrationMode = _args.get<int>("integrationMode", 2, &_lock); const bool deleteInObstacle = _args.getOpt<bool>("deleteInObstacle", 3, true, &_lock); const bool stopInObstacle = _args.getOpt<bool>("stopInObstacle", 4, true, &_lock); + const bool skipNew = _args.getOpt<bool>("skipNew", 5, false, &_lock); const ParticleDataImpl<int> *ptype = _args.getPtrOpt<ParticleDataImpl<int>>( - "ptype", 5, NULL, &_lock); - const int exclude = _args.getOpt<int>("exclude", 6, 0, &_lock); + "ptype", 6, NULL, &_lock); + const int exclude = _args.getOpt<int>("exclude", 7, 0, &_lock); pbo->_args.copy(_args); _retval = getPyNone(); - pbo->advectInGrid( - flags, vel, integrationMode, deleteInObstacle, stopInObstacle, ptype, exclude); + pbo->advectInGrid(flags, + vel, + integrationMode, + deleteInObstacle, + stopInObstacle, + skipNew, + ptype, + exclude); pbo->_args.check(); } pbFinalizePlugin(pbo->getParent(), "ParticleSystem::advectInGrid", !noTiming); @@ -1863,6 +1871,7 @@ template<class S> struct _GridAdvectKernel : public KernelBase { const Real dt, const bool deleteInObstacle, const bool stopInObstacle, + const bool skipNew, const ParticleDataImpl<int> *ptype, const int exclude, std::vector<Vec3> &u) @@ -1873,6 +1882,7 @@ template<class S> struct _GridAdvectKernel : public KernelBase { dt(dt), deleteInObstacle(deleteInObstacle), stopInObstacle(stopInObstacle), + skipNew(skipNew), ptype(ptype), exclude(exclude), u(u) @@ -1885,11 +1895,13 @@ template<class S> struct _GridAdvectKernel : public KernelBase { const Real dt, const bool deleteInObstacle, const bool stopInObstacle, + const bool skipNew, const ParticleDataImpl<int> *ptype, const int exclude, std::vector<Vec3> &u) const { - if ((p[idx].flag & ParticleBase::PDELETE) || (ptype && ((*ptype)[idx] & exclude))) { + if ((p[idx].flag & ParticleBase::PDELETE) || (ptype && ((*ptype)[idx] & exclude)) || + (skipNew && (p[idx].flag & ParticleBase::PNEW))) { u[idx] = 0.; return; } @@ -1910,7 +1922,7 @@ template<class S> struct _GridAdvectKernel : public KernelBase { void operator()(const tbb::blocked_range<IndexInt> &__r) const { for (IndexInt idx = __r.begin(); idx != (IndexInt)__r.end(); idx++) - op(idx, p, vel, flags, dt, deleteInObstacle, stopInObstacle, ptype, exclude, u); + op(idx, p, vel, flags, dt, deleteInObstacle, stopInObstacle, skipNew, ptype, exclude, u); } void run() { @@ -1922,6 +1934,7 @@ template<class S> struct _GridAdvectKernel : public KernelBase { const Real dt; const bool deleteInObstacle; const bool stopInObstacle; + const bool skipNew; const ParticleDataImpl<int> *ptype; const int exclude; std::vector<Vec3> &u; @@ -1933,6 +1946,7 @@ template<class S> struct GridAdvectKernel : public KernelBase { const Real dt, const bool deleteInObstacle, const bool stopInObstacle, + const bool skipNew, const ParticleDataImpl<int> *ptype, const int exclude) : KernelBase(p.size()), @@ -1943,6 +1957,7 @@ template<class S> struct GridAdvectKernel : public KernelBase { dt, deleteInObstacle, stopInObstacle, + skipNew, ptype, exclude, u), @@ -1952,6 +1967,7 @@ template<class S> struct GridAdvectKernel : public KernelBase { dt(dt), deleteInObstacle(deleteInObstacle), stopInObstacle(stopInObstacle), + skipNew(skipNew), ptype(ptype), exclude(exclude), u((size)) @@ -2001,16 +2017,21 @@ template<class S> struct GridAdvectKernel : public KernelBase { return stopInObstacle; } typedef bool type5; - inline const ParticleDataImpl<int> *getArg6() + inline const bool &getArg6() + { + return skipNew; + } + typedef bool type6; + inline const ParticleDataImpl<int> *getArg7() { return ptype; } - typedef ParticleDataImpl<int> type6; - inline const int &getArg7() + typedef ParticleDataImpl<int> type7; + inline const int &getArg8() { return exclude; } - typedef int type7; + typedef int type8; void runMessage() { debMsg("Executing kernel GridAdvectKernel ", 3); @@ -2025,6 +2046,7 @@ template<class S> struct GridAdvectKernel : public KernelBase { const Real dt; const bool deleteInObstacle; const bool stopInObstacle; + const bool skipNew; const ParticleDataImpl<int> *ptype; const int exclude; std::vector<Vec3> u; @@ -2195,6 +2217,7 @@ void ParticleSystem<S>::advectInGrid(const FlagGrid &flags, const int integrationMode, const bool deleteInObstacle, const bool stopInObstacle, + const bool skipNew, const ParticleDataImpl<int> *ptype, const int exclude) { @@ -2208,8 +2231,15 @@ void ParticleSystem<S>::advectInGrid(const FlagGrid &flags, } // update positions - GridAdvectKernel<S> kernel( - mData, vel, flags, getParent()->getDt(), deleteInObstacle, stopInObstacle, ptype, exclude); + GridAdvectKernel<S> kernel(mData, + vel, + flags, + getParent()->getDt(), + deleteInObstacle, + stopInObstacle, + skipNew, + ptype, + exclude); integratePointSet(kernel, integrationMode); if (!deleteInObstacle) { @@ -2438,15 +2468,15 @@ template<class S> void ParticleSystem<S>::compress() //! insert buffered positions as new particles, update additional particle data template<class S> void ParticleSystem<S>::insertBufferedParticles() { + // clear new flag everywhere + for (IndexInt i = 0; i < (IndexInt)mData.size(); ++i) + mData[i].flag &= ~PNEW; + if (mNewBufferPos.size() == 0) return; IndexInt newCnt = mData.size(); resizeAll(newCnt + mNewBufferPos.size()); - // clear new flag everywhere - for (IndexInt i = 0; i < (IndexInt)mData.size(); ++i) - mData[i].flag &= ~PNEW; - for (IndexInt i = 0; i < (IndexInt)mNewBufferPos.size(); ++i) { int flag = (mNewBufferFlag.size() > 0) ? mNewBufferFlag[i] : 0; // note, other fields are not initialized here... diff --git a/extern/mantaflow/preprocessed/plugin/extforces.cpp b/extern/mantaflow/preprocessed/plugin/extforces.cpp index 36221fbbc10..798bb3daeee 100644 --- a/extern/mantaflow/preprocessed/plugin/extforces.cpp +++ b/extern/mantaflow/preprocessed/plugin/extforces.cpp @@ -244,13 +244,15 @@ struct KnApplyForce : public KernelBase { bool additive; }; -//! add gravity forces to all fluid cells, automatically adapts to different grid sizes +//! add gravity forces to all fluid cells, optionally adapts to different grid sizes automatically void addGravity(const FlagGrid &flags, MACGrid &vel, Vec3 gravity, - const Grid<Real> *exclude = NULL) + const Grid<Real> *exclude = NULL, + bool scale = true) { - Vec3 f = gravity * flags.getParent()->getDt() / flags.getDx(); + float gridScale = (scale) ? flags.getDx() : 1; + Vec3 f = gravity * flags.getParent()->getDt() / gridScale; KnApplyForce(flags, vel, f, exclude, true); } static PyObject *_W_0(PyObject *_self, PyObject *_linargs, PyObject *_kwds) @@ -267,8 +269,9 @@ static PyObject *_W_0(PyObject *_self, PyObject *_linargs, PyObject *_kwds) MACGrid &vel = *_args.getPtr<MACGrid>("vel", 1, &_lock); Vec3 gravity = _args.get<Vec3>("gravity", 2, &_lock); const Grid<Real> *exclude = _args.getPtrOpt<Grid<Real>>("exclude", 3, NULL, &_lock); + bool scale = _args.getOpt<bool>("scale", 4, true, &_lock); _retval = getPyNone(); - addGravity(flags, vel, gravity, exclude); + addGravity(flags, vel, gravity, exclude, scale); _args.check(); } pbFinalizePlugin(parent, "addGravity", !noTiming); @@ -287,14 +290,13 @@ void PbRegister_addGravity() } } -//! add gravity forces to all fluid cells , but dont account for changing cell size +//! Deprecated: use addGravity(scale=false) instead void addGravityNoScale(const FlagGrid &flags, MACGrid &vel, const Vec3 &gravity, const Grid<Real> *exclude = NULL) { - const Vec3 f = gravity * flags.getParent()->getDt(); - KnApplyForce(flags, vel, f, exclude, true); + addGravity(flags, vel, gravity, exclude, false); } static PyObject *_W_1(PyObject *_self, PyObject *_linargs, PyObject *_kwds) { @@ -412,14 +414,17 @@ struct KnAddBuoyancy : public KernelBase { Vec3 strength; }; -//! add Buoyancy force based on fctor (e.g. smoke density) +//! add Buoyancy force based on factor (e.g. smoke density), optionally adapts to different grid +//! sizes automatically void addBuoyancy(const FlagGrid &flags, const Grid<Real> &density, MACGrid &vel, Vec3 gravity, - Real coefficient = 1.) + Real coefficient = 1., + bool scale = true) { - Vec3 f = -gravity * flags.getParent()->getDt() / flags.getParent()->getDx() * coefficient; + float gridScale = (scale) ? flags.getDx() : 1; + Vec3 f = -gravity * flags.getParent()->getDt() / gridScale * coefficient; KnAddBuoyancy(flags, density, vel, f); } static PyObject *_W_2(PyObject *_self, PyObject *_linargs, PyObject *_kwds) @@ -437,8 +442,9 @@ static PyObject *_W_2(PyObject *_self, PyObject *_linargs, PyObject *_kwds) MACGrid &vel = *_args.getPtr<MACGrid>("vel", 2, &_lock); Vec3 gravity = _args.get<Vec3>("gravity", 3, &_lock); Real coefficient = _args.getOpt<Real>("coefficient", 4, 1., &_lock); + bool scale = _args.getOpt<bool>("scale", 5, true, &_lock); _retval = getPyNone(); - addBuoyancy(flags, density, vel, gravity, coefficient); + addBuoyancy(flags, density, vel, gravity, coefficient, scale); _args.check(); } pbFinalizePlugin(parent, "addBuoyancy", !noTiming); diff --git a/extern/mantaflow/preprocessed/plugin/secondaryparticles.cpp b/extern/mantaflow/preprocessed/plugin/secondaryparticles.cpp index 18582d57e64..5e24b6f28db 100644 --- a/extern/mantaflow/preprocessed/plugin/secondaryparticles.cpp +++ b/extern/mantaflow/preprocessed/plugin/secondaryparticles.cpp @@ -525,7 +525,7 @@ struct knFlipSampleSecondaryParticlesMoreCylinders : public KernelBase { if (!(flags(i, j, k) & itype)) return; - RandomStream mRand(9832); + static RandomStream mRand(9832); Real radius = 0.25; // diameter=0.5 => sampling with two cylinders in each dimension since cell size=1 for (Real x = i - radius; x <= i + radius; x += 2 * radius) { @@ -791,11 +791,9 @@ struct knFlipSampleSecondaryParticles : public KernelBase { const int n = KE * (k_ta * TA + k_wc * WC) * dt; // number of secondary particles if (n == 0) return; - RandomStream mRand(9832); + static RandomStream mRand(9832); - Vec3 xi = Vec3(i + mRand.getReal(), - j + mRand.getReal(), - k + mRand.getReal()); // randomized offset uniform in cell + Vec3 xi = Vec3(i, j, k) + mRand.getVec3(); // randomized offset uniform in cell Vec3 vi = v.getInterpolated(xi); Vec3 dir = dt * vi; // direction of movement of current particle Vec3 e1 = getNormalized(Vec3(dir.z, 0, -dir.x)); // perpendicular to dir @@ -984,9 +982,14 @@ void flipSampleSecondaryParticles(const std::string mode, const Real c_b, const Real k_ta, const Real k_wc, - const Real dt, + const Real dt = 0, const int itype = FlagGrid::TypeFluid) { + + float timestep = dt; + if (dt <= 0) + timestep = flags.getParent()->getDt(); + if (mode == "single") { knFlipSampleSecondaryParticles(flags, v, @@ -1003,7 +1006,7 @@ void flipSampleSecondaryParticles(const std::string mode, c_b, k_ta, k_wc, - dt, + timestep, itype); } else if (mode == "multiple") { @@ -1022,7 +1025,7 @@ void flipSampleSecondaryParticles(const std::string mode, c_b, k_ta, k_wc, - dt, + timestep, itype); } else { @@ -1055,7 +1058,7 @@ static PyObject *_W_1(PyObject *_self, PyObject *_linargs, PyObject *_kwds) const Real c_b = _args.get<Real>("c_b", 13, &_lock); const Real k_ta = _args.get<Real>("k_ta", 14, &_lock); const Real k_wc = _args.get<Real>("k_wc", 15, &_lock); - const Real dt = _args.get<Real>("dt", 16, &_lock); + const Real dt = _args.getOpt<Real>("dt", 16, 0, &_lock); const int itype = _args.getOpt<int>("itype", 17, FlagGrid::TypeFluid, &_lock); _retval = getPyNone(); flipSampleSecondaryParticles(mode, @@ -1693,13 +1696,20 @@ void flipUpdateSecondaryParticles(const std::string mode, const Real k_d, const Real c_s, const Real c_b, - const Real dt, + const Real dt = 0, + bool scale = true, const int exclude = ParticleBase::PTRACER, const int antitunneling = 0, const int itype = FlagGrid::TypeFluid) { - Vec3 g = gravity / flags.getDx(); + float gridScale = (scale) ? flags.getParent()->getDx() : 1; + Vec3 g = gravity / gridScale; + + float timestep = dt; + if (dt <= 0) + timestep = flags.getParent()->getDt(); + if (mode == "linear") { knFlipUpdateSecondaryParticlesLinear(pts_sec, v_sec, @@ -1713,7 +1723,7 @@ void flipUpdateSecondaryParticles(const std::string mode, k_d, c_s, c_b, - dt, + timestep, exclude, antitunneling); } @@ -1731,7 +1741,7 @@ void flipUpdateSecondaryParticles(const std::string mode, k_d, c_s, c_b, - dt, + timestep, exclude, antitunneling, itype); @@ -1766,10 +1776,11 @@ static PyObject *_W_2(PyObject *_self, PyObject *_linargs, PyObject *_kwds) const Real k_d = _args.get<Real>("k_d", 11, &_lock); const Real c_s = _args.get<Real>("c_s", 12, &_lock); const Real c_b = _args.get<Real>("c_b", 13, &_lock); - const Real dt = _args.get<Real>("dt", 14, &_lock); - const int exclude = _args.getOpt<int>("exclude", 15, ParticleBase::PTRACER, &_lock); - const int antitunneling = _args.getOpt<int>("antitunneling", 16, 0, &_lock); - const int itype = _args.getOpt<int>("itype", 17, FlagGrid::TypeFluid, &_lock); + const Real dt = _args.getOpt<Real>("dt", 14, 0, &_lock); + bool scale = _args.getOpt<bool>("scale", 15, true, &_lock); + const int exclude = _args.getOpt<int>("exclude", 16, ParticleBase::PTRACER, &_lock); + const int antitunneling = _args.getOpt<int>("antitunneling", 17, 0, &_lock); + const int itype = _args.getOpt<int>("itype", 18, FlagGrid::TypeFluid, &_lock); _retval = getPyNone(); flipUpdateSecondaryParticles(mode, pts_sec, @@ -1786,6 +1797,7 @@ static PyObject *_W_2(PyObject *_self, PyObject *_linargs, PyObject *_kwds) c_s, c_b, dt, + scale, exclude, antitunneling, itype); @@ -1834,7 +1846,7 @@ struct knFlipDeleteParticlesInObstacle : public KernelBase { } int gridIndex = flags.index(xidx); // remove particles that penetrate obstacles - if (flags[gridIndex] == FlagGrid::TypeObstacle || flags[gridIndex] == FlagGrid::TypeOutflow) { + if (flags.isObstacle(gridIndex) || flags.isOutflow(gridIndex)) { pts.kill(idx); } } |