org.jcae.mesh.oemm
Class PAVLTreeIntArrayDup

java.lang.Object
  extended by org.jcae.mesh.oemm.PAVLTreeIntArrayDup

public class PAVLTreeIntArrayDup
extends java.lang.Object

Implementation of PAVL binary trees to store locational codes. It is based on excellent Ben Pfaff's GNU libavl. In C, the version with parent pointers (pavl) is slightly faster than avl. Even if there does not seem to be much difference in Java, we chose this version. A major improvement is to use an int array for storing nodes, so that extra memory is almost never allocated. On trees with 2 millions of nodes, this optimization gives a speedup of 5.


Constructor Summary
PAVLTreeIntArrayDup()
           
 
Method Summary
 int get(int[] ijk)
          Returns node value.
 int insert(int[] ijk, int value)
          Inserts a node associated to a value into the tree.
 void show()
          Dumps tree content.
 int size()
          Returns tree size.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PAVLTreeIntArrayDup

public PAVLTreeIntArrayDup()
Method Detail

insert

public final int insert(int[] ijk,
                        int value)
Inserts a node associated to a value into the tree.

Parameters:
ijk - integer coordinates
value - node value
Returns:
if the node is already present, returns its associated value, otherwise returns value

get

public final int get(int[] ijk)
Returns node value.

Parameters:
ijk - coordinates
Returns:
node value, or -1 if this key does not exist in the tree.

size

public int size()
Returns tree size.

Returns:
tree size.

show

public void show()
Dumps tree content.