Hello all,

I am trying to get rolling on using OpenCL for a CFD Code I am writing for my thesis. I am, unfortunately, getting stuck on what should be a fairly simple operation. I am hoping that someone will be able to help me out here.

I have a file that gives me the points on a grid (X, Y, and Z). Grid has 181 points in the X-direction (imax) and 65 in the Y-direction (jmax) (and 1 in the Z- direction). I want to build a 2-D Array of these points, since this essentially a 2-D problem (there are no calculations involving Z, but the mesh is given to me with all of the coordinates anyway.

I can read the file into a 2-D Array:

```
cl_float4** cl2DGridPoints;
cl2DGridPoints = new cl_float4*[imax];
for(i=0;i<imax;i++){
cl2DGridPoints[i] = new cl_float4[jmax];
}
for(j=0;j<jmax;j++){
for(i=0;i<imax;i++){
MeshInput >> XX >> YY >> ZZ;
cl2DGridPoints[i][j].s[0] = XX;
cl2DGridPoints[i][j].s[1] = YY;
cl2DGridPoints[i][j].s[2] = ZZ;
cl2DGridPoints[i][j].s[3] = 0.0;
}
}
```

I can then access the data on the C++ side by the following:

```
MyMesh[i][j].s[0],
MyMesh[i][j].s[1],
MyMesh[i][j].s[2],
0
```

This allows me to use the float4 in OpenCL. However, I am stuck on how to create a buffer / give the array to an OpenCL kernel.

I learned that OpenCL supports 2-D and 3-D images (which appear to have a width, height, and 4 values (RGBA) at each point), but I do not know how to use them.

Would someone be willing to assist me on this matter? I can do the 1-D arrays, but I would like to learn how to use the 2-D method since I will need to further extend this later.

Thank you in advance!

-Kevin Kennedy