Definition shapeElementCount (shape : shapeT) : N :=
  match shape with
  | SArray1D a => shapeArray1DLength a
  | SArray2D a => (shapeArray2DSizeX a) * (shapeArray2DSizeY a)
  | SArray3D a => (shapeArray3DSizeX a) * (shapeArray3DSizeY a) * (shapeArray3DSizeZ a)
  | SMesh a    => shapeMeshLength a
  end.
