Fix T79201: Mantaflow: Fluid guides don't affect simulation.

This broke during the OpenVDB update for 2.90. Just making sure that guiding velocity files are being read correctly.
This commit is contained in:
Sebastián Barschkis 2020-08-07 15:33:51 +02:00
parent 1b1129f82a
commit c2691c93d5
Notes: blender-bot 2023-02-14 10:37:50 +01:00
Referenced by issue #79201, Mantaflow: Fluid guides don't affect simulation.
6 changed files with 186 additions and 139 deletions

View File

@ -1,3 +1,3 @@
#define MANTA_GIT_VERSION "commit 841bfd09c068dfb95637c0ec14fa78305286a433"
#define MANTA_GIT_VERSION "commit e2f6e59e3679f88e5100ae2145410cca4971b9df"

View File

@ -355,6 +355,38 @@ class GridBase : public PbClass {
return isInBounds(Vec3i(i, j, k), bnd);
}
#ifdef BLENDER
//! expose name field to Python for Blender
void setName(const std::string &name)
{
mName = name;
}
static PyObject *_W_9(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
{
try {
PbArgs _args(_linargs, _kwds);
GridBase *pbo = dynamic_cast<GridBase *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "GridBase::setName", !noTiming);
PyObject *_retval = 0;
{
ArgLocker _lock;
const std::string &name = _args.get<std::string>("name", 0, &_lock);
pbo->_args.copy(_args);
_retval = getPyNone();
pbo->setName(name);
pbo->_args.check();
}
pbFinalizePlugin(pbo->getParent(), "GridBase::setName", !noTiming);
return _retval;
}
catch (std::exception &e) {
pbSetError("GridBase::setName", e.what());
return 0;
}
}
#endif
protected:
GridType mType;
Vec3i mSize;
@ -373,7 +405,7 @@ template<class T> class Grid : public GridBase {
public:
//! init new grid, values are set to zero
Grid(FluidSolver *parent, bool show = true);
static int _W_9(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
static int _W_10(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
{
PbClass *obj = Pb::objFromPy(_self);
if (obj)
@ -410,7 +442,7 @@ template<class T> class Grid : public GridBase {
typedef GridBase BASETYPE_GRID;
int save(std::string name);
static PyObject *_W_10(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
static PyObject *_W_11(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
{
try {
PbArgs _args(_linargs, _kwds);
@ -435,7 +467,7 @@ template<class T> class Grid : public GridBase {
}
int load(std::string name);
static PyObject *_W_11(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
static PyObject *_W_12(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
{
try {
PbArgs _args(_linargs, _kwds);
@ -461,7 +493,7 @@ template<class T> class Grid : public GridBase {
//! set all cells to zero
void clear();
static PyObject *_W_12(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
static PyObject *_W_13(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
{
try {
PbArgs _args(_linargs, _kwds);
@ -588,7 +620,7 @@ template<class T> class Grid : public GridBase {
// Grid<T>& operator=(const Grid<T>& a);
//! copy content from other grid (use this one instead of operator= !)
Grid<T> &copyFrom(const Grid<T> &a, bool copyType = true);
static PyObject *_W_13(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
static PyObject *_W_14(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
{
try {
PbArgs _args(_linargs, _kwds);
@ -618,7 +650,7 @@ template<class T> class Grid : public GridBase {
//! get grid type
int getGridType();
static PyObject *_W_14(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
static PyObject *_W_15(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
{
try {
PbArgs _args(_linargs, _kwds);
@ -643,7 +675,7 @@ template<class T> class Grid : public GridBase {
//! add/subtract other grid
void add(const Grid<T> &a);
static PyObject *_W_15(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
static PyObject *_W_16(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
{
try {
PbArgs _args(_linargs, _kwds);
@ -669,7 +701,7 @@ template<class T> class Grid : public GridBase {
}
void sub(const Grid<T> &a);
static PyObject *_W_16(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
static PyObject *_W_17(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
{
try {
PbArgs _args(_linargs, _kwds);
@ -696,7 +728,7 @@ template<class T> class Grid : public GridBase {
//! set all cells to constant value
void setConst(T s);
static PyObject *_W_17(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
static PyObject *_W_18(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
{
try {
PbArgs _args(_linargs, _kwds);
@ -723,7 +755,7 @@ template<class T> class Grid : public GridBase {
//! add constant to all grid cells
void addConst(T s);
static PyObject *_W_18(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
static PyObject *_W_19(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
{
try {
PbArgs _args(_linargs, _kwds);
@ -750,7 +782,7 @@ template<class T> class Grid : public GridBase {
//! add scaled other grid to current one (note, only "Real" factor, "T" type not supported here!)
void addScaled(const Grid<T> &a, const T &factor);
static PyObject *_W_19(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
static PyObject *_W_20(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
{
try {
PbArgs _args(_linargs, _kwds);
@ -778,7 +810,7 @@ template<class T> class Grid : public GridBase {
//! multiply contents of grid
void mult(const Grid<T> &a);
static PyObject *_W_20(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
static PyObject *_W_21(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
{
try {
PbArgs _args(_linargs, _kwds);
@ -805,7 +837,7 @@ template<class T> class Grid : public GridBase {
//! multiply each cell by a constant scalar value
void multConst(T s);
static PyObject *_W_21(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
static PyObject *_W_22(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
{
try {
PbArgs _args(_linargs, _kwds);
@ -832,7 +864,7 @@ template<class T> class Grid : public GridBase {
//! safely divide contents of grid (with zero check)
Grid<T> &safeDivide(const Grid<T> &a);
static PyObject *_W_22(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
static PyObject *_W_23(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
{
try {
PbArgs _args(_linargs, _kwds);
@ -858,7 +890,7 @@ template<class T> class Grid : public GridBase {
//! clamp content to range (for vec3, clamps each component separately)
void clamp(Real min, Real max);
static PyObject *_W_23(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
static PyObject *_W_24(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
{
try {
PbArgs _args(_linargs, _kwds);
@ -886,7 +918,7 @@ template<class T> class Grid : public GridBase {
//! reduce small values to zero
void stomp(const T &threshold);
static PyObject *_W_24(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
static PyObject *_W_25(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
{
try {
PbArgs _args(_linargs, _kwds);
@ -913,7 +945,7 @@ template<class T> class Grid : public GridBase {
//! permute grid axes, e.g. switch y with z (0,2,1)
void permuteAxes(int axis0, int axis1, int axis2);
static PyObject *_W_25(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
static PyObject *_W_26(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
{
try {
PbArgs _args(_linargs, _kwds);
@ -942,7 +974,7 @@ template<class T> class Grid : public GridBase {
//! permute grid axes, e.g. switch y with z (0,2,1)
void permuteAxesCopyToGrid(int axis0, int axis1, int axis2, Grid<T> &out);
static PyObject *_W_26(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
static PyObject *_W_27(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
{
try {
PbArgs _args(_linargs, _kwds);
@ -972,7 +1004,7 @@ 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)
static PyObject *_W_28(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
{
try {
PbArgs _args(_linargs, _kwds);
@ -1001,7 +1033,7 @@ template<class T> class Grid : public GridBase {
// common compound operators
//! get absolute max value in grid
Real getMaxAbs() 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);
@ -1026,7 +1058,7 @@ template<class T> class Grid : public GridBase {
//! get max value in grid
Real getMax() 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);
@ -1051,7 +1083,7 @@ template<class T> class Grid : public GridBase {
//! get min value in grid
Real getMin() const;
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);
@ -1076,7 +1108,7 @@ template<class T> class Grid : public GridBase {
//! calculate L1 norm of grid content
Real getL1(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);
@ -1102,7 +1134,7 @@ template<class T> class Grid : public GridBase {
//! calculate L2 norm of grid content
Real getL2(int bnd = 0);
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);
@ -1128,7 +1160,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_33(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
static PyObject *_W_34(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
{
try {
PbArgs _args(_linargs, _kwds);
@ -1156,7 +1188,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_34(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
static PyObject *_W_35(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
{
try {
PbArgs _args(_linargs, _kwds);
@ -1183,7 +1215,7 @@ template<class T> class Grid : public GridBase {
//! get data pointer of grid
std::string getDataPointer();
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);
@ -1208,7 +1240,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_36(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
static PyObject *_W_37(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
{
try {
PbArgs _args(_linargs, _kwds);
@ -1276,7 +1308,7 @@ class MACGrid : public Grid<Vec3> {
{
mType = (GridType)(TypeMAC | TypeVec3);
}
static int _W_37(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
static int _W_38(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
{
PbClass *obj = Pb::objFromPy(_self);
if (obj)
@ -1358,7 +1390,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_38(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
static PyObject *_W_39(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
{
try {
PbArgs _args(_linargs, _kwds);
@ -1399,7 +1431,7 @@ class FlagGrid : public Grid<int> {
{
mType = (GridType)(TypeFlags | TypeInt);
}
static int _W_39(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
static int _W_40(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
{
PbClass *obj = Pb::objFromPy(_self);
if (obj)
@ -1579,7 +1611,7 @@ class FlagGrid : public Grid<int> {
const std::string &inflow = " ",
const std::string &outflow = " ",
Grid<Real> *phiWalls = 0x00);
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);
@ -1613,7 +1645,7 @@ class FlagGrid : public Grid<int> {
//! set fluid flags inside levelset (liquids)
void updateFromLevelset(LevelsetGrid &levelset);
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);
@ -1640,7 +1672,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_42(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
static PyObject *_W_43(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
{
try {
PbArgs _args(_linargs, _kwds);
@ -1669,7 +1701,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_43(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
static PyObject *_W_44(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
{
try {
PbArgs _args(_linargs, _kwds);

View File

@ -8,103 +8,103 @@ 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_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);
static const Pb::Register _R_27("FlagGrid", "FlagGrid", FlagGrid::_W_40);
static const Pb::Register _R_28("FlagGrid", "initDomain", FlagGrid::_W_41);
static const Pb::Register _R_29("FlagGrid", "updateFromLevelset", FlagGrid::_W_42);
static const Pb::Register _R_30("FlagGrid", "fillGrid", FlagGrid::_W_43);
static const Pb::Register _R_31("FlagGrid", "countCells", FlagGrid::_W_44);
#endif
#ifdef _C_Grid
static const Pb::Register _R_32("Grid<int>", "Grid<int>", "GridBase");
template<> const char *Namify<Grid<int>>::S = "Grid<int>";
static const Pb::Register _R_33("Grid<int>", "Grid", Grid<int>::_W_9);
static const Pb::Register _R_34("Grid<int>", "save", Grid<int>::_W_10);
static const Pb::Register _R_35("Grid<int>", "load", Grid<int>::_W_11);
static const Pb::Register _R_36("Grid<int>", "clear", Grid<int>::_W_12);
static const Pb::Register _R_37("Grid<int>", "copyFrom", Grid<int>::_W_13);
static const Pb::Register _R_38("Grid<int>", "getGridType", Grid<int>::_W_14);
static const Pb::Register _R_39("Grid<int>", "add", Grid<int>::_W_15);
static const Pb::Register _R_40("Grid<int>", "sub", Grid<int>::_W_16);
static const Pb::Register _R_41("Grid<int>", "setConst", Grid<int>::_W_17);
static const Pb::Register _R_42("Grid<int>", "addConst", Grid<int>::_W_18);
static const Pb::Register _R_43("Grid<int>", "addScaled", Grid<int>::_W_19);
static const Pb::Register _R_44("Grid<int>", "mult", Grid<int>::_W_20);
static const Pb::Register _R_45("Grid<int>", "multConst", Grid<int>::_W_21);
static const Pb::Register _R_46("Grid<int>", "safeDivide", Grid<int>::_W_22);
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>", "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_33("Grid<int>", "Grid", Grid<int>::_W_10);
static const Pb::Register _R_34("Grid<int>", "save", Grid<int>::_W_11);
static const Pb::Register _R_35("Grid<int>", "load", Grid<int>::_W_12);
static const Pb::Register _R_36("Grid<int>", "clear", Grid<int>::_W_13);
static const Pb::Register _R_37("Grid<int>", "copyFrom", Grid<int>::_W_14);
static const Pb::Register _R_38("Grid<int>", "getGridType", Grid<int>::_W_15);
static const Pb::Register _R_39("Grid<int>", "add", Grid<int>::_W_16);
static const Pb::Register _R_40("Grid<int>", "sub", Grid<int>::_W_17);
static const Pb::Register _R_41("Grid<int>", "setConst", Grid<int>::_W_18);
static const Pb::Register _R_42("Grid<int>", "addConst", Grid<int>::_W_19);
static const Pb::Register _R_43("Grid<int>", "addScaled", Grid<int>::_W_20);
static const Pb::Register _R_44("Grid<int>", "mult", Grid<int>::_W_21);
static const Pb::Register _R_45("Grid<int>", "multConst", Grid<int>::_W_22);
static const Pb::Register _R_46("Grid<int>", "safeDivide", Grid<int>::_W_23);
static const Pb::Register _R_47("Grid<int>", "clamp", Grid<int>::_W_24);
static const Pb::Register _R_48("Grid<int>", "stomp", Grid<int>::_W_25);
static const Pb::Register _R_49("Grid<int>", "permuteAxes", Grid<int>::_W_26);
static const Pb::Register _R_50("Grid<int>", "permuteAxesCopyToGrid", Grid<int>::_W_27);
static const Pb::Register _R_51("Grid<int>", "join", Grid<int>::_W_28);
static const Pb::Register _R_52("Grid<int>", "getMaxAbs", Grid<int>::_W_29);
static const Pb::Register _R_53("Grid<int>", "getMax", Grid<int>::_W_30);
static const Pb::Register _R_54("Grid<int>", "getMin", Grid<int>::_W_31);
static const Pb::Register _R_55("Grid<int>", "getL1", Grid<int>::_W_32);
static const Pb::Register _R_56("Grid<int>", "getL2", Grid<int>::_W_33);
static const Pb::Register _R_57("Grid<int>", "setBound", Grid<int>::_W_34);
static const Pb::Register _R_58("Grid<int>", "setBoundNeumann", Grid<int>::_W_35);
static const Pb::Register _R_59("Grid<int>", "getDataPointer", Grid<int>::_W_36);
static const Pb::Register _R_60("Grid<int>", "printGrid", Grid<int>::_W_37);
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_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_62("Grid<Real>", "Grid", Grid<Real>::_W_10);
static const Pb::Register _R_63("Grid<Real>", "save", Grid<Real>::_W_11);
static const Pb::Register _R_64("Grid<Real>", "load", Grid<Real>::_W_12);
static const Pb::Register _R_65("Grid<Real>", "clear", Grid<Real>::_W_13);
static const Pb::Register _R_66("Grid<Real>", "copyFrom", Grid<Real>::_W_14);
static const Pb::Register _R_67("Grid<Real>", "getGridType", Grid<Real>::_W_15);
static const Pb::Register _R_68("Grid<Real>", "add", Grid<Real>::_W_16);
static const Pb::Register _R_69("Grid<Real>", "sub", Grid<Real>::_W_17);
static const Pb::Register _R_70("Grid<Real>", "setConst", Grid<Real>::_W_18);
static const Pb::Register _R_71("Grid<Real>", "addConst", Grid<Real>::_W_19);
static const Pb::Register _R_72("Grid<Real>", "addScaled", Grid<Real>::_W_20);
static const Pb::Register _R_73("Grid<Real>", "mult", Grid<Real>::_W_21);
static const Pb::Register _R_74("Grid<Real>", "multConst", Grid<Real>::_W_22);
static const Pb::Register _R_75("Grid<Real>", "safeDivide", Grid<Real>::_W_23);
static const Pb::Register _R_76("Grid<Real>", "clamp", Grid<Real>::_W_24);
static const Pb::Register _R_77("Grid<Real>", "stomp", Grid<Real>::_W_25);
static const Pb::Register _R_78("Grid<Real>", "permuteAxes", Grid<Real>::_W_26);
static const Pb::Register _R_79("Grid<Real>", "permuteAxesCopyToGrid", Grid<Real>::_W_27);
static const Pb::Register _R_80("Grid<Real>", "join", Grid<Real>::_W_28);
static const Pb::Register _R_81("Grid<Real>", "getMaxAbs", Grid<Real>::_W_29);
static const Pb::Register _R_82("Grid<Real>", "getMax", Grid<Real>::_W_30);
static const Pb::Register _R_83("Grid<Real>", "getMin", Grid<Real>::_W_31);
static const Pb::Register _R_84("Grid<Real>", "getL1", Grid<Real>::_W_32);
static const Pb::Register _R_85("Grid<Real>", "getL2", Grid<Real>::_W_33);
static const Pb::Register _R_86("Grid<Real>", "setBound", Grid<Real>::_W_34);
static const Pb::Register _R_87("Grid<Real>", "setBoundNeumann", Grid<Real>::_W_35);
static const Pb::Register _R_88("Grid<Real>", "getDataPointer", Grid<Real>::_W_36);
static const Pb::Register _R_89("Grid<Real>", "printGrid", Grid<Real>::_W_37);
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_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);
static const Pb::Register _R_91("Grid<Vec3>", "Grid", Grid<Vec3>::_W_10);
static const Pb::Register _R_92("Grid<Vec3>", "save", Grid<Vec3>::_W_11);
static const Pb::Register _R_93("Grid<Vec3>", "load", Grid<Vec3>::_W_12);
static const Pb::Register _R_94("Grid<Vec3>", "clear", Grid<Vec3>::_W_13);
static const Pb::Register _R_95("Grid<Vec3>", "copyFrom", Grid<Vec3>::_W_14);
static const Pb::Register _R_96("Grid<Vec3>", "getGridType", Grid<Vec3>::_W_15);
static const Pb::Register _R_97("Grid<Vec3>", "add", Grid<Vec3>::_W_16);
static const Pb::Register _R_98("Grid<Vec3>", "sub", Grid<Vec3>::_W_17);
static const Pb::Register _R_99("Grid<Vec3>", "setConst", Grid<Vec3>::_W_18);
static const Pb::Register _R_100("Grid<Vec3>", "addConst", Grid<Vec3>::_W_19);
static const Pb::Register _R_101("Grid<Vec3>", "addScaled", Grid<Vec3>::_W_20);
static const Pb::Register _R_102("Grid<Vec3>", "mult", Grid<Vec3>::_W_21);
static const Pb::Register _R_103("Grid<Vec3>", "multConst", Grid<Vec3>::_W_22);
static const Pb::Register _R_104("Grid<Vec3>", "safeDivide", Grid<Vec3>::_W_23);
static const Pb::Register _R_105("Grid<Vec3>", "clamp", Grid<Vec3>::_W_24);
static const Pb::Register _R_106("Grid<Vec3>", "stomp", Grid<Vec3>::_W_25);
static const Pb::Register _R_107("Grid<Vec3>", "permuteAxes", Grid<Vec3>::_W_26);
static const Pb::Register _R_108("Grid<Vec3>", "permuteAxesCopyToGrid", Grid<Vec3>::_W_27);
static const Pb::Register _R_109("Grid<Vec3>", "join", Grid<Vec3>::_W_28);
static const Pb::Register _R_110("Grid<Vec3>", "getMaxAbs", Grid<Vec3>::_W_29);
static const Pb::Register _R_111("Grid<Vec3>", "getMax", Grid<Vec3>::_W_30);
static const Pb::Register _R_112("Grid<Vec3>", "getMin", Grid<Vec3>::_W_31);
static const Pb::Register _R_113("Grid<Vec3>", "getL1", Grid<Vec3>::_W_32);
static const Pb::Register _R_114("Grid<Vec3>", "getL2", Grid<Vec3>::_W_33);
static const Pb::Register _R_115("Grid<Vec3>", "setBound", Grid<Vec3>::_W_34);
static const Pb::Register _R_116("Grid<Vec3>", "setBoundNeumann", Grid<Vec3>::_W_35);
static const Pb::Register _R_117("Grid<Vec3>", "getDataPointer", Grid<Vec3>::_W_36);
static const Pb::Register _R_118("Grid<Vec3>", "printGrid", Grid<Vec3>::_W_37);
#endif
#ifdef _C_GridBase
static const Pb::Register _R_119("GridBase", "GridBase", "PbClass");
@ -118,12 +118,13 @@ 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);
static const Pb::Register _R_129("GridBase", "setName", GridBase::_W_9);
#endif
#ifdef _C_MACGrid
static const Pb::Register _R_129("MACGrid", "MACGrid", "Grid<Vec3>");
static const Pb::Register _R_130("MACGrid", "MACGrid", "Grid<Vec3>");
template<> const char *Namify<MACGrid>::S = "MACGrid";
static const Pb::Register _R_130("MACGrid", "MACGrid", MACGrid::_W_37);
static const Pb::Register _R_131("MACGrid", "setBoundMAC", MACGrid::_W_38);
static const Pb::Register _R_131("MACGrid", "MACGrid", MACGrid::_W_38);
static const Pb::Register _R_132("MACGrid", "setBoundMAC", MACGrid::_W_39);
#endif
static const Pb::Register _R_7("GridType_TypeNone", 0);
static const Pb::Register _R_8("GridType_TypeReal", 1);
@ -253,6 +254,7 @@ void PbRegister_file_7()
KEEP_UNUSED(_R_129);
KEEP_UNUSED(_R_130);
KEEP_UNUSED(_R_131);
KEEP_UNUSED(_R_132);
}
}
} // namespace Manta

View File

@ -1014,7 +1014,7 @@ void MANTA::initializeRNAMap(FluidModifierData *fmd)
mRNAMap["NAME_GUIDEVEL_X"] = FLUID_NAME_GUIDEVEL_X;
mRNAMap["NAME_GUIDEVEL_Y"] = FLUID_NAME_GUIDEVEL_Y;
mRNAMap["NAME_GUIDEVEL_Z"] = FLUID_NAME_GUIDEVEL_Z;
mRNAMap["NAME_GUIDEVEL"] = FLUID_NAME_GUIDEVEL;
mRNAMap["NAME_VELOCITY_GUIDE"] = FLUID_NAME_VELOCITY_GUIDE;
/* Cache file names. */
mRNAMap["NAME_CONFIG"] = FLUID_NAME_CONFIG;
@ -1539,6 +1539,7 @@ bool MANTA::bakeGuiding(FluidModifierData *fmd, int framenr)
cacheDirGuiding[0] = '\0';
string volume_format = getCacheFileEnding(fds->cache_data_format);
string resumable_cache = !(fds->flags & FLUID_DOMAIN_USE_RESUMABLE_CACHE) ? "False" : "True";
BLI_path_join(cacheDirGuiding,
sizeof(cacheDirGuiding),
@ -1549,7 +1550,7 @@ bool MANTA::bakeGuiding(FluidModifierData *fmd, int framenr)
ss.str("");
ss << "bake_guiding_" << mCurrentID << "('" << escapeSlashes(cacheDirGuiding) << "', " << framenr
<< ", '" << volume_format << "')";
<< ", '" << volume_format << "', " << resumable_cache << ")";
pythonCommands.push_back(ss.str());
return runPythonString(pythonCommands);
@ -2190,9 +2191,16 @@ bool MANTA::hasParticles(FluidModifierData *fmd, int framenr)
bool MANTA::hasGuiding(FluidModifierData *fmd, int framenr, bool sourceDomain)
{
string subdirectory = (sourceDomain) ? FLUID_DOMAIN_DIR_DATA : FLUID_DOMAIN_DIR_GUIDE;
string filename = (sourceDomain) ? FLUID_NAME_VELOCITY : FLUID_NAME_GUIDEVEL;
string filename = (sourceDomain) ? FLUID_NAME_DATA : FLUID_NAME_GUIDING;
string extension = getCacheFileEnding(fmd->domain->cache_data_format);
bool exists = BLI_exists(getFile(fmd, subdirectory, filename, extension, framenr).c_str());
/* Check old file naming. */
if (!exists) {
filename = (sourceDomain) ? FLUID_NAME_VEL : FLUID_NAME_GUIDEVEL;
exists = BLI_exists(getFile(fmd, subdirectory, filename, extension, framenr).c_str());
}
if (with_debug)
cout << "Fluid: Has Guiding: " << exists << endl;

View File

@ -329,7 +329,7 @@ y_guidevel_s$ID$ = s$ID$.create(RealGrid, name='$NAME_GUIDEVEL_Y$')\n\
z_guidevel_s$ID$ = s$ID$.create(RealGrid, name='$NAME_GUIDEVEL_Z$')\n\
\n\
# Final guide vel grid needs to have independent size\n\
guidevel_sg$ID$ = sg$ID$.create(MACGrid, name='$NAME_GUIDEVEL$')\n\
guidevel_sg$ID$ = sg$ID$.create(MACGrid, name='$NAME_VELOCITY_GUIDE$')\n\
\n\
# Keep track of important objects in dict to load them later on\n\
fluid_guiding_dict_s$ID$ = { 'guidevel' : guidevel_sg$ID$ }\n";
@ -700,14 +700,16 @@ const std::string fluid_load_guiding =
"\n\
def fluid_load_guiding_$ID$(path, framenr, file_format):\n\
mantaMsg('Fluid load guiding, frame ' + str(framenr))\n\
guidevel_sg$ID$.setName('$NAME_VELOCITY_GUIDE$')\n\
fluid_file_import_s$ID$(dict=fluid_guiding_dict_s$ID$, path=path, framenr=framenr, file_format=file_format, file_name=file_guiding_s$ID$)\n";
const std::string fluid_load_vel =
"\n\
def fluid_load_vel_$ID$(path, framenr, file_format):\n\
mantaMsg('Fluid load vel, frame ' + str(framenr))\n\
guidevel_sg$ID$.setName('$NAME_VELOCITY$') # for loading data the guidevel grid will pretend to be the vel grid\n\
fluid_vel_dict_s$ID$ = { 'vel' : guidevel_sg$ID$ }\n\
fluid_file_import_s$ID$(dict=fluid_vel_dict_s$ID$, path=path, framenr=framenr, file_format=file_format)\n";
fluid_file_import_s$ID$(dict=fluid_vel_dict_s$ID$, path=path, framenr=framenr, file_format=file_format, file_name=file_data_s$ID$)\n";
//////////////////////////////////////////////////////////////////////
// EXPORT
@ -748,12 +750,13 @@ def fluid_file_export_s$ID$(framenr, file_format, path, dict, file_name=None, mo
const std::string fluid_save_guiding =
"\n\
def fluid_save_guiding_$ID$(path, framenr, file_format):\n\
def fluid_save_guiding_$ID$(path, framenr, file_format, resumable):\n\
mantaMsg('Fluid save guiding, frame ' + str(framenr))\n\
dict = fluid_guiding_dict_s$ID$\n\
if not withMPSave or isWindows:\n\
fluid_file_export_s$ID$(dict=fluid_guiding_dict_s$ID$, framenr=framenr, file_format=file_format, path=path, file_name=file_guiding_s$ID$)\n\
fluid_file_export_s$ID$(dict=dict, framenr=framenr, file_format=file_format, path=path, file_name=file_guiding_s$ID$)\n\
else:\n\
fluid_cache_multiprocessing_start_$ID$(function=fluid_file_export_s$ID$, file_name=file_guiding_s$ID$, framenr=framenr, format_data=file_format, path_data=path, dict=fluid_guiding_dict_s$ID$, do_join=False)\n";
fluid_cache_multiprocessing_start_$ID$(function=fluid_file_export_s$ID$, file_name=file_guiding_s$ID$, framenr=framenr, format_data=file_format, path_data=path, dict=dict, do_join=False)\n";
//////////////////////////////////////////////////////////////////////
// STANDALONE MODE

View File

@ -225,8 +225,9 @@ enum {
#define FLUID_NAME_GUIDING "fluid_guiding"
/* Fluid object names.*/
#define FLUID_NAME_FLAGS "flags" /* == OpenVDB grid attribute name. */
#define FLUID_NAME_VELOCITY "velocity" /* == OpenVDB grid attribute name. */
#define FLUID_NAME_FLAGS "flags" /* == OpenVDB grid attribute name. */
#define FLUID_NAME_VELOCITY "velocity" /* == OpenVDB grid attribute name. */
#define FLUID_NAME_VEL "vel"
#define FLUID_NAME_VELOCITYTMP "velocity_previous" /* == OpenVDB grid attribute name. */
#define FLUID_NAME_VELOCITYX "x_vel"
#define FLUID_NAME_VELOCITYY "y_vel"
@ -367,7 +368,8 @@ enum {
#define FLUID_NAME_GUIDEVEL_X "x_guidevel"
#define FLUID_NAME_GUIDEVEL_Y "y_guidevel"
#define FLUID_NAME_GUIDEVEL_Z "z_guidevel"
#define FLUID_NAME_GUIDEVEL "velocity_guide"
#define FLUID_NAME_GUIDEVEL "guidevel"
#define FLUID_NAME_VELOCITY_GUIDE "velocity_guide"
/* Cache file extensions. */
#define FLUID_DOMAIN_EXTENSION_UNI ".uni"