[Bf-blender-cvs] [d40deb1] fluid-mantaflow: updated mantaflow pp files

Sebastián Barschkis noreply at git.blender.org
Fri Feb 26 16:14:32 CET 2016


Commit: d40deb173cb30021c4a25c5f28fd4c7c6758465a
Author: Sebastián Barschkis
Date:   Fri Feb 26 16:03:27 2016 +0100
Branches: fluid-mantaflow
https://developer.blender.org/rBd40deb173cb30021c4a25c5f28fd4c7c6758465a

updated mantaflow pp files

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

M	source/blender/python/manta_pp/edgecollapse.cpp
M	source/blender/python/manta_pp/fastmarch.cpp
M	source/blender/python/manta_pp/fileio.cpp
M	source/blender/python/manta_pp/fluidsolver.cpp
M	source/blender/python/manta_pp/general.cpp
M	source/blender/python/manta_pp/general.h
A	source/blender/python/manta_pp/gitinfo.h
M	source/blender/python/manta_pp/grid.cpp
M	source/blender/python/manta_pp/grid.h
M	source/blender/python/manta_pp/hginfo.h
M	source/blender/python/manta_pp/levelset.cpp
M	source/blender/python/manta_pp/mesh.cpp
M	source/blender/python/manta_pp/movingobs.cpp
M	source/blender/python/manta_pp/noisefield.h
M	source/blender/python/manta_pp/particle.cpp
M	source/blender/python/manta_pp/plugin/flip.cpp
M	source/blender/python/manta_pp/shapes.cpp

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

diff --git a/source/blender/python/manta_pp/edgecollapse.cpp b/source/blender/python/manta_pp/edgecollapse.cpp
index 9234f6c..4c76d5c 100644
--- a/source/blender/python/manta_pp/edgecollapse.cpp
+++ b/source/blender/python/manta_pp/edgecollapse.cpp
@@ -441,7 +441,7 @@ void CollapseEdge(Mesh& m, const int trinum, const int which, const Vec3 &edgeve
 			do {
 				// rotate around vertex P1 counter-clockwise
 				int op = m.corners(m.corners(current).next).opposite;
-				if (op < 0) throw Error("tube cutting failed, no opposite");
+				if (op < 0) errMsg("tube cutting failed, no opposite");
 				current = m.corners(op).next;
 				
 				if(m.corners(m.corners(current).prev).node==commonVert)
@@ -455,7 +455,7 @@ void CollapseEdge(Mesh& m, const int trinum, const int which, const Vec3 &edgeve
 			do {
 				// rotate around vertex P0 clockwise
 				int op = m.corners(m.corners(current).prev).opposite;
-				if (op < 0) throw Error("tube cutting failed, no opposite");
+				if (op < 0) errMsg("tube cutting failed, no opposite");
 				
 				current = m.corners(op).prev;
 				if(m.corners(m.corners(current).next).node==commonVert)
@@ -463,7 +463,7 @@ void CollapseEdge(Mesh& m, const int trinum, const int which, const Vec3 &edgeve
 			} while(current != end);
 
 			if (P1P2 < 0 || P2P0 < 0) 
-				throw Error("tube cutting failed, ill geometry");
+				errMsg("tube cutting failed, ill geometry");
 			
 			P2P1 = m.corners(P1P2).opposite;
 			P0P2 = m.corners(P2P0).opposite;
@@ -677,3 +677,4 @@ void CollapseEdge(Mesh& m, const int trinum, const int which, const Vec3 &edgeve
 
 } // namespace
 
+
diff --git a/source/blender/python/manta_pp/fastmarch.cpp b/source/blender/python/manta_pp/fastmarch.cpp
index 2abeb15..3cc7ef2 100644
--- a/source/blender/python/manta_pp/fastmarch.cpp
+++ b/source/blender/python/manta_pp/fastmarch.cpp
@@ -135,7 +135,7 @@ inline Real FastMarch<COMP,TDIR>::calculateDistance(const Vec3i& idx) {
 		ret = v[0]+ (Real)(TDIR) ; // direction = +- 1
 		} break; 
 	default:
-		throw Error("FastMarch :: Invalid invcnt");
+		errMsg("FastMarch :: Invalid invcnt");
 		break;
 	}
 	return ret;
diff --git a/source/blender/python/manta_pp/fileio.cpp b/source/blender/python/manta_pp/fileio.cpp
index d9d7b3b..7f249f2 100644
--- a/source/blender/python/manta_pp/fileio.cpp
+++ b/source/blender/python/manta_pp/fileio.cpp
@@ -463,7 +463,7 @@ void readGridRaw(const string& name, Grid<T>* grid) {
 	
 	int bytes = sizeof(T)*grid->getSizeX()*grid->getSizeY()*grid->getSizeZ();
 	int readBytes = gzread(gzf, &((*grid)[0]), bytes);
-	assertMsg(bytes==readBytes, "can't read raw file, stream length does not match"<<bytes<<" vs "<<readBytes);
+	assertMsg(bytes==readBytes, "can't read raw file, stream length does not match, "<<bytes<<" vs "<<readBytes);
 	gzclose(gzf);
 #	else
 	debMsg( "file format not supported without zlib" ,1);
diff --git a/source/blender/python/manta_pp/fluidsolver.cpp b/source/blender/python/manta_pp/fluidsolver.cpp
index b00817b..a7ae424 100644
--- a/source/blender/python/manta_pp/fluidsolver.cpp
+++ b/source/blender/python/manta_pp/fluidsolver.cpp
@@ -98,11 +98,15 @@ FluidSolver::~FluidSolver() {
 }
 
 PbClass* FluidSolver::create(PbType t, PbTypeVec T, const string& name) {        
+#	if NOPYTHON!=1
 	_args.add("nocheck",true);
 	if (t.str() == "")
 		errMsg("Need to specify object type. Use e.g. Solver.create(FlagGrid, ...) or Solver.create(type=FlagGrid, ...)");
 	
 	PbClass* ret = PbClass::createPyObject(t.str() + T.str(), name, _args, this);
+#	else
+	PbClass* ret = NULL;
+#	endif
 	return ret;
 }
 
@@ -127,6 +131,11 @@ void FluidSolver::step() {
 	updateQtGui(true, mFrame,mTimeTotal, "FluidSolver::step");
 }
 
+//! helper to unify printing from python scripts and printing internal messages (optionally pass debug level to control amount of output)
+void mantaMsg(const std::string& out, int level=1) {
+	debMsg( out, level );
+} static PyObject* _W_0 (PyObject* _self, PyObject* _linargs, PyObject* _kwds) { try { PbArgs _args(_linargs, _kwds); FluidSolver *parent = _args.obtainParent(); pbPreparePlugin(parent, "mantaMsg" ); PyObject *_retval = 0; { ArgLocker _lock; const std::string& out = _args.get<std::string >("out",0,&_lock); int level = _args.getOpt<int >("level",1,1,&_lock);   _retval = getPyNone(); mantaMsg(out,level);  _args.check(); } pbFinalizePlugin(parent,"mantaMsg" ); return _retval; } catch(std::e [...]
+
 void FluidSolver::printMemInfo() {
 	std::ostringstream msg;
 	msg << "Allocated grids: int " << mGridsInt.used  <<"/"<< mGridsInt.grids.size()  <<", ";
@@ -139,11 +148,11 @@ std::string printBuildInfo() {
 	string infoString = buildInfoString();
 	debMsg( "Build info: "<<infoString.c_str()<<" ",1);
 	return infoString;
-} static PyObject* _W_0 (PyObject* _self, PyObject* _linargs, PyObject* _kwds) { try { PbArgs _args(_linargs, _kwds); FluidSolver *parent = _args.obtainParent(); pbPreparePlugin(parent, "printBuildInfo" ); PyObject *_retval = 0; { ArgLocker _lock;   _retval = toPy(printBuildInfo());  _args.check(); } pbFinalizePlugin(parent,"printBuildInfo" ); return _retval; } catch(std::exception& e) { pbSetError("printBuildInfo",e.what()); return 0; } } static const Pb::Register _RP_printBuildInfo ("" [...]
+} static PyObject* _W_1 (PyObject* _self, PyObject* _linargs, PyObject* _kwds) { try { PbArgs _args(_linargs, _kwds); FluidSolver *parent = _args.obtainParent(); pbPreparePlugin(parent, "printBuildInfo" ); PyObject *_retval = 0; { ArgLocker _lock;   _retval = toPy(printBuildInfo());  _args.check(); } pbFinalizePlugin(parent,"printBuildInfo" ); return _retval; } catch(std::exception& e) { pbSetError("printBuildInfo",e.what()); return 0; } } static const Pb::Register _RP_printBuildInfo ("" [...]
 
 void setDebugLevel(int level=1) {
 	gDebugLevel = level; 
-} static PyObject* _W_1 (PyObject* _self, PyObject* _linargs, PyObject* _kwds) { try { PbArgs _args(_linargs, _kwds); FluidSolver *parent = _args.obtainParent(); pbPreparePlugin(parent, "setDebugLevel" ); PyObject *_retval = 0; { ArgLocker _lock; int level = _args.getOpt<int >("level",0,1,&_lock);   _retval = getPyNone(); setDebugLevel(level);  _args.check(); } pbFinalizePlugin(parent,"setDebugLevel" ); return _retval; } catch(std::exception& e) { pbSetError("setDebugLevel",e.what()); re [...]
+} static PyObject* _W_2 (PyObject* _self, PyObject* _linargs, PyObject* _kwds) { try { PbArgs _args(_linargs, _kwds); FluidSolver *parent = _args.obtainParent(); pbPreparePlugin(parent, "setDebugLevel" ); PyObject *_retval = 0; { ArgLocker _lock; int level = _args.getOpt<int >("level",0,1,&_lock);   _retval = getPyNone(); setDebugLevel(level);  _args.check(); } pbFinalizePlugin(parent,"setDebugLevel" ); return _retval; } catch(std::exception& e) { pbSetError("setDebugLevel",e.what()); re [...]
 
 void FluidSolver::adaptTimestep(Real maxVel)
 {
@@ -160,7 +169,7 @@ void FluidSolver::adaptTimestep(Real maxVel)
 			mLockDt = true;
 		}
 	}
-	debMsg( "Frame "<<mFrame<<" current max vel: "<<maxVel<<" , dt: "<<mDt<<", "<<mTimePerFrame<<"/"<<mFrameLength<<" lock:"<<mLockDt , 1);
+	debMsg( "Frame "<<mFrame<<" current max vel: "<<maxVel<<" , dt: "<<mDt<<", "<<mTimePerFrame<<"/"<<mFrameLength<<" lock:"<<mLockDt , 2);
 	mAdaptDt = true;
 
 	// sanity check
diff --git a/source/blender/python/manta_pp/general.cpp b/source/blender/python/manta_pp/general.cpp
index 2301232..52285f5 100644
--- a/source/blender/python/manta_pp/general.cpp
+++ b/source/blender/python/manta_pp/general.cpp
@@ -51,7 +51,7 @@
 #  undef NOMINMAX
 #else
 #   include <sys/time.h>
-#	include "hginfo.h"
+#	include "gitinfo.h"
 #endif
 
 using namespace std;
@@ -147,10 +147,10 @@ std::string buildInfoString() {
 #	endif
 
 	// repository info (git commit id)
-#	ifndef MANTA_HG_VERSION
-#	define MANTA_HG_VERSION "<unknown-commit>"
+#	ifndef MANTA_GIT_VERSION
+#	define MANTA_GIT_VERSION "<unknown-commit>"
 #	endif
-	infoStr << " "<< MANTA_HG_VERSION;
+	infoStr << " "<< MANTA_GIT_VERSION;
 
 	infoStr << " from "<< __DATE__<<", "<<__TIME__;
 	return infoStr.str();
diff --git a/source/blender/python/manta_pp/general.h b/source/blender/python/manta_pp/general.h
index 9df8cfa..18adb7f 100644
--- a/source/blender/python/manta_pp/general.h
+++ b/source/blender/python/manta_pp/general.h
@@ -29,10 +29,7 @@
 #include <iostream>
 #include <sstream>
 #include <cmath>
-
-#if (defined(WIN32) || defined(_WIN32))
 #include <algorithm>
-#endif
 
 namespace Manta {
 
diff --git a/source/blender/python/manta_pp/gitinfo.h b/source/blender/python/manta_pp/gitinfo.h
new file mode 100644
index 0000000..639e253
--- /dev/null
+++ b/source/blender/python/manta_pp/gitinfo.h
@@ -0,0 +1,4 @@
+
+
+#define MANTA_GIT_VERSION "commit c8854f85a0112fa02d4c753d9a99ac5a6e865cc4" 
+
diff --git a/source/blender/python/manta_pp/grid.cpp b/source/blender/python/manta_pp/grid.cpp
index 025e122..c574f51 100644
--- a/source/blender/python/manta_pp/grid.cpp
+++ b/source/blender/python/manta_pp/grid.cpp
@@ -337,7 +337,6 @@ 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);
@@ -527,7 +526,7 @@ static inline Real computeUvRamp(Real t) {
  { this->threadId = omp_get_thread_num(); this->threadNum = omp_get_num_threads();  
 #pragma omp for 
   for (int j=0; j < _maxY; j++) for (int i=0; i < _maxX; i++) op(i,j,k,target);  } }  } Grid<Vec3>& target;   };
-#line 427 "grid.cpp"
+#line 426 "grid.cpp"
 
 
 
@@ -576,7 +575,7 @@ template <class T>  struct knSetBoundary : public KernelBase { knSetBoundary(Gri
  { this->threadId = omp_get_thread_num(); this->threadNum = omp_get_num_threads();  
 #pragma omp for 
   for (int j=0; j < _maxY; j++) for (int i=0; i < _maxX; i++) op(i,j,k,grid,value,w);  } }  } Grid

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list