diff options
author | Sebastián Barschkis <sebbas@sebbas.org> | 2020-02-28 17:31:10 +0300 |
---|---|---|
committer | Sebastián Barschkis <sebbas@sebbas.org> | 2020-02-28 18:20:13 +0300 |
commit | 21bdeb5cc00f29ef452ff61d8947269bb1baba66 (patch) | |
tree | b1f996e1707544594b04c37dd0aa78199c5c9b7a /extern/mantaflow/preprocessed | |
parent | af54bbd61c769c69891c9b39df19eb3cad9dafe2 (diff) |
Fluid: Updated Manta pp files
Updates include:
- std::move() cleanup in rcmatrix.h
- Enabled parallelization for fluid guiding (fairly noticeable speed improvement).
- More flexible flags setter function with control over boundary width.
Diffstat (limited to 'extern/mantaflow/preprocessed')
-rw-r--r-- | extern/mantaflow/preprocessed/gitinfo.h | 2 | ||||
-rw-r--r-- | extern/mantaflow/preprocessed/plugin/initplugins.cpp | 37 |
2 files changed, 25 insertions, 14 deletions
diff --git a/extern/mantaflow/preprocessed/gitinfo.h b/extern/mantaflow/preprocessed/gitinfo.h index 614bf2b91c4..29a9158d5c3 100644 --- a/extern/mantaflow/preprocessed/gitinfo.h +++ b/extern/mantaflow/preprocessed/gitinfo.h @@ -1,3 +1,3 @@ -#define MANTA_GIT_VERSION "commit ce000bcbd7004e6549ac2f118755fcdc1f679bc3" +#define MANTA_GIT_VERSION "commit 1d52e96ad602f1974dfee75bef293bc397e4b41b" diff --git a/extern/mantaflow/preprocessed/plugin/initplugins.cpp b/extern/mantaflow/preprocessed/plugin/initplugins.cpp index 519aa41a08d..7a765813f9f 100644 --- a/extern/mantaflow/preprocessed/plugin/initplugins.cpp +++ b/extern/mantaflow/preprocessed/plugin/initplugins.cpp @@ -1829,13 +1829,15 @@ struct KnUpdateFlagsObs : public KernelBase { const MACGrid *fractions, const Grid<Real> &phiObs, const Grid<Real> *phiOut, - const Grid<Real> *phiIn) - : KernelBase(&flags, 1), + const Grid<Real> *phiIn, + int boundaryWidth) + : KernelBase(&flags, boundaryWidth), flags(flags), fractions(fractions), phiObs(phiObs), phiOut(phiOut), - phiIn(phiIn) + phiIn(phiIn), + boundaryWidth(boundaryWidth) { runMessage(); run(); @@ -1847,7 +1849,8 @@ struct KnUpdateFlagsObs : public KernelBase { const MACGrid *fractions, const Grid<Real> &phiObs, const Grid<Real> *phiOut, - const Grid<Real> *phiIn) const + const Grid<Real> *phiIn, + int boundaryWidth) const { bool isObs = false; @@ -1910,6 +1913,11 @@ struct KnUpdateFlagsObs : public KernelBase { return phiIn; } typedef Grid<Real> type4; + inline int &getArg5() + { + return boundaryWidth; + } + typedef int type5; void runMessage() { debMsg("Executing kernel KnUpdateFlagsObs ", 3); @@ -1923,15 +1931,15 @@ struct KnUpdateFlagsObs : public KernelBase { const int _maxY = maxY; if (maxZ > 1) { for (int k = __r.begin(); k != (int)__r.end(); k++) - for (int j = 1; j < _maxY; j++) - for (int i = 1; i < _maxX; i++) - op(i, j, k, flags, fractions, phiObs, phiOut, phiIn); + for (int j = boundaryWidth; j < _maxY; j++) + for (int i = boundaryWidth; i < _maxX; i++) + op(i, j, k, flags, fractions, phiObs, phiOut, phiIn, boundaryWidth); } else { const int k = 0; for (int j = __r.begin(); j != (int)__r.end(); j++) - for (int i = 1; i < _maxX; i++) - op(i, j, k, flags, fractions, phiObs, phiOut, phiIn); + for (int i = boundaryWidth; i < _maxX; i++) + op(i, j, k, flags, fractions, phiObs, phiOut, phiIn, boundaryWidth); } } void run() @@ -1939,13 +1947,14 @@ struct KnUpdateFlagsObs : public KernelBase { if (maxZ > 1) tbb::parallel_for(tbb::blocked_range<IndexInt>(minZ, maxZ), *this); else - tbb::parallel_for(tbb::blocked_range<IndexInt>(1, maxY), *this); + tbb::parallel_for(tbb::blocked_range<IndexInt>(boundaryWidth, maxY), *this); } FlagGrid &flags; const MACGrid *fractions; const Grid<Real> &phiObs; const Grid<Real> *phiOut; const Grid<Real> *phiIn; + int boundaryWidth; }; //! update obstacle and outflow flags from levelsets @@ -1954,9 +1963,10 @@ void setObstacleFlags(FlagGrid &flags, const Grid<Real> &phiObs, const MACGrid *fractions = NULL, const Grid<Real> *phiOut = NULL, - const Grid<Real> *phiIn = NULL) + const Grid<Real> *phiIn = NULL, + int boundaryWidth = 1) { - KnUpdateFlagsObs(flags, fractions, phiObs, phiOut, phiIn); + KnUpdateFlagsObs(flags, fractions, phiObs, phiOut, phiIn, boundaryWidth); } static PyObject *_W_18(PyObject *_self, PyObject *_linargs, PyObject *_kwds) { @@ -1973,8 +1983,9 @@ static PyObject *_W_18(PyObject *_self, PyObject *_linargs, PyObject *_kwds) const MACGrid *fractions = _args.getPtrOpt<MACGrid>("fractions", 2, NULL, &_lock); const Grid<Real> *phiOut = _args.getPtrOpt<Grid<Real>>("phiOut", 3, NULL, &_lock); const Grid<Real> *phiIn = _args.getPtrOpt<Grid<Real>>("phiIn", 4, NULL, &_lock); + int boundaryWidth = _args.getOpt<int>("boundaryWidth", 5, 1, &_lock); _retval = getPyNone(); - setObstacleFlags(flags, phiObs, fractions, phiOut, phiIn); + setObstacleFlags(flags, phiObs, fractions, phiOut, phiIn, boundaryWidth); _args.check(); } pbFinalizePlugin(parent, "setObstacleFlags", !noTiming); |