Package cds.healpix
Class HealpixNestedBMOC
java.lang.Object
cds.healpix.HealpixNestedBMOC
- All Implemented Interfaces:
Iterable<HealpixNestedBMOC.CurrentValueAccessor>
public final class HealpixNestedBMOC
extends Object
implements Iterable<HealpixNestedBMOC.CurrentValueAccessor>
A BMOC is a MOC storing for each element a binary value telling if the cell is PARTIALY or
FULLY covered by a region.
Internally, a long is made of bits:
BBBBxx...xxS00...00F if depth < depthMax
BBBBxx...xxxx...xxSF if depth = dephtMax
With:
Internally, a long is made of bits:
BBBBxx...xxS00...00F if depth < depthMax
BBBBxx...xxxx...xxSF if depth = dephtMax
With:
- B: the 4 bits coding the base hash [0- 11]
- xx: the 2 bits of level x
- S: the sentinel bit coding the depth
- 00: if (depth != depthMax) those bits are unused bits
- F; the flag bit (0: partial, 1: full)
- Author:
- F.-X. Pineau
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceProvides informations on the current element of the BMOC while iterating over it.static enumTells if an element of the MOC is covered or not by a region and, if covered, it tells is the element is partially or fully covered. -
Method Summary
Modifier and TypeMethodDescriptionstatic final longbuildValue(int depth, long hash, boolean isFull, int depthMax) Creates a specific hash encoding the hash value at the given depth, the depth and the status flag.longReturns the number of cells at depthgetDepthMax()the moc contains, i.e.static HealpixNestedBMOCcreateCheck(int mocDepth, long[] mocCells) Same acreateUnsafe(int, long[])except that the properties (array sorted, no duplicates, no cell included into an other one) is checked.static HealpixNestedBMOCcreateCheck(int mocDepth, long[] mocCells, int toIndex) Same ascreateCheck(int, long[])except that not we do not use the full array.static HealpixNestedBMOCcreatePacking(int mocDepth, long[] mocCells) static HealpixNestedBMOCcreatePacking(int mocDepth, long[] mocCells, int toIndex) We assume here that the given array is ordered, that no element overlaps another one, but that the MOC is not normalized, i.e.static HealpixNestedBMOCcreateUnsafe(int mocDepth, long[] mocCells) Create a MOC considering that the given array is already a MOC: i.e.static HealpixNestedBMOCcreateUnsafe(int mocDepth, long[] mocCells, int toIndex) Same ascreateUnsafe(int, long[])except that not we do not use the full array.Returns an iterator on all the cells in the BMOC at the maximum depth.intReturns the BMOC deeper depth.iterator()An Iterator over hash Ranges at order 29.intsize()Returns the number of elements the moc contains, i.e.status(int depth, long hash) Returns the status of the given hash at the given depthtoDeeperDepth(int newDepth) Returns a new BMOC having a deeper depth.toLowerDepth(int newDepth) Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Method Details
-
toDeeperDepth
Returns a new BMOC having a deeper depth.- Parameters:
newDepth- the depeht of the wanted new BMOC- Returns:
- a new BMOC having a deeper depth.
-
toLowerDepth
-
size
public int size()Returns the number of elements the moc contains, i.e. the number of cells at various depth.- Returns:
- the number of elements the moc contains, i.e. the number of cells at various depth.
-
computeDeepSize
public long computeDeepSize()Returns the number of cells at depthgetDepthMax()the moc contains, i.e. the sum for each cell of the number of cells at depthgetDepthMax().- Returns:
- the number of cells at depth
getDepthMax()the moc contains, i.e. the sum for each cell of the number of cells at depthgetDepthMax().
-
createUnsafe
Create a MOC considering that the given array is already a MOC: i.e. it is sorted (ASC order) and do not contains duplicate or small cells included into larger one's. WARNING: the array is used internally, so it must not be modified by an external reference! useArrays.copy()is you are not sure!- Parameters:
mocDepth- the depth of the MOCmocCells- the array representation of the MOC- Returns:
- the MOC object storing internally the array
-
createUnsafe
Same ascreateUnsafe(int, long[])except that not we do not use the full array.- Parameters:
mocDepth- the depth of the MOCmocCells- the array representation of the MOCtoIndex- the index of the last element (exclusive) to be considered in the moc- Returns:
- the MOC object storing internally the array
-
createCheck
Same acreateUnsafe(int, long[])except that the properties (array sorted, no duplicates, no cell included into an other one) is checked.- Parameters:
mocDepth- the depth of the MOCmocCells- the array representation of the MOC- Returns:
- the MOC object storing internally the array
-
createCheck
Same ascreateCheck(int, long[])except that not we do not use the full array.- Parameters:
mocDepth- the depth of the MOCmocCells- the array representation of the MOCtoIndex- the index of the last element (exclusive) to be considered in the moc- Returns:
- the MOC object storing internally the array
-
createPacking
-
createPacking
We assume here that the given array is ordered, that no element overlaps another one, but that the MOC is not normalized, i.e. a large cell may be splitted in 4 sub-cell (each sub-cell possibly splitted in its 4 sub-cells recursively).- Parameters:
mocDepth- depth of the mocmocCells- ordered list of cellstoIndex- index of the last cell to be read in the given array of cells- Returns:
- a new moc from the input parameters, packing if necessary.
-
getDepthMax
public int getDepthMax()Returns the BMOC deeper depth.- Returns:
- the BMOC deeper depth.
-
status
Returns the status of the given hash at the given depth- Parameters:
depth- depth of the hash we want the statushash- hash for which we want the status- Returns:
- the status of the given hash at the given depth
-
buildValue
public static final long buildValue(int depth, long hash, boolean isFull, int depthMax) Creates a specific hash encoding the hash value at the given depth, the depth and the status flag.- Parameters:
depth- depth of the hash.hash- value of the hash.isFull- flag telling if the cell is fully covered or not.depthMax- maximum depth of the MOC the value will belong to.- Returns:
- a BMOC encoded hash value with its depth and status flag.
-
iterator
- Specified by:
iteratorin interfaceIterable<HealpixNestedBMOC.CurrentValueAccessor>
-
rangeIterator
An Iterator over hash Ranges at order 29.- Returns:
- an Iterator over hash Ranges at order 29.
-
flatHashIterator
Returns an iterator on all the cells in the BMOC at the maximum depth.- Returns:
- an iterator on all the cells in the BMOC at the maximum depth.
-