> I would also like to read my times series of forces from a file. Is
> there a python function that will accomplish. In the script examples I
> saw multi.py that is supposed to read some values from a file, but it
> didn't read from the file when I ran the simulation. I was wondering
> how to use this function (or another one) properly to obtain forces
> from file.
Do it just like you would in python:
forces,times=[],[]
for line in
file('your.text.file.with.2.numbers.per.line.separated.by.whitespace')
if len(line.split())<2: continue # skip empty lines
f,t=[float(s) for s in line.split()]
forces.append(f)
times.append(t)
def applyForce():
# find index of the time we are at or just after now in the series
# this is quite suboptimal, since it traverses the array every time
i=0;
while times[i]<O.time: i+=1
# and use force at that index
f=force[i]
V.
_______________________________________________
Mailing list: https://launchpad.net/~yade-users
Post to : [email protected]
Unsubscribe : https://launchpad.net/~yade-users
More help : https://help.launchpad.net/ListHelp
_______________________________________________
yade-users mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/yade-users