diff options
Diffstat (limited to 'extern/mantaflow/preprocessed/grid.h')
-rw-r--r-- | extern/mantaflow/preprocessed/grid.h | 60 |
1 files changed, 44 insertions, 16 deletions
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); |