← Back to team overview

yade-dev team mailing list archive

[Branch ~yade-dev/yade/trunk] Rev 2309: 1. Fix multiple authors syntax in bibtex (multiple authors MUST be separated by "and", not by com...

 

------------------------------------------------------------
revno: 2309
committer: Václav Šmilauer <eudoxos@xxxxxxxx>
branch nick: trunk
timestamp: Thu 2010-07-01 11:56:50 +0200
message:
  1. Fix multiple authors syntax in bibtex (multiple authors MUST be separated by "and", not by comma!!!)
  2. Add doctests of all modules, fix where failing
  3. Add SpherePack.toSimulation
modified:
  doc/publications.bib
  doc/sphinx/bib2rst.py
  py/_eudoxos.cpp
  py/eudoxos.py
  py/pack/pack.py
  py/plot.py
  py/tests/__init__.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 'doc/publications.bib'
--- doc/publications.bib	2010-06-30 18:40:08 +0000
+++ doc/publications.bib	2010-07-01 09:56:50 +0000
@@ -146,7 +146,7 @@
 
 @article{Sibille2008a,
 	title = {From bifurcation to failure in a granular material: a DEM analysis},
-	author = {L. Sibille and F.-V. Donz{\'e} and F. Nicot and B. Chareyre and F. Darve},
+	author = {L. Sibille and F.-V. Donzé and F. Nicot and B. Chareyre and F. Darve},
 	doi = {10.1007/s11440-007-0035-y},
 	journal = {Acta Geotechnica},
 	pages = {15--24},
@@ -157,7 +157,7 @@
 
 @article{FengChen2007a,
 	title = {Prediction/Verification of Particle Motion in One Dimension with the Discrete-Element Method},
-	author = {Feng Chen, Eric. C. Drumm, and Georges Guiochon},
+	author = {Feng Chen and Eric. C. Drumm and Georges Guiochon},
 	doi = {10.1061/(ASCE)1532-3641(2007)7:5(344)},
 	journal = {International Journal of Geomechanics, ASCE},
 	pages = {344--352},
@@ -168,7 +168,7 @@
 
 @article{Nicot2007a,
 	title = {From microscopic to macroscopic second-order work in granular assemblies},
-	author = {Nicot, F., L. Sibille, F.V. Donzé, F. Darve},
+	author = {Nicot, F. and L. Sibille and F.V. Donzé and F. Darve},
 	doi = {10.1016/j.mechmat.2006.10.003},
 	journal = {Int. J. Mech. Mater.},
 	pages = {664--684},
@@ -179,7 +179,7 @@
 
 @article{Sibille2007a,
 	title = {Material instability in granular assemblies from fundamentally different models},
-	author = {L. Sibille, F. Nicot, F.V. Donzé, F. Darve},
+	author = {L. Sibille and F. Nicot and F.V. Donzé and F. Darve},
 	doi = {10.1002/nag.591},
 	journal = {International Journal For Numerical and Analytical Methods in Geomechanics},
 	pages = {457--481},
@@ -189,7 +189,7 @@
 
 @article{Kozicki2007a,
 	title = {Effect of aggregate structure on fracture process in concrete using 2D lattice model”},
-	author = {J. Kozicki, J. Tejchman},
+	author = {J. Kozicki and J. Tejchman},
 	journal = {Archives of Mechanics},
 	pages = {365--384},
 	volume = {59},
@@ -200,7 +200,7 @@
 
 @article{Chareyre2005a,
 	title = {Dynamic Spar Elements and Discrete Element Methods in Two Dimensions for the Modeling of Soil-Inclusion Problems},
-	author = {Chareyre, B., Villard, P},
+	author = {Chareyre, B. and Villard, P},
 	doi = {10.1061/(ASCE)0733-9399(2005)131:7(689)},
 	journal = { J. Engrg. Mech.},
 	volume = {131},
@@ -210,7 +210,7 @@
 
 @article{Hentz2004a,
 	title = {Discrete element modelling of concrete submitted to dynamic loading at high strain rates},
-	author = {S. Hentz,F.V. Donzé, L.Daudeville},
+	author = {S. Hentz and F.V. Donzé and L.Daudeville},
 	doi = {10.1016/j.compstruc.2004.05.016 },
 	journal = {Computers and Structures},
 	pages = {2509--2524},
@@ -221,7 +221,7 @@
 
 @article{Hentz2004b,
 	title = {Identification and Validation of a Discrete Element Model for Concrete},
-	author = {S. Hentz, L. Daudeville, F.V. Donzé},
+	author = {S. Hentz and L. Daudeville and F.V. Donzé},
 	doi = {10.1061/(ASCE)0733-9399(2004)130:6(709)},
 	journal = {ASCE Journal of Engineering Mechanics},
 	pages = {709--719},
@@ -232,7 +232,7 @@
 
 @article{Villard2004a,
 	title = {Design methods for geosynthetic anchor trenches on the basis of true scale experiments and discrete element modelling},
-	author = {Villard P., Chareyre B},
+	author = {Villard, P. and Chareyre, B.},
 	journal = {Canadian Geotechnical Journal},
 	pages = {1193--1205},
 	volume = {41},
@@ -241,7 +241,7 @@
 
 @article{Camborde2000a,
 	title = {Numerical study of rock and Concrete behaviour by discrete element modelling},
-	author = {F. Camborde, C. Mariotti, F.V. Donzé},
+	author = {F. Camborde and C. Mariotti and F.V. Donzé},
 	journal = {Computers and Geotechnics},
 	pages = {225--247},
 	volume = {27},
@@ -250,7 +250,7 @@
 
 @article{Donzé1999a,
 	title = {Study of the behavior of concrete at high strain rate compressions by a discrete element method},
-	author = {F.V. Donzé, S.A. Magnier, L. Daudeville, C. Mariotti, L. Davenne},
+	author = {F.V. Donzé and S.A. Magnier and L. Daudeville and C. Mariotti and L. Davenne},
 	doi = {10.1016/S0266-352X(00)00013-6},
 	journal = {ASCE J. of Eng. Mech},
 	pages = {1154--1163},
@@ -261,7 +261,7 @@
 
 @article{Magnier1998a,
 	title = {Numerical simulation of impacts using a discrete element method},
-	author = {S.A. Magnier, F.V. Donzé},
+	author = {S.A. Magnier and F.V. Donzé},
 	doi = {10.1002/(SICI)1099-1484(199807)3:3<257::AID-CFM50>3.0.CO;2-Z},
 	journal = {Mech. Cohes.-frict. Mater.},
 	pages = {257--276},
@@ -271,7 +271,7 @@
 
 @article{Donzé1995a,
 	title = {Formulation of a three-dimensional numerical model of brittle behavior},
-	author = {F.V. Donzé, S.A. Magnier},
+	author = {F.V. Donzé and S.A. Magnier},
 	journal = {Geophys. J. Int.},
 	pages = {790--802},
 	volume = {122},
@@ -280,7 +280,7 @@
 
 @article{Donzé1994a,
 	title = {Numerical simulation of faults and shear zones},
-	author = {F.V. Donzé, P. Mora, S.A. Magnier},
+	author = {F.V. Donzé and P. Mora and S.A. Magnier},
 	journal = {Geophys. J. Int.},
 	pages = {46--52},
 	volume = {116},
@@ -289,7 +289,7 @@
 
 @article{Chareyre2002a,
 	title = {Theoretical versus experimental modeling of the anchorage capacity of geotextiles in trenches.},
-	author = {Chareyre, B., Briancon, L., and Villard, P.},
+	author = {Chareyre, B. and Briancon, L. and Villard, P.}, 
 	journal = {Geosynthet. Int.},
 	pages = {97--123},
 	volume = {9},

=== modified file 'doc/sphinx/bib2rst.py'
--- doc/sphinx/bib2rst.py	2010-06-13 21:25:46 +0000
+++ doc/sphinx/bib2rst.py	2010-07-01 09:56:50 +0000
@@ -71,7 +71,7 @@
 		## ReST uses <..> to delimit URL, therefore < and > must be encoded in the URL (http://www.blooberry.com/indexdot/html/topics/urlencoding.htm)
 		def escapeUrl(url): return url.replace('<','%3c').replace('>','%3e')
 		if i.has_key('doi'): line+=' DOI `%s <http://dx.doi.org/%s>`_'%(i['doi'],escapeUrl(i['doi'])) 
-		if i.has_key('url'): line+=' `[download fulltext] <%s>`_'%escapeUrl(i['url'])
+		if i.has_key('url'): line+=' `(fulltext) <%s>`_'%escapeUrl(i['url'])
 		if i.has_key('note'): line+=' (%s)'%i['note']
 		ret.append(line)
 	return ret

=== modified file 'py/_eudoxos.cpp'
--- py/_eudoxos.cpp	2010-06-18 13:02:01 +0000
+++ py/_eudoxos.cpp	2010-07-01 09:56:50 +0000
@@ -238,6 +238,7 @@
 		Scene* scene=Omega::instance().getScene().get();
 		locator=vtkPointLocator::New();
 		points=vtkPoints::New();
+		int count=0;
 		FOREACH(const shared_ptr<Interaction>& i, *scene->interactions){
 			if(!i->isReal()) continue;
 			Dem3DofGeom* ge=dynamic_cast<Dem3DofGeom*>(i->interactionGeometry.get());
@@ -246,7 +247,9 @@
 			int id=points->InsertNextPoint(cp[0],cp[1],cp[2]);
 			if(intrs.size()<=(size_t)id){intrs.resize(id+1000);}
 			intrs[id]=i;
+			count++;
 		}
+		if(count==0) throw std::runtime_error("Zero interactions when constructing InteractionLocator!");
 		double bb[6];
 		points->ComputeBounds(); points->GetBounds(bb);
 		mn=Vector3r(bb[0],bb[2],bb[4]); mx=Vector3r(bb[1],bb[3],bb[5]);

=== modified file 'py/eudoxos.py'
--- py/eudoxos.py	2010-06-17 21:13:59 +0000
+++ py/eudoxos.py	2010-07-01 09:56:50 +0000
@@ -31,8 +31,17 @@
 
 	To get the averaged value, simply call the instance, passing central point and callable object which received interaction object and returns the desired quantity:
 
-		>>> is3d=IntrSmooth3d(0.003)
-		>>> is3d(Vector3r(0,0,0),lambda i: i.phys.omega)
+		>>> O.reset()
+		>>> from yade import utils
+		>>> O.bodies.append([utils.sphere((0,0,0),1),utils.sphere((0,0,1.9),1)])
+		[0, 1]
+		>>> O.engines=[InteractionDispatchers([Ig2_Sphere_Sphere_Dem3DofGeom(),],[Ip2_FrictMat_FrictMat_FrictPhys()],[])]
+		>>> utils.createInteraction(0,1) #doctest: +ELLIPSIS
+		<Interaction instance at 0x...>
+
+		>> is3d=IntrSmooth3d(0.003)
+		>> is3d((0,0,0),lambda i: i.phys.normalForce)
+		Vector3(0,0,0)
 	
 	"""
 	def __init__(self,stDev):
@@ -48,7 +57,7 @@
 	def bounds(self): return self.locator.bounds()
 	def count(self): return self.locator.count()
 	def __call__(self,pt,extr):
-		intrs=self.locator.intrsWithinDistance(pt,self.stDev*self.relThreshold)
+		intrs=self.locator.intrsAroundPt(pt,self.stDev*self.relThreshold)
 		if len(intrs)==0: return float('nan')
 		weights,val=0.,0.
 		for i in intrs:

=== modified file 'py/pack/pack.py'
--- py/pack/pack.py	2010-06-29 14:32:03 +0000
+++ py/pack/pack.py	2010-07-01 09:56:50 +0000
@@ -47,6 +47,56 @@
 from _packObb import *
 from _packSpherePadder import *
 
+##
+# extend _packSphere.SpherePack c++ class by this method
+##
+def SpherePack_toSimulation(self,rot=Matrix3.Identity,**kw):
+	ur"""Append spheres directly to the simulation. In addition calling :yref:`O.bodies.append<BodyContainer.append>`,
+this method also appropriately sets periodic cell information of the simulation.
+
+:param Quaternion/Matrix3 rot: rotation of the packing, which will be applied on spheres and will be used to set :yref:`Cell.trsf` as well.
+:param **kw: passed to :yref:`yade.utils.sphere`
+:return: list of body ids added (like :yref:`O.bodies.append<BodyContainer.append>`)
+
+	>>> from yade import pack; from math import *
+	>>> sp=pack.SpherePack()
+
+Create random periodic packing with 20 spheres:
+
+	>>> sp.makeCloud((0,0,0),(5,5,5),rMean=.5,rRelFuzz=.5,periodic=True,num=20)
+	20
+
+Virgin simulation is aperiodic:
+
+	>>> O.reset()
+	>>> O.periodic
+	False
+
+Add generated packing to the simulation, rotated by 45° along +z
+
+	>>> sp.toSimulation(rot=Quaternion((0,0,1),pi/4),color=(0,0,1))
+	[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19]
+
+Periodic properties are transferred to the simulation correctly:
+
+	>>> O.periodic
+	True
+	>>> O.cell.refSize
+	Vector3(5,5,5)
+	>>> O.cell.trsf
+	Matrix3(0.707107,-0.707107,0, 0.707107,0.707107,0, 0,0,1)
+
+"""
+	if isinstance(rot,Quaternion): rot=rot.toRotationMatrix()
+	assert(isinstance(rot,Matrix3))
+	if self.cellSize!=Vector3.Zero:
+		O.periodic=True
+		O.cell.trsf=rot
+		O.cell.refSize=self.cellSize
+	return O.bodies.append([utils.sphere(rot*c,r,**kw) for c,r in self])
+
+SpherePack.toSimulation=SpherePack_toSimulation
+
 
 class inGtsSurface_py(Predicate):
 	"""This class was re-implemented in c++, but should stay here to serve as reference for implementing

=== modified file 'py/plot.py'
--- py/plot.py	2010-06-29 14:32:03 +0000
+++ py/plot.py	2010-07-01 09:56:50 +0000
@@ -98,7 +98,10 @@
 	You can use 
 	
 		>>> from yade import plot
-		>>> plot.plot(noShow=True).saveFig('someFile.pdf')
+		>>> plot.plot(noShow=True).savefig('someFile.pdf')
+		>>> import os
+		>>> os.path.exists('someFile.pdf')
+		True
 		
 	to save the figure to file automatically.
 	"""

=== modified file 'py/tests/__init__.py'
--- py/tests/__init__.py	2009-12-11 07:27:29 +0000
+++ py/tests/__init__.py	2010-07-01 09:56:50 +0000
@@ -1,11 +1,15 @@
 # encoding: utf-8
 # 2009 © Václav Šmilauer <eudoxos@xxxxxxxx>
 """All defined functionality tests for yade."""
-import unittest 
+import unittest,inspect
 
 # add any new test suites to the list here, so that they are picked up by testAll
 allTests=['wrapper','omega']
 
+# all yade modules (ugly...)
+import yade.eudoxos,yade.export,yade.linterpolation,yade.log,yade.pack,yade.plot,yade.post2d,yade.qt,yade.timing,yade.utils,yade.ymport
+allModules=(yade.eudoxos,yade.export,yade.linterpolation,yade.log,yade.pack,yade.plot,yade.post2d,yade.qt,yade.timing,yade.utils,yade.ymport)
+
 # fully qualified module names
 allTestsFQ=['yade.tests.'+test for test in allTests]
 
@@ -24,8 +28,8 @@
 	TestResult object for further examination."""
 	suite=unittest.defaultTestLoader.loadTestsFromNames(allTestsFQ)
 	import doctest
-	import yade.utils
-	suite.addTest(doctest.DocTestSuite(yade.utils))
+	for mod in allModules:
+		suite.addTest(doctest.DocTestSuite(mod))
 	return unittest.TextTestRunner(verbosity=2).run(suite)
 
 	


Follow ups