← Back to team overview

yade-dev team mailing list archive

[Branch ~yade-dev/yade/trunk] Rev 2224: 1. Remove some old garbage code

 

------------------------------------------------------------
revno: 2224
committer: Václav Šmilauer <eudoxos@xxxxxxxx>
branch nick: trunk
timestamp: Fri 2010-05-14 12:01:37 +0200
message:
  1. Remove some old garbage code
  2. Make Material::id read-only from python
modified:
  core/Collider.cpp
  core/Collider.hpp
  core/Material.hpp
  py/pack/pack.py
  scripts/test/clump.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 'core/Collider.cpp'
--- core/Collider.cpp	2010-02-09 16:50:30 +0000
+++ core/Collider.cpp	2010-05-14 10:01:37 +0000
@@ -9,32 +9,7 @@
 #include "Collider.hpp"
 
 Collider::~Collider(){}
-bool Collider::handleExistingInteraction(Interaction*){
-	throw runtime_error("handleExistingInteraction should not be called");
-#if 0
-	/* logically, we have 4 possibilities
-	 * 1.  real  new → ¬new, keep
-	 * 2.  real ¬new → keep (same as 1.)
-	 * 3. ¬real  new → keep (remains in potential state)
-	 * 4. ¬real ¬new → delete
-	 */
-	
-	// case 1.
-	// Once the interaction has been fully created, it is not "new" anymore
-	if( I->isReal &&  I->isNew){ I->isNew=false; return true; }
-	// case 2.
-	if( I->isReal && !I->isNew) return true; 
-	// case 3.
-	// Keep interaction in potential state (the collider _must_ delete it once it is not in potential state anymore, however)
-	if(!I->isReal &&  I->isNew) return true;
-	// case 4.
-	// Remove interactions deleted by the constitutive law
-	if(!I->isReal && !I->isNew) return false; // should be deleted
 
-	assert(false); // unreachable
-	return false;
-#endif
-}
 bool Collider::mayCollide(const Body* b1, const Body* b2){
 	return 
 		// might be called with deleted bodies, i.e. NULL pointers

=== modified file 'core/Collider.hpp'
--- core/Collider.hpp	2010-02-09 16:50:30 +0000
+++ core/Collider.hpp	2010-05-14 10:01:37 +0000
@@ -27,11 +27,6 @@
 		 * the bodies are in potential interaction geometrically.
 		 */
 		bool mayCollide(const Body*, const Body*);
-		/*! Handle various state transitions of Interaction (isReal, isNew).
-		 *
-		 * Returns whether the interaction should be preserved (true) or deleted (false).
-		 */
-		bool handleExistingInteraction(Interaction*);
 
 		/*! Invalidate all persistent data (if the collider has any), forcing reinitialization at next run.
 		The default implementation does nothing, colliders should override it if it is applicable.

=== modified file 'core/Material.hpp'
--- core/Material.hpp	2010-02-14 19:36:17 +0000
+++ core/Material.hpp	2010-05-14 10:01:37 +0000
@@ -35,12 +35,13 @@
 		static const shared_ptr<Material> byLabel(const std::string& label, shared_ptr<Scene> scene) {return byLabel(label,scene.get());}
 
 	YADE_CLASS_BASE_DOC_ATTRS_CTOR_PY(Material,Serializable,"Material properties of a :yref:`body<Body>`.",
-		((int,id,((void)"not shared",-1),"Numeric id of this material; is non-negative only if this Material is shared (i.e. in O.materials), -1 otherwise. (necessary since yade::serialization doesn't track shared pointers)"))
+		((int,id,((void)"not shared",-1),"[id of shared material, overridden below]"))
 		((string,label,,"Textual identifier for this material; can be used for shared materials lookup in :yref:`MaterialContainer`."))
 		((Real,density,1000,"Density of the material [kg/m³]")),
 		/* ctor */,
 		/*py*/
 		.def("newAssocState",&Material::newAssocState,"Return new :yref:`State` instance, which is associated with this :yref:`Material`. Some materials have special requirement on :yref:`Body::state` type and calling this function when the body is created will ensure that they match. (This is done automatically if you use utils.sphere, … functions from python).")
+		.def_readonly("id",&Material::id,"Numeric id of this material; is non-negative only if this Material is shared (i.e. in O.materials), -1 otherwise. This value is set automatically when the material is inserted to the simulation via :yref:`O.materials.append<MaterialContainer.append>`. (This id is necessary since yade::serialization doesn't track shared pointers, but might disappear in the future)")
 		YADE_PY_TOPINDEXABLE(Material)
 	);
 	REGISTER_INDEX_COUNTER(Material);

=== modified file 'py/pack/pack.py'
--- py/pack/pack.py	2010-05-08 20:24:44 +0000
+++ py/pack/pack.py	2010-05-14 10:01:37 +0000
@@ -357,11 +357,6 @@
 		sp.rotate(*orientation.toAxisAngle())
 	return filterSpherePack(predicate,sp,material=material,color=color)
 
-# compatibility with the deprecated name, can be removed in the future
-def triaxialPack(*args,**kw):
-	import warnings; warnings.warn("pack.triaxialPack was renamed to pack.randomDensePack, update your code!",DeprecationWarning,stacklevel=2);
-	return randomDensePack(*args,**kw)
-
 def randomPeriPack(radius,rRelFuzz,initSize):
 	"""Generate periodic dense packing.	EXPERIMENTAL, you at your own risk.
 

=== modified file 'scripts/test/clump.py'
--- scripts/test/clump.py	2010-01-10 09:09:32 +0000
+++ scripts/test/clump.py	2010-05-14 10:01:37 +0000
@@ -5,19 +5,19 @@
 		Bo1_Sphere_Aabb(),
 		Bo1_Box_Aabb(),
 	]),
-	PersistentSAPCollider(),
+	InsertionSortCollider(),
 	InteractionDispatchers(
 		[Ig2_Sphere_Sphere_ScGeom(),Ig2_Box_Sphere_ScGeom()],
 		[Ip2_FrictMat_FrictMat_FrictPhys()],
 		[Law2_ScGeom_FrictPhys_Basic()]
 	),
 	GravityEngine(gravity=[0,0,-9.81]),
-	NewtonIntegrator(damping=.2)
+	NewtonIntegrator(damping=.2,exactAsphericalRot=True)
 ]
 # support
 O.bodies.append(utils.box([0,0,-1.5],[3,3,.2],dynamic=False))
 # stand-alone sphere
-O.bodies.append(utils.sphere([0,0,0],.5,density=1000,color=[1,1,1]))
+O.bodies.append(utils.sphere([0,0,0],.5))
 # clumps
 relPos=[(0,-.5,-.5),(0,.5,0),(.5,0,0),(0,0,.5)]
 coords=[(-2,0,0),(2,0,0),(0,2,0),(0,-2,0)]
@@ -25,7 +25,7 @@
 	# This shorthand command does something like this:
 	# O.bodies.appendClumped([utils.sphere(...),utils.sphere(...),utils.sphere(...)])
 	# and returns tuple of clumpId,[bodyId1,bodyId2,bodyId3]
-	clump,spheres=O.bodies.appendClumped([utils.sphere([relPos[j][0]+coords[i][0],relPos[j][1]+coords[i][1],relPos[j][2]+coords[i][2]],.5,density=1000) for j in range(0,i+1)])
+	clump,spheres=O.bodies.appendClumped([utils.sphere([relPos[j][0]+coords[i][0],relPos[j][1]+coords[i][1],relPos[j][2]+coords[i][2]],.5) for j in range(0,i+1)])
 	print clump,spheres
 O.dt=utils.PWaveTimeStep()
 O.saveTmp('init')