[Bf-blender-cvs] [191f3fc] fluid-mantaflow: added non-openmp mantaflow pp files

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


Commit: 191f3fc1c271d1de28b39cb76a3a51e48f362af7
Author: Sebastián Barschkis
Date:   Thu Sep 17 18:01:30 2015 +0200
Branches: fluid-mantaflow
https://developer.blender.org/rB191f3fc1c271d1de28b39cb76a3a51e48f362af7

added non-openmp mantaflow pp files

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

M	source/blender/python/CMakeLists.txt
M	source/blender/python/manta_full/source/grid.cpp
M	source/blender/python/manta_full/source/grid.h
M	source/blender/python/manta_pp/grid.cpp
M	source/blender/python/manta_pp/grid.h
M	source/blender/python/manta_pp/grid.h.reg
M	source/blender/python/manta_pp/grid.h.reg.cpp
M	source/blender/python/manta_pp/hginfo.h
A	source/blender/python/manta_pp_openmp/CMakeLists.txt
A	source/blender/python/manta_pp_openmp/commonkernels.h
A	source/blender/python/manta_pp_openmp/commonkernels.h.reg
A	source/blender/python/manta_pp_openmp/commonkernels.h.reg.cpp
A	source/blender/python/manta_pp_openmp/conjugategrad.cpp
A	source/blender/python/manta_pp_openmp/conjugategrad.h
A	source/blender/python/manta_pp_openmp/conjugategrad.h.reg
A	source/blender/python/manta_pp_openmp/conjugategrad.h.reg.cpp
A	source/blender/python/manta_pp_openmp/edgecollapse.cpp
A	source/blender/python/manta_pp_openmp/edgecollapse.h
A	source/blender/python/manta_pp_openmp/edgecollapse.h.reg
A	source/blender/python/manta_pp_openmp/edgecollapse.h.reg.cpp
A	source/blender/python/manta_pp_openmp/fastmarch.cpp
A	source/blender/python/manta_pp_openmp/fastmarch.h
A	source/blender/python/manta_pp_openmp/fastmarch.h.reg
A	source/blender/python/manta_pp_openmp/fastmarch.h.reg.cpp
A	source/blender/python/manta_pp_openmp/fileio.cpp
A	source/blender/python/manta_pp_openmp/fileio.h
A	source/blender/python/manta_pp_openmp/fileio.h.reg
A	source/blender/python/manta_pp_openmp/fileio.h.reg.cpp
A	source/blender/python/manta_pp_openmp/fluidsolver.cpp
A	source/blender/python/manta_pp_openmp/fluidsolver.h
A	source/blender/python/manta_pp_openmp/fluidsolver.h.reg
A	source/blender/python/manta_pp_openmp/fluidsolver.h.reg.cpp
A	source/blender/python/manta_pp_openmp/general.cpp
A	source/blender/python/manta_pp_openmp/general.h
A	source/blender/python/manta_pp_openmp/general.h.reg
A	source/blender/python/manta_pp_openmp/general.h.reg.cpp
A	source/blender/python/manta_pp_openmp/grid.cpp
A	source/blender/python/manta_pp_openmp/grid.h
A	source/blender/python/manta_pp_openmp/grid.h.reg
A	source/blender/python/manta_pp_openmp/grid.h.reg.cpp
A	source/blender/python/manta_pp_openmp/gui/customctrl.cpp
A	source/blender/python/manta_pp_openmp/gui/customctrl.h
A	source/blender/python/manta_pp_openmp/gui/customctrl.h.reg
A	source/blender/python/manta_pp_openmp/gui/customctrl.h.reg.cpp
A	source/blender/python/manta_pp_openmp/gui/glwidget.cpp
A	source/blender/python/manta_pp_openmp/gui/glwidget.h
A	source/blender/python/manta_pp_openmp/gui/glwidget.h.reg
A	source/blender/python/manta_pp_openmp/gui/glwidget.h.reg.cpp
A	source/blender/python/manta_pp_openmp/gui/mainwindow.cpp
A	source/blender/python/manta_pp_openmp/gui/mainwindow.h
A	source/blender/python/manta_pp_openmp/gui/mainwindow.h.reg
A	source/blender/python/manta_pp_openmp/gui/mainwindow.h.reg.cpp
A	source/blender/python/manta_pp_openmp/gui/meshpainter.cpp
A	source/blender/python/manta_pp_openmp/gui/meshpainter.h
A	source/blender/python/manta_pp_openmp/gui/meshpainter.h.reg
A	source/blender/python/manta_pp_openmp/gui/meshpainter.h.reg.cpp
A	source/blender/python/manta_pp_openmp/gui/moc_customctrl.cpp
A	source/blender/python/manta_pp_openmp/gui/moc_customctrl.cpp_parameters
A	source/blender/python/manta_pp_openmp/gui/moc_glwidget.cpp
A	source/blender/python/manta_pp_openmp/gui/moc_glwidget.cpp_parameters
A	source/blender/python/manta_pp_openmp/gui/moc_mainwindow.cpp
A	source/blender/python/manta_pp_openmp/gui/moc_mainwindow.cpp_parameters
A	source/blender/python/manta_pp_openmp/gui/moc_meshpainter.cpp
A	source/blender/python/manta_pp_openmp/gui/moc_meshpainter.cpp_parameters
A	source/blender/python/manta_pp_openmp/gui/moc_painter.cpp
A	source/blender/python/manta_pp_openmp/gui/moc_painter.cpp_parameters
A	source/blender/python/manta_pp_openmp/gui/moc_particlepainter.cpp
A	source/blender/python/manta_pp_openmp/gui/moc_particlepainter.cpp_parameters
A	source/blender/python/manta_pp_openmp/gui/moc_qtmain.cpp
A	source/blender/python/manta_pp_openmp/gui/moc_qtmain.cpp_parameters
A	source/blender/python/manta_pp_openmp/gui/painter.cpp
A	source/blender/python/manta_pp_openmp/gui/painter.h
A	source/blender/python/manta_pp_openmp/gui/painter.h.reg
A	source/blender/python/manta_pp_openmp/gui/painter.h.reg.cpp
A	source/blender/python/manta_pp_openmp/gui/particlepainter.cpp
A	source/blender/python/manta_pp_openmp/gui/particlepainter.h
A	source/blender/python/manta_pp_openmp/gui/particlepainter.h.reg
A	source/blender/python/manta_pp_openmp/gui/particlepainter.h.reg.cpp
A	source/blender/python/manta_pp_openmp/gui/qtmain.cpp
A	source/blender/python/manta_pp_openmp/gui/qtmain.h
A	source/blender/python/manta_pp_openmp/gui/qtmain.h.reg
A	source/blender/python/manta_pp_openmp/gui/qtmain.h.reg.cpp
A	source/blender/python/manta_pp_openmp/hginfo.h
A	source/blender/python/manta_pp_openmp/kernel.cpp
A	source/blender/python/manta_pp_openmp/kernel.h
A	source/blender/python/manta_pp_openmp/kernel.h.reg
A	source/blender/python/manta_pp_openmp/kernel.h.reg.cpp
A	source/blender/python/manta_pp_openmp/levelset.cpp
A	source/blender/python/manta_pp_openmp/levelset.h
A	source/blender/python/manta_pp_openmp/levelset.h.reg
A	source/blender/python/manta_pp_openmp/levelset.h.reg.cpp
A	source/blender/python/manta_pp_openmp/mesh.cpp
A	source/blender/python/manta_pp_openmp/mesh.h
A	source/blender/python/manta_pp_openmp/mesh.h.reg
A	source/blender/python/manta_pp_openmp/mesh.h.reg.cpp
A	source/blender/python/manta_pp_openmp/movingobs.cpp
A	source/blender/python/manta_pp_openmp/movingobs.h
A	source/blender/python/manta_pp_openmp/movingobs.h.reg
A	source/blender/python/manta_pp_openmp/movingobs.h.reg.cpp
A	source/blender/python/manta_pp_openmp/noisefield.cpp
A	source/blender/python/manta_pp_openmp/noisefield.h
A	source/blender/python/manta_pp_openmp/noisefield.h.reg
A	source/blender/python/manta_pp_openmp/noisefield.h.reg.cpp
A	source/blender/python/manta_pp_openmp/particle.cpp
A	source/blender/python/manta_pp_openmp/particle.h
A	source/blender/python/manta_pp_openmp/particle.h.reg
A	source/blender/python/manta_pp_openmp/particle.h.reg.cpp
A	source/blender/python/manta_pp_openmp/plugin/advection.cpp
A	source/blender/python/manta_pp_openmp/plugin/extforces.cpp
A	source/blender/python/manta_pp_openmp/plugin/fire.cpp
A	source/blender/python/manta_pp_openmp/plugin/flip.cpp
A	source/blender/python/manta_pp_openmp/plugin/initplugins.cpp
A	source/blender/python/manta_pp_openmp/plugin/kepsilon.cpp
A	source/blender/python/manta_pp_openmp/plugin/meshplugins.cpp
A	source/blender/python/manta_pp_openmp/plugin/pressure.cpp
A	source/blender/python/manta_pp_openmp/plugin/vortexplugins.cpp
A	source/blender/python/manta_pp_openmp/plugin/waveletturbulence.cpp
A	source/blender/python/manta_pp_openmp/plugin/waves.cpp
A	source/blender/python/manta_pp_openmp/pwrapper/manta.h
A	source/blender/python/manta_pp_openmp/pwrapper/manta_api.cpp
A	source/blender/python/manta_pp_openmp/pwrapper/manta_api.h
A	source/blender/python/manta_pp_openmp/pwrapper/pclass.cpp
A	source/blender/python/manta_pp_openmp/pwrapper/pclass.h
A	source/blender/python/manta_pp_openmp/pwrapper/pconvert.cpp
A	source/blender/python/manta_pp_openmp/pwrapper/pconvert.h
A	source/blender/python/manta_pp_openmp/pwrapper/pvec3.cpp
A	source/blender/python/manta_pp_openmp/pwrapper/pymain.cpp
A	source/blender/python/manta_pp_openmp/pwrapper/pythonInclude.h
A	source/blender/python/manta_pp_openmp/pwrapper/registry.cpp
A	source/blender/python/manta_pp_openmp/pwrapper/registry.h
A	source/blender/python/manta_pp_openmp/python/defines.py
A	source/blender/python/manta_pp_openmp/python/defines.py.reg
A	source/blender/python/manta_pp_openmp/python/defines.py.reg.cpp
A	source/blender/python/manta_pp_openmp/shapes.cpp
A	source/blender/python/manta_pp_openmp/shapes.h
A	source/blender/python/manta_pp_openmp/shapes.h.reg
A	source/blender/python/manta_pp_openmp/shapes.h.reg.cpp
A	source/blender/python/manta_pp_openmp/test.cpp
A	source/blender/python/manta_pp_openmp/timing.cpp
A	source/blender/python/manta_pp_openmp/timing.h
A	source/blender/python/manta_pp_openmp/timing.h.reg
A	source/blender/python/manta_pp_openmp/timing.h.reg.cpp
A	source/blender/python/manta_pp_openmp/turbulencepart.cpp
A	source/blender/python/manta_pp_openmp/turbulencepart.h
A	source/blender/python/manta_pp_openmp/turbulencepart.h.reg
A	source/blender/python/manta_pp_openmp/turbulencepart.h.reg.cpp
A	source/blender/python/manta_pp_openmp/util/integrator.h
A	source/blender/python/manta_pp_openmp/util/interpol.h
A	source/blender/python/manta_pp_openmp/util/interpolHigh.h
A	source/blender/python/manta_pp_openmp/util/mcubes.h
A	source/blender/python/manta_pp_openmp/util/quaternion.h
A	source/blender/python/manta_pp_openmp/util/randomstream.h
A	source/blender/python/manta_pp_openmp/util/simpleimage.cpp
A	source/blender/python/manta_pp_openmp/util/simpleimage.h
A	source/blender/python/manta_pp_openmp/util/solvana.h
A	source/blender/python/manta_pp_openmp/util/vectorbase.cpp
A	source/blender/python/manta_pp_openmp/util/vectorbase.h
A	source/blender/python/manta_pp_openmp/vortexpart.cpp
A	source/blender/python/manta_pp_openmp/vortexpart.h
A	source/blender/python/manta_pp_openmp/vortexpart.h.reg
A	source/blender/python/manta_pp_openmp/vortexpart.h.reg.cpp
A	source/blender/python/manta_pp_openmp/vortexsheet.cpp
A	source/blender/python/manta_pp_openmp/vortexsheet.h
A	source/blender/python/manta_pp_openmp/vortexsheet.h.reg
A	source/blender/python/manta_pp_openmp/vortexsheet.h.reg.cpp

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

diff --git a/source/blender/python/CMakeLists.txt b/source/blender/python/CMakeLists.txt
index 550e791..4d88509 100644
--- a/source/blender/python/CMakeLists.txt
+++ b/source/blender/python/CMakeLists.txt
@@ -20,5 +20,9 @@ add_subdirectory(intern)
 add_subdirectory(generic)
 add_subdirectory(mathutils)
 add_subdirectory(bmesh)
-#choose "manta_pp" for preprocessed files or "manta_full" for full manta module 
-add_subdirectory(manta_pp)
+
+if(WITH_OPENMP)
+	add_subdirectory(manta_pp_openmp)
+else()
+	add_subdirectory(manta_pp)
+endif()
diff --git a/source/blender/python/manta_full/source/grid.cpp b/source/blender/python/manta_full/source/grid.cpp
index eee989b..7012ffd 100644
--- a/source/blender/python/manta_full/source/grid.cpp
+++ b/source/blender/python/manta_full/source/grid.cpp
@@ -241,6 +241,23 @@ template<> Real Grid<int>::getMaxAbs() {
 	int amax = CompMaxInt (*this);
 	return max( fabs((Real)amin), fabs((Real)amax));
 }
+template<class T> void Grid<T>::writeGridToMemory(const std::string& memLoc, const std::string& sizeAllowed) {
+	if (memLoc == "" ||memLoc == "0" ){
+		debMsg("Cant write grid to NULL pointer",1);
+		return;
+	}
+	istringstream iss(sizeAllowed);
+    size_t sizeAllowed_num;
+    iss >> sizeAllowed_num;
+	if (sizeof(T) * mSize.x * mSize.y * mSize.z != sizeAllowed_num){
+		debMsg("Cant write grid with incompatible size",1);
+		return;
+	}
+	stringstream ss(memLoc);
+	void *gridPointer = NULL;
+	ss >> gridPointer;
+	memcpy(gridPointer, mData, sizeAllowed_num);
+}
 template<class T> void Grid<T>::readGridFromMemory(const std::string& memLoc, int x, int y, int z) {
 	debMsg("Reading grid from " + memLoc,1);
 	if (memLoc == "" ||memLoc == "0" ){
@@ -257,6 +274,32 @@ template<class T> void Grid<T>::readGridFromMemory(const std::string& memLoc, in
 	ss >> gridPointer;
 	memcpy(mData, gridPointer, sizeof(T) * x * y * z);
 }
+template<class T> void Grid<T>::readAdaptiveGridFromMemory(const std::string& memLoc, Vec3i minSize, Vec3i maxSize) {
+	if (memLoc == "" ||memLoc == "0" ){
+		debMsg("Can not write grid to NULL pointer",1);
+		return;
+	}
+	if (minSize.x < 0 || minSize.y < 0 || minSize.z < 0){
+		debMsg("Adaptive grid smaller than 0",1);
+		return;
+	}
+	if (maxSize.x > mSize.x || maxSize.y > mSize.y || maxSize.z > mSize.z){
+		debMsg("Adaptive grid larger than current",1);
+		return;
+	}
+	Vec3i adaptiveSize = maxSize - minSize;
+	stringstream ss(memLoc);
+	void *gridPointer = NULL;
+	ss >> gridPointer;
+	float *data_Array = (float* )gridPointer;
+	for (int x = 0; x < adaptiveSize.x; ++x){
+		for (int y = 0; y < adaptiveSize.y; ++y){
+			for (int z = 0; z < adaptiveSize.z; ++z){
+				get(x + minSize.x, y + minSize.y, z + minSize.z) = data_Array[x  + adaptiveSize.x * y + adaptiveSize.x * adaptiveSize.y * z];
+			}
+		}
+	}
+}
 template<class T> std::string Grid<T>::getDataPointer() {
 	ostringstream ss;
 	ss << mData ;
diff --git a/source/blender/python/manta_full/source/grid.h b/source/blender/python/manta_full/source/grid.h
index 41b32be..feef029 100644
--- a/source/blender/python/manta_full/source/grid.h
+++ b/source/blender/python/manta_full/source/grid.h
@@ -181,7 +181,9 @@ public:
 	PYTHON() Real getMinValue()    { return getMin(); }
 
 	//! for Blender Mantaflow API
+	PYTHON() void writeGridToMemory(const std::string& memLoc, const std::string& sizeAllowed);
 	PYTHON() void readGridFromMemory(const std::string& memLoc, int x, int y, int z);
+	PYTHON() void readAdaptiveGridFromMemory(const std::string& memLoc, Vec3i minSize, Vec3i maxSize);
 	PYTHON() std::string getDataPointer();
 
 	//! debugging helper, print grid from python
diff --git a/source/blender/python/manta_pp/grid.cpp b/source/blender/python/manta_pp/grid.cpp
index a332e70..3584565 100644
--- a/source/blender/python/manta_pp/grid.cpp
+++ b/source/blender/python/manta_pp/grid.cpp
@@ -253,6 +253,23 @@ template<> Real Grid<int>::getMaxAbs() {
 	int amax = CompMaxInt (*this);
 	return max( fabs((Real)amin), fabs((Real)amax));
 }
+template<class T> void Grid<T>::writeGridToMemory(const std::string& memLoc, const std::string& sizeAllowed) {
+	if (memLoc == "" ||memLoc == "0" ){
+		debMsg("Cant write grid to NULL pointer",1);
+		return;
+	}
+	istringstream iss(sizeAllowed);
+    size_t sizeAllowed_num;
+    iss >> sizeAllowed_num;
+	if (sizeof(T) * mSize.x * mSize.y * mSize.z != sizeAllowed_num){
+		debMsg("Cant write grid with incompatible size",1);
+		return;
+	}
+	stringstream ss(memLoc);
+	void *gridPointer = NULL;
+	ss >> gridPointer;
+	memcpy(gridPointer, mData, sizeAllowed_num);
+}
 template<class T> void Grid<T>::readGridFromMemory(const std::string& memLoc, int x, int y, int z) {
 	debMsg("Reading grid from " + memLoc,1);
 	if (memLoc == "" ||memLoc == "0" ){
@@ -269,6 +286,32 @@ template<class T> void Grid<T>::readGridFromMemory(const std::string& memLoc, in
 	ss >> gridPointer;
 	memcpy(mData, gridPointer, sizeof(T) * x * y * z);
 }
+template<class T> void Grid<T>::readAdaptiveGridFromMemory(const std::string& memLoc, Vec3i minSize, Vec3i maxSize) {
+	if (memLoc == "" ||memLoc == "0" ){
+		debMsg("Can not write grid to NULL pointer",1);
+		return;
+	}
+	if (minSize.x < 0 || minSize.y < 0 || minSize.z < 0){
+		debMsg("Adaptive grid smaller than 0",1);
+		return;
+	}
+	if (maxSize.x > mSize.x || maxSize.y > mSize.y || maxSize.z > mSize.z){
+		debMsg("Adaptive grid larger than current",1);
+		return;
+	}
+	Vec3i adaptiveSize = maxSize - minSize;
+	stringstream ss(memLoc);
+	void *gridPointer = NULL;
+	ss >> gridPointer;
+	float *data_Array = (float* )gridPointer;
+	for (int x = 0; x < adaptiveSize.x; ++x){
+		for (int y = 0; y < adaptiveSize.y; ++y){
+			for (int z = 0; z < adaptiveSize.z; ++z){
+				get(x + minSize.x, y + minSize.y, z + minSize.z) = data_Array[x  + adaptiveSize.x * y + adaptiveSize.x * adaptiveSize.y * z];
+			}
+		}
+	}
+}
 template<class T> std::string Grid<T>::getDataPointer() {
 	ostringstream ss;
 	ss << mData ;
diff --git a/source/blender/python/manta_pp/grid.h b/source/blender/python/manta_pp/grid.h
index 1ae44ba..d510a8d 100644
--- a/source/blender/python/manta_pp/grid.h
+++ b/source/blender/python/manta_pp/grid.h
@@ -191,11 +191,13 @@ template<class T> class Grid : public GridBase {public:
 	Real getMinValue() { return getMin(); } static PyObject* _W_21 (PyObject* _self, PyObject* _linargs, PyObject* _kwds) { try { PbArgs _args(_linargs, _kwds); Grid* pbo = dynamic_cast<Grid*>(Pb::objFromPy(_self)); pbPreparePlugin(pbo->getParent(), "Grid::getMinValue"); PyObject *_retval = 0; { ArgLocker _lock;  pbo->_args.copy(_args);  _retval = toPy(pbo->getMinValue());  pbo->_args.check(); } pbFinalizePlugin(pbo->getParent(),"Grid::getMinValue"); return _retval; } catch(std::exception&  [...]
 
 	//! for Blender Mantaflow API
-	void readGridFromMemory(const std::string& memLoc, int x, int y, int z); static PyObject* _W_22 (PyObject* _self, PyObject* _linargs, PyObject* _kwds) { try { PbArgs _args(_linargs, _kwds); Grid* pbo = dynamic_cast<Grid*>(Pb::objFromPy(_self)); pbPreparePlugin(pbo->getParent(), "Grid::readGridFromMemory"); PyObject *_retval = 0; { ArgLocker _lock; const std::string& memLoc = _args.get<std::string >("memLoc",0,&_lock); int x = _args.get<int >("x",1,&_lock); int y = _args.get<int >("y",2, [...]
-	std::string getDataPointer(); static PyObject* _W_23 (PyObject* _self, PyObject* _linargs, PyObject* _kwds) { try { PbArgs _args(_linargs, _kwds); Grid* pbo = dynamic_cast<Grid*>(Pb::objFromPy(_self)); pbPreparePlugin(pbo->getParent(), "Grid::getDataPointer"); PyObject *_retval = 0; { ArgLocker _lock;  pbo->_args.copy(_args);  _retval = toPy(pbo->getDataPointer());  pbo->_args.check(); } pbFinalizePlugin(pbo->getParent(),"Grid::getDataPointer"); return _retval; } catch(std::exception& e [...]
+	void writeGridToMemory(const std::string& memLoc, const std::string& sizeAllowed); static PyObject* _W_22 (PyObject* _self, PyObject* _linargs, PyObject* _kwds) { try { PbArgs _args(_linargs, _kwds); Grid* pbo = dynamic_cast<Grid*>(Pb::objFromPy(_self)); pbPreparePlugin(pbo->getParent(), "Grid::writeGridToMemory"); PyObject *_retval = 0; { ArgLocker _lock; const std::string& memLoc = _args.get<std::string >("memLoc",0,&_lock); const std::string& sizeAllowed = _args.get<std::string >("si [...]
+	void readGridFromMemory(const std::string& memLoc, int x, int y, int z); static PyObject* _W_23 (PyObject* _self, PyObject* _linargs, PyObject* _kwds) { try { PbArgs _args(_linargs, _kwds); Grid* pbo = dynamic_cast<Grid*>(Pb::objFromPy(_self)); pbPreparePlugin(pbo->getParent(), "Grid::readGridFromMemory"); PyObject *_retval = 0; { ArgLocker _lock; const std::string& memLoc = _args.get<std::string >("memLoc",0,&_lock); int x = _args.get<int >("x",1,&_lock); int y = _args.get<int >("y",2, [...]
+	void readAdaptiveGridFromMemory(const std::string& memLoc, Vec3i minSize, Vec3i maxSize); static PyObject* _W_24 (PyObject* _self, PyObject* _linargs, PyObject* _kwds) { try { PbArgs _args(_linargs, _kwds); Grid* pbo = dynamic_cast<Grid*>(Pb::objFromPy(_self)); pbPreparePlugin(pbo->getParent(), "Grid::readAdaptiveGridFromMemory"); PyObject *_retval = 0; { ArgLocker _lock; const std::string& memLoc = _args.get<std::string 

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list