← Back to team overview

yade-dev team mailing list archive

[Branch ~yade-dev/yade/trunk] Rev 1805: Fixes import_LSMGenGeo_geometry and its example

 

------------------------------------------------------------
revno: 1805
committer: Anton Gladky <gladky.anton@xxxxxxxxx>
branch nick: trunk
timestamp: Sat 2009-11-21 09:48:42 +0100
message:
  Fixes import_LSMGenGeo_geometry and its example
modified:
  py/utils.py
  scripts/test/regular-sphere-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 'py/utils.py'
--- py/utils.py	2009-11-20 08:25:37 +0000
+++ py/utils.py	2009-11-21 08:48:42 +0000
@@ -374,6 +374,31 @@
 		ret.append(facet((nodelistVector3[i[1]],nodelistVector3[i[2]],nodelistVector3[i[3]]),**kw))
 	return ret
 
+def import_LSMGenGeo_geometry(fileName="file.geo",moveTo=[0.0,0.0,0.0],**kw):
+	""" Imports geometry from LSMGenGeo .geo file and creates spheres.
+	moveTo[X,Y,Z] parameter moves the specimen.
+	Remaining **kw arguments are passed to utils.sphere; 
+	
+	LSMGenGeo library allows to create pack of spheres
+	with given [Rmin:Rmax] with null stress inside the specimen.
+	Can be usefull for Mining Rock simulation.
+	
+	Example added to scripts/test/regular-sphere-pack.py
+	Example of LSMGenGeo library using is added to genCylLSM.py
+	
+  http://www.access.edu.au/lsmgengeo_python_doc/current/pythonapi/html/GenGeo-module.html
+	https://svn.esscc.uq.edu.au/svn/esys3/lsm/contrib/LSMGenGeo/""";
+
+	infile = open(fileName,"r")
+	lines = infile.readlines()
+	infile.close()
+
+	numSpheres = int(lines[6].split()[0])
+	ret=[]
+	for line in lines[7:numSpheres+7]:
+		data = line.split()
+		ret.append(sphere([moveTo[0]+float(data[0]),moveTo[1]+float(data[1]),moveTo[2]+float(data[2])],float(data[3]),**kw))
+	return ret
 
 def encodeVideoFromFrames(frameSpec,out,renameNotOverwrite=True,fps=24):
 	"""Create .ogg video from external image files.

=== modified file 'scripts/test/regular-sphere-pack.py'
--- scripts/test/regular-sphere-pack.py	2009-11-20 14:24:50 +0000
+++ scripts/test/regular-sphere-pack.py	2009-11-21 08:48:42 +0000
@@ -56,7 +56,8 @@
 O.bodies.append(utils.import_mesh_geometry('regular-sphere-pack.mesh',**kwMeshes))#generates facets from the mesh file
 
 """Import regular-sphere-pack-LSMGegGeo.geo into the YADE simulation"""
-O.bodies.append(utils.import_LSMGenGeo_geometry('cyl.geo',moveTo=[-7.0,-7.0,-5.9],color=(0,0,1),**kw))
+O.bodies.append(utils.import_LSMGenGeo_geometry('regular-sphere-pack-LSMGegGeo.geo',moveTo=[-7.0,-7.0,-5.9],color=(1,0,1),**kw))
+
 
 try:
 	from yade import qt