[Bf-blender-cvs] [a3e3647] fluid-mantaflow: added liquid high res api functions
Sebastián Barschkis
noreply at git.blender.org
Wed Sep 14 11:55:49 CEST 2016
Commit: a3e364757db450c69a618713c6b18e53cbaab6c3
Author: Sebastián Barschkis
Date: Mon Sep 5 20:29:11 2016 +0200
Branches: fluid-mantaflow
https://developer.blender.org/rBa3e364757db450c69a618713c6b18e53cbaab6c3
added liquid high res api functions
===================================================================
M intern/mantaflow/extern/manta_fluid_API.h
M intern/mantaflow/intern/FLUID.cpp
M intern/mantaflow/intern/FLUID.h
M intern/mantaflow/intern/manta_fluid_API.cpp
M intern/mantaflow/intern/strings/liquid_script.h
===================================================================
diff --git a/intern/mantaflow/extern/manta_fluid_API.h b/intern/mantaflow/extern/manta_fluid_API.h
index 69a2c68..7cca7b5 100644
--- a/intern/mantaflow/extern/manta_fluid_API.h
+++ b/intern/mantaflow/extern/manta_fluid_API.h
@@ -108,6 +108,9 @@ float liquid_get_triangle_x_at(struct FLUID *liquid, int i);
float liquid_get_triangle_y_at(struct FLUID *liquid, int i);
float liquid_get_triangle_z_at(struct FLUID *liquid, int i);
void liquid_update_mesh_data(struct FLUID *liquid, char *filename);
+void liquid_save_mesh_high(struct FLUID *liquid, char *filename);
+void liquid_save_data_high(struct FLUID *liquid, char *pathname);
+void liquid_load_data_high(struct FLUID *liquid, char *pathname);
#ifdef __cplusplus
}
diff --git a/intern/mantaflow/intern/FLUID.cpp b/intern/mantaflow/intern/FLUID.cpp
index 1b7ba67..216e09c 100644
--- a/intern/mantaflow/intern/FLUID.cpp
+++ b/intern/mantaflow/intern/FLUID.cpp
@@ -313,7 +313,7 @@ void FLUID::initLiquid(SmokeModifierData *smd)
+ liquid_variables_low
+ liquid_bounds_low
+ liquid_init_phi
- + liquid_save_mesh
+ + liquid_save_mesh_low
+ liquid_export_low
+ liquid_import_low
+ liquid_adaptive_step
@@ -332,6 +332,9 @@ void FLUID::initLiquidHigh(SmokeModifierData *smd)
std::string tmpString = liquid_alloc_high
+ liquid_variables_high
+ liquid_bounds_high
+ + liquid_save_mesh_high
+ + liquid_export_high
+ + liquid_import_high
+ liquid_step_high;
std::string finalString = parseScript(tmpString, smd);
mCommands.clear();
@@ -919,9 +922,23 @@ void FLUID::saveMesh(char *filename)
std::string path(filename);
mCommands.clear();
- std::ostringstream save_mesh;
- save_mesh << "save_mesh('" << path << "')";
- mCommands.push_back(save_mesh.str());
+ std::ostringstream save_mesh_low;
+
+ save_mesh_low << "save_mesh_low('" << path << "')";
+ mCommands.push_back(save_mesh_low.str());
+
+ runPythonString(mCommands);
+}
+
+void FLUID::saveMeshHigh(char *filename)
+{
+ std::string path(filename);
+
+ mCommands.clear();
+ std::ostringstream save_mesh_high;
+
+ save_mesh_high << "save_mesh_high('" << path << "')";
+ mCommands.push_back(save_mesh_high.str());
runPythonString(mCommands);
}
@@ -931,9 +948,21 @@ void FLUID::saveLiquidData(char *pathname)
std::string path(pathname);
mCommands.clear();
- std::ostringstream save_liquid_data;
- save_liquid_data << "save_liquid_data('" << path << "')";
- mCommands.push_back(save_liquid_data.str());
+ std::ostringstream save_liquid_data_low;
+ save_liquid_data_low << "save_liquid_data_low('" << path << "')";
+ mCommands.push_back(save_liquid_data_low.str());
+
+ runPythonString(mCommands);
+}
+
+void FLUID::saveLiquidDataHigh(char *pathname)
+{
+ std::string path(pathname);
+
+ mCommands.clear();
+ std::ostringstream save_liquid_data_high;
+ save_liquid_data_high << "save_liquid_data_high('" << path << "')";
+ mCommands.push_back(save_liquid_data_high.str());
runPythonString(mCommands);
}
@@ -943,11 +972,22 @@ void FLUID::loadLiquidData(char *pathname)
std::string path(pathname);
mCommands.clear();
- std::ostringstream load_liquid_data;
- load_liquid_data << "load_liquid_data('" << path << "')";
- mCommands.push_back(load_liquid_data.str());
+ std::ostringstream load_liquid_data_low;
+ load_liquid_data_low << "load_liquid_data_low('" << path << "')";
+ mCommands.push_back(load_liquid_data_low.str());
runPythonString(mCommands);
}
+void FLUID::loadLiquidDataHigh(char *pathname)
+{
+ std::string path(pathname);
+
+ mCommands.clear();
+ std::ostringstream load_liquid_data_high;
+ load_liquid_data_high << "load_liquid_data_high('" << path << "')";
+ mCommands.push_back(load_liquid_data_high.str());
+
+ runPythonString(mCommands);
+}
diff --git a/intern/mantaflow/intern/FLUID.h b/intern/mantaflow/intern/FLUID.h
index e99937b..c6690f5 100644
--- a/intern/mantaflow/intern/FLUID.h
+++ b/intern/mantaflow/intern/FLUID.h
@@ -63,11 +63,14 @@ public:
// Write files for liquids
void saveMesh(char *filename);
+ void saveMeshHigh(char *filename);
void saveLiquidData(char *pathname);
-
+ void saveLiquidDataHigh(char *pathname);
+
// Load files for liquids
- void loadLiquidData(char * pathname);
-
+ void loadLiquidData(char *pathname);
+ void loadLiquidDataHigh(char *pathname);
+
// Smoke getters
inline size_t getTotalCells() { return mTotalCells; }
inline size_t getTotalCellsHigh() { return mTotalCellsHigh; }
diff --git a/intern/mantaflow/intern/manta_fluid_API.cpp b/intern/mantaflow/intern/manta_fluid_API.cpp
index a5f2b6d..3b3d097 100644
--- a/intern/mantaflow/intern/manta_fluid_API.cpp
+++ b/intern/mantaflow/intern/manta_fluid_API.cpp
@@ -510,6 +510,13 @@ extern "C" void liquid_save_mesh(FLUID *liquid, char *filename)
}
}
+extern "C" void liquid_save_mesh_high(FLUID *liquid, char *filename)
+{
+ if (liquid) {
+ liquid->saveMeshHigh(filename);
+ }
+}
+
extern "C" void liquid_save_data(FLUID *liquid, char *pathname)
{
if (liquid) {
@@ -517,6 +524,13 @@ extern "C" void liquid_save_data(FLUID *liquid, char *pathname)
}
}
+extern "C" void liquid_save_data_high(FLUID *liquid, char *pathname)
+{
+ if (liquid) {
+ liquid->saveLiquidDataHigh(pathname);
+ }
+}
+
extern "C" void liquid_load_data(FLUID *liquid, char *pathname)
{
if (liquid) {
@@ -524,6 +538,13 @@ extern "C" void liquid_load_data(FLUID *liquid, char *pathname)
}
}
+extern "C" void liquid_load_data_high(FLUID *liquid, char *pathname)
+{
+ if (liquid) {
+ liquid->loadLiquidDataHigh(pathname);
+ }
+}
+
extern "C" int liquid_get_num_verts(FLUID *liquid)
{
return liquid->getNumVertices();
diff --git a/intern/mantaflow/intern/strings/liquid_script.h b/intern/mantaflow/intern/strings/liquid_script.h
index b70f730..ddcd2ab 100644
--- a/intern/mantaflow/intern/strings/liquid_script.h
+++ b/intern/mantaflow/intern/strings/liquid_script.h
@@ -265,15 +265,16 @@ def liquid_step_high():\n\
// IMPORT / EXPORT
//////////////////////////////////////////////////////////////////////
-const std::string liquid_save_mesh = "\n\
-def save_mesh(path):\n\
- mesh.save(path)\n\
- # TODO (sebbas)\n\
- #if using_highres:\n\
- #xl_mesh.save(path)\n";
+const std::string liquid_save_mesh_low = "\n\
+def save_mesh_low(path):\n\
+ mesh.save(path)\n";
+
+const std::string liquid_save_mesh_high = "\n\
+def save_mesh_high(path):\n\
+ xl_mesh.save(path)\n";
const std::string liquid_import_low = "\n\
-def load_liquid_data(path):\n\
+def load_liquid_data_low(path):\n\
flags.load(path + str('flags.uni'))\n\
\n\
phiParts.load(path + str('phiParts.uni'))\n\
@@ -291,8 +292,16 @@ def load_liquid_data(path):\n\
\n\
gpi.load(path + str('gpi.uni'))\n";
+const std::string liquid_import_high = "\n\
+def load_liquid_data_high(path):\n\
+ xl_flags.load(path + str('xl_flags.uni'))\n\
+ \n\
+ xl_phi.load(path + str('xl_phi.uni'))\n\
+ \n\
+ xl_pp.load(path + str('xl_pp.uni'))\n";
+
const std::string liquid_export_low = "\n\
-def save_liquid_data(path):\n\
+def save_liquid_data_low(path):\n\
flags.save(path + str('flags.uni'))\n\
\n\
phiParts.save(path + str('phiParts.uni'))\n\
@@ -310,6 +319,14 @@ def save_liquid_data(path):\n\
\n\
gpi.save(path + str('gpi.uni'))\n";
+const std::string liquid_export_high = "\n\
+def save_liquid_data_high(path):\n\
+ xl_flags.save(path + str('xl_flags.uni'))\n\
+ \n\
+ xl_phi.save(path + str('xl_phi.uni'))\n\
+ \n\
+ xl_pp.save(path + str('xl_pp.uni'))\n";
+
//////////////////////////////////////////////////////////////////////
// DESTRUCTION
//////////////////////////////////////////////////////////////////////
More information about the Bf-blender-cvs
mailing list