Previous : Contents : Next

### Overview

The IRIS Explorer *Lattice* data type is a generalised multi-dimensional array. It differs from arrays in other languages by being able to store both node-based values **and** coordinate information for each of the nodes. Being extremely flexible, it is the most commonly used data type in IRIS Explorer, used almost exclusively to store data and pass it between modules.

The *Data* part of a lattice can be multi-dimensional. If required, multiple data values can be stored at each node.

The *Coordinate* part of a lattice can have a varying number of dimensions, dependent on the number of dimensions that the data space occupies. There are three different types of coordinate information:

`Uniform``Perimeter``Curvilinear`

### The Uniform Lattice

The *uniform* lattice type has the most simple coordinate specification. The coordinates part is specified as a pair of limits for each spatial dimension. The nodes will be evenly spaced between these limits, so the data must reside on an orthogonal grid with constant spacing in each direction (e.g. a 2D image).

Figure 10.1: An Example Uniform Lattice

### The Perimeter Lattice

The *perimeter* lattice type is used when the coordinates use an orthogonal grid but the spacing is variable (e.g. a logarithmic grid), so each dimension requires a vector of locations for the nodes.

Figure 10.2: An Example Perimeter Lattice

### The Curvilinear Lattice

The curvilinear lattice is used for more complex coordinate requirements. In it, the coordinates for each individual node are specified. Although the data must reside on a grid, it does not have to be orthogonal or regularly spaced (e.g. the output from a computational fluid dynamics calculation). Also, the dimensionality of the coordinate space and physical space can be different.

Figure 10.3: An Example Curvilinear Lattice

### Lattice Components

Internally, lattices are stored as structures containing all the information IRIS Explorer needs. It is normal to use the parts of the structure to describe the format of the lattice, so it is worth understanding what the structure contains

`nDim`: number of computational dimensions`dims`: vector containing number of nodes in each dimension`nDataVar`: number of data variables at each node`primType`: primitive type of data (byte, short, long, float or double)`coordType`: type of node coordinates (uniform, perimeter or curvilinear)`nCoordVar`: number of coordinate variables at each node

### Some Lattice Examples

- nDim = 2
- dims = [9, 5]
- nDataVar = 1
- primType = short
- coordType = uniform

- nDim = 3
- dims = [6, 5, 4]
- nDataVar = 3
- primType = double
- coordType = perimeter

A particle trajectory in 3D space

- nDim = 1
- dims = [7]
- nDataVar = 1
- primType = float
- coordType = curvilinear
- nCoordVar = 3

### The Lattice File Format

Lattices can be written to file using the *WriteLat* module and read using the *ReadLat* module. These use ASCII text file format, enabling users familiar with the structure of lattices to examine a data file using a standard text editor. The format is as follows.

- 1. The first line of the file must be:

`#!/usr/explorer/bin/explorer cxLattice plain 1.0`

2. Comment lines begin with a `#' character, and whitespace is ignored. The file may contain multiple data structures (or steps).

3. The file should contain the following fields, in this order**nDim**: number of dimensions of the input lattice.**dims**: vector of dimensions of the input lattice.**nDataVar**: number of data variables at each node of the lattice.**primType**: primitive type of data (0 = byte, 1 = short, 2 = long, 3 = float, 4 = double).**coordType**: type of coordinates (0 = uniform, 1 = perimeter, 2 = curvilinear).**nSteps**: number of data structures in the file.**nCoordVar**: number of coordinate variables.*This variable must only be present in the file if the coordinate type is*`curvilinear`*.***coordinate values**: For uniform lattices, these are the bounding box values; for perimeter values these are the values of the edge points. For curvilinear lattices the coordinate values are arranged in row-major format (i.e. I varying fastest). See the IRIS Explorer Module Writer's Guide for a description of lattice coordinate arrays.**data values**(for step = 1, .., nSteps) : Data vector at each node, again with I varying fastest.

Previous : Contents : Next