void BingoPgIndex::readXyzItem(int section_idx, int mol_idx, indigo::Array<char>& xyz_buf) { /* * Prepare info for reading */ BingoPgSection& current_section = _jumpToSection(section_idx); int map_block_idx = mol_idx / BINGO_MOLS_PER_MAPBLOCK; int map_mol_idx = mol_idx % BINGO_MOLS_PER_MAPBLOCK; BingoPgBufferCacheMap& map_cache = current_section.getMapBufferCache(map_block_idx); elog(DEBUG1, "bingo: index: read xyz: start read structure %d for section = %d", mol_idx, section_idx); /* * Get xyz item */ ItemPointerData xyz_item; map_cache.getXyzItem(map_mol_idx, xyz_item); /* * Check for correct block num */ dword block_num = ItemPointerGetBlockNumber(&xyz_item); if(block_num == InvalidBlockNumber) { xyz_buf.clear(); elog(DEBUG1, "bingo: index: read xyz: xyz is empty for structure %d for section = %d", mol_idx, section_idx); return; } unsigned short block_offset = ItemPointerGetOffsetNumber(&xyz_item); /* * Read xyz buffer for a given offset */ BingoPgBufferCacheBin& bin_cache = current_section.getBinBufferCache(block_num); bin_cache.readBin(block_offset, xyz_buf); elog(DEBUG1, "bingo: index: read xyz: successfully read xyz of size %d for block %d offset %d", xyz_buf.size(), block_num, block_offset); }
void BingoPgIndex::readDictionary(indigo::Array<char>& dictionary) { dictionary.clear(); if(_metaInfo.n_blocks_for_dictionary == 0) return; indigo::Array<char> buffer_dict; int block_size = _metaInfo.n_blocks_for_dictionary + _metaInfo.offset_dictionary; /* * Read all buffers for dictionary */ for (int block_idx = _metaInfo.offset_dictionary; block_idx < block_size; ++block_idx) { BingoPgBufferCacheBin buffer_cache(block_idx, _index, false); /* * Read and concat buffers */ buffer_cache.readBin(0, buffer_dict); dictionary.concat(buffer_dict); } }