[Bf-blender-cvs] [ea7ed9d] fluid-mantaflow: refactored mantaflow scripts
Sebastián Barschkis
noreply at git.blender.org
Mon Aug 15 23:01:20 CEST 2016
Commit: ea7ed9dd1072e06d8d395060f7e4783a7d01d5ba
Author: Sebastián Barschkis
Date: Mon Aug 15 22:54:04 2016 +0200
Branches: fluid-mantaflow
https://developer.blender.org/rBea7ed9dd1072e06d8d395060f7e4783a7d01d5ba
refactored mantaflow scripts
===================================================================
M intern/mantaflow/intern/SMOKE.cpp
M intern/mantaflow/intern/strings/liquid_script.h
M intern/mantaflow/intern/strings/shared_script.h
M intern/mantaflow/intern/strings/smoke_script.h
===================================================================
diff --git a/intern/mantaflow/intern/SMOKE.cpp b/intern/mantaflow/intern/SMOKE.cpp
index e49b34f..b6a7b71 100644
--- a/intern/mantaflow/intern/SMOKE.cpp
+++ b/intern/mantaflow/intern/SMOKE.cpp
@@ -191,8 +191,8 @@ SMOKE::SMOKE(int *res, SmokeModifierData *smd)
void SMOKE::initDomain(SmokeModifierData *smd)
{
std::string tmpString = manta_import
- + solver_low
- + adaptive_time_stepping_low;
+ + fluid_solver_low
+ + fluid_adaptive_time_stepping_low;
std::string finalString = parseScript(tmpString, smd);
mCommands.clear();
mCommands.push_back(finalString);
@@ -202,8 +202,8 @@ void SMOKE::initDomain(SmokeModifierData *smd)
void SMOKE::initDomainHigh(SmokeModifierData *smd)
{
- std::string tmpString = solver_high
- + adaptive_time_stepping_high;
+ std::string tmpString = fluid_solver_high
+ + fluid_adaptive_time_stepping_high;
std::string finalString = parseScript(tmpString, smd);
mCommands.clear();
mCommands.push_back(finalString);
@@ -213,11 +213,10 @@ void SMOKE::initDomainHigh(SmokeModifierData *smd)
void SMOKE::initSmoke(SmokeModifierData *smd)
{
- std::string tmpString = alloc_base_grids_low
- + fluid_variables
+ std::string tmpString = smoke_alloc_low
+ smoke_variables_low
- + smoke_prep_domain_low
- + manta_step
+ + smoke_bounds_low
+ + smoke_adaptive_step
+ smoke_step_low;
std::string finalString = parseScript(tmpString, smd);
mCommands.clear();
@@ -228,11 +227,11 @@ void SMOKE::initSmoke(SmokeModifierData *smd)
void SMOKE::initSmokeHigh(SmokeModifierData *smd)
{
- std::string tmpString = alloc_base_grids_high
+ std::string tmpString = smoke_alloc_high
+ smoke_variables_high
- + uv_setup
- + smoke_prep_domain_high
- + wavelet_turbulence_noise
+ + smoke_uv_setup
+ + smoke_bounds_high
+ + smoke_wavelet_turbulence_noise
+ smoke_step_high;
std::string finalString = parseScript(tmpString, smd);
mCommands.clear();
@@ -246,8 +245,8 @@ void SMOKE::initHeat(SmokeModifierData *smd)
{
if (!mHeat) {
mCommands.clear();
- mCommands.push_back(alloc_heat_low);
- mCommands.push_back(with_heat);
+ mCommands.push_back(smoke_alloc_heat_low);
+ mCommands.push_back(smoke_with_heat);
runPythonString(mCommands);
mUsingHeat = true;
@@ -258,8 +257,8 @@ void SMOKE::initFire(SmokeModifierData *smd)
{
if (!mFuel) {
mCommands.clear();
- mCommands.push_back(alloc_fire_low);
- mCommands.push_back(with_fire);
+ mCommands.push_back(smoke_alloc_fire_low);
+ mCommands.push_back(smoke_with_fire);
runPythonString(mCommands);
mUsingFire = true;
@@ -270,8 +269,8 @@ void SMOKE::initFireHigh(SmokeModifierData *smd)
{
if (!mFuelHigh) {
mCommands.clear();
- mCommands.push_back(alloc_fire_high);
- mCommands.push_back(with_fire);
+ mCommands.push_back(smoke_alloc_fire_high);
+ mCommands.push_back(smoke_with_fire);
runPythonString(mCommands);
mUsingFire = true;
@@ -282,11 +281,11 @@ void SMOKE::initColors(SmokeModifierData *smd)
{
if (!mColorR) {
mCommands.clear();
- std::string colorCodes = parseScript(set_color_codes, smd);
+ std::string colorCodes = parseScript(smoke_set_color_codes, smd);
mCommands.push_back(colorCodes);
- mCommands.push_back(alloc_colors_low);
- mCommands.push_back(init_colors_low);
- mCommands.push_back(with_colors);
+ mCommands.push_back(smoke_alloc_colors_low);
+ mCommands.push_back(smoke_init_colors_low);
+ mCommands.push_back(smoke_with_colors);
runPythonString(mCommands);
mUsingColors = true;
@@ -297,11 +296,11 @@ void SMOKE::initColorsHigh(SmokeModifierData *smd)
{
if (!mColorRHigh) {
mCommands.clear();
- std::string colorCodes = parseScript(set_color_codes, smd);
+ std::string colorCodes = parseScript(smoke_set_color_codes, smd);
mCommands.push_back(colorCodes);
- mCommands.push_back(alloc_colors_high);
- mCommands.push_back(init_colors_high);
- mCommands.push_back(with_colors);
+ mCommands.push_back(smoke_alloc_colors_high);
+ mCommands.push_back(smoke_init_colors_high);
+ mCommands.push_back(smoke_with_colors);
runPythonString(mCommands);
mUsingColors = true;
@@ -311,16 +310,15 @@ void SMOKE::initColorsHigh(SmokeModifierData *smd)
void SMOKE::initLiquid(SmokeModifierData *smd)
{
if (!mPhi) {
- std::string tmpString = alloc_liquid
- + fluid_variables
- + liquid_variables
- + liquid_prep_domain_low
- + init_phi
- + save_mesh
- + save_liquid_data
- + load_liquid_data
- + adaptive_step_liquid
- + liquid_step;
+ std::string tmpString = liquid_alloc_low
+ + liquid_variables_low
+ + liquid_bounds_low
+ + liquid_init_phi
+ + liquid_save_mesh
+ + liquid_export_low
+ + liquid_import_low
+ + liquid_adaptive_step
+ + liquid_step_low;
std::string finalString = parseScript(tmpString, smd);
mCommands.clear();
mCommands.push_back(finalString);
@@ -332,9 +330,9 @@ void SMOKE::initLiquid(SmokeModifierData *smd)
void SMOKE::initLiquidHigh(SmokeModifierData *smd)
{
- std::string tmpString = alloc_liquid_high
+ std::string tmpString = liquid_alloc_high
+ liquid_variables_high
- + liquid_prep_domain_high
+ + liquid_bounds_high
+ liquid_step_high;
std::string finalString = parseScript(tmpString, smd);
mCommands.clear();
@@ -370,33 +368,33 @@ SMOKE::~SMOKE()
// Liquid
if (mUsingLiquid) {
- mCommands.push_back(del_liquid_grids);
- mCommands.push_back(del_liquid_vars);
+ mCommands.push_back(liquid_delete_grids_low);
+ mCommands.push_back(liquid_delete_variables_low);
- if (mUsingHighRes) mCommands.push_back(del_liquid_grids_high);
- if (mUsingHighRes) mCommands.push_back(del_liquid_vars_high);
+ if (mUsingHighRes) mCommands.push_back(liquid_delete_grids_high);
+ if (mUsingHighRes) mCommands.push_back(liquid_delete_variables_high);
}
// Smoke
if (mUsingSmoke) {
- mCommands.push_back(del_base_grids_low);
- mCommands.push_back(del_vars_low);
- if (mUsingHeat) mCommands.push_back(del_heat_low);
- if (mUsingFire) mCommands.push_back(del_fire_low);
- if (mUsingColors) mCommands.push_back(del_colors_low);
+ mCommands.push_back(smoke_delete_grids_low);
+ mCommands.push_back(smoke_delete_variables_low);
+ if (mUsingHeat) mCommands.push_back(smoke_delete_heat_low);
+ if (mUsingFire) mCommands.push_back(smoke_delete_fire_low);
+ if (mUsingColors) mCommands.push_back(smoke_delete_colors_low);
- if (mUsingHighRes) mCommands.push_back(del_base_grids_high);
- if (mUsingHighRes) mCommands.push_back(del_vars_high);
- if (mUsingColors && mUsingHighRes) mCommands.push_back(del_colors_high);
- if (mUsingFire && mUsingHighRes) mCommands.push_back(del_fire_high);
+ if (mUsingHighRes) mCommands.push_back(smoke_delete_grids_high);
+ if (mUsingHighRes) mCommands.push_back(smoke_delete_variables_high);
+ if (mUsingColors && mUsingHighRes) mCommands.push_back(smoke_delete_colors_high);
+ if (mUsingFire && mUsingHighRes) mCommands.push_back(smoke_delete_fire_high);
}
// Make sure that everything is garbage collected
mCommands.push_back(gc_collect);
// Solvers always have to be the last objects to be deleted
- mCommands.push_back(del_solver_low);
- if (mUsingHighRes) mCommands.push_back(del_solver_high);
+ mCommands.push_back(fluid_delete_solver_low);
+ if (mUsingHighRes) mCommands.push_back(fluid_delete_solver_high);
// Just in case: gc again
mCommands.push_back(gc_collect);
@@ -632,48 +630,48 @@ void SMOKE::exportScript(SmokeModifierData *smd)
// Setup low
std::string manta_script =
manta_import +
- solver_low +
- alloc_base_grids_low;
+ fluid_solver_low +
+ smoke_alloc_low;
// Add heat grid low if needed
if (smd->domain->active_fields & SM_ACTIVE_HEAT) {
- manta_script += alloc_heat_low;
+ manta_script += smoke_alloc_heat_low;
}
// Add color grids low if needed
if (smd->domain->active_fields & SM_ACTIVE_COLORS) {
- manta_script += alloc_colors_low;
+ manta_script += smoke_alloc_colors_low;
}
// Add fire grids low if needed
if (smd->domain->active_fields & SM_ACTIVE_FIRE) {
- manta_script += alloc_fire_low;
+ manta_script += smoke_alloc_fire_low;
}
// Rest of low res setup
- manta_script += smoke_prep_domain_low + smoke_variables_low;
+ manta_script += smoke_bounds_low + smoke_variables_low;
// Setup high
if (smd->domain->flags & MOD_SMOKE_HIGHRES) {
- manta_script += solver_high
+ manta_script += fluid_solver_high
+ smoke_variables_high
- + uv_setup
- + alloc_base_grids_high;
+ + smoke_uv_setup
+ + smoke_alloc_high;
}
// Add color grids high if needed
if (smd->domain->flags & MOD_SMOKE_HIGHRES && smd->domain->active_fields & SM_ACTIVE_COLORS) {
- manta_script += alloc_colors_high;
+ manta_script += smoke_alloc_colors_high;
}
// Add fire grids high if needed
if (smd->domain->flags & MOD_SMOKE_HIGHRES && smd->domain->active_fields & SM_ACTIVE_FIRE) {
- manta_script += alloc_fire_high;
+ manta_script += smoke_alloc_fire_high;
}
// Rest of high res setup
if (smd->domain->flags & MOD_SMOKE_HIGHRES) {
- manta_script += smoke_prep_domain_high + wavelet_turbulence_noise;
+ manta_script += smoke_bounds_high + smoke_wavelet_turbulence_noise;
}
// Import low
@@ -699,13 +697,13 @@ void SMOKE::exportScript(SmokeModifierData *smd)
}
// Step wrapper function
- manta_script += manta_step;
+ manta_script += smoke_adaptive_step;
// Fill in missing variables in script
std::string final_script = SMOKE::parseScript(manta_script, smd);
// Add standalone mode (loop, gui, ...)
- final_script += standalone;
+ final_script += smoke_standalone;
// Write script
std::ofstream myfile;
diff --git a/intern/mantaflow/intern/strings/liquid_script.h b/intern/mantaflow/intern/strings/liquid_script.h
index e263dc2..afae08d 100644
--- a/intern/mantaflow/intern/strings/liquid_script.h
+++ b/intern/mantaflow/intern/strings/liquid_script.h
@@ -30,10 +30,28 @@
#include <string>
//////////////////////////////////////////////////////////////////////
-// GENERAL SETUP
+// BOUNDS
//////////////////////////////////////////////////////////////////////
-const std::string liquid_variables = "\n\
+con
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list