# 11.5.2 Multi-Dimensional Arrays

Topic Version | 1 | Published | 09/11/2015 | |

For Standard | RESQML v2.0.1 |

Although it may seem reasonable to always merge all objects of the same type into a single long array, this is not always advantageous. For column-layer grids, cells and nodes consist of multi-dimensional arrays, which should be stored in this fashion in HDF5 to facilitate hyper-slabbing and rapid data access. To retain this capability for the bulk of the model data, truncation cells and split and truncation nodes are stored as separate patches, although when indexed, the total count of cells and nodes each includes the multi-dimensional plus the one-dimensional counts. The schema is constrained to have a patch index of 0 for the grid representation itself, so that the relative patch ordering always starts with the multi-dimensional patch, i.e., 2D+1D nodes, not 1D+2D.

As with all RESQML representations, each element of a multi-dimensional array within a grid must have a well-defined 1D index (for more information, see 6.2 Indexing ). For example for a two dimensional array (N1 x N2) with indices I1=0,…,N1-1 and I2=0,…,N2-1, then the 1D index is I1+N1*I2. For a three dimensional array (N1 x N2 x N3) with indices I1=0,…,N1-1, I2=0,…,N2-1 and I3=0,…,N3-1, the 1D index is I1+N1*I2+N1*N2*I3. This ordering choice is sometimes called “fastest to slowest”, with the first index varying the fastest, and the last index varying the slowest. RESQML is not restricted to three dimensional arrays, for example, the nodes per cell on an IJK grid follow a 5D (4 x 2 x NI x NJ x NK) array indexing. The equivalent array in RESQML v1 followed a 6D (2 x 2 x 2 x NI x NJ x NK) array indexing, but unlike RESQML v2, it was never necessary to reduce that multi-dimensional array index to a single 1D index.

Examples of multi-dimensional arrays include the coordinate line nodes on a faulted grid, where N1=CoordinateLineCount and N2=NKL. However, the dimensionality of an array may vary with context; for example, the coordinate lines themselves may be either a 1D or a 2D array. In the special case of an unfaulted IJK grid, the coordinate lines are a 2D array indexed by NIL x NJL and the coordinate line nodes are a 3D array indexed by NIL x NJL x NKL.