Hi,

How can i distribute a n-dimensional array as blocks across all places and
then initialize each element of that array?

i have an array which is first declared as a 5-D array and then inside a
function the array is initialized with the appropriate distribution taking
the bounds of the region from the parameters of that function.

class ATFInitMatrix
{
var ATF_dim:Array[Int](1) = Array.make[Int](0..2);

        var ATF_rm000:Array[Double](5);

public def ATF_Init_matrix(var px:int, var py:int, var pz:int):boolean
{
 var dim5:Array[Int](1) = Array.make[Int](0..4);

        ATF_dim(0) = px;
        ATF_dim(1) = py;
        ATF_dim(2) = pz;

    /* Allocate dynamic arrays */
    dim5(0) = ATF_dim(0)+2;
    dim5(1) = ATF_dim(1)+2;
    dim5(2) = ATF_dim(2)+2;
    dim5(3) = 1;
    dim5(4) = 1;

    val R1 = [0..dim5(0), 0..dim5(1),0..dim5(2),0..dim5(3),0..dim5(4)];
    val D1  = Dist.makeBlock(R1, 0);

    ATF_rm000 = Array.make[Double](D1);
}

public def ATF_Reset():boolean
{
     finish ateach(val p(i,j,k,l,n): Point(5) in ATF_rm000.dist)
    {
           ATF_rm000(p) = 0.0;
    }
}

The ATF_Reset function throws a badplaceexception. What are the options
available to do this. should i declare the ATF_rm000 array as a val instead
of var, in which case how do i declare first and initialize later or is
there another approach.

Please advice.

Thanks,
Sarat
University of Houston
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
X10-users mailing list
X10-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/x10-users

Reply via email to