[kepler-users] For loop
Shawn Bowers
sbowers at ucdavis.edu
Wed Feb 4 06:53:36 PST 2009
Hi Michal,
I think there are a number of ways to do this in Kepler. One way to do
it is as Bertram suggests, but use the ArrayToSequence and
SequenceToArray actors to induce the "implicit" iteration based on
sequences.
Attached is a .moml workflow that does something similar. Also, some
screenshots are attached. The outer workflow contains the PN director,
an array constant actor (set to an array with the integers 1 to 10),
the A actor with two input ports (ain1 and arraylength), and then a
simple display actor to show the output.
Looking inside the A actor, the ArrayToSequence actor is used to
create a sequence of tokens from the array elements. The "Scale" actor
scales each element of the array by a factor of 10 (this actor is
where, e.g., you would put the file operation). The result of the
Scale actor is then passed to a SequenceToArray actor, which also
receives the original array length. This actor outputs the final,
modified, array.
There are other ways to perform iteration and looping in Kepler, but
I wanted to demonstrate how this could be done using Bertram's
suggestion of employing the "natural" mechanism of iteration in
Kepler, and dataflow computation models in general.
Shawn
On Tue, Feb 3, 2009 at 11:57 PM, Michal Owsiak <michalo at man.poznan.pl> wrote:
> Hello Bertram,
>
> thanks for the reference to the paper.
>
> I see your point, but I am not sure whether this is a solution in my
> case. I'll try to express myself more precisely.
>
> I have a composite actor A, which have input port ain1 and output port
> aout1.
>
> Inside actor A, I have actor B (input port bin1 output port bout1) which
> performs file related tasks basing on input.
>
> Actor B reads file name from it's input port (bin1), performs actions on
> that file and sends information to the output port - bout1 - (name of
> the file with prefix).
>
> What I want to do is:
>
> 1. Send array of the file names as a parameter into input port of actor A
>
> files={file1, file2, file3 } -> ain1:A
>
> 2. inside composite actor A I want to perform
>
> for(i=0;i<ain1.length;i++) {
> ain1[i] -> bin1:B
> bout1:B -> aout1:A -> outputArray
> }
>
> I hope this is more precise description of my needs :)
>
> Cheers
>
> --
> Michal Owsiak <michalo at man.poznan.pl>
> Poznan Supercomputing and Networking Center
> ul. Noskowskiego 10, 61-704 Poznan, POLAND
> http://www.man.poznan.pl
> _______________________________________________
> Kepler-users mailing list
> Kepler-users at kepler-project.org
> http://mercury.nceas.ucsb.edu/kepler/mailman/listinfo/kepler-users
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: array-iteration.moml
Type: application/octet-stream
Size: 35670 bytes
Desc: not available
URL: <http://lists.nceas.ucsb.edu/kepler/pipermail/kepler-users/attachments/20090204/28aa5fad/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: array-iteration-1.tiff
Type: image/tiff
Size: 22980 bytes
Desc: not available
URL: <http://lists.nceas.ucsb.edu/kepler/pipermail/kepler-users/attachments/20090204/28aa5fad/attachment.tiff>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: array-iteration-2.tiff
Type: image/tiff
Size: 22332 bytes
Desc: not available
URL: <http://lists.nceas.ucsb.edu/kepler/pipermail/kepler-users/attachments/20090204/28aa5fad/attachment-0001.tiff>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: array-iteration-3.tiff
Type: image/tiff
Size: 17506 bytes
Desc: not available
URL: <http://lists.nceas.ucsb.edu/kepler/pipermail/kepler-users/attachments/20090204/28aa5fad/attachment-0002.tiff>
More information about the Kepler-users
mailing list