← Back to team overview

yade-dev team mailing list archive

[svn] r1937 - in trunk: . pkg/dem/DataClass py scripts/test

 

Author: eudoxos
Date: 2009-08-11 13:37:21 +0200 (Tue, 11 Aug 2009)
New Revision: 1937

Modified:
   trunk/SConstruct
   trunk/pkg/dem/DataClass/SpherePack.cpp
   trunk/pkg/dem/DataClass/SpherePack.hpp
   trunk/py/_packSpheres.cpp
   trunk/scripts/test/periodic-compress.py
Log:
1. Fix linkage for boost<=1.34 (hopefully)


Modified: trunk/SConstruct
===================================================================
--- trunk/SConstruct	2009-08-11 10:47:18 UTC (rev 1936)
+++ trunk/SConstruct	2009-08-11 11:37:21 UTC (rev 1937)
@@ -295,7 +295,8 @@
 
 	# gentoo has threaded flavour named differently and it must have precedence over the non-threaded one
 	def CheckLib_maybeMT(conf,lib,header,lang,func): return conf.CheckLibWithHeader(lib+'-mt',['limits.h',header],'c++',func,autoadd=1) or conf.CheckLibWithHeader(lib,['limits.h',header],lang,func,autoadd=1)
-	ok&=CheckLib_maybeMT(conf,'boost_system','boost/system/error_code.hpp','c++','boost::system::error_code();')
+	# in boost::filesystem>=1.35 depends on boost::system being explicitly linked to; if not present, we are probably in <=1.34, where boost::system didn't exist and wasn't needed either 
+	CheckLib_maybeMT(conf,'boost_system','boost/system/error_code.hpp','c++','boost::system::error_code(); /* non-essential */')
 	ok&=CheckLib_maybeMT(conf,'boost_thread','boost/thread/thread.hpp','c++','boost::thread::thread();')
 	ok&=CheckLib_maybeMT(conf,'boost_date_time','boost/date_time/posix_time/posix_time.hpp','c++','boost::posix_time::time_duration::time_duration();')
 	ok&=CheckLib_maybeMT(conf,'boost_filesystem','boost/filesystem/path.hpp','c++','boost::filesystem::path();')

Modified: trunk/pkg/dem/DataClass/SpherePack.cpp
===================================================================
--- trunk/pkg/dem/DataClass/SpherePack.cpp	2009-08-11 10:47:18 UTC (rev 1936)
+++ trunk/pkg/dem/DataClass/SpherePack.cpp	2009-08-11 11:37:21 UTC (rev 1937)
@@ -77,6 +77,7 @@
 		if(!intSph) continue;
 		pack.push_back(Sph(b->physicalParameters->se3.position,intSph->radius));
 	}
+	if(rootBody->isPeriodic) cellSize=rootBody->cellMax-rootBody->cellMin;
 }
 
 long SpherePack::makeCloud(Vector3r mn, Vector3r mx, Real rMean, Real rRelFuzz, size_t num, bool periodic){
@@ -111,7 +112,7 @@
 	return pack.size();
 }
 
-void SpherePack::cellFillVolume(Vector3r vol){
+void SpherePack::cellFill(Vector3r vol){
 	Vector3<int> count;
 	for(int i=0; i<3; i++) count[i]=(int)(ceil(vol[i]/cellSize[i]));
 	cellRepeat(count);
@@ -124,7 +125,7 @@
 	pack.reserve(origSize*count[0]*count[1]*count[2]);
 	for(int i=0; i<count[0]; i++){
 		for(int j=0; j<count[1]; j++){
-			for(int k=0; k<count[2]; j++){
+			for(int k=0; k<count[2]; k++){
 				if((i==0) && (j==0) && (k==0)) continue; // original cell
 				Vector3r off(cellSize[0]*i,cellSize[1]*j,cellSize[2]*k);
 				for(size_t l=0; l<origSize; l++){

Modified: trunk/pkg/dem/DataClass/SpherePack.hpp
===================================================================
--- trunk/pkg/dem/DataClass/SpherePack.hpp	2009-08-11 10:47:18 UTC (rev 1936)
+++ trunk/pkg/dem/DataClass/SpherePack.hpp	2009-08-11 11:37:21 UTC (rev 1937)
@@ -60,7 +60,7 @@
 
 	// periodic repetition
 	void cellRepeat(Vector3<int> count);
-	void cellFillVolume(Vector3r volume);
+	void cellFill(Vector3r volume);
 
 	// spatial characteristics
 	Vector3r dim() const {Vector3r mn,mx; aabb(mn,mx); return mx-mn;}

Modified: trunk/py/_packSpheres.cpp
===================================================================
--- trunk/py/_packSpheres.cpp	2009-08-11 10:47:18 UTC (rev 1936)
+++ trunk/py/_packSpheres.cpp	2009-08-11 11:37:21 UTC (rev 1937)
@@ -16,7 +16,7 @@
 		.def("dim",&SpherePack::dim,"Return dimensions of the packing in terms of aabb(), as a 3-tuple.")
 		.def("center",&SpherePack::midPt,"Return coordinates of the bounding box center.")
 		.def_readonly("cellSize",&SpherePack::cellSize,"Size of periodic cell; is Vector3(0,0,0) if not periodic.")
-		.def("cellFillVolume",&SpherePack::cellFillVolume,"Repeat the packing (if periodic) so that the results has dim() >= given size. The packing retains periodicity, but changes cellSize. Raises exception for non-periodic packing.")
+		.def("cellFill",&SpherePack::cellFill,"Repeat the packing (if periodic) so that the results has dim() >= given size. The packing retains periodicity, but changes cellSize. Raises exception for non-periodic packing.")
 		.def("cellRepeat",&SpherePack::cellRepeat,"Repeat the packing given number of times in each dimension. Periodicity is retained, cellSize changes. Raises exception for non-periodic packing.")
 		.def("relDensity",&SpherePack::relDensity,"Relative packing density, measured as sum of spheres' volumes / aabb volume.\n(Sphere overlaps are ignored.)")
 		.def("translate",&SpherePack::translate,"Translate all spheres by given vector.")

Modified: trunk/scripts/test/periodic-compress.py
===================================================================
--- trunk/scripts/test/periodic-compress.py	2009-08-11 10:47:18 UTC (rev 1936)
+++ trunk/scripts/test/periodic-compress.py	2009-08-11 11:37:21 UTC (rev 1937)
@@ -25,3 +25,13 @@
 O.run()
 O.wait()
 timing.stats()
+
+# now take that packing and pad some larger volume with it
+sp=pack.SpherePack()
+sp.fromSimulation() # take spheres from simulation; cellSize is set as well
+O.reset()
+print sp.cellSize
+sp.cellFill((30,30,30))
+print sp.cellSize
+for s in sp:
+	O.bodies.append(utils.sphere(s[0],s[1]))




Follow ups