Hi,
I answer this ancient post since I encountered the same problem and
analyzed it.
I tried (in run-sources+):
(when-true cond? (at-end output-epsilon)) and (at-end (when-true cond?
output-epsilon))
but neither had worked.
This is a fundamental limitation that is caused by the internal workings
of meep.
Step functions are internally called with an argument that specifies the
type of the step; normal step functions get *'step* as argument, whereas
a final call with *'finish* as argument allows for clean-up operations
(such as closing files).
Looking at the definition of *when-true* (see link
<https://github.com/stevengj/meep/blob/1a614f058b69d48020c70c42dc3d44ca6e40b52e/libctl/meep.scm.in#L697>),
one sees that it calls the step function if *cond?* evaluates to true or
if the argument is *'finish*.
The *at-end* modifier checks if the argument is *'finish* and then
executes the step function with both *'step* and *'finish* argument.
As a consequence, the step function is executed with argument *'finish*
in any case and *when-true* has no effect.
As a solution, I defined a variable *cond-variable?* that I set outside
of the step functions (or with *set!* inside another step function) and
then write my step function as
*
(define (conditional-step-function)**
** (if cond-variable? (actual-step-function))*
which I then call with
*
(at-end conditional-step-function)*
This approach is similar to the one suggested by Steven (see link
<https://www.mail-archive.com/meep-discuss@ab-initio.mit.edu/msg01717.html>).
Cheers,
Thomas
_______________________________________________
meep-discuss mailing list
meep-discuss@ab-initio.mit.edu
http://ab-initio.mit.edu/cgi-bin/mailman/listinfo/meep-discuss