diff options
Diffstat (limited to 'intern')
-rw-r--r-- | intern/mantaflow/extern/manta_fluid_API.h | 1 | ||||
-rw-r--r-- | intern/mantaflow/intern/MANTA_main.cpp | 11 | ||||
-rw-r--r-- | intern/mantaflow/intern/MANTA_main.h | 5 | ||||
-rw-r--r-- | intern/mantaflow/intern/manta_fluid_API.cpp | 4 | ||||
-rw-r--r-- | intern/mantaflow/intern/strings/fluid_script.h | 12 | ||||
-rw-r--r-- | intern/mantaflow/intern/strings/liquid_script.h | 6 | ||||
-rw-r--r-- | intern/mantaflow/intern/strings/smoke_script.h | 1 |
7 files changed, 36 insertions, 4 deletions
diff --git a/intern/mantaflow/extern/manta_fluid_API.h b/intern/mantaflow/extern/manta_fluid_API.h index 85cc04b4a52..7825ad14d7d 100644 --- a/intern/mantaflow/extern/manta_fluid_API.h +++ b/intern/mantaflow/extern/manta_fluid_API.h @@ -107,6 +107,7 @@ float *manta_get_phistatic_in(struct MANTA *fluid); float *manta_get_phiobs_in(struct MANTA *fluid); float *manta_get_phiobsstatic_in(struct MANTA *fluid); float *manta_get_phiout_in(struct MANTA *fluid); +float *manta_get_phioutstatic_in(struct MANTA *fluid); /* Smoke functions */ void manta_smoke_export_script(struct MANTA *smoke, struct FluidModifierData *mmd); diff --git a/intern/mantaflow/intern/MANTA_main.cpp b/intern/mantaflow/intern/MANTA_main.cpp index 539e3080c54..a56ce4c1f60 100644 --- a/intern/mantaflow/intern/MANTA_main.cpp +++ b/intern/mantaflow/intern/MANTA_main.cpp @@ -141,6 +141,7 @@ MANTA::MANTA(int *res, FluidModifierData *mmd) : mCurrentID(++solverID) mPhiIn = nullptr; mPhiStaticIn = nullptr; mPhiOutIn = nullptr; + mPhiOutStaticIn = nullptr; mPhi = nullptr; // Mesh @@ -1926,6 +1927,7 @@ void MANTA::exportSmokeScript(FluidModifierData *mmd) bool obstacle = mmd->domain->active_fields & FLUID_DOMAIN_ACTIVE_OBSTACLE; bool guiding = mmd->domain->active_fields & FLUID_DOMAIN_ACTIVE_GUIDE; bool invel = mmd->domain->active_fields & FLUID_DOMAIN_ACTIVE_INVEL; + bool outflow = mmd->domain->active_fields & FLUID_DOMAIN_ACTIVE_OUTFLOW; std::string manta_script; @@ -1968,6 +1970,8 @@ void MANTA::exportSmokeScript(FluidModifierData *mmd) manta_script += fluid_alloc_obstacle; if (invel) manta_script += fluid_alloc_invel; + if (outflow) + manta_script += fluid_alloc_outflow; // Noise field if (noise) @@ -2032,6 +2036,7 @@ void MANTA::exportLiquidScript(FluidModifierData *mmd) bool fractions = mmd->domain->flags & FLUID_DOMAIN_USE_FRACTIONS; bool guiding = mmd->domain->active_fields & FLUID_DOMAIN_ACTIVE_GUIDE; bool invel = mmd->domain->active_fields & FLUID_DOMAIN_ACTIVE_INVEL; + bool outflow = mmd->domain->active_fields & FLUID_DOMAIN_ACTIVE_OUTFLOW; std::string manta_script; @@ -2070,6 +2075,8 @@ void MANTA::exportLiquidScript(FluidModifierData *mmd) manta_script += fluid_alloc_fractions; if (invel) manta_script += fluid_alloc_invel; + if (outflow) + manta_script += fluid_alloc_outflow; // Domain init manta_script += header_gridinit + liquid_init_phi; @@ -3119,6 +3126,8 @@ void MANTA::updatePointers() if (mUsingOutflow) { mPhiOutIn = (float *)pyObjectToPointer(callPythonFunction("phiOutIn" + solver_ext, func)); + mPhiOutStaticIn = (float *)pyObjectToPointer( + callPythonFunction("phiOutSIn" + solver_ext, func)); } if (mUsingObstacle) { mPhiObsIn = (float *)pyObjectToPointer(callPythonFunction("phiObsIn" + solver_ext, func)); @@ -3230,7 +3239,7 @@ bool MANTA::hasConfig(FluidModifierData *mmd, int framenr) bool MANTA::hasData(FluidModifierData *mmd, int framenr) { - std::string filename = (mUsingSmoke) ? FLUID_DOMAIN_FILE_DENSITY : FLUID_DOMAIN_FILE_PHI; + std::string filename = (mUsingSmoke) ? FLUID_DOMAIN_FILE_DENSITY : FLUID_DOMAIN_FILE_PP; std::string extension = getCacheFileEnding(mmd->domain->cache_data_format); return BLI_exists(getFile(mmd, FLUID_DOMAIN_DIR_DATA, filename, extension, framenr).c_str()); } diff --git a/intern/mantaflow/intern/MANTA_main.h b/intern/mantaflow/intern/MANTA_main.h index caac63d8e39..21946431f28 100644 --- a/intern/mantaflow/intern/MANTA_main.h +++ b/intern/mantaflow/intern/MANTA_main.h @@ -405,6 +405,10 @@ struct MANTA { { return mPhiOutIn; } + inline float *getPhiOutStaticIn() + { + return mPhiOutStaticIn; + } inline float *getPhi() { return mPhi; @@ -844,6 +848,7 @@ struct MANTA { float *mPhiObsStaticIn; float *mPhiGuideIn; float *mPhiOutIn; + float *mPhiOutStaticIn; float *mPhi; // Mesh fields diff --git a/intern/mantaflow/intern/manta_fluid_API.cpp b/intern/mantaflow/intern/manta_fluid_API.cpp index b4582051c3c..49bc224b3fa 100644 --- a/intern/mantaflow/intern/manta_fluid_API.cpp +++ b/intern/mantaflow/intern/manta_fluid_API.cpp @@ -390,6 +390,10 @@ float *manta_get_phiout_in(MANTA *fluid) { return fluid->getPhiOutIn(); } +float *manta_get_phioutstatic_in(MANTA *fluid) +{ + return fluid->getPhiOutStaticIn(); +} /* Smoke functions */ void manta_smoke_export_script(MANTA *smoke, FluidModifierData *mmd) diff --git a/intern/mantaflow/intern/strings/fluid_script.h b/intern/mantaflow/intern/strings/fluid_script.h index e81a44109ef..dd2111db7d7 100644 --- a/intern/mantaflow/intern/strings/fluid_script.h +++ b/intern/mantaflow/intern/strings/fluid_script.h @@ -261,7 +261,7 @@ const std::string fluid_alloc_obstacle = "\n\ mantaMsg('Allocating obstacle data')\n\ numObs_s$ID$ = s$ID$.create(RealGrid)\n\ -phiObsSIn_s$ID$ = s$ID$.create(LevelsetGrid) # helper for static obstacles\n\ +phiObsSIn_s$ID$ = s$ID$.create(LevelsetGrid) # helper for static obstacle objects\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\ @@ -311,7 +311,15 @@ z_invel_s$ID$ = s$ID$.create(RealGrid)\n"; const std::string fluid_alloc_outflow = "\n\ mantaMsg('Allocating outflow data')\n\ -phiOutIn_s$ID$ = s$ID$.create(LevelsetGrid)\n"; +phiOutSIn_s$ID$ = s$ID$.create(LevelsetGrid) # helper for static outflow objects\n\ +phiOutIn_s$ID$ = s$ID$.create(LevelsetGrid)\n\ +\n\ +# Set some initial values\n\ +phiOutSIn_s$ID$.setConst(9999)\n\ +phiOutIn_s$ID$.setConst(9999)\n\ +\n\ +if 'fluid_data_dict_resume_s$ID$' in globals():\n\ + fluid_data_dict_resume_s$ID$.update(phiOutIn=phiOutIn_s$ID$)\n"; ////////////////////////////////////////////////////////////////////// // PRE / POST STEP diff --git a/intern/mantaflow/intern/strings/liquid_script.h b/intern/mantaflow/intern/strings/liquid_script.h index 34994f115d7..f20b218427c 100644 --- a/intern/mantaflow/intern/strings/liquid_script.h +++ b/intern/mantaflow/intern/strings/liquid_script.h @@ -191,6 +191,7 @@ def liquid_adaptive_step_$ID$(framenr):\n\ phi_s$ID$.join(phiIn_s$ID$)\n\ \n\ if using_outflow_s$ID$:\n\ + phiOutIn_s$ID$.join(phiOutSIn_s$ID$) # Join static outflow map\n\ phiOut_s$ID$.join(phiOutIn_s$ID$)\n\ \n\ if using_fractions_s$ID$:\n\ @@ -206,6 +207,9 @@ def liquid_adaptive_step_$ID$(framenr):\n\ extrapolateVec3Simple(vel=invelC_s$ID$, phi=phiIn_s$ID$, distance=6, inside=True)\n\ resampleVec3ToMac(source=invelC_s$ID$, target=invel_s$ID$)\n\ pVel_pp$ID$.setSource(invel_s$ID$, isMAC=True)\n\ + # ensure that pvel has vel as source (important when resuming bake jobs)\n\ + else:\n\ + pVel_pp$ID$.setSource(vel_s$ID$, isMAC=True)\n\ \n\ sampleLevelsetWithParticles(phi=phiIn_s$ID$, flags=flags_s$ID$, parts=pp_s$ID$, discretization=particleNumber_s$ID$, randomness=randomness_s$ID$)\n\ flags_s$ID$.updateFromLevelset(phi_s$ID$)\n\ @@ -363,7 +367,7 @@ def liquid_step_particles_$ID$():\n\ interpolateGrid(target=phiOut_sp$ID$, source=phiOut_s$ID$)\n\ \n\ # phiIn not needed, bwidth to 0 because we are omitting flags.initDomain()\n\ - setObstacleFlags(flags=flags_sp$ID$, phiObs=phiObs_sp$ID$, phiOut=None, phiIn=None, boundaryWidth=0)\n\ + setObstacleFlags(flags=flags_sp$ID$, phiObs=phiObs_sp$ID$, phiOut=phiOut_sp$ID$, phiIn=None, boundaryWidth=0)\n\ flags_sp$ID$.updateFromLevelset(levelset=phi_sp$ID$)\n\ \n\ # Actual secondary particle simulation\n\ diff --git a/intern/mantaflow/intern/strings/smoke_script.h b/intern/mantaflow/intern/strings/smoke_script.h index cb651eb40b3..146106fd147 100644 --- a/intern/mantaflow/intern/strings/smoke_script.h +++ b/intern/mantaflow/intern/strings/smoke_script.h @@ -296,6 +296,7 @@ def smoke_adaptive_step_$ID$(framenr):\n\ extrapolateLsSimple(phi=phiIn_s$ID$, distance=3, inside=False)\n\ \n\ if using_outflow_s$ID$:\n\ + phiOutIn_s$ID$.join(phiOutSIn_s$ID$) # Join static outflow map\n\ phiOut_s$ID$.join(phiOutIn_s$ID$)\n\ \n\ setObstacleFlags(flags=flags_s$ID$, phiObs=phiObs_s$ID$, phiOut=phiOut_s$ID$, phiIn=phiIn_s$ID$, boundaryWidth=1)\n\ |