[overture] Re: Indexing Problem

  • From: mostafa amini afshar <m_aminiafshar@xxxxxxxxx>
  • To: "overture@xxxxxxxxxxxxx" <overture@xxxxxxxxxxxxx>
  • Date: Fri, 23 Dec 2011 12:29:38 +0000 (GMT)

Hi Bill

Thanks for the reply.

I have added the #define BOUNDS_CHECK directive to my file, but when I try to 
get the coordinate for a point beyond the index bound using the vertex 
functionlike " mg.vertex(I1,I2,I3,axis2)(1,300,3) " , the program still gives a 
value and dose not complain. Could you please kindly tell me what is the 
problem?


Best regards
Mostafa



________________________________
 From: Bill Henshaw <henshaw@xxxxxxxx>
To: "overture@xxxxxxxxxxxxx" <overture@xxxxxxxxxxxxx> 
Sent: Tuesday, 20 December 2011, 1:17
Subject: [overture] Re: Indexing Problem
 

Hi Mostafa:
    What you have may be ok.  Bounds checking on scalar indexing is not
turned on by
default (as it slows things down).  Add #define BOUNDS_CHECK to the top
of your
file to turn it on.
      There are examples in the Overture/primer/gridPrint.C file of how
I would loop
over grid functions and index them with scalars i,j,k. There is
generally no need to 
make additional copies as you have done.

...Bill
    

mostafa amini afshar wrote: 
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: