On Mon, 8 Jan 2007, Mischa Megens wrote:
meep>
meep> (reset-meep)
meep> (run-until 10
..     (at-time 5
..       (lambda (x) (display "time: ") (display (meep-time)) (newline))
..     )
..   )

This is not correct: your step function should take no arguments, i.e. it should be (lambda () ...) and not (lambda (x) ...).

You should also use "print" instead of "display", as "print" will work correctly on a multiprocessor machine (it will only print once, as opposed to display which will print N times on N cpus). e.g.
        (lambda () (print "time: " (meep-time) "\n"))

See the section "Writing your own step functions" in the Meep manual.

In particular, as explained in the manual, if your step function takes one argument, as in (lambda (x) ...), then that argument will either be x = 'step, during time-stepping, or x = 'finish, at the end of the run. This is so that you can write a step function which performs some final task once at the end (e.g. closes output files, or prints a summary, or whatever). In your example, you were simply ignoring the value of x, which means that your function prints once at time 5 and once at the end. In contrast, if your step function takes no arguments, then it is only called during time-stepping, and not an extra time at the end.

Steven

_______________________________________________
meep-discuss mailing list
[email protected]
http://ab-initio.mit.edu/cgi-bin/mailman/listinfo/meep-discuss

Reply via email to