HarshaBangalore

Replacing iter

Discussion created by HarshaBangalore on Jun 17, 2009
Latest reply on Jun 17, 2009 by gaurav.garg
How to replace "iter" keyword of Brook language with that in Brook+ language

Here is a code in Brook programming language, which needs a replacement of "iter" keyword with respect to Brook+ programming language.

kernel void process(float Hx[][], float Chxh[][], float Chxe[][], float Ez[][], iter float2 it<>, out float o_img<>

{

     float2 t0 = float2(0.0f,1.0f);

     o_img = (Chxh[it] * Hx [it]) + (Chxe[it] * (Ez[it] - Ez[it + t0]));

}

int main(int argc, char* argv[])

{

     ----------

     ----------

     for(i = 0; i < 100; i++)

    {

         aHx = 0.0f;

         aEz = 0.0f;

         aChxh = 1.0f;

         aChxe = 1.0f;

    }

     streamRead(Hx, aHx);

     streamRead(Ez, aEz);

     streamRead(Chxhx, aChxh);

     streamRead(Chxe, aChxe);

     iter float2 it<110,110> = iter(float2(1.0f, 1.0f), float2 (499.0f,  499.0f));

     float Hx<100,100>, Ez<100,100>

     float Chxh<100,100>, Chxe<100,100>;

     float o_Hx<100,100>;

     process(Hx, Chxh, Chxe, Ez, it, o_Hx);

     streamWrite(Hx, outputHx);  //outputHx is an array

     streamWrite(Ez, outputEz);   //outputEz is an array

     -----------

     -----------

}

 

Outcomes