On Apr 25, 2008, at 3:10 AM, fanguofang wrote:
>
> Hi:
> I want to get the flux of two waveguide for different index ,so I
> use a loop and add-flux should be after the geometry,I put it in the
> loop.
> But (define trans (add-flux fcen df nfreq (make flux-
> region ))) can not work in the loop .
> How can I do?
> Thank you
> the following is the control file
>
You can't use "define" inside a loop. A simple workaround is to
(define trans 0) outside the loop to define the variable with a dummy
value, and then to use (set! trans (add-flux ....)) inside the loop.
A cleaner way to define local variables in a Scheme program, e.g.
inside a loop or a function, is to use the "let" construct, as in
(let ((trans (add-flux ...)))
...do stuff...)
Regards,
Steven G. Johnson
_______________________________________________
meep-discuss mailing list
[email protected]
http://ab-initio.mit.edu/cgi-bin/mailman/listinfo/meep-discuss