← Back to team overview

yade-users team mailing list archive

Re: [Question #631147]: fail to check the permF I applied

 

Question #631147 on Yade changed:
https://answers.launchpad.net/yade/+question/631147

Jan Stránský proposed the following answer:
with current implementation,  you only can read permanent forces before adding new permanent forces and after O.step()/O.run()
if it is a problem, you can:
- modify source code
- use some auxiliary variable to store set forces after O.forces.addF and before O.step:
##############
O.bodies.append(sphere((0,0,0),1))
O.run(10,True)

permanentForces = dict()
def setPermanentForce(id,force):
   O.forces.addF(id,force,permanent=True)
   permanentForces[id] = force

setPermanentForce(0,(1,2,3))

#print O.forces.permF(0) # error
print permanentForces[0] # (1,2,3)

O.step()
print O.forces.permF(0) # (1,2,3), no error after O.step()
print permanentForces[0] # (1,2,3)
##############

cheers
Jan

-- 
You received this question notification because your team yade-users is
an answer contact for Yade.