← Back to team overview

yade-dev team mailing list archive

[Branch ~yade-dev/yade/trunk] Rev 2112: 1. Use BSP sort in gl2ps only if len(O.bodies)<100

 

------------------------------------------------------------
revno: 2112
committer: Václav Šmilauer <eudoxos@xxxxxxxx>
branch nick: trunk
timestamp: Mon 2010-03-29 14:28:06 +0200
message:
  1. Use BSP sort in gl2ps only if len(O.bodies)<100
  2. Remove ClumpMemberMover, no longer used anywhere
  3. Fix pack.regularHexa bug, reported by Nasibeh http://www.mail-archive.com/yade-users@xxxxxxxxxxxxxxxxxxx/msg01424.html
modified:
  debian/rules
  gui/qt3/GLViewer.cpp
  pkg/dem/DataClass/Clump.cpp
  pkg/dem/DataClass/Clump.hpp
  py/pack/pack.py


--
lp:yade
https://code.launchpad.net/~yade-dev/yade/trunk

Your team Yade developers is subscribed to branch lp:yade.
To unsubscribe from this branch go to https://code.launchpad.net/~yade-dev/yade/trunk/+edit-subscription.
=== modified file 'debian/rules'
--- debian/rules	2010-03-29 11:36:21 +0000
+++ debian/rules	2010-03-29 12:28:06 +0000
@@ -47,7 +47,7 @@
 	## remove builddirs and installation directories
 	rm -rf debian/build-* `find debian/ -name 'yade-*' -type d`
 	## keep this, it takes very little space and annoyingly wipes local configs
-	#rm -rf scons.profile* scons.current-profile
+	for f in scons.profile*; do mv $$f $$f~old; done
 	dh_clean 
 
 install: build

=== modified file 'gui/qt3/GLViewer.cpp'
--- gui/qt3/GLViewer.cpp	2010-03-27 22:39:49 +0000
+++ gui/qt3/GLViewer.cpp	2010-03-29 12:28:06 +0000
@@ -421,9 +421,11 @@
 		gl2psStream=fopen(nextFrameSnapshotFilename.c_str(),"wb");
 		if(!gl2psStream){ int err=errno; throw runtime_error(string("Error opening file ")+nextFrameSnapshotFilename+": "+strerror(err)); }
 		LOG_DEBUG("Start saving snapshot to "<<nextFrameSnapshotFilename);
+		size_t nBodies=Omega::instance().getScene()->bodies->size();
+		int sortAlgo=(nBodies<100 ? GL2PS_BSP_SORT : GL2PS_SIMPLE_SORT);
 		gl2psBeginPage(/*const char *title*/"Some title", /*const char *producer*/ "Yade",
 			/*GLint viewport[4]*/ NULL,
-			/*GLint format*/ GL2PS_PDF, /*GLint sort*/ GL2PS_BSP_SORT, /*GLint options*/GL2PS_SIMPLE_LINE_OFFSET|GL2PS_USE_CURRENT_VIEWPORT|GL2PS_TIGHT_BOUNDING_BOX|GL2PS_COMPRESS|GL2PS_OCCLUSION_CULL|GL2PS_NO_BLENDING, 
+			/*GLint format*/ GL2PS_PDF, /*GLint sort*/ sortAlgo, /*GLint options*/GL2PS_SIMPLE_LINE_OFFSET|GL2PS_USE_CURRENT_VIEWPORT|GL2PS_TIGHT_BOUNDING_BOX|GL2PS_COMPRESS|GL2PS_OCCLUSION_CULL|GL2PS_NO_BLENDING, 
 			/*GLint colormode*/ GL_RGBA, /*GLint colorsize*/0, 
 			/*GL2PSrgba *colortable*/NULL, 
 			/*GLint nr*/0, /*GLint ng*/0, /*GLint nb*/0, 

=== modified file 'pkg/dem/DataClass/Clump.cpp'
--- pkg/dem/DataClass/Clump.cpp	2010-03-20 12:40:44 +0000
+++ pkg/dem/DataClass/Clump.cpp	2010-03-29 12:28:06 +0000
@@ -6,10 +6,11 @@
 #include<yade/core/BodyContainer.hpp>
 #include<yade/core/State.hpp>
 
-YADE_PLUGIN((Clump)(ClumpMemberMover));
+YADE_PLUGIN((Clump)/*(ClumpMemberMover)*/);
 CREATE_LOGGER(Clump);
+
+#if 0
 CREATE_LOGGER(ClumpMemberMover);
-
 /**************************************************************************************
  ************************************* ClumpMemberMover ******************************
  **************************************************************************************/
@@ -28,6 +29,7 @@
 	}
 	//if(!clump->isDynamic) return; // perhaps clump that has been desactivated?!
 }
+#endif
 
 /**************************************************************************************
  ******************************************** Clump ***********************************

=== modified file 'pkg/dem/DataClass/Clump.hpp'
--- pkg/dem/DataClass/Clump.hpp	2010-03-20 12:40:44 +0000
+++ pkg/dem/DataClass/Clump.hpp	2010-03-29 12:28:06 +0000
@@ -82,7 +82,8 @@
 };
 REGISTER_SERIALIZABLE(Clump);
 
-
+// NewtonIntegrator calls Clump::moveMembers directly, no need for a dedicated engine
+#if 0
 /*! Update ::Clump::members positions so that the Clump behaves as a rigid body. */
 class ClumpMemberMover: public PartialEngine {
 	public:
@@ -93,4 +94,4 @@
 	DECLARE_LOGGER;
 };
 REGISTER_SERIALIZABLE(ClumpMemberMover);
-
+#endif

=== modified file 'py/pack/pack.py'
--- py/pack/pack.py	2010-03-28 21:22:25 +0000
+++ py/pack/pack.py	2010-03-29 12:28:06 +0000
@@ -112,14 +112,14 @@
 def sweptPolylines2gtsSurface(pts,threshold=0,capStart=False,capEnd=False):
 	"""Create swept suface (as GTS triangulation) given same-length sequences of points (as 3-tuples).
 
-	If threshold is given (>0), then
-
-	* degenerate faces (with edges shorter than threshold) will not be created
-	* gts.Surface().cleanup(threshold) will be called before returning, which merges vertices mutually closer than threshold. In case your pts are closed (last point concident with the first one) this will the surface strip of triangles. If you additionally have capStart==True and capEnd==True, the surface will be closed.
-
-	.. note:: capStart and capEnd make the most naive polygon triangulation (diagonals) and will perhaps fail for non-convex sections.
-
-	.. warning:: the algorithm connects points sequentially; if two polylines are mutually rotated or have inverse sense, the algorithm will not detect it and connect them regardless in their given order.
+If threshold is given (>0), then
+
+* degenerate faces (with edges shorter than threshold) will not be created
+* gts.Surface().cleanup(threshold) will be called before returning, which merges vertices mutually closer than threshold. In case your pts are closed (last point concident with the first one) this will the surface strip of triangles. If you additionally have capStart==True and capEnd==True, the surface will be closed.
+
+.. note:: capStart and capEnd make the most naive polygon triangulation (diagonals) and will perhaps fail for non-convex sections.
+
+.. warning:: the algorithm connects points sequentially; if two polylines are mutually rotated or have inverse sense, the algorithm will not detect it and connect them regardless in their given order.
 	"""
 	if not len(set([len(pts1) for pts1 in pts]))==1: raise RuntimeError("Polylines must be all of the same length!")
 	vtxs=[[gts.Vertex(x,y,z) for x,y,z in pts1] for pts1 in pts]
@@ -193,15 +193,17 @@
 	Created spheres will have given radius and will be separated by gap space."""
 	ret=[]
 	a=2*radius+gap
-	h=a*sqrt(3)/2.
+	# thanks to Nasibeh Moradi for finding bug here:
+	# http://www.mail-archive.com/yade-users@xxxxxxxxxxxxxxxxxxx/msg01424.html
+	hy,hz=a*sqrt(3)/2.,a*sqrt(6)/3.
 	mn,mx=predicate.aabb()
 	dim=[mx[i]-mn[i] for i in 0,1,2]
 	if(max(dim)==float('inf')): raise ValueError("Aabb of the predicate must not be infinite (didn't you use union | instead of intersection & for unbounded predicate such as notInNotch?");
-	ii,jj,kk=[range(0,int(dim[0]/a)+1),range(0,int(dim[1]/h)+1),range(0,int(dim[2]/h)+1)]
+	ii,jj,kk=[range(0,int(dim[0]/a)+1),range(0,int(dim[1]/hy)+1),range(0,int(dim[2]/hz)+1)]
 	for i,j,k in itertools.product(ii,jj,kk):
-		x,y,z=mn[0]+radius+i*a,mn[1]+radius+j*h,mn[2]+radius+k*h
+		x,y,z=mn[0]+radius+i*a,mn[1]+radius+j*hy,mn[2]+radius+k*hz
 		if j%2==0: x+= a/2. if k%2==0 else -a/2.
-		if k%2!=0: x+=a/2.; y+=h/2.
+		if k%2!=0: x+=a/2.; y+=hy/2.
 		if predicate((x,y,z),radius): ret+=[utils.sphere((x,y,z),radius=radius,**kw)]
 	return ret