Fluid: Moved grid reset loop for inner obstacle cells from blenkernel code into Mantaflow
Having this loop in directly Manta is faster and potentially fixes issues T72783 and T72894.
This commit is contained in:
parent
f7fa6cd1da
commit
adcc9d014c
|
@ -1,3 +1,3 @@
|
|||
|
||||
|
||||
#define MANTA_GIT_VERSION "commit 3701f32027ab499401581ed70b6999b284635ad8"
|
||||
#define MANTA_GIT_VERSION "commit 8d19f1096a4d8e115d9d1ec6024c65d53a94f47b"
|
||||
|
|
|
@ -826,9 +826,35 @@ 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)
|
||||
{
|
||||
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::safeDivide", !noTiming);
|
||||
PyObject *_retval = 0;
|
||||
{
|
||||
ArgLocker _lock;
|
||||
const Grid<T> &a = *_args.getPtr<Grid<T>>("a", 0, &_lock);
|
||||
pbo->_args.copy(_args);
|
||||
_retval = toPy(pbo->safeDivide(a));
|
||||
pbo->_args.check();
|
||||
}
|
||||
pbFinalizePlugin(pbo->getParent(), "Grid::safeDivide", !noTiming);
|
||||
return _retval;
|
||||
}
|
||||
catch (std::exception &e) {
|
||||
pbSetError("Grid::safeDivide", e.what());
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
//! clamp content to range (for vec3, clamps each component separately)
|
||||
void clamp(Real min, Real max);
|
||||
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);
|
||||
|
@ -856,7 +882,7 @@ template<class T> class Grid : public GridBase {
|
|||
|
||||
//! reduce small values to zero
|
||||
void stomp(const T &threshold);
|
||||
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);
|
||||
|
@ -883,7 +909,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_24(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
|
||||
static PyObject *_W_25(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
|
||||
{
|
||||
try {
|
||||
PbArgs _args(_linargs, _kwds);
|
||||
|
@ -912,7 +938,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_25(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
|
||||
static PyObject *_W_26(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
|
||||
{
|
||||
try {
|
||||
PbArgs _args(_linargs, _kwds);
|
||||
|
@ -943,7 +969,7 @@ template<class T> class Grid : public GridBase {
|
|||
// common compound operators
|
||||
//! get absolute max value in grid
|
||||
Real getMaxAbs() const;
|
||||
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);
|
||||
|
@ -968,7 +994,7 @@ template<class T> class Grid : public GridBase {
|
|||
|
||||
//! get max value in grid
|
||||
Real getMax() 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);
|
||||
|
@ -993,7 +1019,7 @@ template<class T> class Grid : public GridBase {
|
|||
|
||||
//! get min value in grid
|
||||
Real getMin() 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);
|
||||
|
@ -1018,7 +1044,7 @@ template<class T> class Grid : public GridBase {
|
|||
|
||||
//! calculate L1 norm of grid content
|
||||
Real getL1(int bnd = 0);
|
||||
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 +1070,7 @@ template<class T> class Grid : public GridBase {
|
|||
|
||||
//! calculate L2 norm of grid content
|
||||
Real getL2(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 +1096,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_31(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
|
||||
static PyObject *_W_32(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
|
||||
{
|
||||
try {
|
||||
PbArgs _args(_linargs, _kwds);
|
||||
|
@ -1098,7 +1124,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_32(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
|
||||
static PyObject *_W_33(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
|
||||
{
|
||||
try {
|
||||
PbArgs _args(_linargs, _kwds);
|
||||
|
@ -1125,7 +1151,7 @@ template<class T> class Grid : public GridBase {
|
|||
|
||||
//! get data pointer of grid
|
||||
std::string getDataPointer();
|
||||
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);
|
||||
|
@ -1150,7 +1176,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_34(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
|
||||
static PyObject *_W_35(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
|
||||
{
|
||||
try {
|
||||
PbArgs _args(_linargs, _kwds);
|
||||
|
@ -1186,7 +1212,6 @@ template<class T> class Grid : public GridBase {
|
|||
template<class S> Grid<T> &operator*=(const S &a);
|
||||
template<class S> Grid<T> &operator/=(const Grid<S> &a);
|
||||
template<class S> Grid<T> &operator/=(const S &a);
|
||||
Grid<T> &safeDivide(const Grid<T> &a);
|
||||
|
||||
//! Swap data with another grid (no actual data is moved)
|
||||
void swap(Grid<T> &other);
|
||||
|
@ -1219,7 +1244,7 @@ class MACGrid : public Grid<Vec3> {
|
|||
{
|
||||
mType = (GridType)(TypeMAC | TypeVec3);
|
||||
}
|
||||
static int _W_35(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
|
||||
static int _W_36(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
|
||||
{
|
||||
PbClass *obj = Pb::objFromPy(_self);
|
||||
if (obj)
|
||||
|
@ -1301,7 +1326,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_36(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
|
||||
static PyObject *_W_37(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
|
||||
{
|
||||
try {
|
||||
PbArgs _args(_linargs, _kwds);
|
||||
|
@ -1342,7 +1367,7 @@ class FlagGrid : public Grid<int> {
|
|||
{
|
||||
mType = (GridType)(TypeFlags | TypeInt);
|
||||
}
|
||||
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)
|
||||
|
@ -1522,7 +1547,7 @@ class FlagGrid : public Grid<int> {
|
|||
const std::string &inflow = " ",
|
||||
const std::string &outflow = " ",
|
||||
Grid<Real> *phiWalls = 0x00);
|
||||
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);
|
||||
|
@ -1556,7 +1581,7 @@ class FlagGrid : public Grid<int> {
|
|||
|
||||
//! set fluid flags inside levelset (liquids)
|
||||
void updateFromLevelset(LevelsetGrid &levelset);
|
||||
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);
|
||||
|
@ -1583,7 +1608,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_40(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
|
||||
static PyObject *_W_41(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
|
||||
{
|
||||
try {
|
||||
PbArgs _args(_linargs, _kwds);
|
||||
|
@ -1612,7 +1637,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_41(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
|
||||
static PyObject *_W_42(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
|
||||
{
|
||||
try {
|
||||
PbArgs _args(_linargs, _kwds);
|
||||
|
|
|
@ -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_37);
|
||||
static const Pb::Register _R_28("FlagGrid", "initDomain", FlagGrid::_W_38);
|
||||
static const Pb::Register _R_29("FlagGrid", "updateFromLevelset", FlagGrid::_W_39);
|
||||
static const Pb::Register _R_30("FlagGrid", "fillGrid", FlagGrid::_W_40);
|
||||
static const Pb::Register _R_31("FlagGrid", "countCells", FlagGrid::_W_41);
|
||||
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);
|
||||
#endif
|
||||
#ifdef _C_Grid
|
||||
static const Pb::Register _R_32("Grid<int>", "Grid<int>", "GridBase");
|
||||
|
@ -30,94 +30,97 @@ 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>", "clamp", Grid<int>::_W_22);
|
||||
static const Pb::Register _R_47("Grid<int>", "stomp", Grid<int>::_W_23);
|
||||
static const Pb::Register _R_48("Grid<int>", "permuteAxes", Grid<int>::_W_24);
|
||||
static const Pb::Register _R_49("Grid<int>", "permuteAxesCopyToGrid", Grid<int>::_W_25);
|
||||
static const Pb::Register _R_50("Grid<int>", "getMaxAbs", Grid<int>::_W_26);
|
||||
static const Pb::Register _R_51("Grid<int>", "getMax", Grid<int>::_W_27);
|
||||
static const Pb::Register _R_52("Grid<int>", "getMin", Grid<int>::_W_28);
|
||||
static const Pb::Register _R_53("Grid<int>", "getL1", Grid<int>::_W_29);
|
||||
static const Pb::Register _R_54("Grid<int>", "getL2", Grid<int>::_W_30);
|
||||
static const Pb::Register _R_55("Grid<int>", "setBound", Grid<int>::_W_31);
|
||||
static const Pb::Register _R_56("Grid<int>", "setBoundNeumann", Grid<int>::_W_32);
|
||||
static const Pb::Register _R_57("Grid<int>", "getDataPointer", Grid<int>::_W_33);
|
||||
static const Pb::Register _R_58("Grid<int>", "printGrid", Grid<int>::_W_34);
|
||||
static const Pb::Register _R_59("Grid<Real>", "Grid<Real>", "GridBase");
|
||||
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>", "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");
|
||||
template<> const char *Namify<Grid<Real>>::S = "Grid<Real>";
|
||||
static const Pb::Register _R_60("Grid<Real>", "Grid", Grid<Real>::_W_9);
|
||||
static const Pb::Register _R_61("Grid<Real>", "save", Grid<Real>::_W_10);
|
||||
static const Pb::Register _R_62("Grid<Real>", "load", Grid<Real>::_W_11);
|
||||
static const Pb::Register _R_63("Grid<Real>", "clear", Grid<Real>::_W_12);
|
||||
static const Pb::Register _R_64("Grid<Real>", "copyFrom", Grid<Real>::_W_13);
|
||||
static const Pb::Register _R_65("Grid<Real>", "getGridType", Grid<Real>::_W_14);
|
||||
static const Pb::Register _R_66("Grid<Real>", "add", Grid<Real>::_W_15);
|
||||
static const Pb::Register _R_67("Grid<Real>", "sub", Grid<Real>::_W_16);
|
||||
static const Pb::Register _R_68("Grid<Real>", "setConst", Grid<Real>::_W_17);
|
||||
static const Pb::Register _R_69("Grid<Real>", "addConst", Grid<Real>::_W_18);
|
||||
static const Pb::Register _R_70("Grid<Real>", "addScaled", Grid<Real>::_W_19);
|
||||
static const Pb::Register _R_71("Grid<Real>", "mult", Grid<Real>::_W_20);
|
||||
static const Pb::Register _R_72("Grid<Real>", "multConst", Grid<Real>::_W_21);
|
||||
static const Pb::Register _R_73("Grid<Real>", "clamp", Grid<Real>::_W_22);
|
||||
static const Pb::Register _R_74("Grid<Real>", "stomp", Grid<Real>::_W_23);
|
||||
static const Pb::Register _R_75("Grid<Real>", "permuteAxes", Grid<Real>::_W_24);
|
||||
static const Pb::Register _R_76("Grid<Real>", "permuteAxesCopyToGrid", Grid<Real>::_W_25);
|
||||
static const Pb::Register _R_77("Grid<Real>", "getMaxAbs", Grid<Real>::_W_26);
|
||||
static const Pb::Register _R_78("Grid<Real>", "getMax", Grid<Real>::_W_27);
|
||||
static const Pb::Register _R_79("Grid<Real>", "getMin", Grid<Real>::_W_28);
|
||||
static const Pb::Register _R_80("Grid<Real>", "getL1", Grid<Real>::_W_29);
|
||||
static const Pb::Register _R_81("Grid<Real>", "getL2", Grid<Real>::_W_30);
|
||||
static const Pb::Register _R_82("Grid<Real>", "setBound", Grid<Real>::_W_31);
|
||||
static const Pb::Register _R_83("Grid<Real>", "setBoundNeumann", Grid<Real>::_W_32);
|
||||
static const Pb::Register _R_84("Grid<Real>", "getDataPointer", Grid<Real>::_W_33);
|
||||
static const Pb::Register _R_85("Grid<Real>", "printGrid", Grid<Real>::_W_34);
|
||||
static const Pb::Register _R_86("Grid<Vec3>", "Grid<Vec3>", "GridBase");
|
||||
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");
|
||||
template<> const char *Namify<Grid<Vec3>>::S = "Grid<Vec3>";
|
||||
static const Pb::Register _R_87("Grid<Vec3>", "Grid", Grid<Vec3>::_W_9);
|
||||
static const Pb::Register _R_88("Grid<Vec3>", "save", Grid<Vec3>::_W_10);
|
||||
static const Pb::Register _R_89("Grid<Vec3>", "load", Grid<Vec3>::_W_11);
|
||||
static const Pb::Register _R_90("Grid<Vec3>", "clear", Grid<Vec3>::_W_12);
|
||||
static const Pb::Register _R_91("Grid<Vec3>", "copyFrom", Grid<Vec3>::_W_13);
|
||||
static const Pb::Register _R_92("Grid<Vec3>", "getGridType", Grid<Vec3>::_W_14);
|
||||
static const Pb::Register _R_93("Grid<Vec3>", "add", Grid<Vec3>::_W_15);
|
||||
static const Pb::Register _R_94("Grid<Vec3>", "sub", Grid<Vec3>::_W_16);
|
||||
static const Pb::Register _R_95("Grid<Vec3>", "setConst", Grid<Vec3>::_W_17);
|
||||
static const Pb::Register _R_96("Grid<Vec3>", "addConst", Grid<Vec3>::_W_18);
|
||||
static const Pb::Register _R_97("Grid<Vec3>", "addScaled", Grid<Vec3>::_W_19);
|
||||
static const Pb::Register _R_98("Grid<Vec3>", "mult", Grid<Vec3>::_W_20);
|
||||
static const Pb::Register _R_99("Grid<Vec3>", "multConst", Grid<Vec3>::_W_21);
|
||||
static const Pb::Register _R_100("Grid<Vec3>", "clamp", Grid<Vec3>::_W_22);
|
||||
static const Pb::Register _R_101("Grid<Vec3>", "stomp", Grid<Vec3>::_W_23);
|
||||
static const Pb::Register _R_102("Grid<Vec3>", "permuteAxes", Grid<Vec3>::_W_24);
|
||||
static const Pb::Register _R_103("Grid<Vec3>", "permuteAxesCopyToGrid", Grid<Vec3>::_W_25);
|
||||
static const Pb::Register _R_104("Grid<Vec3>", "getMaxAbs", Grid<Vec3>::_W_26);
|
||||
static const Pb::Register _R_105("Grid<Vec3>", "getMax", Grid<Vec3>::_W_27);
|
||||
static const Pb::Register _R_106("Grid<Vec3>", "getMin", Grid<Vec3>::_W_28);
|
||||
static const Pb::Register _R_107("Grid<Vec3>", "getL1", Grid<Vec3>::_W_29);
|
||||
static const Pb::Register _R_108("Grid<Vec3>", "getL2", Grid<Vec3>::_W_30);
|
||||
static const Pb::Register _R_109("Grid<Vec3>", "setBound", Grid<Vec3>::_W_31);
|
||||
static const Pb::Register _R_110("Grid<Vec3>", "setBoundNeumann", Grid<Vec3>::_W_32);
|
||||
static const Pb::Register _R_111("Grid<Vec3>", "getDataPointer", Grid<Vec3>::_W_33);
|
||||
static const Pb::Register _R_112("Grid<Vec3>", "printGrid", Grid<Vec3>::_W_34);
|
||||
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);
|
||||
#endif
|
||||
#ifdef _C_GridBase
|
||||
static const Pb::Register _R_113("GridBase", "GridBase", "PbClass");
|
||||
static const Pb::Register _R_116("GridBase", "GridBase", "PbClass");
|
||||
template<> const char *Namify<GridBase>::S = "GridBase";
|
||||
static const Pb::Register _R_114("GridBase", "GridBase", GridBase::_W_0);
|
||||
static const Pb::Register _R_115("GridBase", "getSizeX", GridBase::_W_1);
|
||||
static const Pb::Register _R_116("GridBase", "getSizeY", GridBase::_W_2);
|
||||
static const Pb::Register _R_117("GridBase", "getSizeZ", GridBase::_W_3);
|
||||
static const Pb::Register _R_118("GridBase", "getSize", GridBase::_W_4);
|
||||
static const Pb::Register _R_119("GridBase", "is3D", GridBase::_W_5);
|
||||
static const Pb::Register _R_120("GridBase", "is4D", GridBase::_W_6);
|
||||
static const Pb::Register _R_121("GridBase", "getSizeT", GridBase::_W_7);
|
||||
static const Pb::Register _R_122("GridBase", "getStrideT", GridBase::_W_8);
|
||||
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);
|
||||
#endif
|
||||
#ifdef _C_MACGrid
|
||||
static const Pb::Register _R_123("MACGrid", "MACGrid", "Grid<Vec3>");
|
||||
static const Pb::Register _R_126("MACGrid", "MACGrid", "Grid<Vec3>");
|
||||
template<> const char *Namify<MACGrid>::S = "MACGrid";
|
||||
static const Pb::Register _R_124("MACGrid", "MACGrid", MACGrid::_W_35);
|
||||
static const Pb::Register _R_125("MACGrid", "setBoundMAC", MACGrid::_W_36);
|
||||
static const Pb::Register _R_127("MACGrid", "MACGrid", MACGrid::_W_36);
|
||||
static const Pb::Register _R_128("MACGrid", "setBoundMAC", MACGrid::_W_37);
|
||||
#endif
|
||||
static const Pb::Register _R_7("GridType_TypeNone", 0);
|
||||
static const Pb::Register _R_8("GridType_TypeReal", 1);
|
||||
|
@ -241,6 +244,9 @@ void PbRegister_file_7()
|
|||
KEEP_UNUSED(_R_123);
|
||||
KEEP_UNUSED(_R_124);
|
||||
KEEP_UNUSED(_R_125);
|
||||
KEEP_UNUSED(_R_126);
|
||||
KEEP_UNUSED(_R_127);
|
||||
KEEP_UNUSED(_R_128);
|
||||
}
|
||||
}
|
||||
} // namespace Manta
|
|
@ -1468,23 +1468,50 @@ void PbRegister_setForceField()
|
|||
}
|
||||
}
|
||||
|
||||
void dissolveSmoke(const FlagGrid &flags,
|
||||
Grid<Real> &density,
|
||||
Grid<Real> *heat = NULL,
|
||||
Grid<Real> *red = NULL,
|
||||
Grid<Real> *green = NULL,
|
||||
Grid<Real> *blue = NULL,
|
||||
int speed = 5,
|
||||
bool logFalloff = true)
|
||||
{
|
||||
float dydx = 1.0f / (float)speed; // max density/speed = dydx
|
||||
float fac = 1.0f - dydx;
|
||||
|
||||
FOR_IJK_BND(density, 0)
|
||||
struct KnDissolveSmoke : public KernelBase {
|
||||
KnDissolveSmoke(const FlagGrid &flags,
|
||||
Grid<Real> &density,
|
||||
Grid<Real> *heat,
|
||||
Grid<Real> *red,
|
||||
Grid<Real> *green,
|
||||
Grid<Real> *blue,
|
||||
int speed,
|
||||
bool logFalloff,
|
||||
float dydx,
|
||||
float fac)
|
||||
: KernelBase(&flags, 0),
|
||||
flags(flags),
|
||||
density(density),
|
||||
heat(heat),
|
||||
red(red),
|
||||
green(green),
|
||||
blue(blue),
|
||||
speed(speed),
|
||||
logFalloff(logFalloff),
|
||||
dydx(dydx),
|
||||
fac(fac)
|
||||
{
|
||||
runMessage();
|
||||
run();
|
||||
}
|
||||
inline void op(int i,
|
||||
int j,
|
||||
int k,
|
||||
const FlagGrid &flags,
|
||||
Grid<Real> &density,
|
||||
Grid<Real> *heat,
|
||||
Grid<Real> *red,
|
||||
Grid<Real> *green,
|
||||
Grid<Real> *blue,
|
||||
int speed,
|
||||
bool logFalloff,
|
||||
float dydx,
|
||||
float fac) const
|
||||
{
|
||||
|
||||
bool curFluid = flags.isFluid(i, j, k);
|
||||
if (!curFluid)
|
||||
continue;
|
||||
return;
|
||||
|
||||
if (logFalloff) {
|
||||
density(i, j, k) *= fac;
|
||||
|
@ -1517,6 +1544,111 @@ void dissolveSmoke(const FlagGrid &flags,
|
|||
}
|
||||
}
|
||||
}
|
||||
inline const FlagGrid &getArg0()
|
||||
{
|
||||
return flags;
|
||||
}
|
||||
typedef FlagGrid type0;
|
||||
inline Grid<Real> &getArg1()
|
||||
{
|
||||
return density;
|
||||
}
|
||||
typedef Grid<Real> type1;
|
||||
inline Grid<Real> *getArg2()
|
||||
{
|
||||
return heat;
|
||||
}
|
||||
typedef Grid<Real> type2;
|
||||
inline Grid<Real> *getArg3()
|
||||
{
|
||||
return red;
|
||||
}
|
||||
typedef Grid<Real> type3;
|
||||
inline Grid<Real> *getArg4()
|
||||
{
|
||||
return green;
|
||||
}
|
||||
typedef Grid<Real> type4;
|
||||
inline Grid<Real> *getArg5()
|
||||
{
|
||||
return blue;
|
||||
}
|
||||
typedef Grid<Real> type5;
|
||||
inline int &getArg6()
|
||||
{
|
||||
return speed;
|
||||
}
|
||||
typedef int type6;
|
||||
inline bool &getArg7()
|
||||
{
|
||||
return logFalloff;
|
||||
}
|
||||
typedef bool type7;
|
||||
inline float &getArg8()
|
||||
{
|
||||
return dydx;
|
||||
}
|
||||
typedef float type8;
|
||||
inline float &getArg9()
|
||||
{
|
||||
return fac;
|
||||
}
|
||||
typedef float type9;
|
||||
void runMessage()
|
||||
{
|
||||
debMsg("Executing kernel KnDissolveSmoke ", 3);
|
||||
debMsg("Kernel range"
|
||||
<< " x " << maxX << " y " << maxY << " z " << minZ << " - " << maxZ << " ",
|
||||
4);
|
||||
};
|
||||
void operator()(const tbb::blocked_range<IndexInt> &__r) const
|
||||
{
|
||||
const int _maxX = maxX;
|
||||
const int _maxY = maxY;
|
||||
if (maxZ > 1) {
|
||||
for (int k = __r.begin(); k != (int)__r.end(); k++)
|
||||
for (int j = 0; j < _maxY; j++)
|
||||
for (int i = 0; i < _maxX; i++)
|
||||
op(i, j, k, flags, density, heat, red, green, blue, speed, logFalloff, dydx, fac);
|
||||
}
|
||||
else {
|
||||
const int k = 0;
|
||||
for (int j = __r.begin(); j != (int)__r.end(); j++)
|
||||
for (int i = 0; i < _maxX; i++)
|
||||
op(i, j, k, flags, density, heat, red, green, blue, speed, logFalloff, dydx, fac);
|
||||
}
|
||||
}
|
||||
void run()
|
||||
{
|
||||
if (maxZ > 1)
|
||||
tbb::parallel_for(tbb::blocked_range<IndexInt>(minZ, maxZ), *this);
|
||||
else
|
||||
tbb::parallel_for(tbb::blocked_range<IndexInt>(0, maxY), *this);
|
||||
}
|
||||
const FlagGrid &flags;
|
||||
Grid<Real> &density;
|
||||
Grid<Real> *heat;
|
||||
Grid<Real> *red;
|
||||
Grid<Real> *green;
|
||||
Grid<Real> *blue;
|
||||
int speed;
|
||||
bool logFalloff;
|
||||
float dydx;
|
||||
float fac;
|
||||
};
|
||||
|
||||
void dissolveSmoke(const FlagGrid &flags,
|
||||
Grid<Real> &density,
|
||||
Grid<Real> *heat = NULL,
|
||||
Grid<Real> *red = NULL,
|
||||
Grid<Real> *green = NULL,
|
||||
Grid<Real> *blue = NULL,
|
||||
int speed = 5,
|
||||
bool logFalloff = true)
|
||||
{
|
||||
float dydx = 1.0f / (float)speed; // max density/speed = dydx
|
||||
float fac = 1.0f - dydx;
|
||||
KnDissolveSmoke(flags, density, heat, red, green, blue, speed, logFalloff, dydx, fac);
|
||||
}
|
||||
static PyObject *_W_11(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
|
||||
{
|
||||
|
|
|
@ -1003,6 +1003,214 @@ void PbRegister_densityInflowMesh()
|
|||
}
|
||||
}
|
||||
|
||||
struct KnResetInObstacle : public KernelBase {
|
||||
KnResetInObstacle(FlagGrid &flags,
|
||||
MACGrid &vel,
|
||||
Grid<Real> *density,
|
||||
Grid<Real> *heat,
|
||||
Grid<Real> *fuel,
|
||||
Grid<Real> *flame,
|
||||
Grid<Real> *red,
|
||||
Grid<Real> *green,
|
||||
Grid<Real> *blue,
|
||||
Real resetValue)
|
||||
: KernelBase(&flags, 0),
|
||||
flags(flags),
|
||||
vel(vel),
|
||||
density(density),
|
||||
heat(heat),
|
||||
fuel(fuel),
|
||||
flame(flame),
|
||||
red(red),
|
||||
green(green),
|
||||
blue(blue),
|
||||
resetValue(resetValue)
|
||||
{
|
||||
runMessage();
|
||||
run();
|
||||
}
|
||||
inline void op(int i,
|
||||
int j,
|
||||
int k,
|
||||
FlagGrid &flags,
|
||||
MACGrid &vel,
|
||||
Grid<Real> *density,
|
||||
Grid<Real> *heat,
|
||||
Grid<Real> *fuel,
|
||||
Grid<Real> *flame,
|
||||
Grid<Real> *red,
|
||||
Grid<Real> *green,
|
||||
Grid<Real> *blue,
|
||||
Real resetValue) const
|
||||
{
|
||||
if (!flags.isObstacle(i, j, k))
|
||||
return;
|
||||
vel(i, j, k).x = resetValue;
|
||||
vel(i, j, k).y = resetValue;
|
||||
vel(i, j, k).z = resetValue;
|
||||
|
||||
if (density) {
|
||||
(*density)(i, j, k) = resetValue;
|
||||
}
|
||||
if (heat) {
|
||||
(*heat)(i, j, k) = resetValue;
|
||||
}
|
||||
if (fuel) {
|
||||
(*fuel)(i, j, k) = resetValue;
|
||||
(*flame)(i, j, k) = resetValue;
|
||||
}
|
||||
if (red) {
|
||||
(*red)(i, j, k) = resetValue;
|
||||
(*green)(i, j, k) = resetValue;
|
||||
(*blue)(i, j, k) = resetValue;
|
||||
}
|
||||
}
|
||||
inline FlagGrid &getArg0()
|
||||
{
|
||||
return flags;
|
||||
}
|
||||
typedef FlagGrid type0;
|
||||
inline MACGrid &getArg1()
|
||||
{
|
||||
return vel;
|
||||
}
|
||||
typedef MACGrid type1;
|
||||
inline Grid<Real> *getArg2()
|
||||
{
|
||||
return density;
|
||||
}
|
||||
typedef Grid<Real> type2;
|
||||
inline Grid<Real> *getArg3()
|
||||
{
|
||||
return heat;
|
||||
}
|
||||
typedef Grid<Real> type3;
|
||||
inline Grid<Real> *getArg4()
|
||||
{
|
||||
return fuel;
|
||||
}
|
||||
typedef Grid<Real> type4;
|
||||
inline Grid<Real> *getArg5()
|
||||
{
|
||||
return flame;
|
||||
}
|
||||
typedef Grid<Real> type5;
|
||||
inline Grid<Real> *getArg6()
|
||||
{
|
||||
return red;
|
||||
}
|
||||
typedef Grid<Real> type6;
|
||||
inline Grid<Real> *getArg7()
|
||||
{
|
||||
return green;
|
||||
}
|
||||
typedef Grid<Real> type7;
|
||||
inline Grid<Real> *getArg8()
|
||||
{
|
||||
return blue;
|
||||
}
|
||||
typedef Grid<Real> type8;
|
||||
inline Real &getArg9()
|
||||
{
|
||||
return resetValue;
|
||||
}
|
||||
typedef Real type9;
|
||||
void runMessage()
|
||||
{
|
||||
debMsg("Executing kernel KnResetInObstacle ", 3);
|
||||
debMsg("Kernel range"
|
||||
<< " x " << maxX << " y " << maxY << " z " << minZ << " - " << maxZ << " ",
|
||||
4);
|
||||
};
|
||||
void operator()(const tbb::blocked_range<IndexInt> &__r) const
|
||||
{
|
||||
const int _maxX = maxX;
|
||||
const int _maxY = maxY;
|
||||
if (maxZ > 1) {
|
||||
for (int k = __r.begin(); k != (int)__r.end(); k++)
|
||||
for (int j = 0; j < _maxY; j++)
|
||||
for (int i = 0; i < _maxX; i++)
|
||||
op(i, j, k, flags, vel, density, heat, fuel, flame, red, green, blue, resetValue);
|
||||
}
|
||||
else {
|
||||
const int k = 0;
|
||||
for (int j = __r.begin(); j != (int)__r.end(); j++)
|
||||
for (int i = 0; i < _maxX; i++)
|
||||
op(i, j, k, flags, vel, density, heat, fuel, flame, red, green, blue, resetValue);
|
||||
}
|
||||
}
|
||||
void run()
|
||||
{
|
||||
if (maxZ > 1)
|
||||
tbb::parallel_for(tbb::blocked_range<IndexInt>(minZ, maxZ), *this);
|
||||
else
|
||||
tbb::parallel_for(tbb::blocked_range<IndexInt>(0, maxY), *this);
|
||||
}
|
||||
FlagGrid &flags;
|
||||
MACGrid &vel;
|
||||
Grid<Real> *density;
|
||||
Grid<Real> *heat;
|
||||
Grid<Real> *fuel;
|
||||
Grid<Real> *flame;
|
||||
Grid<Real> *red;
|
||||
Grid<Real> *green;
|
||||
Grid<Real> *blue;
|
||||
Real resetValue;
|
||||
};
|
||||
|
||||
void resetInObstacle(FlagGrid &flags,
|
||||
MACGrid &vel,
|
||||
Grid<Real> *density,
|
||||
Grid<Real> *heat = NULL,
|
||||
Grid<Real> *fuel = NULL,
|
||||
Grid<Real> *flame = NULL,
|
||||
Grid<Real> *red = NULL,
|
||||
Grid<Real> *green = NULL,
|
||||
Grid<Real> *blue = NULL,
|
||||
Real resetValue = 0)
|
||||
{
|
||||
KnResetInObstacle(flags, vel, density, heat, fuel, flame, red, green, blue, resetValue);
|
||||
}
|
||||
static PyObject *_W_10(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
|
||||
{
|
||||
try {
|
||||
PbArgs _args(_linargs, _kwds);
|
||||
FluidSolver *parent = _args.obtainParent();
|
||||
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
|
||||
pbPreparePlugin(parent, "resetInObstacle", !noTiming);
|
||||
PyObject *_retval = 0;
|
||||
{
|
||||
ArgLocker _lock;
|
||||
FlagGrid &flags = *_args.getPtr<FlagGrid>("flags", 0, &_lock);
|
||||
MACGrid &vel = *_args.getPtr<MACGrid>("vel", 1, &_lock);
|
||||
Grid<Real> *density = _args.getPtr<Grid<Real>>("density", 2, &_lock);
|
||||
Grid<Real> *heat = _args.getPtrOpt<Grid<Real>>("heat", 3, NULL, &_lock);
|
||||
Grid<Real> *fuel = _args.getPtrOpt<Grid<Real>>("fuel", 4, NULL, &_lock);
|
||||
Grid<Real> *flame = _args.getPtrOpt<Grid<Real>>("flame", 5, NULL, &_lock);
|
||||
Grid<Real> *red = _args.getPtrOpt<Grid<Real>>("red", 6, NULL, &_lock);
|
||||
Grid<Real> *green = _args.getPtrOpt<Grid<Real>>("green", 7, NULL, &_lock);
|
||||
Grid<Real> *blue = _args.getPtrOpt<Grid<Real>>("blue", 8, NULL, &_lock);
|
||||
Real resetValue = _args.getOpt<Real>("resetValue", 9, 0, &_lock);
|
||||
_retval = getPyNone();
|
||||
resetInObstacle(flags, vel, density, heat, fuel, flame, red, green, blue, resetValue);
|
||||
_args.check();
|
||||
}
|
||||
pbFinalizePlugin(parent, "resetInObstacle", !noTiming);
|
||||
return _retval;
|
||||
}
|
||||
catch (std::exception &e) {
|
||||
pbSetError("resetInObstacle", e.what());
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
static const Pb::Register _RP_resetInObstacle("", "resetInObstacle", _W_10);
|
||||
extern "C" {
|
||||
void PbRegister_resetInObstacle()
|
||||
{
|
||||
KEEP_UNUSED(_RP_resetInObstacle);
|
||||
}
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
|
||||
//! check for symmetry , optionally enfore by copying
|
||||
|
@ -1026,7 +1234,7 @@ void checkSymmetry(
|
|||
}
|
||||
}
|
||||
}
|
||||
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);
|
||||
|
@ -1053,7 +1261,7 @@ static PyObject *_W_10(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
|
|||
return 0;
|
||||
}
|
||||
}
|
||||
static const Pb::Register _RP_checkSymmetry("", "checkSymmetry", _W_10);
|
||||
static const Pb::Register _RP_checkSymmetry("", "checkSymmetry", _W_11);
|
||||
extern "C" {
|
||||
void PbRegister_checkSymmetry()
|
||||
{
|
||||
|
@ -1144,7 +1352,7 @@ void checkSymmetryVec3(Grid<Vec3> &a,
|
|||
}
|
||||
}
|
||||
}
|
||||
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);
|
||||
|
@ -1172,7 +1380,7 @@ static PyObject *_W_11(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
|
|||
return 0;
|
||||
}
|
||||
}
|
||||
static const Pb::Register _RP_checkSymmetryVec3("", "checkSymmetryVec3", _W_11);
|
||||
static const Pb::Register _RP_checkSymmetryVec3("", "checkSymmetryVec3", _W_12);
|
||||
extern "C" {
|
||||
void PbRegister_checkSymmetryVec3()
|
||||
{
|
||||
|
@ -1192,7 +1400,7 @@ void projectPpmFull(const Grid<Real> &val, string name, int shadeMode = 0, Real
|
|||
projectImg(img, val, shadeMode, scale);
|
||||
img.writePpm(name);
|
||||
}
|
||||
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);
|
||||
|
@ -1218,7 +1426,7 @@ static PyObject *_W_12(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
|
|||
return 0;
|
||||
}
|
||||
}
|
||||
static const Pb::Register _RP_projectPpmFull("", "projectPpmFull", _W_12);
|
||||
static const Pb::Register _RP_projectPpmFull("", "projectPpmFull", _W_13);
|
||||
extern "C" {
|
||||
void PbRegister_projectPpmFull()
|
||||
{
|
||||
|
@ -1238,7 +1446,7 @@ void addTestParts(BasicParticleSystem &parts, int num)
|
|||
parts.doCompress();
|
||||
parts.insertBufferedParticles();
|
||||
}
|
||||
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);
|
||||
|
@ -1262,7 +1470,7 @@ static PyObject *_W_13(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
|
|||
return 0;
|
||||
}
|
||||
}
|
||||
static const Pb::Register _RP_addTestParts("", "addTestParts", _W_13);
|
||||
static const Pb::Register _RP_addTestParts("", "addTestParts", _W_14);
|
||||
extern "C" {
|
||||
void PbRegister_addTestParts()
|
||||
{
|
||||
|
@ -1313,7 +1521,7 @@ Real pdataMaxDiff(const ParticleDataBase *a, const ParticleDataBase *b)
|
|||
|
||||
return maxVal;
|
||||
}
|
||||
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);
|
||||
|
@ -1336,7 +1544,7 @@ static PyObject *_W_14(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
|
|||
return 0;
|
||||
}
|
||||
}
|
||||
static const Pb::Register _RP_pdataMaxDiff("", "pdataMaxDiff", _W_14);
|
||||
static const Pb::Register _RP_pdataMaxDiff("", "pdataMaxDiff", _W_15);
|
||||
extern "C" {
|
||||
void PbRegister_pdataMaxDiff()
|
||||
{
|
||||
|
@ -1359,7 +1567,7 @@ Vec3 calcCenterOfMass(const Grid<Real> &density)
|
|||
p /= w;
|
||||
return p;
|
||||
}
|
||||
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);
|
||||
|
@ -1381,7 +1589,7 @@ static PyObject *_W_15(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
|
|||
return 0;
|
||||
}
|
||||
}
|
||||
static const Pb::Register _RP_calcCenterOfMass("", "calcCenterOfMass", _W_15);
|
||||
static const Pb::Register _RP_calcCenterOfMass("", "calcCenterOfMass", _W_16);
|
||||
extern "C" {
|
||||
void PbRegister_calcCenterOfMass()
|
||||
{
|
||||
|
@ -1581,7 +1789,7 @@ void updateFractions(const FlagGrid &flags,
|
|||
fractions.setConst(Vec3(0.));
|
||||
KnUpdateFractions(flags, phiObs, fractions, boundaryWidth, fracThreshold);
|
||||
}
|
||||
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);
|
||||
|
@ -1608,7 +1816,7 @@ static PyObject *_W_16(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
|
|||
return 0;
|
||||
}
|
||||
}
|
||||
static const Pb::Register _RP_updateFractions("", "updateFractions", _W_16);
|
||||
static const Pb::Register _RP_updateFractions("", "updateFractions", _W_17);
|
||||
extern "C" {
|
||||
void PbRegister_updateFractions()
|
||||
{
|
||||
|
@ -1750,7 +1958,7 @@ void setObstacleFlags(FlagGrid &flags,
|
|||
{
|
||||
KnUpdateFlagsObs(flags, fractions, phiObs, phiOut, phiIn);
|
||||
}
|
||||
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);
|
||||
|
@ -1777,7 +1985,7 @@ static PyObject *_W_17(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
|
|||
return 0;
|
||||
}
|
||||
}
|
||||
static const Pb::Register _RP_setObstacleFlags("", "setObstacleFlags", _W_17);
|
||||
static const Pb::Register _RP_setObstacleFlags("", "setObstacleFlags", _W_18);
|
||||
extern "C" {
|
||||
void PbRegister_setObstacleFlags()
|
||||
{
|
||||
|
@ -1894,7 +2102,7 @@ void initVortexVelocity(const Grid<Real> &phiObs,
|
|||
{
|
||||
kninitVortexVelocity(phiObs, vel, center, radius);
|
||||
}
|
||||
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);
|
||||
|
@ -1920,7 +2128,7 @@ static PyObject *_W_18(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
|
|||
return 0;
|
||||
}
|
||||
}
|
||||
static const Pb::Register _RP_initVortexVelocity("", "initVortexVelocity", _W_18);
|
||||
static const Pb::Register _RP_initVortexVelocity("", "initVortexVelocity", _W_19);
|
||||
extern "C" {
|
||||
void PbRegister_initVortexVelocity()
|
||||
{
|
||||
|
@ -2246,7 +2454,7 @@ int blurMacGrid(MACGrid &oG, MACGrid &tG, float si)
|
|||
}
|
||||
return tmGK.mDim;
|
||||
}
|
||||
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);
|
||||
|
@ -2270,7 +2478,7 @@ static PyObject *_W_19(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
|
|||
return 0;
|
||||
}
|
||||
}
|
||||
static const Pb::Register _RP_blurMacGrid("", "blurMacGrid", _W_19);
|
||||
static const Pb::Register _RP_blurMacGrid("", "blurMacGrid", _W_20);
|
||||
extern "C" {
|
||||
void PbRegister_blurMacGrid()
|
||||
{
|
||||
|
@ -2282,7 +2490,7 @@ int blurRealGrid(Grid<Real> &oG, Grid<Real> &tG, float si)
|
|||
{
|
||||
return blurGrid<Real>(oG, tG, si);
|
||||
}
|
||||
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);
|
||||
|
@ -2306,7 +2514,7 @@ static PyObject *_W_20(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
|
|||
return 0;
|
||||
}
|
||||
}
|
||||
static const Pb::Register _RP_blurRealGrid("", "blurRealGrid", _W_20);
|
||||
static const Pb::Register _RP_blurRealGrid("", "blurRealGrid", _W_21);
|
||||
extern "C" {
|
||||
void PbRegister_blurRealGrid()
|
||||
{
|
||||
|
|
|
@ -103,6 +103,7 @@ extern void PbRegister_obstacleLevelset();
|
|||
extern void PbRegister_applyEmission();
|
||||
extern void PbRegister_densityInflowMeshNoise();
|
||||
extern void PbRegister_densityInflowMesh();
|
||||
extern void PbRegister_resetInObstacle();
|
||||
extern void PbRegister_checkSymmetry();
|
||||
extern void PbRegister_checkSymmetryVec3();
|
||||
extern void PbRegister_projectPpmFull();
|
||||
|
@ -295,6 +296,7 @@ void MantaEnsureRegistration()
|
|||
PbRegister_applyEmission();
|
||||
PbRegister_densityInflowMeshNoise();
|
||||
PbRegister_densityInflowMesh();
|
||||
PbRegister_resetInObstacle();
|
||||
PbRegister_checkSymmetry();
|
||||
PbRegister_checkSymmetryVec3();
|
||||
PbRegister_projectPpmFull();
|
||||
|
|
|
@ -85,8 +85,8 @@ float *manta_get_force_x(struct MANTA *fluid);
|
|||
float *manta_get_force_y(struct MANTA *fluid);
|
||||
float *manta_get_force_z(struct MANTA *fluid);
|
||||
float *manta_get_phiguide_in(struct MANTA *fluid);
|
||||
int *manta_get_num_obstacle(struct MANTA *fluid);
|
||||
int *manta_get_num_guide(struct MANTA *fluid);
|
||||
float *manta_get_num_obstacle(struct MANTA *fluid);
|
||||
float *manta_get_num_guide(struct MANTA *fluid);
|
||||
int manta_get_res_x(struct MANTA *fluid);
|
||||
int manta_get_res_y(struct MANTA *fluid);
|
||||
int manta_get_res_z(struct MANTA *fluid);
|
||||
|
|
|
@ -2522,10 +2522,6 @@ void MANTA::updatePointers()
|
|||
|
||||
std::vector<std::tuple<int **, std::string, std::string, bool>> mantaIntObjects;
|
||||
mantaIntObjects.push_back(std::make_tuple(&mObstacle, "flags" + solver_ext, func, true));
|
||||
mantaIntObjects.push_back(
|
||||
std::make_tuple(&mNumObstacle, "numObs" + solver_ext, func, mUsingObstacle));
|
||||
mantaIntObjects.push_back(
|
||||
std::make_tuple(&mNumGuide, "numGuides" + solver_ext, func, mUsingGuiding));
|
||||
|
||||
std::vector<std::tuple<float **, std::string, std::string, bool>> mantaFloatObjects;
|
||||
mantaFloatObjects.push_back(std::make_tuple(&mPhiIn, "phiIn" + solver_ext, func, true));
|
||||
|
@ -2559,6 +2555,10 @@ void MANTA::updatePointers()
|
|||
std::make_tuple(&mInVelocityY, "y_invel" + solver_ext, func, mUsingInvel));
|
||||
mantaFloatObjects.push_back(
|
||||
std::make_tuple(&mInVelocityZ, "z_invel" + solver_ext, func, mUsingInvel));
|
||||
mantaFloatObjects.push_back(
|
||||
std::make_tuple(&mNumObstacle, "numObs" + solver_ext, func, mUsingObstacle));
|
||||
mantaFloatObjects.push_back(
|
||||
std::make_tuple(&mNumGuide, "numGuides" + solver_ext, func, mUsingGuiding));
|
||||
|
||||
mantaFloatObjects.push_back(std::make_tuple(&mPhi, "phi" + solver_ext, func, mUsingLiquid));
|
||||
|
||||
|
|
|
@ -248,11 +248,11 @@ struct MANTA {
|
|||
{
|
||||
return mObstacle;
|
||||
}
|
||||
inline int *getNumObstacle()
|
||||
inline float *getNumObstacle()
|
||||
{
|
||||
return mNumObstacle;
|
||||
}
|
||||
inline int *getNumGuide()
|
||||
inline float *getNumGuide()
|
||||
{
|
||||
return mNumGuide;
|
||||
}
|
||||
|
@ -765,8 +765,8 @@ struct MANTA {
|
|||
float *mForceY;
|
||||
float *mForceZ;
|
||||
int *mObstacle;
|
||||
int *mNumObstacle;
|
||||
int *mNumGuide;
|
||||
float *mNumObstacle;
|
||||
float *mNumGuide;
|
||||
|
||||
// Smoke grids
|
||||
float *mDensity;
|
||||
|
|
|
@ -292,11 +292,11 @@ float *manta_get_phiguide_in(MANTA *fluid)
|
|||
return fluid->getPhiGuideIn();
|
||||
}
|
||||
|
||||
int *manta_get_num_obstacle(MANTA *fluid)
|
||||
float *manta_get_num_obstacle(MANTA *fluid)
|
||||
{
|
||||
return fluid->getNumObstacle();
|
||||
}
|
||||
int *manta_get_num_guide(MANTA *fluid)
|
||||
float *manta_get_num_guide(MANTA *fluid)
|
||||
{
|
||||
return fluid->getNumGuide();
|
||||
}
|
||||
|
|
|
@ -243,7 +243,7 @@ fluid_data_dict_s$ID$ = dict(vel=vel_s$ID$, phiObs=phiObs_s$ID$, phiIn=phiIn_s$I
|
|||
const std::string fluid_alloc_obstacle =
|
||||
"\n\
|
||||
mantaMsg('Allocating obstacle data')\n\
|
||||
numObs_s$ID$ = s$ID$.create(IntGrid)\n\
|
||||
numObs_s$ID$ = s$ID$.create(RealGrid)\n\
|
||||
phiObsIn_s$ID$ = s$ID$.create(LevelsetGrid)\n\
|
||||
obvel_s$ID$ = s$ID$.create(MACGrid)\n\
|
||||
obvelC_s$ID$ = s$ID$.create(Vec3Grid)\n\
|
||||
|
@ -259,7 +259,7 @@ const std::string fluid_alloc_guiding =
|
|||
mantaMsg('Allocating guiding data')\n\
|
||||
velT_s$ID$ = s$ID$.create(MACGrid)\n\
|
||||
weightGuide_s$ID$ = s$ID$.create(RealGrid)\n\
|
||||
numGuides_s$ID$ = s$ID$.create(IntGrid)\n\
|
||||
numGuides_s$ID$ = s$ID$.create(RealGrid)\n\
|
||||
phiGuideIn_s$ID$ = s$ID$.create(LevelsetGrid)\n\
|
||||
guidevelC_s$ID$ = s$ID$.create(Vec3Grid)\n\
|
||||
x_guidevel_s$ID$ = s$ID$.create(RealGrid)\n\
|
||||
|
@ -324,9 +324,15 @@ def fluid_pre_step_$ID$():\n\
|
|||
\n\
|
||||
# translate obvels (world space) to grid space\n\
|
||||
if using_obstacle_s$ID$:\n\
|
||||
# Average out velocities from multiple obstacle objects at one cell\n\
|
||||
x_obvel_s$ID$.safeDivide(numObs_s$ID$)\n\
|
||||
y_obvel_s$ID$.safeDivide(numObs_s$ID$)\n\
|
||||
z_obvel_s$ID$.safeDivide(numObs_s$ID$)\n\
|
||||
\n\
|
||||
x_obvel_s$ID$.multConst(toMantaUnitsFac_s$ID$)\n\
|
||||
y_obvel_s$ID$.multConst(toMantaUnitsFac_s$ID$)\n\
|
||||
z_obvel_s$ID$.multConst(toMantaUnitsFac_s$ID$)\n\
|
||||
\n\
|
||||
copyRealToVec3(sourceX=x_obvel_s$ID$, sourceY=y_obvel_s$ID$, sourceZ=z_obvel_s$ID$, target=obvelC_s$ID$)\n\
|
||||
\n\
|
||||
# translate invels (world space) to grid space\n\
|
||||
|
@ -572,9 +578,15 @@ def bake_guiding_process_$ID$(framenr, format_guiding, path_guiding):\n\
|
|||
if framenr>1:\n\
|
||||
fluid_load_guiding_$ID$(path_guiding, framenr-1, format_guiding)\n\
|
||||
\n\
|
||||
# Average out velocities from multiple guiding objects at one cell\n\
|
||||
x_guidevel_s$ID$.safeDivide(numGuides_s$ID$)\n\
|
||||
y_guidevel_s$ID$.safeDivide(numGuides_s$ID$)\n\
|
||||
z_guidevel_s$ID$.safeDivide(numGuides_s$ID$)\n\
|
||||
\n\
|
||||
x_guidevel_s$ID$.multConst(Real(toMantaUnitsFac_s$ID$))\n\
|
||||
y_guidevel_s$ID$.multConst(Real(toMantaUnitsFac_s$ID$))\n\
|
||||
z_guidevel_s$ID$.multConst(Real(toMantaUnitsFac_s$ID$))\n\
|
||||
\n\
|
||||
copyRealToVec3(sourceX=x_guidevel_s$ID$, sourceY=y_guidevel_s$ID$, sourceZ=z_guidevel_s$ID$, target=guidevelC_s$ID$)\n\
|
||||
\n\
|
||||
mantaMsg('Extrapolating guiding velocity')\n\
|
||||
|
|
|
@ -371,6 +371,9 @@ def smoke_step_$ID$():\n\
|
|||
extrapolateVec3Simple(vel=obvelC_s$ID$, phi=phiObsIn_s$ID$, distance=3, inside=False)\n\
|
||||
resampleVec3ToMac(source=obvelC_s$ID$, target=obvel_s$ID$)\n\
|
||||
\n\
|
||||
# Cells inside obstacle should not contain any density, fire, etc.\n\
|
||||
resetInObstacle(flags=flags_s$ID$, density=density_s$ID$, vel=vel_s$ID$, heat=heat_s$ID$, fuel=fuel_s$ID$, flame=flame_s$ID$, red=color_r_s$ID$, green=color_g_s$ID$, blue=color_b_s$ID$)\n\
|
||||
\n\
|
||||
# add initial velocity\n\
|
||||
if using_invel_s$ID$:\n\
|
||||
resampleVec3ToMac(source=invelC_s$ID$, target=invel_s$ID$)\n\
|
||||
|
@ -388,7 +391,7 @@ def smoke_step_$ID$():\n\
|
|||
\n\
|
||||
def process_burn_$ID$():\n\
|
||||
mantaMsg('Process burn')\n\
|
||||
processBurn(fuel=fuel_s$ID$, density=density_s$ID$, react=react_s$ID$, red=color_r_s$ID$ if using_colors_s$ID$ else None, green=color_g_s$ID$ if using_colors_s$ID$ else None, blue=color_b_s$ID$ if using_colors_s$ID$ else None, heat=heat_s$ID$ if using_heat_s$ID$ else None, burningRate=burningRate_s$ID$, flameSmoke=flameSmoke_s$ID$, ignitionTemp=ignitionTemp_s$ID$, maxTemp=maxTemp_s$ID$, flameSmokeColor=flameSmokeColor_s$ID$)\n\
|
||||
processBurn(fuel=fuel_s$ID$, density=density_s$ID$, react=react_s$ID$, red=color_r_s$ID$, green=color_g_s$ID$, blue=color_b_s$ID$, heat=heat_s$ID$, burningRate=burningRate_s$ID$, flameSmoke=flameSmoke_s$ID$, ignitionTemp=ignitionTemp_s$ID$, maxTemp=maxTemp_s$ID$, flameSmokeColor=flameSmokeColor_s$ID$)\n\
|
||||
\n\
|
||||
def update_flame_$ID$():\n\
|
||||
mantaMsg('Update flame')\n\
|
||||
|
@ -503,7 +506,7 @@ def step_noise_$ID$():\n\
|
|||
\n\
|
||||
def process_burn_noise_$ID$():\n\
|
||||
mantaMsg('Process burn noise')\n\
|
||||
processBurn(fuel=fuel_sn$ID$, density=density_sn$ID$, react=react_sn$ID$, red=color_r_sn$ID$ if using_colors_s$ID$ else None, green=color_g_sn$ID$ if using_colors_s$ID$ else None, blue=color_b_sn$ID$ if using_colors_s$ID$ else None, burningRate=burningRate_s$ID$, flameSmoke=flameSmoke_s$ID$, ignitionTemp=ignitionTemp_s$ID$, maxTemp=maxTemp_s$ID$, flameSmokeColor=flameSmokeColor_s$ID$)\n\
|
||||
processBurn(fuel=fuel_sn$ID$, density=density_sn$ID$, react=react_sn$ID$, red=color_r_sn$ID$, green=color_g_sn$ID$, blue=color_b_sn$ID$, burningRate=burningRate_s$ID$, flameSmoke=flameSmoke_s$ID$, ignitionTemp=ignitionTemp_s$ID$, maxTemp=maxTemp_s$ID$, flameSmokeColor=flameSmokeColor_s$ID$)\n\
|
||||
\n\
|
||||
def update_flame_noise_$ID$():\n\
|
||||
mantaMsg('Update flame noise')\n\
|
||||
|
|
|
@ -616,7 +616,7 @@ typedef struct ObstaclesFromDMData {
|
|||
bool has_velocity;
|
||||
float *vert_vel;
|
||||
float *velocity_x, *velocity_y, *velocity_z;
|
||||
int *num_objects;
|
||||
float *num_objects;
|
||||
float *distances_map;
|
||||
} ObstaclesFromDMData;
|
||||
|
||||
|
@ -702,15 +702,9 @@ static void obstacles_from_mesh_task_cb(void *__restrict userdata,
|
|||
}
|
||||
else {
|
||||
/* Apply (i.e. add) effector object velocity */
|
||||
data->velocity_x[index] += (data->mes->type == FLUID_EFFECTOR_TYPE_GUIDE) ?
|
||||
hit_vel[0] * data->mes->vel_multi :
|
||||
hit_vel[0];
|
||||
data->velocity_y[index] += (data->mes->type == FLUID_EFFECTOR_TYPE_GUIDE) ?
|
||||
hit_vel[1] * data->mes->vel_multi :
|
||||
hit_vel[1];
|
||||
data->velocity_z[index] += (data->mes->type == FLUID_EFFECTOR_TYPE_GUIDE) ?
|
||||
hit_vel[2] * data->mes->vel_multi :
|
||||
hit_vel[2];
|
||||
data->velocity_x[index] += hit_vel[0];
|
||||
data->velocity_y[index] += hit_vel[1];
|
||||
data->velocity_z[index] += hit_vel[2];
|
||||
# ifdef DEBUG_PRINT
|
||||
/* Debugging: Print object velocities. */
|
||||
printf("adding effector object vel: [%f, %f, %f], dx is: %f\n",
|
||||
|
@ -749,7 +743,7 @@ static void obstacles_from_mesh(Object *coll_ob,
|
|||
float *velocity_x,
|
||||
float *velocity_y,
|
||||
float *velocity_z,
|
||||
int *num_objects,
|
||||
float *num_objects,
|
||||
float dt)
|
||||
{
|
||||
if (!mes->mesh) {
|
||||
|
@ -922,22 +916,11 @@ static void update_obstacles(Depsgraph *depsgraph,
|
|||
float *vel_x_guide = manta_get_guide_velocity_x(mds->fluid);
|
||||
float *vel_y_guide = manta_get_guide_velocity_y(mds->fluid);
|
||||
float *vel_z_guide = manta_get_guide_velocity_z(mds->fluid);
|
||||
float *vel_x_orig = manta_get_velocity_x(mds->fluid);
|
||||
float *vel_y_orig = manta_get_velocity_y(mds->fluid);
|
||||
float *vel_z_orig = manta_get_velocity_z(mds->fluid);
|
||||
float *density = manta_smoke_get_density(mds->fluid);
|
||||
float *fuel = manta_smoke_get_fuel(mds->fluid);
|
||||
float *flame = manta_smoke_get_flame(mds->fluid);
|
||||
float *r = manta_smoke_get_color_r(mds->fluid);
|
||||
float *g = manta_smoke_get_color_g(mds->fluid);
|
||||
float *b = manta_smoke_get_color_b(mds->fluid);
|
||||
float *phi_obs_in = manta_get_phiobs_in(mds->fluid);
|
||||
float *phi_guide_in = manta_get_phiguide_in(mds->fluid);
|
||||
int *obstacles = manta_smoke_get_obstacle(mds->fluid);
|
||||
int *num_obstacles = manta_get_num_obstacle(mds->fluid);
|
||||
int *num_guides = manta_get_num_guide(mds->fluid);
|
||||
float *num_obstacles = manta_get_num_obstacle(mds->fluid);
|
||||
float *num_guides = manta_get_num_guide(mds->fluid);
|
||||
uint z;
|
||||
float tmp = 0;
|
||||
|
||||
/* Grid reset before writing again. */
|
||||
for (z = 0; z < mds->res[0] * mds->res[1] * mds->res[2]; z++) {
|
||||
|
@ -1023,44 +1006,6 @@ static void update_obstacles(Depsgraph *depsgraph,
|
|||
}
|
||||
|
||||
BKE_collision_objects_free(coll_ob_array);
|
||||
|
||||
/* Obstacle cells should not contain any velocity from the smoke simulation. */
|
||||
for (z = 0; z < mds->res[0] * mds->res[1] * mds->res[2]; z++) {
|
||||
if (obstacles[z] & 2) /* Mantaflow convention: FlagObstacle. */
|
||||
{
|
||||
if (vel_x_orig && vel_y_orig && vel_z_orig) {
|
||||
vel_x_orig[z] = 0.0f;
|
||||
vel_y_orig[z] = 0.0f;
|
||||
vel_z_orig[z] = 0.0f;
|
||||
}
|
||||
if (density) {
|
||||
density[z] = 0.0f;
|
||||
}
|
||||
if (fuel) {
|
||||
fuel[z] = 0.0f;
|
||||
flame[z] = 0.0f;
|
||||
}
|
||||
if (r) {
|
||||
r[z] = 0.0f;
|
||||
g[z] = 0.0f;
|
||||
b[z] = 0.0f;
|
||||
}
|
||||
}
|
||||
/* Average velocities from multiple obstacles in one cell. */
|
||||
if (num_obstacles && num_obstacles[z]) {
|
||||
tmp = 1.0f / num_obstacles[z];
|
||||
vel_x[z] *= tmp;
|
||||
vel_y[z] *= tmp;
|
||||
vel_z[z] *= tmp;
|
||||
}
|
||||
/* Average velocities from multiple guides in one cell. */
|
||||
if (num_guides && num_guides[z]) {
|
||||
tmp = 1.0f / num_guides[z];
|
||||
vel_x_guide[z] *= tmp;
|
||||
vel_y_guide[z] *= tmp;
|
||||
vel_z_guide[z] *= tmp;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** \} */
|
||||
|
|
Loading…
Reference in New Issue