<<>> <> <> <> DIRECTORY G2dBasic, G3dBasic, RefTab, Rope; G3dVoxel: CEDAR DEFINITIONS ~ BEGIN <> ROPE: TYPE ~ Rope.ROPE; Table: TYPE ~ RefTab.Ref; Nat3: TYPE ~ G2dBasic.Nat3; Type: TYPE ~ {hash, array}; Triple: TYPE ~ G2dBasic.Triple; -- a point in space RealSequence: TYPE ~ G2dBasic.RealSequence; -- sequence of x RealSequenceRep: TYPE ~ G2dBasic.RealSequenceRep; Box: TYPE ~ G3dBasic.Box; -- bounding box <> Error: SIGNAL [reason: ATOM]; <> Refs: TYPE ~ RECORD [SEQUENCE maxLength: CARDINAL OF REF]; Refs2d: TYPE ~ RECORD [SEQUENCE maxLength: CARDINAL OF REF Refs]; Refs3d: TYPE ~ RECORD [SEQUENCE maxLength: CARDINAL OF REF Refs2d]; Voxels: TYPE ~ REF VoxelsRep; VoxelsRep: TYPE ~ RECORD [ name: ROPE ¬ NIL, -- name of Voxels type: Type ¬ hash, -- type of Voxels hashTable: RefTab.Ref ¬ NIL, -- hash table size: Nat3 ¬ [0, 0, 0], -- size of array array: REF Refs3d ¬ NIL, -- array clientData: REF ANY ¬ NIL -- for miscellaneous data ]; CreateVoxels: PROC [sparse: BOOL ¬ TRUE, size: Nat3 ¬ [0, 0, 0], name: ROPE ¬ NIL] RETURNS [Voxels]; <> <> <> Store: PROC [voxels: Voxels, address: Nat3, voxel: REF]; <> <> <> RetrieveFromVoxels: PROC [voxels: Voxels, address: Nat3] RETURNS [REF]; <> <> <> <> Reals2d: TYPE ~ REF Reals2dRep; -- sequence of [x][y] Reals3d: TYPE ~ REF Reals3dRep; -- sequence of [x][y][z] Reals2dRep: TYPE ~ RECORD [ length: CARDINAL ¬ 0, element: SEQUENCE maxLength: CARDINAL OF RealSequence]; Reals3dRep: TYPE ~ RECORD [ length: CARDINAL ¬ 0, element: SEQUENCE maxLength: CARDINAL OF Reals2d]; RealProc: TYPE ~ PROC [ref: REF ANY] RETURNS [value: REAL]; Grid: TYPE ~ REF GridRep; GridRep: TYPE ~ RECORD [ res: Nat3 ¬ [], -- resolution of data evenlySpaced: BOOL ¬ TRUE, -- if spacing is constant scale: Triple ¬ [], -- scale factor for indexing box: Box ¬ [], -- domain of the grid x, y, z: RealSequence ¬ NIL, -- indices along the three axes values: Reals3d ¬ NIL, -- functional values clientData: REF ¬ NIL -- for miscellaneous data ]; CreateGrid: PROC [ values: Reals3d, -- values at the grid points box: Box ¬ [], -- domain of the grid, presuming equal spacing x, y, z: RealSequence ¬ NIL, -- domain of the grid, presuming unequal spacing clientData: REF ¬ NIL] RETURNS [Grid]; <> <> SetGridBox: PROC [grid: Grid, box: Box]; <> <<>> AllocateGridValues: PROC [res: Nat3] RETURNS[Reals3d]; <> <<>> PointFromIJK: PROC [grid: Grid, i, j, k: NAT] RETURNS [Triple]; <> <<>> RetrieveFromGrid: PROC [grid: Grid, q: Triple] RETURNS [REAL]; <> <<>> ReadGridFromFile: PROC [fileName: ROPE] RETURNS [Grid]; <> < >> <> <> <> <> <> <> <> <> <> <> <<>> WriteGridToFile: PROC [grid: Grid, fileName: ROPE, comment: ROPE ¬ NIL]; <> <<>> GridFromVoxels: PROC [voxels: Voxels, realProc: RealProc] RETURNS [Grid]; <> <<>> END.