[Swift-devel] Re: arrays of structures and building them in SWIFT

Mihael Hategan hategan at mcs.anl.gov
Sun May 4 18:10:02 CDT 2008


> But this doesn't take care of the other use of types that  I planned
> on, which is using them as a placeholder for results of calls.
> I,e., if a call generates a file4.HEAD and file4.BRIK file as output,
> it would be nice to have the ability to say
> mytpe result = MyCall(myarray[0])
> and then automotatically get 'result' populated
> result.head == HEAD result of MyCall
> result.brik == BRIK result of MyCall

You can do that with the simple mapper:
mytype result <simple_mapper;prefix="result.">;
You'll then get result.HEAD and result.BRIK.

> 
> From the viewpoint of the workflow, what this will look like is that
> the functions took mytpe as input and gave mytype as output rather
> than specific filenames. 
> I'm new to the SWIFT so might be confusing design principles.
> 
> Best,
> Uri
> 
> 
> On Sun, May 4, 2008 at 5:05 PM, Ben Clifford <benc at hawaga.org.uk>
> wrote:
>         
>         The v3 code probably has a very similar problem to that
>         expressed in
>         bug123, which I think is that mapper parameters don't interact
>         in well
>         with runtime constructed datasets.
>         
>         Perhaps this would be doable with a custom mapper that mapped
>         an array inp
>         declared as:
>         
>         type t { file head; file brik; }
>         t inp[][];
>         
>         such that:
>         
>          inputs/Snnnn.runbyrun.reg_TS_run-.rrrrrr+orig.sssss
>         
>         is mapped to:
>         
>          inp[nnn][rrrr].sssss
>         
>         That is, rather than feeding list of nnn and rrr and then
>         attempting to
>         construct filenames, do it the other way round - use the
>         presence of files
>         in the input/ directory to cause a data structure to be
>         constructed.
>         
>         That would be straightforward, I think, if you want to process
>         all files
>         that look like:
>         
>          inputs/S*.runbyrun.reg_TS_run-*+orig.*
>         
>         rather than some subset of those.
>         
>         So one question is: do you want to process all files that look
>         like:
>          inputs/S*.runbyrun.reg_TS_run-*+orig.*
>         or do you want to process only a subset? And if so, what is
>         the longer
>         term goal for selecting the subset (you have "05" and 1
>         hard-coded at the
>         moment, but I guess there's some intention to do otherwise
>         eventually)
>         
>         
>         On Sun, 4 May 2008, Mihael Hategan wrote:
>         
>         > Right. The problem here is that you can't reasonably
>         "assign" file names
>         > to data on the fly.
>         >
>         > How do your files look like? In other words, what are your
>         input files?
>         > (I get the ones in the graph, but you mention an array, so I
>         figured
>         > there's more).
>         >
>         > Mihael
>         >
>         > On Sun, 2008-05-04 at 11:54 -0500, Uri Hasson wrote:
>         > > Hi Mihael,
>         > >
>         > > I'm trying to write an MRAC and so am finalizing up some
>         swift
>         > > routines...
>         > >
>         > > One thing I can't seem to manage is to declare a complex
>         type that
>         > > will contain two types (both of which are files), assign
>         data to that
>         > > type, and then pass that type to a call. I think my
>         problem is that I
>         > > don't know how to setup an array of structures and assign
>         it values
>         > > that are file locations.
>         > >
>         > > If you have a sec, could you advise on this?
>         > > For starters, a graph of my current, nonelegant workflow
>         can be seen
>         > > in
>         >
>         > /disks/gpfs/fmri/cnari/swift/projects/uhasson/AFNIflows/SNR/snrgraph1.png
>         > >
>         > > and the script that generates it is:
>         >
>         > /disks/gpfs/fmri/cnari/swift/projects/uhasson/AFNIflows/SNR/AFNIsnrV2.swift
>         > >
>         > > All the procedures I write are very simple: they take
>         *.HEAD and
>         > > *.BRIK file pairs as input (a pair defines  a brain
>         dataset), and
>         > > output a *.HEAD and *.BRIK file as output.
>         > >
>         > > Now, Currently, I am stating each HEAD and BRIK file
>         seperately as
>         > > arguments, e.g., AFNI_mean (string baseName, file
>         headFile, file
>         > > brikFile ...)
>         > >
>         > > What I want to do is create a type like
>         > > type AFNI_obj{
>         > > file head;
>         > > file brik;
>         > > };
>         > >
>         > > assign the *.HEAD and *.BRIK file to that type and then
>         pass that
>         > > complex type like this: AFNI_mean (string baseName,
>         AFNI_obj t, ...)
>         > >
>         > > I've tried doing this with Sarah, but we couldn't get it
>         to work.
>         > > If I do the csv mapper way, I can do it (AFNIsnrV4.swift
>         in same dir)
>         > > but if I try constructing the filenames on the fly within
>         the script
>         > > (feeble attempts in AFNIsnrV3.swift), it doesn't work.
>         > >
>         > > I think what I don't understand is how to manully set up
>         an array of
>         > > structures similarly to what the csv mapper does.
>         > > If meeting in person is faster, would be very glad to
>         meet.
>         > >
>         > > Any advice,
>         > > Much appreciated.
>         > >
>         > > Uri
>         > >
>         >
>         
>         > _______________________________________________
>         > Swift-devel mailing list
>         > Swift-devel at ci.uchicago.edu
>         > http://mail.ci.uchicago.edu/mailman/listinfo/swift-devel
>         >
>         >
> 




More information about the Swift-devel mailing list