[Swift-devel] Re: passing types and variables in swift

Veronika Nefedova nefedova at mcs.anl.gov
Fri Oct 5 08:31:17 CDT 2007


The code is here: http://www.ci.uchicago.edu/~nefedova/gen-swift-loops

the relevant piece is toward the end:

First you construct in your shell script the string, in my case it  
was the strings $output_files and $outp_files. Then you define swift  
arrays and write it into your .swift (or .dtm) file:

cat  >> ./MolDyn.dtm <<EOFF

($outp_files) = GENERATOR (whamfiles, s);
string tout = @strcat ("\1_",s,".out");
file outf[] <fixed_array_mapper;files="$output_files">;
file outfiles[]  
<structured_regexp_mapper;source=outf,match="(.*).out", transform=tout>;
string INPUT[];
EOFF

Then you populate the arrays with the values (in my case - the values  
are the results from applications):

cat  >> ./MolDyn.dtm <<EOFF
INPUT[$i] = @strcat("input:","$inp2","_",s);
outfiles [$i] = CHARMM4 ($inp1, whaminp, s1,INPUT[$i] );
EOFF

(you do the above inside the loop in your shell script).

Hope this helps,

NIka


On Oct 5, 2007, at 12:27 AM, Michael Wilde wrote:

> Nika, can you post or send the moldyn code which you generate to  
> deal with a similar problem to this?
>
> I thought you mentioned that it was already online but I cant find it.
>
> Thanks,
>
> - Mike
>
>
> On 10/4/07 11:53 AM, Ben Clifford wrote:
>> On Thu, 4 Oct 2007, Michael Wilde wrote:
>>> is one way to do this to 'eval' a file containing swift expressions?
>>> Or, to #include them?
>>> This would look like a keyword-based value file
>>>
>>> myparms.rho[0]=0.1 mparms.theta[0]=0.2
>>> myparms.rho[1]=0.4 mparms.theta[0]=0.8
>>> ...
>>> myparms.rho[N-1]=0.etc mparms.theta[etc]=0.etc
>>>
>>> even if not as clean as extractcsv, it might be both fast and  
>>> useful for many
>>> other purposes.
>> you can do that already - generate a swiftscript source file from  
>> some other source. nika did something like this (and still does,  
>> but to a lesser extent) for moldyn.
>




More information about the Swift-devel mailing list