@Override public LocationIndex prepareIndex() { if (initialized) throw new IllegalStateException("Call prepareIndex only once"); StopWatch sw = new StopWatch().start(); prepareAlgo(); // in-memory preparation InMemConstructionIndex inMem = getPrepareInMemIndex(); // compact & store to dataAccess dataAccess.create(64 * 1024); try { inMem.store(inMem.root, START_POINTER); flush(); } catch (Exception ex) { throw new IllegalStateException("Problem while storing location index. " + Helper.getMemInfo(), ex); } float entriesPerLeaf = (float) inMem.size / inMem.leafs; initialized = true; logger.info("location index created in " + sw.stop().getSeconds() + "s, size:" + Helper.nf(inMem.size) + ", leafs:" + Helper.nf(inMem.leafs) + ", precision:" + minResolutionInMeter + ", depth:" + entries.length + ", checksum:" + calcChecksum() + ", entries:" + Arrays.toString(entries) + ", entriesPerLeaf:" + entriesPerLeaf); return this; }
@Test public void testInMemIndex3() { LocationIndexTree index = createIndexNoPrepare(createTestGraph(encodingManager), 10000); index.prepareAlgo(); LocationIndexTree.InMemConstructionIndex inMemIndex = index.getPrepareInMemIndex(); assertEquals(IntArrayList.from(new int[]{64, 4}), index.getEntries()); assertEquals(33, inMemIndex.getEntriesOf(0).size()); assertEquals(69, inMemIndex.getEntriesOf(1).size()); assertEquals(0, inMemIndex.getEntriesOf(2).size()); index.dataAccess.create(1024); inMemIndex.store(inMemIndex.root, LocationIndexTree.START_POINTER); assertEquals(1 << 20, index.getCapacity()); QueryResult res = index.findClosest(-.5, -.5, EdgeFilter.ALL_EDGES); assertEquals(1, res.getClosestNode()); }
inMemIndex.store(inMemIndex.root, LocationIndexTree.START_POINTER);
intIndex = store(subEntry, beforeIntIndex); if (intIndex == beforeIntIndex)
intIndex = store(subEntry, beforeIntIndex); if (intIndex == beforeIntIndex) { dataAccess.setInt(refPointer, 0);
intIndex = store(subEntry, beforeIntIndex); if (intIndex == beforeIntIndex) { dataAccess.setInt(refPointer, 0);
try inMem.store(inMem.root, START_POINTER); flush(); } catch (Exception ex)
@Override public LocationIndex prepareIndex() { if (initialized) throw new IllegalStateException("Call prepareIndex only once"); StopWatch sw = new StopWatch().start(); prepareAlgo(); // in-memory preparation InMemConstructionIndex inMem = getPrepareInMemIndex(); // compact & store to dataAccess dataAccess.create(64 * 1024); try { inMem.store(inMem.root, START_POINTER); flush(); } catch (Exception ex) { throw new IllegalStateException("Problem while storing location index. " + Helper.getMemInfo(), ex); } float entriesPerLeaf = (float) inMem.size / inMem.leafs; initialized = true; logger.info("location index created in " + sw.stop().getSeconds() + "s, size:" + Helper.nf(inMem.size) + ", leafs:" + Helper.nf(inMem.leafs) + ", precision:" + minResolutionInMeter + ", depth:" + entries.length + ", checksum:" + calcChecksum() + ", entries:" + Arrays.toString(entries) + ", entriesPerLeaf:" + entriesPerLeaf); return this; }
@Override public LocationIndex prepareIndex() { if (initialized) throw new IllegalStateException("Call prepareIndex only once"); StopWatch sw = new StopWatch().start(); prepareAlgo(); // in-memory preparation InMemConstructionIndex inMem = getPrepareInMemIndex(); // compact & store to dataAccess dataAccess.create(64 * 1024); try { inMem.store(inMem.root, START_POINTER); flush(); } catch (Exception ex) { throw new IllegalStateException("Problem while storing location index. " + Helper.getMemInfo(), ex); } float entriesPerLeaf = (float) inMem.size / inMem.leafs; initialized = true; logger.info("location index created in " + sw.stop().getSeconds() + "s, size:" + Helper.nf(inMem.size) + ", leafs:" + Helper.nf(inMem.leafs) + ", precision:" + minResolutionInMeter + ", depth:" + entries.length + ", checksum:" + calcChecksum() + ", entries:" + Arrays.toString(entries) + ", entriesPerLeaf:" + entriesPerLeaf); return this; }
intIndex = store(subEntry, beforeIntIndex); if (intIndex == beforeIntIndex) { dataAccess.setInt(refPointer, 0);
inMemIndex.store(inMemIndex.root, LocationIndexTree.START_POINTER);