rlaramee
Class ASCIItoASCIIsortErrCube
java.lang.Object
|
+--rlaramee.ASCIItoASCIIsortErrCube
- public class ASCIItoASCIIsortErrCube
- extends java.lang.Object
Description The ASCIItoBinaryCubes object reads the input file. The input
file stores cubes of data in ASCII representing 3D volume
data. The reader sorts and saves the input data in binary format
to a file.
start date Wed 15 Mar 00
- Version:
- 2.0
- Author:
- Robert S Laramee
- See Also:
Methods inherited from class java.lang.Object |
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait |
fileHandler
private FileHandler fileHandler
asciiCubeParser
private ASCIIcubeParser asciiCubeParser
memory
private Memory memory
cubeArray
private Cube[] cubeArray
debug
private boolean debug
sortLevel
private byte sortLevel
ASCIItoASCIIsortErrCube
public ASCIItoASCIIsortErrCube(byte level)
- Parameters:
level
- the level of the cubes we are saving
getSortLevel
private byte getSortLevel()
- Returns:
- sortLevel the level of cubes being sorted
setSortLevel
private boolean setSortLevel(byte newLevel)
- Parameters:
sortLevel
- the level of cubes being sorted
getFileHandler
private FileHandler getFileHandler()
- Returns:
- fileHandler this object's FileHandler
setFileHandler
private boolean setFileHandler(FileHandler newFileHandler)
- Parameters:
newFileHandler
- this object's FileHandler- Returns:
- TRUE if the set was successful
getASCIIcubeParser
private ASCIIcubeParser getASCIIcubeParser()
- Returns:
- asciiCubeParser this object's ASCIIcubeParser
setASCIIcubeParser
private boolean setASCIIcubeParser(ASCIIcubeParser acp)
- Parameters:
acp
- this object's ASCIIcubeParser- Returns:
- TRUE if the set was successful
getCubeArray
private Cube[] getCubeArray()
- Returns:
- cubeArray the array that stores the cubes
setCubeArray
private boolean setCubeArray(Cube[] ca)
- Parameters:
ca
- an array that stores the cubes- Returns:
- TRUE if successful
getCubeAtArrayIndex
private Cube getCubeAtArrayIndex(int i)
- Parameters:
index
- an index into the cube array- Returns:
- Cube the cube object at the given array index
setCubeArrayIndex
private boolean setCubeArrayIndex(Cube cube,
int i)
- Parameters:
cube
- the cube being stored in the arrayi
- an array index- Returns:
- TRUE if the cube array was set
run
public boolean run(java.lang.String inputFileName,
int dimensionLength)
- The run() function starts the ASCII Cubes Reader.
- Parameters:
inputFileName
- the name of the input file to readoutputFileName
- the name of the output file to writedimensionLength
- the length of each x,y,z dimension- Returns:
- TRUE on success
sortCubeByOctant
private boolean sortCubeByOctant(Cube cube)
- Parameters:
cube
- the cube to do our sorting on- Returns:
- TRUE if the cube was sorted successfully
computeArrayIndexOfOneLevelByOctant
private int computeArrayIndexOfOneLevelByOctant(Cube cube,
int currentOffset)
- Parameters:
cube
- the cube whose array index we are computingcurrentOffset
- the offset into the array of cubes thus far- Returns:
- index the correct offset into the array of cubes
thisLevelOffsetByOctant
private int thisLevelOffsetByOctant(byte level,
byte octant)
- The cube array is ordered by octants within levels. For example,
all of the cubes that lie in octant 0 at level 6 are in array indices
[0 to (64^3 - 1)].
all of the cubes that lie in octant 1 at level 5 are in and are children
of child 0 at level 6 are in array indices
[ (0 * (64^3 - 1)) +
(1 * 32^3 to 2 * (32^3 - 1) ]
etc.
dimensions in dimensions in
level block space coordinate space level scale
----- ------------- ----------------- -----------
7 1 x 1 x 1 128 x 128 x 128 128^3
6 2 x 2 x 2 64 x 64 x 64 64^3
5 4 x 4 x 4 32 x 32 x 32 32^3
4 8 x 8 x 8 16 x 16 x 16 16^3
3 16 x 16 x 16 8 x 8 x 8 8^3
2 32 x 32 x 32 4 x 4 x 4 4^3
1 64 x 64 x 64 2 x 2 x 2 2^3
0 128 x 128 x 128 1 x 1 x 1 1^3
- Parameters:
level
- level in the octreeoctant
- the octant at that level- Returns:
- int the index into the sorted array that the cube belongs
in
writeCubeArray
private int writeCubeArray()
- This prints out all the cubes in the array
- Returns:
- writeCount the number of cubes actaully printed
main
public static void main(java.lang.String[] args)
- The main() method is what starts the sorting
- Parameters:
inputFileName
- the name of the input filelevel
- the level that the cubes are in