------------------------------------------------------------
revno: 1924
committer: Václav Šmilauer <[email protected]>
branch nick: trunk
timestamp: Fri 2009-12-25 16:28:07 +0100
message:
  1. Make python interaction iterator return only real interactions. (TODO: 
regression test & check scripts for compat)
modified:
  py/yadeWrapper/yadeWrapper.cpp


--
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/yadeWrapper/yadeWrapper.cpp'
--- py/yadeWrapper/yadeWrapper.cpp	2009-12-25 14:46:48 +0000
+++ py/yadeWrapper/yadeWrapper.cpp	2009-12-25 15:28:07 +0000
@@ -216,8 +216,13 @@
 	public:
 	pyInteractionIterator(const shared_ptr<InteractionContainer>& ic){ I=ic->begin(); Iend=ic->end(); }
 	pyInteractionIterator pyIter(){return *this;}
-	shared_ptr<Interaction> pyNext(){ if(!(I!=Iend)){ PyErr_SetNone(PyExc_StopIteration); python::throw_error_already_set(); }
-		InteractionContainer::iterator ret=I; ++I; return *ret; }
+	shared_ptr<Interaction> pyNext(){
+		InteractionContainer::iterator ret;
+		while(I!=Iend){ ret=I; ++I; if((*ret)->isReal()) return *ret; }
+		PyErr_SetNone(PyExc_StopIteration); python::throw_error_already_set();
+		throw; // to avoid compiler warning; never reached
+		//InteractionContainer::iterator ret=I; ++I; return *ret;
+	}
 };
 
 class pyInteractionContainer{

_______________________________________________
Mailing list: https://launchpad.net/~yade-dev
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~yade-dev
More help   : https://help.launchpad.net/ListHelp

Reply via email to