diff options
Diffstat (limited to 'intern/mantaflow')
-rw-r--r-- | intern/mantaflow/intern/MANTA_main.cpp | 305 | ||||
-rw-r--r-- | intern/mantaflow/intern/strings/fluid_script.h | 80 | ||||
-rw-r--r-- | intern/mantaflow/intern/strings/liquid_script.h | 68 | ||||
-rw-r--r-- | intern/mantaflow/intern/strings/smoke_script.h | 72 |
4 files changed, 332 insertions, 193 deletions
diff --git a/intern/mantaflow/intern/MANTA_main.cpp b/intern/mantaflow/intern/MANTA_main.cpp index 95013958561..e760cef8641 100644 --- a/intern/mantaflow/intern/MANTA_main.cpp +++ b/intern/mantaflow/intern/MANTA_main.cpp @@ -858,23 +858,144 @@ void MANTA::initializeRNAMap(FluidModifierData *mmd) mRNAMap["GRAVITY_Y"] = to_string(mds->gravity[1]); mRNAMap["GRAVITY_Z"] = to_string(mds->gravity[2]); mRNAMap["CACHE_DIR"] = cacheDirectory; - mRNAMap["NAME_DENSITY"] = FLUID_GRIDNAME_DENSITY; - mRNAMap["NAME_SHADOW"] = FLUID_GRIDNAME_SHADOW; - mRNAMap["NAME_HEAT"] = FLUID_GRIDNAME_HEAT; - mRNAMap["NAME_VELOCITY"] = FLUID_GRIDNAME_VELOCITY; - mRNAMap["NAME_COLORR"] = FLUID_GRIDNAME_COLORR; - mRNAMap["NAME_COLORG"] = FLUID_GRIDNAME_COLORG; - mRNAMap["NAME_COLORB"] = FLUID_GRIDNAME_COLORB; - mRNAMap["NAME_FLAME"] = FLUID_GRIDNAME_FLAME; - mRNAMap["NAME_FUEL"] = FLUID_GRIDNAME_FUEL; - mRNAMap["NAME_REACT"] = FLUID_GRIDNAME_REACT; - mRNAMap["NAME_DENSITYNOISE"] = FLUID_GRIDNAME_DENSITYNOISE; - mRNAMap["NAME_COLORRNOISE"] = FLUID_GRIDNAME_COLORRNOISE; - mRNAMap["NAME_COLORGNOISE"] = FLUID_GRIDNAME_COLORGNOISE; - mRNAMap["NAME_COLORBNOISE"] = FLUID_GRIDNAME_COLORBNOISE; - mRNAMap["NAME_FLAMENOISE"] = FLUID_GRIDNAME_FLAMENOISE; - mRNAMap["NAME_FUELNOISE"] = FLUID_GRIDNAME_FUELNOISE; - mRNAMap["NAME_REACTNOISE"] = FLUID_GRIDNAME_REACTNOISE; + + /* Fluid object names. */ + mRNAMap["NAME_FLAGS"] = FLUID_NAME_FLAGS; + mRNAMap["NAME_VELOCITY"] = FLUID_NAME_VELOCITY; + mRNAMap["NAME_VELOCITYTMP"] = FLUID_NAME_VELOCITYTMP; + mRNAMap["NAME_VELOCITY_X"] = FLUID_NAME_VELOCITYX; + mRNAMap["NAME_VELOCITY_Y"] = FLUID_NAME_VELOCITYY; + mRNAMap["NAME_VELOCITY_Z"] = FLUID_NAME_VELOCITYZ; + mRNAMap["NAME_PRESSURE"] = FLUID_NAME_PRESSURE; + mRNAMap["NAME_PHIOBS"] = FLUID_NAME_PHIOBS; + mRNAMap["NAME_PHISIN"] = FLUID_NAME_PHISIN; + mRNAMap["NAME_PHIIN"] = FLUID_NAME_PHIIN; + mRNAMap["NAME_PHIOUT"] = FLUID_NAME_PHIOUT; + mRNAMap["NAME_FORCES"] = FLUID_NAME_FORCES; + mRNAMap["NAME_FORCES_X"] = FLUID_NAME_FORCE_X; + mRNAMap["NAME_FORCES_Y"] = FLUID_NAME_FORCE_Y; + mRNAMap["NAME_FORCES_Z"] = FLUID_NAME_FORCE_Z; + mRNAMap["NAME_NUMOBS"] = FLUID_NAME_NUMOBS; + mRNAMap["NAME_PHIOBSSIN"] = FLUID_NAME_PHIOBSSIN; + mRNAMap["NAME_PHIOBSIN"] = FLUID_NAME_PHIOBSIN; + mRNAMap["NAME_OBVEL"] = FLUID_NAME_OBVEL; + mRNAMap["NAME_OBVELC"] = FLUID_NAME_OBVELC; + mRNAMap["NAME_OBVEL_X"] = FLUID_NAME_OBVEL_X; + mRNAMap["NAME_OBVEL_Y"] = FLUID_NAME_OBVEL_Y; + mRNAMap["NAME_OBVEL_Z"] = FLUID_NAME_OBVEL_Z; + mRNAMap["NAME_FRACTIONS"] = FLUID_NAME_FRACTIONS; + mRNAMap["NAME_INVELC"] = FLUID_NAME_INVELC; + mRNAMap["NAME_INVEL"] = FLUID_NAME_INVEL; + mRNAMap["NAME_INVEL_X"] = FLUID_NAME_INVEL_X; + mRNAMap["NAME_INVEL_Y"] = FLUID_NAME_INVEL_Y; + mRNAMap["NAME_INVEL_Z"] = FLUID_NAME_INVEL_Z; + mRNAMap["NAME_PHIOUTSIN"] = FLUID_NAME_PHIOUTSIN; + mRNAMap["NAME_PHIOUTIN"] = FLUID_NAME_PHIOUTIN; + + /* Smoke object names. */ + mRNAMap["NAME_SHADOW"] = FLUID_NAME_SHADOW; + mRNAMap["NAME_EMISSION"] = FLUID_NAME_EMISSION; + mRNAMap["NAME_EMISSIONIN"] = FLUID_NAME_EMISSIONIN; + mRNAMap["NAME_DENSITY"] = FLUID_NAME_DENSITY; + mRNAMap["NAME_DENSITYIN"] = FLUID_NAME_DENSITYIN; + mRNAMap["NAME_HEAT"] = FLUID_NAME_HEAT; + mRNAMap["NAME_HEATIN"] = FLUID_NAME_HEATIN; + mRNAMap["NAME_COLORR"] = FLUID_NAME_COLORR; + mRNAMap["NAME_COLORG"] = FLUID_NAME_COLORG; + mRNAMap["NAME_COLORB"] = FLUID_NAME_COLORB; + mRNAMap["NAME_COLORRIN"] = FLUID_NAME_COLORRIN; + mRNAMap["NAME_COLORGIN"] = FLUID_NAME_COLORGIN; + mRNAMap["NAME_COLORBIN"] = FLUID_NAME_COLORBIN; + mRNAMap["NAME_FLAME"] = FLUID_NAME_FLAME; + mRNAMap["NAME_FUEL"] = FLUID_NAME_FUEL; + mRNAMap["NAME_REACT"] = FLUID_NAME_REACT; + mRNAMap["NAME_FUELIN"] = FLUID_NAME_FUELIN; + mRNAMap["NAME_REACTIN"] = FLUID_NAME_REACTIN; + + /* Liquid object names. */ + mRNAMap["NAME_PHIPARTS"] = FLUID_NAME_PHIPARTS; + mRNAMap["NAME_PHI"] = FLUID_NAME_PHI; + mRNAMap["NAME_PHITMP"] = FLUID_NAME_PHITMP; + mRNAMap["NAME_VELOLD"] = FLUID_NAME_VELOCITYOLD; + mRNAMap["NAME_VELPARTS"] = FLUID_NAME_VELOCITYPARTS; + mRNAMap["NAME_MAPWEIGHTS"] = FLUID_NAME_MAPWEIGHTS; + mRNAMap["NAME_PP"] = FLUID_NAME_PP; + mRNAMap["NAME_PVEL"] = FLUID_NAME_PVEL; + mRNAMap["NAME_PINDEX"] = FLUID_NAME_PINDEX; + mRNAMap["NAME_GPI"] = FLUID_NAME_GPI; + mRNAMap["NAME_CURVATURE"] = FLUID_NAME_CURVATURE; + + /* Noise object names. */ + mRNAMap["NAME_VELOCITY_NOISE"] = FLUID_NAME_VELOCITY_NOISE; + mRNAMap["NAME_DENSITY_NOISE"] = FLUID_NAME_DENSITY_NOISE; + mRNAMap["NAME_PHIIN_NOISE"] = FLUID_NAME_PHIIN_NOISE; + mRNAMap["NAME_PHIOUT_NOISE"] = FLUID_NAME_PHIOUT_NOISE; + mRNAMap["NAME_PHIOBS_NOISE"] = FLUID_NAME_PHIOBS_NOISE; + mRNAMap["NAME_FLAGS_NOISE"] = FLUID_NAME_FLAGS_NOISE; + mRNAMap["NAME_TMPIN_NOISE"] = FLUID_NAME_TMPIN_NOISE; + mRNAMap["NAME_EMISSIONIN_NOISE"] = FLUID_NAME_EMISSIONIN_NOISE; + mRNAMap["NAME_ENERGY"] = FLUID_NAME_ENERGY; + mRNAMap["NAME_TMPFLAGS"] = FLUID_NAME_TMPFLAGS; + mRNAMap["NAME_TEXTURE_U"] = FLUID_NAME_TEXTURE_U; + mRNAMap["NAME_TEXTURE_V"] = FLUID_NAME_TEXTURE_V; + mRNAMap["NAME_TEXTURE_W"] = FLUID_NAME_TEXTURE_W; + mRNAMap["NAME_TEXTURE_U2"] = FLUID_NAME_TEXTURE_U2; + mRNAMap["NAME_TEXTURE_V2"] = FLUID_NAME_TEXTURE_V2; + mRNAMap["NAME_TEXTURE_W2"] = FLUID_NAME_TEXTURE_W2; + mRNAMap["NAME_UV0"] = FLUID_NAME_UV0; + mRNAMap["NAME_UV1"] = FLUID_NAME_UV1; + mRNAMap["NAME_COLORR_NOISE"] = FLUID_NAME_COLORR_NOISE; + mRNAMap["NAME_COLORG_NOISE"] = FLUID_NAME_COLORG_NOISE; + mRNAMap["NAME_COLORB_NOISE"] = FLUID_NAME_COLORB_NOISE; + mRNAMap["NAME_FLAME_NOISE"] = FLUID_NAME_FLAME_NOISE; + mRNAMap["NAME_FUEL_NOISE"] = FLUID_NAME_FUEL_NOISE; + mRNAMap["NAME_REACT_NOISE"] = FLUID_NAME_REACT_NOISE; + + /* Mesh object names. */ + mRNAMap["NAME_PHIPARTS_MESH"] = FLUID_NAME_PHIPARTS_MESH; + mRNAMap["NAME_PHI_MESH"] = FLUID_NAME_PHI_MESH; + mRNAMap["NAME_PP_MESH"] = FLUID_NAME_PP_MESH; + mRNAMap["NAME_FLAGS_MESH"] = FLUID_NAME_FLAGS_MESH; + mRNAMap["NAME_LMESH"] = FLUID_NAME_LMESH; + mRNAMap["NAME_VELOCITYVEC_MESH"] = FLUID_NAME_VELOCITYVEC_MESH; + mRNAMap["NAME_VELOCITY_MESH"] = FLUID_NAME_VELOCITY_MESH; + mRNAMap["NAME_PINDEX_MESH"] = FLUID_NAME_PINDEX_MESH; + mRNAMap["NAME_GPI_MESH"] = FLUID_NAME_GPI_MESH; + + /* Particles object names. */ + mRNAMap["NAME_PP_PARTICLES"] = FLUID_NAME_PP_PARTICLES; + mRNAMap["NAME_PVEL_PARTICLES"] = FLUID_NAME_PVEL_PARTICLES; + mRNAMap["NAME_PFORCE_PARTICLES"] = FLUID_NAME_PFORCE_PARTICLES; + mRNAMap["NAME_PLIFE_PARTICLES"] = FLUID_NAME_PLIFE_PARTICLES; + mRNAMap["NAME_VELOCITY_PARTICLES"] = FLUID_NAME_VELOCITY_PARTICLES; + mRNAMap["NAME_FLAGS_PARTICLES"] = FLUID_NAME_FLAGS_PARTICLES; + mRNAMap["NAME_PHI_PARTICLES"] = FLUID_NAME_PHI_PARTICLES; + mRNAMap["NAME_PHIOBS_PARTICLES"] = FLUID_NAME_PHIOBS_PARTICLES; + mRNAMap["NAME_PHIOUT_PARTICLES"] = FLUID_NAME_PHIOUT_PARTICLES; + mRNAMap["NAME_NORMAL_PARTICLES"] = FLUID_NAME_NORMAL_PARTICLES; + mRNAMap["NAME_NEIGHBORRATIO_PARTICLES"] = FLUID_NAME_NEIGHBORRATIO_PARTICLES; + mRNAMap["NAME_TRAPPEDAIR_PARTICLES"] = FLUID_NAME_TRAPPEDAIR_PARTICLES; + mRNAMap["NAME_WAVECREST_PARTICLES"] = FLUID_NAME_WAVECREST_PARTICLES; + mRNAMap["NAME_KINETICENERGY_PARTICLES"] = FLUID_NAME_KINETICENERGY_PARTICLES; + + /* Guiding object names. */ + mRNAMap["NAME_VELT"] = FLUID_NAME_VELT; + mRNAMap["NAME_WEIGHTGUIDE"] = FLUID_NAME_WEIGHTGUIDE; + mRNAMap["NAME_NUMGUIDES"] = FLUID_NAME_NUMGUIDES; + mRNAMap["NAME_PHIGUIDEIN"] = FLUID_NAME_PHIGUIDEIN; + mRNAMap["NAME_GUIDEVELC"] = FLUID_NAME_GUIDEVELC; + 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; + + /* Cache file names. */ + mRNAMap["NAME_CONFIG"] = FLUID_NAME_CONFIG; + mRNAMap["NAME_DATA"] = FLUID_NAME_DATA; + mRNAMap["NAME_NOISE"] = FLUID_NAME_NOISE; + mRNAMap["NAME_MESH"] = FLUID_NAME_MESH; + mRNAMap["NAME_PARTICLES"] = FLUID_NAME_PARTICLES; + mRNAMap["NAME_GUIDING"] = FLUID_NAME_GUIDING; } string MANTA::getRealValue(const string &varName) @@ -965,7 +1086,7 @@ bool MANTA::updateFlipStructures(FluidModifierData *mmd, int framenr) mFlipParticleVelocity->clear(); string pformat = getCacheFileEnding(mds->cache_particle_format); - string file = getFile(mmd, FLUID_DOMAIN_DIR_DATA, FLUID_FILENAME_PP, pformat, framenr); + string file = getFile(mmd, FLUID_DOMAIN_DIR_DATA, FLUID_NAME_PP, pformat, framenr); expected += 1; if (BLI_exists(file.c_str())) { @@ -973,7 +1094,7 @@ bool MANTA::updateFlipStructures(FluidModifierData *mmd, int framenr) assert(result == expected); } - file = getFile(mmd, FLUID_DOMAIN_DIR_DATA, FLUID_FILENAME_PVEL, pformat, framenr); + file = getFile(mmd, FLUID_DOMAIN_DIR_DATA, FLUID_NAME_PVEL, pformat, framenr); expected += 1; if (BLI_exists(file.c_str())) { result += updateParticlesFromFile(file, false, true); @@ -1011,7 +1132,7 @@ bool MANTA::updateMeshStructures(FluidModifierData *mmd, int framenr) string mformat = getCacheFileEnding(mds->cache_mesh_format); string dformat = getCacheFileEnding(mds->cache_data_format); - string file = getFile(mmd, FLUID_DOMAIN_DIR_MESH, FLUID_FILENAME_MESH, mformat, framenr); + string file = getFile(mmd, FLUID_DOMAIN_DIR_MESH, FLUID_NAME_LMESH, mformat, framenr); expected += 1; if (BLI_exists(file.c_str())) { @@ -1020,7 +1141,7 @@ bool MANTA::updateMeshStructures(FluidModifierData *mmd, int framenr) } if (mUsingMVel) { - file = getFile(mmd, FLUID_DOMAIN_DIR_MESH, FLUID_FILENAME_MESHVEL, dformat, framenr); + file = getFile(mmd, FLUID_DOMAIN_DIR_MESH, FLUID_NAME_VELOCITYVEC_MESH, dformat, framenr); expected += 1; if (BLI_exists(file.c_str())) { result += updateMeshFromFile(file); @@ -1056,7 +1177,8 @@ bool MANTA::updateParticleStructures(FluidModifierData *mmd, int framenr) mSndParticleLife->clear(); string pformat = getCacheFileEnding(mds->cache_particle_format); - string file = getFile(mmd, FLUID_DOMAIN_DIR_PARTICLES, FLUID_FILENAME_PPSND, pformat, framenr); + string file = getFile( + mmd, FLUID_DOMAIN_DIR_PARTICLES, FLUID_NAME_PP_PARTICLES, pformat, framenr); expected += 1; if (BLI_exists(file.c_str())) { @@ -1064,14 +1186,14 @@ bool MANTA::updateParticleStructures(FluidModifierData *mmd, int framenr) assert(result == expected); } - file = getFile(mmd, FLUID_DOMAIN_DIR_PARTICLES, FLUID_FILENAME_PVELSND, pformat, framenr); + file = getFile(mmd, FLUID_DOMAIN_DIR_PARTICLES, FLUID_NAME_PVEL_PARTICLES, pformat, framenr); expected += 1; if (BLI_exists(file.c_str())) { result += updateParticlesFromFile(file, true, true); assert(result == expected); } - file = getFile(mmd, FLUID_DOMAIN_DIR_PARTICLES, FLUID_FILENAME_PLIFESND, pformat, framenr); + file = getFile(mmd, FLUID_DOMAIN_DIR_PARTICLES, FLUID_NAME_PLIFE_PARTICLES, pformat, framenr); expected += 1; if (BLI_exists(file.c_str())) { result += updateParticlesFromFile(file, true, false); @@ -1135,29 +1257,29 @@ bool MANTA::updateSmokeStructures(FluidModifierData *mmd, int framenr) void *aReact[] = {mReact}; /* File names for grids. */ - string fDensity = getFile(mmd, FLUID_DOMAIN_DIR_DATA, FLUID_FILENAME_DENSITY, dformat, framenr); - string fShadow = getFile(mmd, FLUID_DOMAIN_DIR_DATA, FLUID_FILENAME_SHADOW, dformat, framenr); - string fVel = getFile(mmd, FLUID_DOMAIN_DIR_DATA, FLUID_FILENAME_VELOCITY, dformat, framenr); - string fHeat = getFile(mmd, FLUID_DOMAIN_DIR_DATA, FLUID_FILENAME_HEAT, dformat, framenr); - string fColorR = getFile(mmd, FLUID_DOMAIN_DIR_DATA, FLUID_FILENAME_COLORR, dformat, framenr); - string fColorG = getFile(mmd, FLUID_DOMAIN_DIR_DATA, FLUID_FILENAME_COLORG, dformat, framenr); - string fColorB = getFile(mmd, FLUID_DOMAIN_DIR_DATA, FLUID_FILENAME_COLORB, dformat, framenr); - string fFlame = getFile(mmd, FLUID_DOMAIN_DIR_DATA, FLUID_FILENAME_FLAME, dformat, framenr); - string fFuel = getFile(mmd, FLUID_DOMAIN_DIR_DATA, FLUID_FILENAME_FUEL, dformat, framenr); - string fReact = getFile(mmd, FLUID_DOMAIN_DIR_DATA, FLUID_FILENAME_REACT, dformat, framenr); - string fFluid = getFile(mmd, FLUID_DOMAIN_DIR_DATA, FLUID_FILENAME_DATA, dformat, framenr); + string fDensity = getFile(mmd, FLUID_DOMAIN_DIR_DATA, FLUID_NAME_DENSITY, dformat, framenr); + string fShadow = getFile(mmd, FLUID_DOMAIN_DIR_DATA, FLUID_NAME_SHADOW, dformat, framenr); + string fVel = getFile(mmd, FLUID_DOMAIN_DIR_DATA, FLUID_NAME_VELOCITY, dformat, framenr); + string fHeat = getFile(mmd, FLUID_DOMAIN_DIR_DATA, FLUID_NAME_HEAT, dformat, framenr); + string fColorR = getFile(mmd, FLUID_DOMAIN_DIR_DATA, FLUID_NAME_COLORR, dformat, framenr); + string fColorG = getFile(mmd, FLUID_DOMAIN_DIR_DATA, FLUID_NAME_COLORG, dformat, framenr); + string fColorB = getFile(mmd, FLUID_DOMAIN_DIR_DATA, FLUID_NAME_COLORB, dformat, framenr); + string fFlame = getFile(mmd, FLUID_DOMAIN_DIR_DATA, FLUID_NAME_FLAME, dformat, framenr); + string fFuel = getFile(mmd, FLUID_DOMAIN_DIR_DATA, FLUID_NAME_FUEL, dformat, framenr); + string fReact = getFile(mmd, FLUID_DOMAIN_DIR_DATA, FLUID_NAME_REACT, dformat, framenr); + string fFluid = getFile(mmd, FLUID_DOMAIN_DIR_DATA, FLUID_NAME_DATA, dformat, framenr); /* Prepare grid info containers. */ - GridItem gDensity = {aDensity, FLUID_DOMAIN_GRID_FLOAT, res, FLUID_GRIDNAME_DENSITY}; - GridItem gShadow = {aShadow, FLUID_DOMAIN_GRID_FLOAT, res, FLUID_GRIDNAME_SHADOW}; - GridItem gVel = {aVelocities, FLUID_DOMAIN_GRID_VEC3F, res, FLUID_GRIDNAME_VELOCITY}; - GridItem gHeat = {aHeat, FLUID_DOMAIN_GRID_FLOAT, res, FLUID_GRIDNAME_HEAT}; - GridItem gColorR = {aColorR, FLUID_DOMAIN_GRID_FLOAT, res, FLUID_GRIDNAME_COLORR}; - GridItem gColorG = {aColorG, FLUID_DOMAIN_GRID_FLOAT, res, FLUID_GRIDNAME_COLORG}; - GridItem gColorB = {aColorB, FLUID_DOMAIN_GRID_FLOAT, res, FLUID_GRIDNAME_COLORB}; - GridItem gFlame = {aFlame, FLUID_DOMAIN_GRID_FLOAT, res, FLUID_GRIDNAME_FLAME}; - GridItem gFuel = {aFuel, FLUID_DOMAIN_GRID_FLOAT, res, FLUID_GRIDNAME_FUEL}; - GridItem gReact = {aReact, FLUID_DOMAIN_GRID_FLOAT, res, FLUID_GRIDNAME_REACT}; + GridItem gDensity = {aDensity, FLUID_DOMAIN_GRID_FLOAT, res, FLUID_NAME_DENSITY}; + GridItem gShadow = {aShadow, FLUID_DOMAIN_GRID_FLOAT, res, FLUID_NAME_SHADOW}; + GridItem gVel = {aVelocities, FLUID_DOMAIN_GRID_VEC3F, res, FLUID_NAME_VELOCITY}; + GridItem gHeat = {aHeat, FLUID_DOMAIN_GRID_FLOAT, res, FLUID_NAME_HEAT}; + GridItem gColorR = {aColorR, FLUID_DOMAIN_GRID_FLOAT, res, FLUID_NAME_COLORR}; + GridItem gColorG = {aColorG, FLUID_DOMAIN_GRID_FLOAT, res, FLUID_NAME_COLORG}; + GridItem gColorB = {aColorB, FLUID_DOMAIN_GRID_FLOAT, res, FLUID_NAME_COLORB}; + GridItem gFlame = {aFlame, FLUID_DOMAIN_GRID_FLOAT, res, FLUID_NAME_FLAME}; + GridItem gFuel = {aFuel, FLUID_DOMAIN_GRID_FLOAT, res, FLUID_NAME_FUEL}; + GridItem gReact = {aReact, FLUID_DOMAIN_GRID_FLOAT, res, FLUID_NAME_REACT}; /* TODO (sebbas): For now, only allow single file mode. Combined grid file export is todo. */ const int fileMode = FLUID_DOMAIN_CACHE_FILES_SINGLE; @@ -1252,36 +1374,31 @@ bool MANTA::updateNoiseStructures(FluidModifierData *mmd, int framenr) void *aReact[] = {mReactHigh}; /* File names for grids. */ - string fShadow = getFile(mmd, FLUID_DOMAIN_DIR_DATA, FLUID_FILENAME_SHADOW, dformat, framenr); - string fVel = getFile(mmd, FLUID_DOMAIN_DIR_DATA, FLUID_FILENAME_VELOCITY, dformat, framenr); - string fFluid = getFile(mmd, FLUID_DOMAIN_DIR_NOISE, FLUID_FILENAME_DATA, dformat, framenr); + string fShadow = getFile(mmd, FLUID_DOMAIN_DIR_DATA, FLUID_NAME_SHADOW, dformat, framenr); + string fVel = getFile(mmd, FLUID_DOMAIN_DIR_DATA, FLUID_NAME_VELOCITY, dformat, framenr); + string fFluid = getFile(mmd, FLUID_DOMAIN_DIR_NOISE, FLUID_NAME_DATA, dformat, framenr); string fDensity = getFile( - mmd, FLUID_DOMAIN_DIR_NOISE, FLUID_FILENAME_DENSITYNOISE, nformat, framenr); - string fColorR = getFile( - mmd, FLUID_DOMAIN_DIR_NOISE, FLUID_FILENAME_COLORRNOISE, nformat, framenr); - string fColorG = getFile( - mmd, FLUID_DOMAIN_DIR_NOISE, FLUID_FILENAME_COLORGNOISE, nformat, framenr); - string fColorB = getFile( - mmd, FLUID_DOMAIN_DIR_NOISE, FLUID_FILENAME_COLORBNOISE, nformat, framenr); - string fFlame = getFile( - mmd, FLUID_DOMAIN_DIR_NOISE, FLUID_FILENAME_FLAMENOISE, nformat, framenr); - string fFuel = getFile(mmd, FLUID_DOMAIN_DIR_NOISE, FLUID_FILENAME_FUELNOISE, nformat, framenr); - string fReact = getFile( - mmd, FLUID_DOMAIN_DIR_NOISE, FLUID_FILENAME_REACTNOISE, nformat, framenr); - string fNoise = getFile(mmd, FLUID_DOMAIN_DIR_NOISE, FLUID_FILENAME_NOISE, nformat, framenr); + mmd, FLUID_DOMAIN_DIR_NOISE, FLUID_NAME_DENSITY_NOISE, nformat, framenr); + string fColorR = getFile(mmd, FLUID_DOMAIN_DIR_NOISE, FLUID_NAME_COLORR_NOISE, nformat, framenr); + string fColorG = getFile(mmd, FLUID_DOMAIN_DIR_NOISE, FLUID_NAME_COLORG_NOISE, nformat, framenr); + string fColorB = getFile(mmd, FLUID_DOMAIN_DIR_NOISE, FLUID_NAME_COLORB_NOISE, nformat, framenr); + string fFlame = getFile(mmd, FLUID_DOMAIN_DIR_NOISE, FLUID_NAME_FLAME_NOISE, nformat, framenr); + string fFuel = getFile(mmd, FLUID_DOMAIN_DIR_NOISE, FLUID_NAME_FUEL_NOISE, nformat, framenr); + string fReact = getFile(mmd, FLUID_DOMAIN_DIR_NOISE, FLUID_NAME_REACT_NOISE, nformat, framenr); + string fNoise = getFile(mmd, FLUID_DOMAIN_DIR_NOISE, FLUID_NAME_NOISE, nformat, framenr); /* Prepare grid info containers. */ - GridItem gShadow = {aShadow, FLUID_DOMAIN_GRID_FLOAT, resData, FLUID_GRIDNAME_SHADOW}; - GridItem gVel = {aVelocities, FLUID_DOMAIN_GRID_VEC3F, resData, FLUID_GRIDNAME_VELOCITY}; + GridItem gShadow = {aShadow, FLUID_DOMAIN_GRID_FLOAT, resData, FLUID_NAME_SHADOW}; + GridItem gVel = {aVelocities, FLUID_DOMAIN_GRID_VEC3F, resData, FLUID_NAME_VELOCITY}; - GridItem gDensity = {aDensity, FLUID_DOMAIN_GRID_FLOAT, resNoise, FLUID_GRIDNAME_DENSITYNOISE}; - GridItem gColorR = {aColorR, FLUID_DOMAIN_GRID_FLOAT, resNoise, FLUID_GRIDNAME_COLORRNOISE}; - GridItem gColorG = {aColorG, FLUID_DOMAIN_GRID_FLOAT, resNoise, FLUID_GRIDNAME_COLORGNOISE}; - GridItem gColorB = {aColorB, FLUID_DOMAIN_GRID_FLOAT, resNoise, FLUID_GRIDNAME_COLORBNOISE}; - GridItem gFlame = {aFlame, FLUID_DOMAIN_GRID_FLOAT, resNoise, FLUID_GRIDNAME_FLAMENOISE}; - GridItem gFuel = {aFuel, FLUID_DOMAIN_GRID_FLOAT, resNoise, FLUID_GRIDNAME_FUELNOISE}; - GridItem gReact = {aReact, FLUID_DOMAIN_GRID_FLOAT, resNoise, FLUID_GRIDNAME_REACTNOISE}; + GridItem gDensity = {aDensity, FLUID_DOMAIN_GRID_FLOAT, resNoise, FLUID_NAME_DENSITY_NOISE}; + GridItem gColorR = {aColorR, FLUID_DOMAIN_GRID_FLOAT, resNoise, FLUID_NAME_COLORR_NOISE}; + GridItem gColorG = {aColorG, FLUID_DOMAIN_GRID_FLOAT, resNoise, FLUID_NAME_COLORG_NOISE}; + GridItem gColorB = {aColorB, FLUID_DOMAIN_GRID_FLOAT, resNoise, FLUID_NAME_COLORB_NOISE}; + GridItem gFlame = {aFlame, FLUID_DOMAIN_GRID_FLOAT, resNoise, FLUID_NAME_FLAME_NOISE}; + GridItem gFuel = {aFuel, FLUID_DOMAIN_GRID_FLOAT, resNoise, FLUID_NAME_FUEL_NOISE}; + GridItem gReact = {aReact, FLUID_DOMAIN_GRID_FLOAT, resNoise, FLUID_NAME_REACT_NOISE}; /* TODO (sebbas): For now, only allow single file mode. Combined grid file export is todo. */ const int fileMode = FLUID_DOMAIN_CACHE_FILES_SINGLE; @@ -1371,7 +1488,7 @@ bool MANTA::writeConfiguration(FluidModifierData *mmd, int framenr) string directory = getDirectory(mmd, FLUID_DOMAIN_DIR_CONFIG); string format = FLUID_DOMAIN_EXTENSION_UNI; - string file = getFile(mmd, FLUID_DOMAIN_DIR_CONFIG, FLUID_FILENAME_CONFIG, format, framenr); + string file = getFile(mmd, FLUID_DOMAIN_DIR_CONFIG, FLUID_NAME_CONFIG, format, framenr); /* Create 'config' subdir if it does not exist already. */ BLI_dir_create_recursive(directory.c_str()); @@ -1471,7 +1588,7 @@ bool MANTA::readConfiguration(FluidModifierData *mmd, int framenr) string directory = getDirectory(mmd, FLUID_DOMAIN_DIR_CONFIG); string format = FLUID_DOMAIN_EXTENSION_UNI; - string file = getFile(mmd, FLUID_DOMAIN_DIR_CONFIG, FLUID_FILENAME_CONFIG, format, framenr); + string file = getFile(mmd, FLUID_DOMAIN_DIR_CONFIG, FLUID_NAME_CONFIG, format, framenr); if (!hasConfig(mmd, framenr)) return false; @@ -3356,42 +3473,64 @@ bool MANTA::hasConfig(FluidModifierData *mmd, int framenr) { string extension = FLUID_DOMAIN_EXTENSION_UNI; return BLI_exists( - getFile(mmd, FLUID_DOMAIN_DIR_CONFIG, FLUID_FILENAME_CONFIG, extension, framenr).c_str()); + getFile(mmd, FLUID_DOMAIN_DIR_CONFIG, FLUID_NAME_CONFIG, extension, framenr).c_str()); } bool MANTA::hasData(FluidModifierData *mmd, int framenr) { - string filename = (mUsingSmoke) ? FLUID_FILENAME_DENSITY : FLUID_FILENAME_PP; string extension = getCacheFileEnding(mmd->domain->cache_data_format); - return BLI_exists(getFile(mmd, FLUID_DOMAIN_DIR_DATA, filename, extension, framenr).c_str()); + bool exists = BLI_exists( + getFile(mmd, FLUID_DOMAIN_DIR_DATA, FLUID_NAME_DATA, extension, framenr).c_str()); + + /* Check single file naming. */ + if (!exists) { + string filename = (mUsingSmoke) ? FLUID_NAME_DENSITY : FLUID_NAME_PP; + exists = BLI_exists(getFile(mmd, FLUID_DOMAIN_DIR_DATA, filename, extension, framenr).c_str()); + } + return exists; } bool MANTA::hasNoise(FluidModifierData *mmd, int framenr) { string extension = getCacheFileEnding(mmd->domain->cache_noise_format); - return BLI_exists( - getFile(mmd, FLUID_DOMAIN_DIR_NOISE, FLUID_FILENAME_DENSITYNOISE, extension, framenr) - .c_str()); + bool exists = BLI_exists( + getFile(mmd, FLUID_DOMAIN_DIR_NOISE, FLUID_NAME_NOISE, extension, framenr).c_str()); + + /* Check single file naming. */ + if (!exists) { + exists = BLI_exists( + getFile(mmd, FLUID_DOMAIN_DIR_NOISE, FLUID_NAME_DENSITY_NOISE, extension, framenr) + .c_str()); + } + return exists; } bool MANTA::hasMesh(FluidModifierData *mmd, int framenr) { string extension = getCacheFileEnding(mmd->domain->cache_mesh_format); return BLI_exists( - getFile(mmd, FLUID_DOMAIN_DIR_MESH, FLUID_FILENAME_MESH, extension, framenr).c_str()); + getFile(mmd, FLUID_DOMAIN_DIR_MESH, FLUID_NAME_LMESH, extension, framenr).c_str()); } bool MANTA::hasParticles(FluidModifierData *mmd, int framenr) { string extension = getCacheFileEnding(mmd->domain->cache_particle_format); - return BLI_exists( - getFile(mmd, FLUID_DOMAIN_DIR_PARTICLES, FLUID_FILENAME_PPSND, extension, framenr).c_str()); + bool exists = BLI_exists( + getFile(mmd, FLUID_DOMAIN_DIR_PARTICLES, FLUID_NAME_PARTICLES, extension, framenr).c_str()); + + /* Check single file naming. */ + if (!exists) { + exists = BLI_exists( + getFile(mmd, FLUID_DOMAIN_DIR_PARTICLES, FLUID_NAME_PP_PARTICLES, extension, framenr) + .c_str()); + } + return exists; } bool MANTA::hasGuiding(FluidModifierData *mmd, int framenr, bool sourceDomain) { string subdirectory = (sourceDomain) ? FLUID_DOMAIN_DIR_DATA : FLUID_DOMAIN_DIR_GUIDE; - string filename = (sourceDomain) ? FLUID_FILENAME_VELOCITY : FLUID_FILENAME_GUIDEVEL; + string filename = (sourceDomain) ? FLUID_NAME_VELOCITY : FLUID_NAME_GUIDEVEL; string extension = getCacheFileEnding(mmd->domain->cache_data_format); return BLI_exists(getFile(mmd, subdirectory, filename, extension, framenr).c_str()); } @@ -3410,7 +3549,7 @@ string MANTA::getFile( { char targetFile[FILE_MAX]; string path = getDirectory(mmd, subdirectory); - string filename = fname + extension; + string filename = fname + "_####" + extension; BLI_join_dirfile(targetFile, sizeof(targetFile), path.c_str(), filename.c_str()); BLI_path_frame(targetFile, framenr, 0); return targetFile; diff --git a/intern/mantaflow/intern/strings/fluid_script.h b/intern/mantaflow/intern/strings/fluid_script.h index cf99717c102..637dd22f128 100644 --- a/intern/mantaflow/intern/strings/fluid_script.h +++ b/intern/mantaflow/intern/strings/fluid_script.h @@ -258,21 +258,21 @@ def fluid_adapt_time_step_$ID$():\n\ const std::string fluid_alloc = "\n\ mantaMsg('Fluid alloc data')\n\ -flags_s$ID$ = s$ID$.create(FlagGrid)\n\ +flags_s$ID$ = s$ID$.create(FlagGrid, name='$NAME_FLAGS$')\n\ vel_s$ID$ = s$ID$.create(MACGrid, name='$NAME_VELOCITY$')\n\ -velTmp_s$ID$ = s$ID$.create(MACGrid)\n\ -x_vel_s$ID$ = s$ID$.create(RealGrid)\n\ -y_vel_s$ID$ = s$ID$.create(RealGrid)\n\ -z_vel_s$ID$ = s$ID$.create(RealGrid)\n\ -pressure_s$ID$ = s$ID$.create(RealGrid)\n\ -phiObs_s$ID$ = s$ID$.create(LevelsetGrid)\n\ -phiSIn_s$ID$ = s$ID$.create(LevelsetGrid) # helper for static flow objects\n\ -phiIn_s$ID$ = s$ID$.create(LevelsetGrid)\n\ -phiOut_s$ID$ = s$ID$.create(LevelsetGrid)\n\ -forces_s$ID$ = s$ID$.create(Vec3Grid)\n\ -x_force_s$ID$ = s$ID$.create(RealGrid)\n\ -y_force_s$ID$ = s$ID$.create(RealGrid)\n\ -z_force_s$ID$ = s$ID$.create(RealGrid)\n\ +velTmp_s$ID$ = s$ID$.create(MACGrid, name='$NAME_VELOCITYTMP$')\n\ +x_vel_s$ID$ = s$ID$.create(RealGrid, name='$NAME_VELOCITY_X$')\n\ +y_vel_s$ID$ = s$ID$.create(RealGrid, name='$NAME_VELOCITY_Y$')\n\ +z_vel_s$ID$ = s$ID$.create(RealGrid, name='$NAME_VELOCITY_Z$')\n\ +pressure_s$ID$ = s$ID$.create(RealGrid, name='$NAME_PRESSURE$')\n\ +phiObs_s$ID$ = s$ID$.create(LevelsetGrid, name='$NAME_PHIOBS$')\n\ +phiSIn_s$ID$ = s$ID$.create(LevelsetGrid, name='$NAME_PHISIN$') # helper for static flow objects\n\ +phiIn_s$ID$ = s$ID$.create(LevelsetGrid, name='$NAME_PHIIN$')\n\ +phiOut_s$ID$ = s$ID$.create(LevelsetGrid, name='$NAME_PHIOUT$')\n\ +forces_s$ID$ = s$ID$.create(Vec3Grid, name='$NAME_FORCES$')\n\ +x_force_s$ID$ = s$ID$.create(RealGrid, name='$NAME_FORCES_X$')\n\ +y_force_s$ID$ = s$ID$.create(RealGrid, name='$NAME_FORCES_Y$')\n\ +z_force_s$ID$ = s$ID$.create(RealGrid, name='$NAME_FORCES_Z$')\n\ obvel_s$ID$ = None\n\ \n\ # Set some initial values\n\ @@ -288,14 +288,14 @@ fluid_data_dict_resume_s$ID$ = dict(phiObs=phiObs_s$ID$, phiIn=phiIn_s$ID$, phiO 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 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\ -x_obvel_s$ID$ = s$ID$.create(RealGrid)\n\ -y_obvel_s$ID$ = s$ID$.create(RealGrid)\n\ -z_obvel_s$ID$ = s$ID$.create(RealGrid)\n\ +numObs_s$ID$ = s$ID$.create(RealGrid, name='$NAME_NUMOBS$')\n\ +phiObsSIn_s$ID$ = s$ID$.create(LevelsetGrid, name='$NAME_PHIOBSSIN$') # helper for static obstacle objects\n\ +phiObsIn_s$ID$ = s$ID$.create(LevelsetGrid, name='$NAME_PHIOBSIN$')\n\ +obvel_s$ID$ = s$ID$.create(MACGrid, name='$NAME_OBVEL$')\n\ +obvelC_s$ID$ = s$ID$.create(Vec3Grid, name='$NAME_OBVELC$')\n\ +x_obvel_s$ID$ = s$ID$.create(RealGrid, name='$NAME_OBVEL_X$')\n\ +y_obvel_s$ID$ = s$ID$.create(RealGrid, name='$NAME_OBVEL_Y$')\n\ +z_obvel_s$ID$ = s$ID$.create(RealGrid, name='$NAME_OBVEL_Z$')\n\ \n\ # Set some initial values\n\ phiObsSIn_s$ID$.setConst(9999)\n\ @@ -307,40 +307,40 @@ if 'fluid_data_dict_resume_s$ID$' in globals():\n\ const std::string fluid_alloc_guiding = "\n\ 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(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\ -y_guidevel_s$ID$ = s$ID$.create(RealGrid)\n\ -z_guidevel_s$ID$ = s$ID$.create(RealGrid)\n\ +velT_s$ID$ = s$ID$.create(MACGrid, name='$NAME_VELT$')\n\ +weightGuide_s$ID$ = s$ID$.create(RealGrid, name='$NAME_WEIGHTGUIDE$')\n\ +numGuides_s$ID$ = s$ID$.create(RealGrid, name='$NAME_NUMGUIDES$')\n\ +phiGuideIn_s$ID$ = s$ID$.create(LevelsetGrid, name='$NAME_PHIGUIDEIN$')\n\ +guidevelC_s$ID$ = s$ID$.create(Vec3Grid, name='$NAME_GUIDEVELC$')\n\ +x_guidevel_s$ID$ = s$ID$.create(RealGrid, name='$NAME_GUIDEVEL_X$')\n\ +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)\n\ +guidevel_sg$ID$ = sg$ID$.create(MACGrid, name='$NAME_GUIDEVEL$')\n\ \n\ # Keep track of important objects in dict to load them later on\n\ -fluid_guiding_dict_s$ID$ = dict(guidevel=guidevel_sg$ID$)\n"; +fluid_guiding_dict_s$ID$ = { 'guidevel' : guidevel_sg$ID$ }\n"; const std::string fluid_alloc_fractions = "\n\ mantaMsg('Allocating fractions data')\n\ -fractions_s$ID$ = s$ID$.create(MACGrid)\n"; +fractions_s$ID$ = s$ID$.create(MACGrid, name='$NAME_FRACTIONS$')\n"; const std::string fluid_alloc_invel = "\n\ mantaMsg('Allocating initial velocity data')\n\ -invelC_s$ID$ = s$ID$.create(VecGrid)\n\ -invel_s$ID$ = s$ID$.create(MACGrid)\n\ -x_invel_s$ID$ = s$ID$.create(RealGrid)\n\ -y_invel_s$ID$ = s$ID$.create(RealGrid)\n\ -z_invel_s$ID$ = s$ID$.create(RealGrid)\n"; +invelC_s$ID$ = s$ID$.create(VecGrid, name='$NAME_INVELC$')\n\ +invel_s$ID$ = s$ID$.create(MACGrid, name='$NAME_INVEL$')\n\ +x_invel_s$ID$ = s$ID$.create(RealGrid, name='$NAME_INVEL_X$')\n\ +y_invel_s$ID$ = s$ID$.create(RealGrid, name='$NAME_INVEL_Y$')\n\ +z_invel_s$ID$ = s$ID$.create(RealGrid, name='$NAME_INVEL_Z$')\n"; const std::string fluid_alloc_outflow = "\n\ mantaMsg('Allocating outflow data')\n\ -phiOutSIn_s$ID$ = s$ID$.create(LevelsetGrid) # helper for static outflow objects\n\ -phiOutIn_s$ID$ = s$ID$.create(LevelsetGrid)\n\ +phiOutSIn_s$ID$ = s$ID$.create(LevelsetGrid, name='$NAME_PHIOUTSIN$') # helper for static outflow objects\n\ +phiOutIn_s$ID$ = s$ID$.create(LevelsetGrid, name='$NAME_PHIOUTIN$')\n\ \n\ # Set some initial values\n\ phiOutSIn_s$ID$.setConst(9999)\n\ diff --git a/intern/mantaflow/intern/strings/liquid_script.h b/intern/mantaflow/intern/strings/liquid_script.h index e9777eb9cda..26b6644f231 100644 --- a/intern/mantaflow/intern/strings/liquid_script.h +++ b/intern/mantaflow/intern/strings/liquid_script.h @@ -77,21 +77,21 @@ using_snd_pushout_sp$ID$ = $SNDPARTICLE_BOUNDARY_PUSHOUT$\n"; const std::string liquid_alloc = "\n\ mantaMsg('Liquid alloc')\n\ -phiParts_s$ID$ = s$ID$.create(LevelsetGrid)\n\ -phi_s$ID$ = s$ID$.create(LevelsetGrid)\n\ -phiTmp_s$ID$ = s$ID$.create(LevelsetGrid)\n\ -velOld_s$ID$ = s$ID$.create(MACGrid)\n\ -velParts_s$ID$ = s$ID$.create(MACGrid)\n\ -mapWeights_s$ID$ = s$ID$.create(MACGrid)\n\ +phiParts_s$ID$ = s$ID$.create(LevelsetGrid, name='$NAME_PHIPARTS$')\n\ +phi_s$ID$ = s$ID$.create(LevelsetGrid, name='$NAME_PHI$')\n\ +phiTmp_s$ID$ = s$ID$.create(LevelsetGrid, name='$NAME_PHITMP$')\n\ +velOld_s$ID$ = s$ID$.create(MACGrid, name='$NAME_VELOLD$')\n\ +velParts_s$ID$ = s$ID$.create(MACGrid, name='$NAME_VELPARTS$')\n\ +mapWeights_s$ID$ = s$ID$.create(MACGrid, name='$NAME_MAPWEIGHTS$')\n\ fractions_s$ID$ = None # allocated dynamically\n\ curvature_s$ID$ = None\n\ \n\ -pp_s$ID$ = s$ID$.create(BasicParticleSystem)\n\ -pVel_pp$ID$ = pp_s$ID$.create(PdataVec3)\n\ +pp_s$ID$ = s$ID$.create(BasicParticleSystem, name='$NAME_PP$')\n\ +pVel_pp$ID$ = pp_s$ID$.create(PdataVec3, name='$NAME_PVEL$')\n\ \n\ # Acceleration data for particle nbs\n\ -pindex_s$ID$ = s$ID$.create(ParticleIndexSystem)\n\ -gpi_s$ID$ = s$ID$.create(IntGrid)\n\ +pindex_s$ID$ = s$ID$.create(ParticleIndexSystem, name='$NAME_PINDEX$')\n\ +gpi_s$ID$ = s$ID$.create(IntGrid, name='$NAME_GPI$')\n\ \n\ # Keep track of important objects in dict to load them later on\n\ liquid_data_dict_final_s$ID$ = dict(pp=pp_s$ID$, pVel=pVel_pp$ID$)\n\ @@ -100,19 +100,19 @@ liquid_data_dict_resume_s$ID$ = dict(phiParts=phiParts_s$ID$, phi=phi_s$ID$, phi const std::string liquid_alloc_mesh = "\n\ mantaMsg('Liquid alloc mesh')\n\ -phiParts_sm$ID$ = sm$ID$.create(LevelsetGrid)\n\ -phi_sm$ID$ = sm$ID$.create(LevelsetGrid)\n\ -pp_sm$ID$ = sm$ID$.create(BasicParticleSystem)\n\ -flags_sm$ID$ = sm$ID$.create(FlagGrid)\n\ -mesh_sm$ID$ = sm$ID$.create(Mesh)\n\ +phiParts_sm$ID$ = sm$ID$.create(LevelsetGrid, name='$NAME_PHIPARTS_MESH$')\n\ +phi_sm$ID$ = sm$ID$.create(LevelsetGrid, name='$NAME_PHI_MESH$')\n\ +pp_sm$ID$ = sm$ID$.create(BasicParticleSystem, name='$NAME_PP_MESH$')\n\ +flags_sm$ID$ = sm$ID$.create(FlagGrid, name='$NAME_FLAGS_MESH$')\n\ +mesh_sm$ID$ = sm$ID$.create(Mesh, name='$NAME_LMESH$')\n\ \n\ if using_speedvectors_s$ID$:\n\ - mVel_mesh$ID$ = mesh_sm$ID$.create(MdataVec3)\n\ - vel_sm$ID$ = sm$ID$.create(MACGrid)\n\ + mVel_mesh$ID$ = mesh_sm$ID$.create(MdataVec3, name='$NAME_VELOCITYVEC_MESH$')\n\ + vel_sm$ID$ = sm$ID$.create(MACGrid, name='$NAME_VELOCITY_MESH$')\n\ \n\ # Acceleration data for particle nbs\n\ -pindex_sm$ID$ = sm$ID$.create(ParticleIndexSystem)\n\ -gpi_sm$ID$ = sm$ID$.create(IntGrid)\n\ +pindex_sm$ID$ = sm$ID$.create(ParticleIndexSystem, name='$NAME_PINDEX_MESH$')\n\ +gpi_sm$ID$ = sm$ID$.create(IntGrid, name='$NAME_GPI_MESH$')\n\ \n\ # Set some initial values\n\ phiParts_sm$ID$.setConst(9999)\n\ @@ -127,24 +127,24 @@ if using_speedvectors_s$ID$:\n\ const std::string liquid_alloc_curvature = "\n\ mantaMsg('Liquid alloc curvature')\n\ -curvature_s$ID$ = s$ID$.create(RealGrid)\n"; +curvature_s$ID$ = s$ID$.create(RealGrid, name='$NAME_CURVATURE$')\n"; const std::string liquid_alloc_particles = "\n\ -ppSnd_sp$ID$ = sp$ID$.create(BasicParticleSystem)\n\ -pVelSnd_pp$ID$ = ppSnd_sp$ID$.create(PdataVec3)\n\ -pForceSnd_pp$ID$ = ppSnd_sp$ID$.create(PdataVec3)\n\ -pLifeSnd_pp$ID$ = ppSnd_sp$ID$.create(PdataReal)\n\ -vel_sp$ID$ = sp$ID$.create(MACGrid)\n\ -flags_sp$ID$ = sp$ID$.create(FlagGrid)\n\ -phi_sp$ID$ = sp$ID$.create(LevelsetGrid)\n\ -phiObs_sp$ID$ = sp$ID$.create(LevelsetGrid)\n\ -phiOut_sp$ID$ = sp$ID$.create(LevelsetGrid)\n\ -normal_sp$ID$ = sp$ID$.create(VecGrid)\n\ -neighborRatio_sp$ID$ = sp$ID$.create(RealGrid)\n\ -trappedAir_sp$ID$ = sp$ID$.create(RealGrid)\n\ -waveCrest_sp$ID$ = sp$ID$.create(RealGrid)\n\ -kineticEnergy_sp$ID$ = sp$ID$.create(RealGrid)\n\ +ppSnd_sp$ID$ = sp$ID$.create(BasicParticleSystem, name='$FLUID_NAME_PP_PARTICLES$')\n\ +pVelSnd_pp$ID$ = ppSnd_sp$ID$.create(PdataVec3, name='$FLUID_NAME_PVEL_PARTICLES$')\n\ +pForceSnd_pp$ID$ = ppSnd_sp$ID$.create(PdataVec3, name='$FLUID_NAME_PFORCE_PARTICLES$')\n\ +pLifeSnd_pp$ID$ = ppSnd_sp$ID$.create(PdataReal, name='$FLUID_NAME_PLIFE_PARTICLES$')\n\ +vel_sp$ID$ = sp$ID$.create(MACGrid, name='$FLUID_NAME_VELOCITY_PARTICLES$')\n\ +flags_sp$ID$ = sp$ID$.create(FlagGrid, name='$FLUID_NAME_FLAGS_PARTICLES$')\n\ +phi_sp$ID$ = sp$ID$.create(LevelsetGrid, name='$FLUID_NAME_PHI_PARTICLES$')\n\ +phiObs_sp$ID$ = sp$ID$.create(LevelsetGrid, name='$FLUID_NAME_PHIOBS_PARTICLES$')\n\ +phiOut_sp$ID$ = sp$ID$.create(LevelsetGrid, name='$FLUID_NAME_PHIOUT_PARTICLES$')\n\ +normal_sp$ID$ = sp$ID$.create(VecGrid, name='$FLUID_NAME_NORMAL_PARTICLES$')\n\ +neighborRatio_sp$ID$ = sp$ID$.create(RealGrid, name='$FLUID_NAME_NEIGHBORRATIO_PARTICLES$')\n\ +trappedAir_sp$ID$ = sp$ID$.create(RealGrid, name='$FLUID_NAME_TRAPPEDAIR_PARTICLES$')\n\ +waveCrest_sp$ID$ = sp$ID$.create(RealGrid, name='$FLUID_NAME_WAVECREST_PARTICLES$')\n\ +kineticEnergy_sp$ID$ = sp$ID$.create(RealGrid, name='$FLUID_NAME_KINETICENERGY_PARTICLES$')\n\ \n\ # Set some initial values\n\ phi_sp$ID$.setConst(9999)\n\ diff --git a/intern/mantaflow/intern/strings/smoke_script.h b/intern/mantaflow/intern/strings/smoke_script.h index 72d5e20b58b..a592ad8644a 100644 --- a/intern/mantaflow/intern/strings/smoke_script.h +++ b/intern/mantaflow/intern/strings/smoke_script.h @@ -82,10 +82,10 @@ const std::string smoke_alloc = "\n\ mantaMsg('Smoke alloc')\n\ shadow_s$ID$ = s$ID$.create(RealGrid, name='$NAME_SHADOW$')\n\ -emission_s$ID$ = s$ID$.create(RealGrid)\n\ -emissionIn_s$ID$ = s$ID$.create(RealGrid)\n\ +emission_s$ID$ = s$ID$.create(RealGrid, name='$NAME_EMISSION$')\n\ +emissionIn_s$ID$ = s$ID$.create(RealGrid, name='$NAME_EMISSIONIN$')\n\ density_s$ID$ = s$ID$.create(RealGrid, name='$NAME_DENSITY$')\n\ -densityIn_s$ID$ = s$ID$.create(RealGrid)\n\ +densityIn_s$ID$ = s$ID$.create(RealGrid, name='$NAME_DENSITYIN$')\n\ heat_s$ID$ = None # allocated dynamically\n\ heatIn_s$ID$ = None\n\ flame_s$ID$ = None\n\ @@ -107,22 +107,22 @@ smoke_data_dict_resume_s$ID$ = dict(densityIn=densityIn_s$ID$, emission=emission const std::string smoke_alloc_noise = "\n\ mantaMsg('Smoke alloc noise')\n\ -vel_sn$ID$ = sn$ID$.create(MACGrid)\n\ -density_sn$ID$ = sn$ID$.create(RealGrid, name='$NAME_DENSITYNOISE$')\n\ -phiIn_sn$ID$ = sn$ID$.create(LevelsetGrid)\n\ -phiOut_sn$ID$ = sn$ID$.create(LevelsetGrid)\n\ -phiObs_sn$ID$ = sn$ID$.create(LevelsetGrid)\n\ -flags_sn$ID$ = sn$ID$.create(FlagGrid)\n\ -tmpIn_sn$ID$ = sn$ID$.create(RealGrid)\n\ -emissionIn_sn$ID$ = sn$ID$.create(RealGrid)\n\ -energy_s$ID$ = s$ID$.create(RealGrid)\n\ -tempFlag_s$ID$ = s$ID$.create(FlagGrid)\n\ -texture_u_s$ID$ = s$ID$.create(RealGrid)\n\ -texture_v_s$ID$ = s$ID$.create(RealGrid)\n\ -texture_w_s$ID$ = s$ID$.create(RealGrid)\n\ -texture_u2_s$ID$ = s$ID$.create(RealGrid)\n\ -texture_v2_s$ID$ = s$ID$.create(RealGrid)\n\ -texture_w2_s$ID$ = s$ID$.create(RealGrid)\n\ +vel_sn$ID$ = sn$ID$.create(MACGrid, name='$NAME_VELOCITY_NOISE$')\n\ +density_sn$ID$ = sn$ID$.create(RealGrid, name='$NAME_DENSITY_NOISE$')\n\ +phiIn_sn$ID$ = sn$ID$.create(LevelsetGrid, name='$NAME_PHIIN_NOISE$')\n\ +phiOut_sn$ID$ = sn$ID$.create(LevelsetGrid, name='$NAME_PHIOUT_NOISE$')\n\ +phiObs_sn$ID$ = sn$ID$.create(LevelsetGrid, name='$NAME_PHIOBS_NOISE$')\n\ +flags_sn$ID$ = sn$ID$.create(FlagGrid, name='$NAME_FLAGS_NOISE$')\n\ +tmpIn_sn$ID$ = sn$ID$.create(RealGrid, name='$NAME_TMPIN_NOISE$')\n\ +emissionIn_sn$ID$ = sn$ID$.create(RealGrid, name='$NAME_EMISSIONIN_NOISE$')\n\ +energy_s$ID$ = s$ID$.create(RealGrid, name='$NAME_ENERGY$')\n\ +tmpFlags_s$ID$ = s$ID$.create(FlagGrid, name='$NAME_TMPFLAGS$')\n\ +texture_u_s$ID$ = s$ID$.create(RealGrid, name='$NAME_TEXTURE_U$')\n\ +texture_v_s$ID$ = s$ID$.create(RealGrid, name='$NAME_TEXTURE_V$')\n\ +texture_w_s$ID$ = s$ID$.create(RealGrid, name='$NAME_TEXTURE_W$')\n\ +texture_u2_s$ID$ = s$ID$.create(RealGrid, name='$NAME_TEXTURE_U2$')\n\ +texture_v2_s$ID$ = s$ID$.create(RealGrid, name='$NAME_TEXTURE_V2$')\n\ +texture_w2_s$ID$ = s$ID$.create(RealGrid, name='$NAME_TEXTURE_W2$')\n\ flame_sn$ID$ = None\n\ fuel_sn$ID$ = None\n\ react_sn$ID$ = None\n\ @@ -132,8 +132,8 @@ color_b_sn$ID$ = None\n\ wltnoise_sn$ID$ = sn$ID$.create(NoiseField, fixedSeed=265, loadFromFile=True)\n\ \n\ mantaMsg('Initializing UV Grids')\n\ -uvGrid0_s$ID$ = s$ID$.create(VecGrid)\n\ -uvGrid1_s$ID$ = s$ID$.create(VecGrid)\n\ +uvGrid0_s$ID$ = s$ID$.create(VecGrid, name='$NAME_UV0$')\n\ +uvGrid1_s$ID$ = s$ID$.create(VecGrid, name='$NAME_UV1$')\n\ resetUvGrid(target=uvGrid0_s$ID$, offset=uvs_offset_s$ID$)\n\ resetUvGrid(target=uvGrid1_s$ID$, offset=uvs_offset_s$ID$)\n\ \n\ @@ -160,9 +160,9 @@ mantaMsg('Allocating colors')\n\ color_r_s$ID$ = s$ID$.create(RealGrid, name='$NAME_COLORR$')\n\ color_g_s$ID$ = s$ID$.create(RealGrid, name='$NAME_COLORG$')\n\ color_b_s$ID$ = s$ID$.create(RealGrid, name='$NAME_COLORB$')\n\ -color_r_in_s$ID$ = s$ID$.create(RealGrid)\n\ -color_g_in_s$ID$ = s$ID$.create(RealGrid)\n\ -color_b_in_s$ID$ = s$ID$.create(RealGrid)\n\ +color_r_in_s$ID$ = s$ID$.create(RealGrid, name='$NAME_COLORRIN$')\n\ +color_g_in_s$ID$ = s$ID$.create(RealGrid, name='$NAME_COLORGIN$')\n\ +color_b_in_s$ID$ = s$ID$.create(RealGrid, name='$NAME_COLORBIN$')\n\ \n\ # Add objects to dict to load them later on\n\ if 'smoke_data_dict_final_s$ID$' in globals():\n\ @@ -178,9 +178,9 @@ if 'color_g_sn$ID$' in globals(): del color_g_sn$ID$\n\ if 'color_b_sn$ID$' in globals(): del color_b_sn$ID$\n\ \n\ mantaMsg('Allocating colors noise')\n\ -color_r_sn$ID$ = sn$ID$.create(RealGrid, name='$NAME_COLORRNOISE$')\n\ -color_g_sn$ID$ = sn$ID$.create(RealGrid, name='$NAME_COLORGNOISE$')\n\ -color_b_sn$ID$ = sn$ID$.create(RealGrid, name='$NAME_COLORBNOISE$')\n\ +color_r_sn$ID$ = sn$ID$.create(RealGrid, name='$NAME_COLORR_NOISE$')\n\ +color_g_sn$ID$ = sn$ID$.create(RealGrid, name='$NAME_COLORG_NOISE$')\n\ +color_b_sn$ID$ = sn$ID$.create(RealGrid, name='$NAME_COLORB_NOISE$')\n\ \n\ # Add objects to dict to load them later on\n\ if 'smoke_noise_dict_final_s$ID$' in globals():\n\ @@ -214,7 +214,7 @@ if 'heatIn_s$ID$' in globals(): del heatIn_s$ID$\n\ \n\ mantaMsg('Allocating heat')\n\ heat_s$ID$ = s$ID$.create(RealGrid, name='$NAME_HEAT$')\n\ -heatIn_s$ID$ = s$ID$.create(RealGrid)\n\ +heatIn_s$ID$ = s$ID$.create(RealGrid, name='$NAME_HEATIN$')\n\ \n\ # Add objects to dict to load them later on\n\ if 'smoke_data_dict_final_s$ID$' in globals():\n\ @@ -235,8 +235,8 @@ mantaMsg('Allocating fire')\n\ flame_s$ID$ = s$ID$.create(RealGrid, name='$NAME_FLAME$')\n\ fuel_s$ID$ = s$ID$.create(RealGrid, name='$NAME_FUEL$')\n\ react_s$ID$ = s$ID$.create(RealGrid, name='$NAME_REACT$')\n\ -fuelIn_s$ID$ = s$ID$.create(RealGrid)\n\ -reactIn_s$ID$ = s$ID$.create(RealGrid)\n\ +fuelIn_s$ID$ = s$ID$.create(RealGrid, name='$NAME_FUELIN$')\n\ +reactIn_s$ID$ = s$ID$.create(RealGrid, name='$NAME_REACTIN$')\n\ \n\ # Add objects to dict to load them later on\n\ if 'smoke_data_dict_final_s$ID$' in globals():\n\ @@ -252,9 +252,9 @@ if 'fuel_sn$ID$' in globals(): del fuel_sn$ID$\n\ if 'react_sn$ID$' in globals(): del react_sn$ID$\n\ \n\ mantaMsg('Allocating fire noise')\n\ -flame_sn$ID$ = sn$ID$.create(RealGrid, name='$NAME_FLAMENOISE$')\n\ -fuel_sn$ID$ = sn$ID$.create(RealGrid, name='$NAME_FUELNOISE$')\n\ -react_sn$ID$ = sn$ID$.create(RealGrid, name='$NAME_REACTNOISE$')\n\ +flame_sn$ID$ = sn$ID$.create(RealGrid, name='$NAME_FLAME_NOISE$')\n\ +fuel_sn$ID$ = sn$ID$.create(RealGrid, name='$NAME_FUEL_NOISE$')\n\ +react_sn$ID$ = sn$ID$.create(RealGrid, name='$NAME_REACT_NOISE$')\n\ \n\ # Add objects to dict to load them later on\n\ if 'smoke_noise_dict_final_s$ID$' in globals():\n\ @@ -493,9 +493,9 @@ def step_noise_$ID$():\n\ mantaMsg('Energy')\n\ computeEnergy(flags=flags_s$ID$, vel=vel_s$ID$, energy=energy_s$ID$)\n\ \n\ - tempFlag_s$ID$.copyFrom(flags_s$ID$)\n\ - extrapolateSimpleFlags(flags=flags_s$ID$, val=tempFlag_s$ID$, distance=2, flagFrom=FlagObstacle, flagTo=FlagFluid)\n\ - extrapolateSimpleFlags(flags=tempFlag_s$ID$, val=energy_s$ID$, distance=6, flagFrom=FlagFluid, flagTo=FlagObstacle)\n\ + tmpFlags_s$ID$.copyFrom(flags_s$ID$)\n\ + extrapolateSimpleFlags(flags=flags_s$ID$, val=tmpFlags_s$ID$, distance=2, flagFrom=FlagObstacle, flagTo=FlagFluid)\n\ + extrapolateSimpleFlags(flags=tmpFlags_s$ID$, val=energy_s$ID$, distance=6, flagFrom=FlagFluid, flagTo=FlagObstacle)\n\ computeWaveletCoeffs(energy_s$ID$)\n\ \n\ sStr_s$ID$ = 1.0 * wltStrength_s$ID$\n\ |