domian, stream, array
eg:
//--------------------------------------------------------
Kernel:
kernel void
domainAdd(double inCCCCCC,double inputStream[][], out double o[][])
{
int2 position = instance().xy;
int i=position.x;
int j=position.y;
o=inputStream+1.0;
}
kernel void
domainAddStream(double inCCCCCC,double inputStream<>, out double o<>
{
o=inputStream+1.0;
}
//-------------------------------------------------
the main:
int blockSize=128;
#define real double
const unsigned int width = blockSize;
const unsigned int height = blockSize;
// Specifying the size of the 2D stream
unsigned int streamSize[] = {width, height};
// Specifying the rank of the stream
unsigned int rank = 2;
real* outputBuffer = new real[width * height];
memset(outputBuffer, 0, width * height * sizeof(real));
real* inputBuffer = new real[width * height];
memset(inputBuffer, 1, width * height * sizeof(real));
// Create a 2D stream of specified size i.e. 64x64 floating-point values
brook::Stream<real> *outputStream;
outputStream=new Stream<real>(rank, streamSize);
brook::Stream<real> inputStream(rank, streamSize);
inputStream.read(inputBuffer);
unsigned int start[] = {5,0};//(width,height)
unsigned int end[] = {16,4};
//domainAdd(1.0,inputStream.domain(start,end),outputStream->domain(start,end));// this will get the wrong answer
domainAddStream(1.0,inputStream.domain(start,end),outputStream->domain(start,end));