[Swift-user] Dynamic For Loops from Input File
Matthew Shaxted
Matthew.Shaxted at som.com
Wed Aug 20 16:59:53 CDT 2014
Hi Swift Users,
I have a swift script that reads an input file of parameters and variables, and iterates through the variables in one for loop per parameter:
Input Sweep File Example:
pnum pname pvals
1 InfilRate 0.0015,0.025
2 PreheatCoilSetpoint 15,15.5,16.0
3 KitchenGasPD 200,250
Swift File For Loops:
foreach v0 in pval[0] {
foreach v1 in pval[1] {
foreach v2 in pval[2] {
As of now, I need to hard code in the number of for loops in the Swift script to match those of the input file parameters, and I'm thinking there must be a better way.
I'm wondering if there is a more dynamic way to have Swift loop through the parameters without having to hard code in the for loops? For example, if I define 5 parameters in the input file, the Swift script would automatically know to add 5 for loops.
I was thinking I could create a shell script to read the input file and dynamically create the swift script with the correct number of for loops before running swift, but perhaps there is a better way?
Thanks,
Matthew
MATTHEW SHAXTED
SKIDMORE, OWINGS & MERRILL LLP
224 SOUTH MICHIGAN AVENUE
CHICAGO, IL 60604
T (312) 360-4368
MATTHEW.SHAXTED at SOM.COM<mailto:MATTHEW.SHAXTED at SOM.COM>
[cid:image004.png at 01CFBC98.297A1030]<http://www.som.com/>
The information contained in this communication may be confidential, is intended only for the use of the recipient(s) named above, and may be legally privileged. If the reader of this message is not the intended recipient, you are hereby notified that any dissemination, distribution, or copying of this communication, or any of its contents, is strictly prohibited and may be unlawful. If you have received this communication in error, please return it to the sender immediately and delete the original message and any copy of it from your computer system. If you have any questions concerning this message, please contact the sender.
[cid:image003.gif at 01CFBC96.E755A620]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/swift-user/attachments/20140820/eade24d7/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image003.gif
Type: image/gif
Size: 566 bytes
Desc: image003.gif
URL: <http://lists.mcs.anl.gov/pipermail/swift-user/attachments/20140820/eade24d7/attachment.gif>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image004.png
Type: image/png
Size: 5311 bytes
Desc: image004.png
URL: <http://lists.mcs.anl.gov/pipermail/swift-user/attachments/20140820/eade24d7/attachment.png>
More information about the Swift-user
mailing list