UNSUBSCRIBE ME ________________________________ From: meep-discuss <meep-discuss-boun...@ab-initio.mit.edu> on behalf of meep-discuss-requ...@ab-initio.mit.edu <meep-discuss-requ...@ab-initio.mit.edu> Sent: Friday, September 8, 2017 12:00:01 PM To: meep-discuss@ab-initio.mit.edu Subject: meep-discuss Digest, Vol 138, Issue 3
Send meep-discuss mailing list submissions to meep-discuss@ab-initio.mit.edu To subscribe or unsubscribe via the World Wide Web, visit https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fab-initio.mit.edu%2Fcgi-bin%2Fmailman%2Flistinfo%2Fmeep-discuss&data=02%7C01%7Cjohn.b.sigman.th%40dartmouth.edu%7C9a023aa15e484c04f89f08d4f6d2b724%7C995b093648d640e5a31ebf689ec9446f%7C0%7C0%7C636404832270107707&sdata=ts%2B%2BZuBZmLLBaL262SbXtCUPn939rkS%2Bkh5L112S1Gs%3D&reserved=0 or, via email, send a message with subject or body 'help' to meep-discuss-requ...@ab-initio.mit.edu You can reach the person managing the list at meep-discuss-ow...@ab-initio.mit.edu When replying, please edit your Subject line so it is more specific than "Re: Contents of meep-discuss digest..." Today's Topics: 1. Re: How to combine conditions for step-functions? (Thomas AUZINGER) ---------------------------------------------------------------------- Message: 1 Date: Fri, 8 Sep 2017 15:19:45 +0200 From: Thomas AUZINGER <tho...@auzinger.name> To: qwer1...@gmail.com, "meep-discuss@ab-initio.mit.edu" <meep-discuss@ab-initio.mit.edu> Subject: Re: [Meep-discuss] How to combine conditions for step-functions? Message-ID: <5110b741-5550-1e96-1292-610579692...@auzinger.name> Content-Type: text/plain; charset="utf-8"; Format="flowed" 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://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fstevengj%2Fmeep%2Fblob%2F1a614f058b69d48020c70c42dc3d44ca6e40b52e%2Flibctl%2Fmeep.scm.in%23L697&data=02%7C01%7Cjohn.b.sigman.th%40dartmouth.edu%7C9a023aa15e484c04f89f08d4f6d2b724%7C995b093648d640e5a31ebf689ec9446f%7C0%7C0%7C636404832270107707&sdata=1vO74mHlLwqwhntaJC1kqde%2FZnRCk53OzfTFIqGjB3I%3D&reserved=0>), 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://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.mail-archive.com%2Fmeep-discuss%40ab-initio.mit.edu%2Fmsg01717.html&data=02%7C01%7Cjohn.b.sigman.th%40dartmouth.edu%7C9a023aa15e484c04f89f08d4f6d2b724%7C995b093648d640e5a31ebf689ec9446f%7C0%7C0%7C636404832270107707&sdata=T4wtiGlB95eiyIFwdml2KsQeWm3XnFfevDeG8ZxDLPs%3D&reserved=0>). Cheers, Thomas -------------- next part -------------- An HTML attachment was scrubbed... URL: <https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fab-initio.mit.edu%2Fpipermail%2Fmeep-discuss%2Fattachments%2F20170908%2F9f26c79d%2Fattachment-0001.html&data=02%7C01%7Cjohn.b.sigman.th%40dartmouth.edu%7C9a023aa15e484c04f89f08d4f6d2b724%7C995b093648d640e5a31ebf689ec9446f%7C0%7C0%7C636404832270107707&sdata=2zWE6C20z8%2BOxelbz5BGqgziTRj3KbRTULz8pQSFBa8%3D&reserved=0> ------------------------------ Subject: Digest Footer _______________________________________________ meep-discuss mailing list meep-discuss@ab-initio.mit.edu https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fab-initio.mit.edu%2Fcgi-bin%2Fmailman%2Flistinfo%2Fmeep-discuss&data=02%7C01%7Cjohn.b.sigman.th%40dartmouth.edu%7C9a023aa15e484c04f89f08d4f6d2b724%7C995b093648d640e5a31ebf689ec9446f%7C0%7C0%7C636404832270107707&sdata=ts%2B%2BZuBZmLLBaL262SbXtCUPn939rkS%2Bkh5L112S1Gs%3D&reserved=0 ------------------------------ End of meep-discuss Digest, Vol 138, Issue 3 ********************************************
_______________________________________________ meep-discuss mailing list meep-discuss@ab-initio.mit.edu http://ab-initio.mit.edu/cgi-bin/mailman/listinfo/meep-discuss