We need to keep in mind, since this may be called from Fortran, that C++ stores multiple dimension arrays as row-major while Fortran stores them as column-major.  I'm planning to point to the data inside a class that will (hopefully) look at the data as a single dimension array and flag it as row- or column-major (and handle it as expected).  Keeping the C++ arrays one dimensional may also be beneficial since they will need to be dynamically allocated.  Dynamically allocated 3D arrays are typically not in contiguous memory (without extra work).  By dynamically allocating a 1D array and referencing the elements by the linear offset (which can adapt to row-major or column-major depending on a flag), we will have arrays in contiguous memory and handle the row- vs. column-major issue.

  • No labels