[Bf-blender-cvs] [e43b821] fluid-mantaflow: added liquid obstacle grids and access functions
Sebastián Barschkis
noreply at git.blender.org
Mon Oct 3 19:47:46 CEST 2016
Commit: e43b82166496d0358863615504ceb6b6f69449a3
Author: Sebastián Barschkis
Date: Tue Sep 13 02:32:14 2016 +0200
Branches: fluid-mantaflow
https://developer.blender.org/rBe43b82166496d0358863615504ceb6b6f69449a3
added liquid obstacle grids and access 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 668b4f2..bd30929 100644
--- a/intern/mantaflow/extern/manta_fluid_API.h
+++ b/intern/mantaflow/extern/manta_fluid_API.h
@@ -90,6 +90,7 @@ unsigned char *smoke_turbulence_get_obstacle(struct FLUID *smoke);
float *liquid_get_phi(struct FLUID *liquid);
float *liquid_get_phiinit(struct FLUID *liquid);
+float *liquid_get_phiobsinit(struct FLUID *liquid);
float *liquid_turbulence_get_phi(struct FLUID *liquid);
void liquid_ensure_init(struct FLUID *liquid, struct SmokeModifierData *smd);
void liquid_save_mesh(struct FLUID *liquid, char *filename);
diff --git a/intern/mantaflow/intern/FLUID.cpp b/intern/mantaflow/intern/FLUID.cpp
index acec131..f94b970 100644
--- a/intern/mantaflow/intern/FLUID.cpp
+++ b/intern/mantaflow/intern/FLUID.cpp
@@ -114,7 +114,8 @@ FLUID::FLUID(int *res, SmokeModifierData *smd)
// Liquid low res grids
mPhi = NULL;
mPhiInit = NULL;
-
+ mPhiObsInit = NULL;
+
// Liquid high res grids
mPhiHigh = NULL;
@@ -441,9 +442,10 @@ FLUID::~FLUID()
mTextureW2 = NULL;
// Liquid
- mPhi = NULL;
- mPhiInit = NULL;
- mPhiHigh = NULL;
+ mPhi = NULL;
+ mPhiInit = NULL;
+ mPhiObsInit = NULL;
+ mPhiHigh = NULL;
// Reset flags
mUsingHeat = false;
@@ -913,8 +915,9 @@ void FLUID::updatePointers(SmokeModifierData *smd)
// Liquid
if (mUsingLiquid) {
- mPhi = (float*) getGridPointer("phi", "s");
- mPhiInit = (float*) getGridPointer("phiInit", "s");
+ mPhi = (float*) getGridPointer("phi", "s");
+ mPhiInit = (float*) getGridPointer("phiInit", "s");
+ mPhiObsInit = (float*) getGridPointer("phiObsInit", "s");
}
// Smoke
diff --git a/intern/mantaflow/intern/FLUID.h b/intern/mantaflow/intern/FLUID.h
index 607bee0..59f315b 100644
--- a/intern/mantaflow/intern/FLUID.h
+++ b/intern/mantaflow/intern/FLUID.h
@@ -123,9 +123,10 @@ public:
inline float* getTextureW2() { return mTextureW2; }
inline unsigned char* getObstacleHigh() { return mObstacleHigh; }
- inline float* getPhi() { return mPhi; }
- inline float* getPhiInit() { return mPhiInit; }
- inline float* getPhiHigh() { return NULL; } // Not yet implemented
+ inline float* getPhi() { return mPhi; }
+ inline float* getPhiInit() { return mPhiInit; }
+ inline float* getPhiObsInit() { return mPhiObsInit; }
+ inline float* getPhiHigh() { return NULL; } // Not yet implemented
static bool mantaInitialized;
@@ -215,6 +216,7 @@ private:
// Liquids
float* mPhi;
float* mPhiInit;
+ float* mPhiObsInit;
float* mPhiHigh;
// Mesh fields for liquid surface
diff --git a/intern/mantaflow/intern/manta_fluid_API.cpp b/intern/mantaflow/intern/manta_fluid_API.cpp
index 2aa457b..90d729b 100644
--- a/intern/mantaflow/intern/manta_fluid_API.cpp
+++ b/intern/mantaflow/intern/manta_fluid_API.cpp
@@ -503,6 +503,11 @@ extern "C" float *liquid_get_phiinit(FLUID *liquid)
return liquid->getPhiInit();
}
+extern "C" float *liquid_get_phiobsinit(FLUID *liquid)
+{
+ return liquid->getPhiObsInit();
+}
+
extern "C" void liquid_save_mesh(FLUID *liquid, char *filename)
{
if (liquid) {
diff --git a/intern/mantaflow/intern/strings/liquid_script.h b/intern/mantaflow/intern/strings/liquid_script.h
index e4f5b54..d307663 100644
--- a/intern/mantaflow/intern/strings/liquid_script.h
+++ b/intern/mantaflow/intern/strings/liquid_script.h
@@ -83,6 +83,10 @@ phi = s.create(LevelsetGrid)\n\
phiInit = s.create(LevelsetGrid)\n\
pressure = s.create(RealGrid)\n\
\n\
+phiObs = s.create(LevelsetGrid)\n\
+phiObsInit = s.create(LevelsetGrid)\n\
+fractions = s.create(MACGrid)\n\
+\n\
vel = s.create(MACGrid)\n\
x_vel = s.create(RealGrid)\n\
y_vel = s.create(RealGrid)\n\
@@ -276,6 +280,9 @@ def load_liquid_data_low(path):\n\
phiParts.load(path + str('phiParts.uni'))\n\
phi.load(path + str('phi.uni'))\n\
phiInit.load(path + str('phiInit.uni'))\n\
+ phiObs.load(path + str('phiObs.uni'))\n\
+ phiObsInit.load(path + str('phiObsInit.uni'))\n\
+ fractions.load(path + str('fractions.uni'))\n\
pressure.load(path + str('pressure.uni'))\n\
\n\
vel.load(path + str('vel.uni'))\n\
@@ -304,6 +311,9 @@ def save_liquid_data_low(path):\n\
phiParts.save(path + str('phiParts.uni'))\n\
phi.save(path + str('phi.uni'))\n\
phiInit.save(path + str('phiInit.uni'))\n\
+ phiObs.save(path + str('phiObs.uni'))\n\
+ phiObsInit.save(path + str('phiObsInit.uni'))\n\
+ fractions.save(path + str('fractions.uni'))\n\
pressure.save(path + str('pressure.uni'))\n\
\n\
vel.save(path + str('vel.uni'))\n\
@@ -355,7 +365,10 @@ if 'gpi' in globals() : del gpi\n\
if 'forces' in globals() : del forces\n\
if 'x_force' in globals() : del x_force\n\
if 'y_force' in globals() : del y_force\n\
-if 'z_force' in globals() : del z_force\n";
+if 'z_force' in globals() : del z_force\n\
+if 'phiObs' in globals() : del phiObs\n\
+if 'phiObsInit' in globals() : del phiObsInit\n\
+if 'fractions' in globals() : del fractions\n";
const std::string liquid_delete_grids_high = "\n\
mantaMsg('Deleting highres grids, mesh, particlesystem')\n\
More information about the Bf-blender-cvs
mailing list