← Back to team overview

yade-dev team mailing list archive

[Branch ~yade-pkg/yade/git-trunk] Rev 3791: Raise warning, if no spheres are produced by regular* commands.

 

------------------------------------------------------------
revno: 3791
committer: Anton Gladky <gladky.anton@xxxxxxxxx>
timestamp: Mon 2014-01-06 15:10:07 +0100
message:
  Raise warning, if no spheres are produced by regular* commands.
modified:
  py/pack/pack.py


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

Your team Yade developers is subscribed to branch lp:yade.
To unsubscribe from this branch go to https://code.launchpad.net/~yade-pkg/yade/git-trunk/+edit-subscription
=== modified file 'py/pack/pack.py'
--- py/pack/pack.py	2013-12-16 15:05:33 +0000
+++ py/pack/pack.py	2014-01-06 14:10:07 +0000
@@ -264,6 +264,8 @@
 	xx,yy,zz=[arange(mn[i]+radius,mx[i]-radius,2*radius+gap) for i in 0,1,2]
 	for xyz in itertools.product(xx,yy,zz):
 		if predicate(xyz,radius): ret+=[utils.sphere(xyz,radius=radius,**kw)]
+	if (len(ret)==0):
+		warnings.warn('No spheres are produced by regularOrtho-function',category=RuntimeWarning)
 	return ret
 
 def regularHexa(predicate,radius,gap,**kw):
@@ -283,6 +285,8 @@
 		if j%2==0: x+= a/2. if k%2==0 else -a/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)]
+	if (len(ret)==0):
+		warnings.warn('No spheres are produced by regularHexa-function',category=RuntimeWarning)
 	return ret
 
 def filterSpherePack(predicate,spherePack,returnSpherePack=None,**kw):