The following does not look good just now.

To move a tensor across a facet from one zone to a neighboring zone requires coordinate transformations. A tensor with k indexes is a k dimensional array of floats and requires k superscript or subscript values to access a floating value. I am inclined to do a run-time transformation driven by a list of bits, each bit indicating whether the next index is a subscript or subscript.

The 2 transformation matrices can be computed after the ds2’s of the adjacent zones are known. The logic of this code breaks down each zone into facets, designated by their vertex numbers. By sorting techniques these facets from neighbor zones are brought together and mated except for facets on the boundary of the complex. The altered code computes the coordinate transformation between the zone coordinate system and facet coordinate system. When mating occurs this transformation is completed in the form of a transformation between bcc systems of the respective neighbors. This transformation, and its inverse is kept with the facet information.

Each zone knows its vertices in the order of the magnitude of their global vertex numbers. Each zone and each vertex uses its first vertex as origin. This limits the possible vertex permutations between zones.

The Ocaml Tensor

I am now skeptical about the following interesting ideas. They do not address multiplication and contraction of tensor values. They do not suggest the exploitation of symmetries that may be necessary. We shall wait to see what operations we actually need.

I begin here to construct tensors with the same OCaml tools that work well for division algebras. The OCaml module defines one (or a few) abstracted data types and holds the code that is privileged to see inside those types. The OCaml functor is a compile time mapping of a module to another module. For the division algebras the functor G takes us up a grade—from the complex numbers to the quaternions, for instance.
The following prose is garbled but I want to work on the math just now:
I presume that for each integer p and integer q, the tensors of covariant rank p and contravariant rank q are owned by a module I propose here two functors, one which tensors of some particular rank to the tensors with an additional super-script. The other functor leads to an additional sub-script.

module type Tensor = sig
   type tensor

module U = functor (Ten: Tensor) -> struct
   type tensor = Ten.tensor array

module D = functor (Ten: Tensor) -> struct
   type tensor = Ten.tensor array

module Scalar = struct
   type tensor = float

module Tdd = D(D(Scalar));;