[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [46254] branches/smoke2/intern/smoke/ intern/source: Add debug output:

Daniel Genrich daniel.genrich at gmx.net
Fri May 4 02:16:18 CEST 2012


Revision: 46254
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=46254
Author:   genscher
Date:     2012-05-04 00:16:16 +0000 (Fri, 04 May 2012)
Log Message:
-----------
Add debug output:
Using memory flags ("new SolverObject") fails while loading the same grid from file works. Weird.

Modified Paths:
--------------
    branches/smoke2/intern/smoke/intern/source/smoke.cpp
    branches/smoke2/intern/smoke/intern/source/solverinit.cpp
    branches/smoke2/intern/smoke/intern/source/solverinit.h

Modified: branches/smoke2/intern/smoke/intern/source/smoke.cpp
===================================================================
--- branches/smoke2/intern/smoke/intern/source/smoke.cpp	2012-05-03 23:54:25 UTC (rev 46253)
+++ branches/smoke2/intern/smoke/intern/source/smoke.cpp	2012-05-04 00:16:16 UTC (rev 46254)
@@ -51,7 +51,40 @@
 	printf("-------------------- SMOKE INIT B-------------------------\n");
 	{
 		Vec3 inflow (0.4, 0, 0);
-		SolverObject* solver = new SolverObject( "run_static", _flags);
+		SolverObject* solver = new SolverObject( "run_static",/*_flags */  "scene/static-flags.gz" );
+
+		{
+			Grid<int> *tf = solver->getParams().getGridInt("flags");
+
+			printf("data size: %ld, %ld\n", _flags->getDataSize(), tf->getDataSize());
+			printf("display flags: %d, %d\n", _flags->getDisplayFlags(), tf->getDisplayFlags());
+			printf("grid flags: %d, %d\n", _flags->getGridFlags(), tf->getGridFlags());
+			printf("grid id: %d, %d\n", _flags->getGridId(), tf->getGridId());
+			printf("grid size: %d, %d, %d; %d, %d, %d\n", _flags->getGridSize().x, _flags->getGridSize().y, _flags->getGridSize().z, tf->getGridSize().x, tf->getGridSize().y, tf->getGridSize().z);
+			printf("max size: %d, %d\n", _flags->getMaxSize(), tf->getMaxSize());
+			printf("name: %s, %s\n", _flags->getName().c_str(), tf->getName().c_str());
+			printf("numelements: %d, %d\n", _flags->getNumElements(), tf->getNumElements());
+			printf("sanity: %d, %d\n", _flags->getSanityCheckMode(), tf->getSanityCheckMode());
+
+			int count = 0;
+			int min = INT_MAX, max = -INT_MAX;
+			for(unsigned int x = 0; x < tf->getGridSize().x; x++)
+				for(unsigned int y= 0; y< tf->getGridSize().y; y++)
+					for(unsigned int z = 0; z < tf->getGridSize().z; z++)
+			{
+				if(_flags->get(x, y, z) != tf->get(x, y, z))
+					count++;
+
+				int tm = tf->get(x, y, z);
+
+				if(min > tm)
+					min = tm;
+				if(max < tm)
+					max = tm;
+			}
+			printf("count: %d, min: %d, max: %d\n", count, min, max);
+		}
+
 		solver->getParams().mU0 = inflow;
 		solver->getParams().mTimestepAnim = 0.005;
 			

Modified: branches/smoke2/intern/smoke/intern/source/solverinit.cpp
===================================================================
--- branches/smoke2/intern/smoke/intern/source/solverinit.cpp	2012-05-03 23:54:25 UTC (rev 46253)
+++ branches/smoke2/intern/smoke/intern/source/solverinit.cpp	2012-05-04 00:16:16 UTC (rev 46254)
@@ -125,7 +125,7 @@
 }
 
 // initialize default solver params
-void SolverObject::init(const string& name, const nVec3i& size, Grid<int> *flags)
+void SolverObject::init(const string& name, const nVec3i& size, Grid<int> *flagsGrid)
 {
 	ParamSet par;
 	par.AddInt("host-vorticity-system", 1);
@@ -146,7 +146,7 @@
 	mSolver->setParams(solverParam);
 
 	// create default grids
-	createIntGrid("flags", flags);
+	createIntGrid("flags", flagsGrid);
 	createVec3Grid("vel-curr",false);
 	createRealGrid("pressure",false);
 

Modified: branches/smoke2/intern/smoke/intern/source/solverinit.h
===================================================================
--- branches/smoke2/intern/smoke/intern/source/solverinit.h	2012-05-03 23:54:25 UTC (rev 46253)
+++ branches/smoke2/intern/smoke/intern/source/solverinit.h	2012-05-04 00:16:16 UTC (rev 46254)
@@ -72,7 +72,7 @@
 
 		protected:
 		void init(const std::string& name, const nVec3i& gridSize, int gridFlags = 0);
-		void init(const string& name, const nVec3i& size, Grid<int> *flags);
+		void init(const string& name, const nVec3i& size, Grid<int> *flagsGrid);
 		SolverPlugin* createPlugin(const std::string& name, const PluginArgument&);
 		
 		FluidSolver* mSolver;




More information about the Bf-blender-cvs mailing list