[Bf-blender-cvs] [965ac27] fluid-mantaflow: refactoring manta api and started to comment out old code -> removing it later

Sebastián Barschkis noreply at git.blender.org
Thu Jan 28 12:37:24 CET 2016


Commit: 965ac27fb757f7f5e7bc3e8867dd303381cb6ba8
Author: Sebastián Barschkis
Date:   Fri Jan 8 02:12:57 2016 +0100
Branches: fluid-mantaflow
https://developer.blender.org/rB965ac27fb757f7f5e7bc3e8867dd303381cb6ba8

refactoring manta api and started to comment out old code -> removing it later

===================================================================

M	intern/smoke/extern/smoke_API.h
M	intern/smoke/intern/FLUID_3D.cpp
M	intern/smoke/intern/MANTA.cpp
M	intern/smoke/intern/MANTA.h
M	intern/smoke/intern/WTURBULENCE.cpp
M	intern/smoke/intern/smoke_API.cpp
M	release/scripts/startup/bl_ui/properties_physics_smoke.py
M	source/blender/editors/physics/physics_fluid.c
M	source/blender/editors/physics/physics_intern.h
M	source/blender/editors/physics/physics_ops.c

===================================================================

diff --git a/intern/smoke/extern/smoke_API.h b/intern/smoke/extern/smoke_API.h
index f0e3a4f..2051c35 100644
--- a/intern/smoke/extern/smoke_API.h
+++ b/intern/smoke/extern/smoke_API.h
@@ -122,14 +122,14 @@ void smoke_ensure_fire(struct FLUID_3D *fluid, struct WTURBULENCE *wt);
 void smoke_ensure_colors(struct FLUID_3D *fluid, struct WTURBULENCE *wt, float init_r, float init_g, float init_b);
 
 
-	/*Mantaflow functions*/
-int smoke_mantaflow_read(struct SmokeDomainSettings *sds, char* name, bool with_wavelets); //1:success, 0: no file,error
-void smoke_mantaflow_stop_sim(struct Manta_API *fluid);
-void manta_write_effectors(struct FLUID_3D *fluid);
-void manta_update_effectors(struct Scene *scene, struct Object *ob,struct SmokeDomainSettings *sds, float dt);
-void manta_write_emitters(struct SmokeFlowSettings *sfs, bool highRes, int min_x, int min_y, int min_z, int max_x, int max_y, int max_z, int d_x, int d_y, int d_z,float *influence, float *vel);	
-void manta_export_obstacles(float * influence, int x, int y, int z);
-	int cell_index_3D(int index_2d,int sizex,int sizey, int sizez); /*For 2D sims only: transforms 2D manta cell index into 3D Blender index*/
+//	/*Mantaflow functions*/
+//int smoke_mantaflow_read(struct SmokeDomainSettings *sds, char* name, bool with_wavelets); //1:success, 0: no file,error
+//void smoke_mantaflow_stop_sim(struct Manta_API *fluid);
+//void manta_write_effectors(struct FLUID_3D *fluid);
+//void manta_update_effectors(struct Scene *scene, struct Object *ob,struct SmokeDomainSettings *sds, float dt);
+//void manta_write_emitters(struct SmokeFlowSettings *sfs, bool highRes, int min_x, int min_y, int min_z, int max_x, int max_y, int max_z, int d_x, int d_y, int d_z,float *influence, float *vel);	
+//void manta_export_obstacles(float * influence, int x, int y, int z);
+//	int cell_index_3D(int index_2d,int sizex,int sizey, int sizez); /*For 2D sims only: transforms 2D manta cell index into 3D Blender index*/
 #ifdef __cplusplus
 }
 #endif
diff --git a/intern/smoke/intern/FLUID_3D.cpp b/intern/smoke/intern/FLUID_3D.cpp
index fcf0a4e..7bb539e 100644
--- a/intern/smoke/intern/FLUID_3D.cpp
+++ b/intern/smoke/intern/FLUID_3D.cpp
@@ -618,7 +618,7 @@ _xRes(res[0]), _yRes(res[1]), _zRes(res[2]), _res(0.0f)
 		initColors(0.0f, 0.0f, 0.0f);
 	}
 	
-	Manta_API::updatePointers(this);
+	Manta_API::update_pointers(this);
 }
 
 void FLUID_3D::initHeat()
@@ -723,7 +723,7 @@ void FLUID_3D::step(float dt, float gravity[3])
 	std::string py_string_0 = string("step_low()");
 	PyRun_SimpleString(py_string_0.c_str());
 	PyGILState_Release(gilstate);
-	Manta_API::updatePointers(this);
+	Manta_API::update_pointers(this);
 }
 
 void FLUID_3D::processBurn(float *fuel, float *smoke, float *react, float *heat,
@@ -733,7 +733,7 @@ void FLUID_3D::processBurn(float *fuel, float *smoke, float *react, float *heat,
 	std::string py_string_0 = string("process_burn_low()");
 	PyRun_SimpleString(py_string_0.c_str());
 	PyGILState_Release(gilstate);
-	Manta_API::updatePointers(this);
+	Manta_API::update_pointers(this);
 }
 
 void FLUID_3D::updateFlame(float *react, float *flame, int total_cells)
@@ -742,7 +742,7 @@ void FLUID_3D::updateFlame(float *react, float *flame, int total_cells)
 	std::string py_string_0 = string("update_flame_low()");
 	PyRun_SimpleString(py_string_0.c_str());
 	PyGILState_Release(gilstate);
-	Manta_API::updatePointers(this);
+	Manta_API::update_pointers(this);
 }
 
 #endif /*WITH_MANTA*/
diff --git a/intern/smoke/intern/MANTA.cpp b/intern/smoke/intern/MANTA.cpp
index 71e0f99..b7f7ea9 100644
--- a/intern/smoke/intern/MANTA.cpp
+++ b/intern/smoke/intern/MANTA.cpp
@@ -3,382 +3,382 @@
 #include "scenarios/smoke.h"
 #include "../../../source/blender/python/manta_pp/pwrapper/manta.h"
 
-extern "C" bool manta_check_grid_size(struct FLUID_3D *fluid, int dimX, int dimY, int dimZ)
-{
-	/*Y and Z axes are swapped in manta and blender*/
-	if (!(dimX == fluid->xRes() && dimY == fluid->yRes() && dimZ == fluid->zRes())) {
-		for (int cnt(0); cnt < fluid->_totalCells; cnt++)
-			fluid->_density[cnt] = 0.0f;
-		return false;
-	}
-	return true;
-}
-
-extern "C" bool manta_check_wavelets_size(struct WTURBULENCE *wt, int dimX, int dimY, int dimZ)
-{
-	/*Y and Z axes are swapped in manta and blender*/
-	if (!(dimX == wt->_xResBig && dimY == wt->_yResBig && dimZ == wt->_zResBig)) {
-		for (int cnt(0); cnt < wt->_totalCellsBig; cnt++)
-			wt->_densityBig[cnt] = 0.0f;
-		return false;
-	}
-	return true;
-}
-
-void read_rotated_grid(gzFile gzf, float *data, int size_x, int size_y, int size_z)
-{
-	assert(size_x > 1 && size_y > 1 && size_z > 1);
-	float* temp_data = (float*)malloc(sizeof(float) * size_x * size_y * size_z);
-//	data = (float*)malloc(sizeof(float) * size_x * size_y * size_z);
-	gzread(gzf, temp_data, sizeof(float)* size_x * size_y * size_z);
-	for (int cnt_x(0); cnt_x < size_x; ++cnt_x)
-{
-		for (int cnt_y(0); cnt_y < size_y; ++cnt_y)
-		{
-			for (int cnt_z(0); cnt_z < size_z; ++cnt_z)
-			{
-				data[cnt_x + size_x * cnt_y + size_x*size_y * cnt_z] = temp_data[cnt_x + size_x * cnt_y + size_x*size_y * cnt_z];
-			}			
-		}
-	}
-}
-
-static void wavelets_add_lowres_density(SmokeDomainSettings *sds)
-{
-	assert(sds != NULL);
-	for (int cnt_x(0); cnt_x < sds->wt->_xResBig; ++cnt_x)
-	{
-		for (int cnt_y(0); cnt_y < sds->wt->_yResBig; ++cnt_y)
-		{
-			for (int cnt_z(0); cnt_z < sds->wt->_zResBig; ++cnt_z)
-			{
-				//scale down to domain res
-				float x_sc = 1. * sds->base_res[0] * cnt_x / sds->wt->_xResBig;
-				float y_sc = 1. * sds->base_res[1] * cnt_y / sds->wt->_yResBig;
-				float z_sc = 1. * sds->base_res[2] * cnt_z / sds->wt->_zResBig;
-				//finding cells to interpolate from
-				int start_x = int(x_sc / 1);
-				int start_y = int(y_sc / 1);
-				int start_z = int(z_sc / 1);
-				int end_x = ((x_sc - start_x > 0.001) && (start_x + 1 < sds->base_res[0]))? start_x + 1: start_x;
-				int end_y = ((y_sc - start_y > 0.001) && (start_y + 1 < sds->base_res[1]))? start_y + 1: start_y;
-				int end_z = ((z_sc - start_z > 0.001) && (start_z + 1 < sds->base_res[2]))? start_z + 1: start_z;
-				//interpolation
-				float add_value = 0;
-				int cnt=0;
-				for(int x(start_x); x <= end_x; ++x)
-				{
-					for(int y(start_y); y <= end_y; ++y)
-					{
-						for(int z(start_z); z <= end_z; ++z)
-						{
-							cnt++;
-							add_value += sds->fluid->_density[x + y*sds->base_res[0] + z * sds->base_res[0]*sds->base_res[1]];	
-						}			
-					}	
-				}
-				add_value /= float(cnt);
-				sds->wt->_densityBig[cnt_x + cnt_y *sds->wt->_xResBig + cnt_z*sds->wt->_xResBig*sds->wt->_yResBig] += add_value;
-			}
-		}
-	}
-}
-
-//PR need SMD data here for wavelets 
-extern "C" int read_mantaflow_sim(struct SmokeDomainSettings *sds, char *name, bool reading_wavelets)
-{
-    /*! l /*! legacy headers for reading old files */
-	typedef struct {
-		int dimX, dimY, dimZ;
-		int frames, elements, elementType, bytesPerElement, bytesPerFrame;
-	} UniLegacyHeader;
-	
-	typedef struct {
-		int dimX, dimY, dimZ;
-		int gridType, elementType, bytesPerElement;
-	} UniLegacyHeader2;
-	
-	/* uni file header - currently used */ 
-	typedef struct {
-		int dimX, dimY, dimZ;
-		int gridType, elementType, bytesPerElement;
-		char info[256]; /* mantaflow build information */
-		unsigned long long timestamp; /* creation time */
-	} UniHeader;
-	
-#	if NO_ZLIB!=1
-    gzFile gzf = gzopen(name, "rb");
-//    if (!gzf) {
-//		if(reading_wavelets){
-//			for (int cnt(0); cnt < sds->wt->_totalCellsBig; cnt++)
-//				sds->wt->_densityBig[cnt] = 0.0f;
+//extern "C" bool manta_check_grid_size(struct FLUID_3D *fluid, int dimX, int dimY, int dimZ)
+//{
+//	/*Y and Z axes are swapped in manta and blender*/
+//	if (!(dimX == fluid->xRes() && dimY == fluid->yRes() && dimZ == fluid->zRes())) {
+//		for (int cnt(0); cnt < fluid->_totalCells; cnt++)
+//			fluid->_density[cnt] = 0.0f;
+//		return false;
+//	}
+//	return true;
+//}
+//
+//extern "C" bool manta_check_wavelets_size(struct WTURBULENCE *wt, int dimX, int dimY, int dimZ)
+//{
+//	/*Y and Z axes are swapped in manta and blender*/
+//	if (!(dimX == wt->_xResBig && dimY == wt->_yResBig && dimZ == wt->_zResBig)) {
+//		for (int cnt(0); cnt < wt->_totalCellsBig; cnt++)
+//			wt->_densityBig[cnt] = 0.0f;
+//		return false;
+//	}
+//	return true;
+//}
+//
+//void read_rotated_grid(gzFile gzf, float *data, int size_x, int size_y, int size_z)
+//{
+//	assert(size_x > 1 && size_y > 1 && size_z > 1);
+//	float* temp_data = (float*)malloc(sizeof(float) * size_x * size_y * size_z);
+////	data = (float*)malloc(sizeof(float) * size_x * size_y * size_z);
+//	gzread(gzf, temp_data, sizeof(float)* size_x * size_y * size_z);
+//	for (int cnt_x(0); cnt_x < size_x; ++cnt_x)
+//{
+//		for (int cnt_y(0); cnt_y < size_y; ++cnt_y)
+//		{
+//			for (int cnt_z(0); cnt_z < size_z; ++cnt_z)
+//			{
+//				data[cnt_x + size_x * cnt_y + size_x*size_y * cnt_z] = temp_data[cnt_x + size_x * cnt_y + size_x*size_y * cnt_z];
+//			}			
+//		}
+//	}
+//}
+//
+//static void wavelets_add_lowres_density(SmokeDomainSettings *sds)
+//{
+//	assert(sds != NULL);
+//	for (int cnt_x(0); cnt_x < sds->wt->_xResBig; ++cnt_x)
+//	{
+//		for (int cnt_y(0); cnt_y < sds->wt->_yResBig; ++cnt_y)
+//		{
+//			for (int cnt_z(0); cnt_z < sds->wt->_zResBig; ++cnt_z)
+//			{
+//				//scale down to domain res
+//				float x_sc = 1. * sds->base_res[0] * cnt_x / sds->wt->_xResBig;
+//				float y_sc = 1. * sds->base_res[1] * cnt_y / sds->wt->_yResBig;
+//				float z_sc = 1. * sds->base_res[2] * cnt_z / sds->wt->_zResBig;
+//				//finding cells to interpolate from
+//				int start_x = int(x_sc / 1);
+//				int start_y = int(y_sc / 1);
+//				int start_z = int(z_sc / 1);
+//				int end_x = ((x_sc - start_x > 0.001) && (start_x + 1 < sds->base_res[0]))? start_x + 1: start_x;
+//				int end_y = ((y_sc - start_y > 0.001) && (start_y + 1 < sds->base_res[1]))? start_y + 1: start_y;
+//				int end_z = ((z_sc - start_z > 0.001) && (start_z + 1 < sds->base_res[2]))? start_z + 1: start_z;
+//				//interpolation
+//				float add_value = 0;
+//				int cnt=0;
+//				for(int x(start_x); x <= end_x; ++x)
+//				{
+//					for(int y(start_y); y <= end_y; ++y)
+//					{
+//						for(int z(start_z); z <= end_z; ++z)

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list