<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    Hi Ricardo,<br>
    <br>
    Interfacing to C is not that difficult, though it is difficult to do
    in a portable manner.  <br>
    See<br>
    <a class="moz-txt-link-freetext" href="http://docs.oracle.com/javase/7/docs/technotes/guides/jni/">http://docs.oracle.com/javase/7/docs/technotes/guides/jni/</a><br>
    <br>
    I used JNA (<a class="moz-txt-link-freetext" href="https://github.com/twall/jna">https://github.com/twall/jna</a>) with good success to
    interface to FMI, see org/ptolemy/fmu.<br>
    <br>
    The JNAerator will create stub code for you from C and C++<br>
    <a class="moz-txt-link-freetext" href="http://code.google.com/p/jnaerator/">http://code.google.com/p/jnaerator/</a><br>
    <br>
    Ptolemy II includes ways to access C code, see the faq links below.<br>
    See $PTII/bin/vergil $PTII/ptolemy/cg/lib/demo/Scale/ScaleC.xml<br>
    <br>
    For interfacing to a C library that is complex, I suggest using JNA
    to create some wrapper Java code and then write actors that use the
    Java wrapper code.<br>
    <br>
    I don't really understand your initial question though.  What are
    you trying to do?<br>
    <br>
    You said you wanted to create a "scope workflow wide".  Typically,
    we do this by placing a parameter into a model.<br>
    <br>
    If you were writing Java code, you would create a parameter in the
    container of an actor, but this is not very good actor-oriented
    programming.<br>
    <br>
    For information about writing actors in Java,  see the designing
    actors chapter of
    <a class="moz-txt-link-freetext" href="http://www.eecs.berkeley.edu/Pubs/TechRpts/2008/EECS-2008-28.html">http://www.eecs.berkeley.edu/Pubs/TechRpts/2008/EECS-2008-28.html</a><br>
    <br>
    _Christopher<br>
    <br>
    <br>
    <br>
    <div class="moz-cite-prefix">On 10/1/12 6:04 PM,
      <a class="moz-txt-link-abbreviated" href="mailto:Ricardo.Pascual@csiro.au">Ricardo.Pascual@csiro.au</a> wrote:<br>
    </div>
    <blockquote
cite="mid:3BA9AAF8AEF5E4448B2581E3CAB5C8A57771DC7206@EXNSW-MBX03.nexus.csiro.au"
      type="cite">
      <meta http-equiv="Content-Type" content="text/html;
        charset=ISO-8859-1">
      <meta name="Generator" content="Microsoft Word 12 (filtered
        medium)">
      <style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p.MsoAcetate, li.MsoAcetate, div.MsoAcetate
        {mso-style-priority:99;
        mso-style-link:"Balloon Text Char";
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:8.0pt;
        font-family:"Tahoma","sans-serif";}
span.EmailStyle17
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
span.BalloonTextChar
        {mso-style-name:"Balloon Text Char";
        mso-style-priority:99;
        mso-style-link:"Balloon Text";
        font-family:"Tahoma","sans-serif";}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
      <div class="WordSection1">
        <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Hi
            Derik,<o:p></o:p></span></p>
        <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Thanks
            for the email.   Somehow I need to interface with C/C++
            codes as there are codes that I will need written in C/C++.
            <o:p></o:p></span></p>
        <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">It
            is good to know that there is an active forum on Kepler.<o:p></o:p></span></p>
        <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Cheers,<o:p></o:p></span></p>
        <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Ric<o:p></o:p></span></p>
        <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
        <div>
          <div style="border:none;border-top:solid #B5C4DF
            1.0pt;padding:3.0pt 0cm 0cm 0cm">
            <p class="MsoNormal"><b><span
style="font-size:10.0pt;font-family:"Tahoma","sans-serif""
                  lang="EN-US">From:</span></b><span
style="font-size:10.0pt;font-family:"Tahoma","sans-serif""
                lang="EN-US"> Derik Barseghian
                [<a class="moz-txt-link-freetext" href="mailto:barseghian@nceas.ucsb.edu">mailto:barseghian@nceas.ucsb.edu</a>] <br>
                <b>Sent:</b> Tuesday, 2 October 2012 10:56 AM<br>
                <b>To:</b> Pascual, Ricardo (CMAR, Dutton Park)<br>
                <b>Cc:</b> <a class="moz-txt-link-abbreviated" href="mailto:kepler-users@kepler-project.org">kepler-users@kepler-project.org</a> Users<br>
                <b>Subject:</b> Re: [kepler-users] Kepler: Array
                instatiation and Array element assignment<o:p></o:p></span></p>
          </div>
        </div>
        <p class="MsoNormal"><o:p> </o:p></p>
        <div>
          <p class="MsoNormal">Hi Ric,<o:p></o:p></p>
        </div>
        <div>
          <p class="MsoNormal"><o:p> </o:p></p>
        </div>
        <div>
          <p class="MsoNormal">I found some relevant info here;<o:p></o:p></p>
        </div>
        <div>
          <p class="MsoNormal"><a moz-do-not-send="true"
href="http://ptolemy.eecs.berkeley.edu/ptolemyII/ptIIfaq.htm#Interfacing%20to%20C/C++">http://ptolemy.eecs.berkeley.edu/ptolemyII/ptIIfaq.htm#Interfacing
              to C/C++</a><o:p></o:p></p>
        </div>
        <div>
          <p class="MsoNormal"><a moz-do-not-send="true"
              href="http://ptolemy.eecs.berkeley.edu/ptolemyII/ptIIfaq.htm#CodeGen">http://ptolemy.eecs.berkeley.edu/ptolemyII/ptIIfaq.htm#CodeGen</a><o:p></o:p></p>
        </div>
        <div>
          <p class="MsoNormal">The descriptions make it sound like these
            aren't being worked on anymore, but I've seen ptolemy SVN
            check-ins that seem to do w/ C code generation and
            copernicus in the recent past, so I'm not sure about that.<o:p></o:p></p>
        </div>
        <div>
          <p class="MsoNormal"><o:p> </o:p></p>
        </div>
        <div>
          <p class="MsoNormal">Note you can call any arbitrary program
            using the External Execution actor.<o:p></o:p></p>
        </div>
        <div>
          <p class="MsoNormal"><o:p> </o:p></p>
        </div>
        <div>
          <p class="MsoNormal">If you're trying to develop new actor(s),
            customizing the RExpression or Python actors, or writing new
            ones in Java is probably easiest.<o:p></o:p></p>
        </div>
        <div>
          <p class="MsoNormal">Derik<o:p></o:p></p>
        </div>
        <div>
          <div>
            <div>
              <p class="MsoNormal"><o:p> </o:p></p>
            </div>
            <div>
              <p class="MsoNormal">On Oct 1, 2012, at 8:46 AM, "Edward
                A. Lee" <<a moz-do-not-send="true"
                  href="mailto:eal@eecs.berkeley.edu">eal@eecs.berkeley.edu</a>>
                wrote:<o:p></o:p></p>
            </div>
            <p class="MsoNormal"><br>
              <br>
              <o:p></o:p></p>
            <p class="MsoNormal"><br>
              The SetVariable actor is rather tricky to use.<br>
              Depending on the director that you choose and the
              parameters you set,<br>
              it could be nondeterministic.  Why go through a variable?
              Why not just<br>
              feed the data from DirectoryListing to where it is needed?<br>
              <br>
              If there are lots of places it is needed, you might
              consider using<br>
              Publisher and Subscriber.  These, at least, are assured of
              determinism.<br>
              <br>
              It is a bit of a change of mindset to "think in kepler"
              :-)<br>
              It's quite important which director you pick. They all
              provide<br>
              a concurrent model of computation, but their behaviors are
              quite<br>
              different...<br>
              <br>
              Edward<br>
              <br>
              <br>
              On 9/30/12 8:49 PM, <a moz-do-not-send="true"
                href="mailto:Ricardo.Pascual@csiro.au">Ricardo.Pascual@csiro.au</a>
              wrote:<br>
              <br>
              <o:p></o:p></p>
            <p class="MsoNormal">Hi Edward.<br>
              <br>
              Thanks for the email.  I am still trying to to learn how
              to think properly in kepler.  Any how the best solution  I
              can come up with is defining a parameter actor and setting
              the value using the VariableSetter actor. I believe you
              created this actor.  So if I set it to an array of strings
              dirList will be an array of string as in below.<br>
              *dirList  #"declare the variable as ParameterActor"<br>
              DirectoryListingActor -----> VariableSetterActor(with
              .variablename =dirList)<br>
              <br>
              There might be a more elegant solution but that will have
              to wait until I know more of kepler.  As you pointed out
              you can do this with the various Expression like
              RExpression and others. BTW is there a hook to C++ in
              kepler?<br>
              <br>
              <br>
              Kind regards.<br>
              <br>
              Ric<br>
              ________________________________________<br>
              From: Edward A. Lee [<a moz-do-not-send="true"
                href="mailto:eal@eecs.berkeley.edu">eal@eecs.berkeley.edu</a>]<br>
              Sent: Monday, 1 October 2012 7:02 AM<br>
              To: Pascual, Ricardo (CMAR, Dutton Park)<br>
              Cc: <a moz-do-not-send="true"
                href="mailto:Kepler-users@kepler-project.org">Kepler-users@kepler-project.org</a>;
              <a moz-do-not-send="true"
                href="mailto:cxh@eecs.berkeley.edu">cxh@eecs.berkeley.edu</a>;
              <a moz-do-not-send="true" href="mailto:crawl@sdsc.edu">crawl@sdsc.edu</a><br>
              Subject: Re: [kepler-users] Kepler: Array instatiation and
              Array element assignment<br>
              <br>
              Hi Ric,<br>
              <br>
              I'm not sure what you mean by "programmatically."<br>
              What you describe below is a program in an imperative
              language.<br>
              In Kepler, the primary imperative language is Java. So you<br>
              could write an actor in Java that does this.<br>
              <br>
              There are also hooks to write actors in MATLAB and Python,<br>
              which are also imperative languages.<br>
              <br>
              If instead you are trying to define a workflow that builds<br>
              this variable, then the only director with an imperative<br>
              flavor is the FSM. I think it could be awkward to define<br>
              it in an FSM.<br>
              <br>
              You could use a dataflow director or PN and
              SequenceToArray<br>
              actor, but these are distinctly not imperative.<br>
              <br>
              In Kepler, parameters are defined as expressions in the<br>
              Ptolemy expression language.<br>
              The expression language is also not an imperative
              language.<br>
              It is a functional language. So you don't actually specify<br>
              sequences of steps for defining variables.<br>
              <br>
              It occurs to me that it could be very useful to define<br>
              subclass of Parameter, say PythonParameter, that specifies<br>
              a parameter value that is initialized by running a Python<br>
              script... This would probably be fairly easy to write...<br>
              Any interest in this?<br>
              <br>
              Edward<br>
              <br>
              <br>
              <br>
              On 9/30/12 12:39 PM, <a moz-do-not-send="true"
                href="mailto:Ricardo.Pascual@csiro.au">Ricardo.Pascual@csiro.au</a>
              wrote:<br>
              <br>
              <o:p></o:p></p>
            <p class="MsoNormal" style="margin-bottom:12.0pt">Hi All,<br>
              <br>
              Oooops wrong title.<br>
              <br>
              Thanks,<br>
              <br>
              Ric<br>
              <br>
              ________________________________________<br>
              From: <a moz-do-not-send="true"
                href="mailto:kepler-users-bounces@kepler-project.org">kepler-users-bounces@kepler-project.org</a>
              [<a moz-do-not-send="true"
                href="mailto:kepler-users-bounces@kepler-project.org">kepler-users-bounces@kepler-project.org</a>]
              On Behalf Of <a moz-do-not-send="true"
                href="mailto:Ricardo.Pascual@csiro.au">Ricardo.Pascual@csiro.au</a>
              [<a moz-do-not-send="true"
                href="mailto:Ricardo.Pascual@csiro.au">Ricardo.Pascual@csiro.au</a>]<br>
              Sent: Sunday, 30 September 2012 9:11 PM<br>
              To: <a moz-do-not-send="true"
                href="mailto:Kepler-users@kepler-project.org">Kepler-users@kepler-project.org</a>;
              <a moz-do-not-send="true"
                href="mailto:cxh@eecs.berkeley.edu">cxh@eecs.berkeley.edu</a>;
              <a moz-do-not-send="true" href="mailto:crawl@sdsc.edu">crawl@sdsc.edu</a><br>
              Subject: [ExternalEmail] Re: [kepler-users] netCDF<br>
              <br>
              Hi All,<br>
              <br>
              I am about a week old into Kepler and having difficulty
              defining an array variable programmatically.  I have
              search the internet for this to no avail.   I know how to
              do it as a constant by assigning the value = {"x1", ...}.<br>
              <br>
              What I like to do is define a variable with scope workflow
              wide say<br>
              <br>
              string fileNames[];<br>
              <br>
              then assign values to it as in<br>
              <br>
              fileNames[0] = "file0"<br>
              fileNames[1] = "file1"<br>
              <br>
              <br>
              and so on.<br>
              <br>
              <br>
              Thank you very much,<br>
              <br>
              Ric<br>
              _______________________________________________<br>
              Kepler-users mailing list<br>
              <a moz-do-not-send="true"
                href="mailto:Kepler-users@kepler-project.org">Kepler-users@kepler-project.org</a><br>
              <a moz-do-not-send="true"
                href="http://lists.nceas.ucsb.edu/kepler/mailman/listinfo/kepler-users">http://lists.nceas.ucsb.edu/kepler/mailman/listinfo/kepler-users</a><br>
              _______________________________________________<br>
              Kepler-users mailing list<br>
              <a moz-do-not-send="true"
                href="mailto:Kepler-users@kepler-project.org">Kepler-users@kepler-project.org</a><br>
              <a moz-do-not-send="true"
                href="http://lists.nceas.ucsb.edu/kepler/mailman/listinfo/kepler-users">http://lists.nceas.ucsb.edu/kepler/mailman/listinfo/kepler-users</a><o:p></o:p></p>
            <p class="MsoNormal"><o:p> </o:p></p>
            <p class="MsoNormal"><eal.vcf>_______________________________________________<br>
              Kepler-users mailing list<br>
              <a moz-do-not-send="true"
                href="mailto:Kepler-users@kepler-project.org">Kepler-users@kepler-project.org</a><br>
              <a moz-do-not-send="true"
                href="http://lists.nceas.ucsb.edu/kepler/mailman/listinfo/kepler-users">http://lists.nceas.ucsb.edu/kepler/mailman/listinfo/kepler-users</a><o:p></o:p></p>
          </div>
          <p class="MsoNormal"><o:p> </o:p></p>
        </div>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
Kepler-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Kepler-users@kepler-project.org">Kepler-users@kepler-project.org</a>
<a class="moz-txt-link-freetext" href="http://lists.nceas.ucsb.edu/kepler/mailman/listinfo/kepler-users">http://lists.nceas.ucsb.edu/kepler/mailman/listinfo/kepler-users</a>
</pre>
    </blockquote>
    <br>
    <pre class="moz-signature" cols="72">-- 
Christopher Brooks, PMP                       University of California
CHESS Executive Director                      US Mail: 337 Cory Hall
Programmer/Analyst CHESS/Ptolemy/Trust        Berkeley, CA 94720-1774
ph: 510.643.9841                                (Office: 545Q Cory)
home: (F-Tu) 707.665.0131 cell: 707.332.0670 </pre>
  </body>
</html>