Sascha Roloff <sascha.rol...@googlemail.com> wrote on 03/24/2011 08:54:55
AM:
>
> Can anybody give me a working example of copying data from a RemoteArray
to
> a local Array?
>

Hi,

Here's an example pulled from our nightly regression test suite.


    public def run() {
       val localA = new Array[int](R1,(p:Point)=>p(0));
       val localB = new Array[int](R2,(p:Point(2))=>10*p(1)+p(0));
       val remoteA = at (here.next()) new RemoteArray[int](new Array
[int](R1));
       val remoteB = at (here.next()) new RemoteArray[int](new Array
[int](R2));
       val finalA = new Array[int](R1);
       val finalB = new Array[int](R2);
       var fail:boolean = false;

       finish {
         Array.asyncCopy(localA, 0, remoteA, 0, 81);
         Array.asyncCopy(localB, remoteB);
       }
       finish {
         Array.asyncCopy(remoteA, 0, finalA, 0, 81);
         Array.asyncCopy(remoteB, finalB);
       }

       for (p in localA) {
         if (localA(p) != finalA(p)) {
             Console.OUT.println("Expected to find "+localA(p)+" at "+p+"
but fo
und "+finalA(p));
             fail = true;
         }
       }

       for (p in localB) {
         if (localB(p) != finalB(p)) {
             Console.OUT.println("Expected to find "+localB(p)+" at "+p+"
but fo
und "+finalB(p));
             fail = true;
         }
       }
------------------------------------------------------------------------------
Enable your software for Intel(R) Active Management Technology to meet the
growing manageability and security demands of your customers. Businesses
are taking advantage of Intel(R) vPro (TM) technology - will your software 
be a part of the solution? Download the Intel(R) Manageability Checker 
today! http://p.sf.net/sfu/intel-dev2devmar
_______________________________________________
X10-users mailing list
X10-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/x10-users

Reply via email to