Class Storage

  extended by org.jcae.mesh.oemm.Storage
Direct Known Subclasses:

public class Storage
extends java.lang.Object

This class converts between disk and memory formats. MeshOEMMIndex is an example to show how to convert a triangle soup into an out-of-core mesh data structure. When an OEMM is generated on disk, octants can be loaded and unloaded on demand. An OEMM instance is first created by calling readOEMMStructure(java.lang.String). Then MeshReader.buildMesh(TIntHashSet) can be called to select which octants are loaded into memory. As can be seen in readOEMMStructure(java.lang.String), OEMM instances are serialized on disk. But this is different with partial mesh data structure. Each child octant has a local number between 0 and 7 depending on its spatial localization. A similar structure is kept on disk, each child octant is put into a seperate directory named after its number. Octant leaves contain vertex and triangle data. A file with a "v" suffix contains coordinates of vertices stored as 3 double values. A file with a "a" suffix contains for each vertex the list of leaves which are connected to this vertex. This allows setting readable and writable attributes, as explained in original paper. A file with a "t" suffix contains for each triangle 6 int values, the first 3 are leaf numbers for its 3 vertices, and last 3 are local vertex number in their respective leaf.

Field Summary
protected static int TRIANGLE_SIZE
          Number of bytes per triangle.
protected static int VERTEX_SIZE
          Number of bytes per vertex.
Constructor Summary
Method Summary
protected static getAdjacencyFile(OEMM oemm, OEMM.Node node)
protected static getTrianglesFile(OEMM oemm, OEMM.Node node)
protected static getVerticesFile(OEMM oemm, OEMM.Node current)
protected static java.util.List<TIntArrayList> readAdjacencyFile(OEMM oemm, OEMM.Node node, TIntHashSet storedLeaves)
          Read adjacency file and returns List of adjacent nodes without nodes that are loaded.
static OEMM readOEMMStructure(java.lang.String dir)
          Creates an OEMM instance from its disk representation.
static void saveNodes(OEMM oemm, Mesh mesh, TIntHashSet storedLeaves)
          Saves mesh on the disk into octree structure.
static void storeOEMMStructure(OEMM oemm)
          Stores an OEMM instance to its disk representation.
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Field Detail


protected static final int TRIANGLE_SIZE
Number of bytes per triangle. On disk a triangle is represented by

See Also:
Constant Field Values


protected static final int VERTEX_SIZE
Number of bytes per vertex. On disk a vertex is represented by 3 double (coordinates).

See Also:
Constant Field Values
Constructor Detail


public Storage()
Method Detail


public static OEMM readOEMMStructure(java.lang.String dir)
Creates an OEMM instance from its disk representation.

dir - directory containing disk representation
an OEMM instance


public static void storeOEMMStructure(OEMM oemm)
Stores an OEMM instance to its disk representation.

oemm - stored object


public static void saveNodes(OEMM oemm,
                             Mesh mesh,
                             TIntHashSet storedLeaves)
Saves mesh on the disk into octree structure. The o-nodes, that will be saved, are deduced from mesh (from position of vertices).

oemm - OEMM instance
mesh - mesh to be stored onto disk
storedLeaves - set of leaves to store TODO There is no support for moving vertices into another octree node.


protected static getAdjacencyFile(OEMM oemm,
                                               OEMM.Node node)


protected static getTrianglesFile(OEMM oemm,
                                               OEMM.Node node)


protected static getVerticesFile(OEMM oemm,
                                              OEMM.Node current)


protected static java.util.List<TIntArrayList> readAdjacencyFile(OEMM oemm,
                                                                 OEMM.Node node,
                                                                 TIntHashSet storedLeaves)
Read adjacency file and returns List of adjacent nodes without nodes that are loaded.

oemm - OEMM instance
node - OEMM node
storedLeaves - set of node indices being loaded
a List instance; for each vertex, returns indices of adjacent and non-loaded nodes