diff options
author | Jacques Lucke <jacques@blender.org> | 2020-04-09 13:02:02 +0300 |
---|---|---|
committer | Jacques Lucke <jacques@blender.org> | 2020-04-09 13:02:02 +0300 |
commit | 55ee66be4d2eaf1bd4556a938c618c77985b4008 (patch) | |
tree | 85b445409637fa021c72e096d0d2133fdcf2992a /extern/mantaflow/preprocessed | |
parent | 726cf93f8ad09b49cd6481af2c6ad7d5e51b0c20 (diff) | |
parent | dabd59ba23f877f68aaf73e79f0d58118723d9b7 (diff) |
Merge branch 'functions' into builtin-simulation-nodesbuiltin-simulation-nodes
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/plugin/secondaryparticles.cpp | 10 |
5 files changed, 291 insertions, 106 deletions
diff --git a/extern/mantaflow/preprocessed/gitinfo.h b/extern/mantaflow/preprocessed/gitinfo.h index 208d8008a7e..791dd001bbe 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 21303fab2eda588ec22988bf9e5762d2001c131f" 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/plugin/secondaryparticles.cpp b/extern/mantaflow/preprocessed/plugin/secondaryparticles.cpp index 18582d57e64..a8913a218c1 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 @@ -1834,7 +1832,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); } } |