void collect_tree_nodes_recursive(CIndexBlock* subtree_root_block, vector<block_tree_node_t>* tree_nodes) { CList* sub_blocks = subtree_root_block->get_sub_blocks(); if (sub_blocks->get_num_elements()>0) { CIndexBlock* iterator = (CIndexBlock*)sub_blocks->get_first_element(); do { SG_SDEBUG("Block [%d %d] \n",iterator->get_min_index(), iterator->get_max_index()) tree_nodes->push_back(block_tree_node_t(iterator->get_min_index(),iterator->get_max_index(),iterator->get_weight())); if (iterator->get_num_sub_blocks()>0) collect_tree_nodes_recursive(iterator, tree_nodes); SG_UNREF(iterator); } while ((iterator = (CIndexBlock*)sub_blocks->get_next_element()) != NULL); } SG_UNREF(sub_blocks); }
SGVector<index_t> CIndexBlockGroup::get_SLEP_ind() { check_blocks_list(m_blocks); int32_t n_sub_blocks = m_blocks->get_num_elements(); SG_DEBUG("Number of sub-blocks = %d\n", n_sub_blocks) SGVector<index_t> ind(n_sub_blocks+1); CIndexBlock* iterator = (CIndexBlock*)(m_blocks->get_first_element()); ind[0] = 0; int32_t i = 0; do { ind[i+1] = iterator->get_max_index(); SG_UNREF(iterator); i++; } while ((iterator = (CIndexBlock*)m_blocks->get_next_element()) != NULL); //ind.display_vector("ind"); return ind; }