[overture] Indexing Problem

  • From: mostafa amini afshar <m_aminiafshar@xxxxxxxxx>
  • To: "overture@xxxxxxxxxxxxx" <overture@xxxxxxxxxxxxx>
  • Date: Sun, 18 Dec 2011 09:42:49 +0000 (GMT)

Hi everyone

I am trying to index all elements in 3D mappedgridfunction arrays. Actually the 
intention is to loop over all elements one by one using i,j and k indexing as 
follows. 


I am doubtful if i am correctly 
indexing the elements as when i set  index values larger than the length of the 
array index, the program still runs!.  
I would highly appreciate it if anyone can tell me whether I am indexing the 
elements in a proper way.

Best regards
Mostafa


    realArray zco(I1.length(),I2.length(),I3.length());
    zco=mg.vertex()(I1,I2,I3,axis2);

    realArray xco(I1.length(),I2.length(),I3.length());
    xco=mg.vertex()(I1,I2,I3,axis1);

    realArray yco(I1.length(),I2.length(),I3.length());
    yco=mg.vertex()(I1,I2,I3,axis3);

    realArray function(I1.length(),I2.length(),I3.length());
    function=fxyz[grid](I1,I2,I3);

    realArray difference(I1.length(),I2.length(),I3.length());
    difference=zco-fxyz[grid](I1,I2,I3);

    for(int i=12;i<=12;i++)
       {
         for(int k=1;k<=1;k++)
           {
         for(int j=0;j<=I2.getBound();j++)
           {   

                                   
    if((difference(i,j+1,k)>0 and difference(i,j,k)<0) or 
(difference(i,j+1,k)<0 and difference(i,j,k)>0))
                                             {

                                                    .....................

Other related posts: