in GraphSampling/meshPooler.h [122:197]
void compute_pool_and_unpool_map(int stride=2, int radius_pool=1, int radius_unpool=1)
{
//first check connection map is ok
if(is_connection_map_good()==false)
return;
cout<<"stride: "<<stride<<", radius pool: "<<radius_pool<<", radius unpool: "<<radius_unpool;
//cout<<"Get center points lst.\n";
//step 1 get sample point list with stride S (for both pool and unpool)
//sample the centers so that no other centers in radius (S-1) of each center
//center_points_lst contains the old indices of the center points
_center_lst = get_center_points_lst(stride);
cout<<"Center points number: "<<_center_lst.size()<<"\n";
//also get old to new list
int original_num=_connection_map.size();
for(int i=0;i<original_num;i++)
_old2new_index_lst.push_back(-1);
for(int i=0;i<_center_lst.size();i++)
_old2new_index_lst[_center_lst[i]]=i;
//cout<<"Get pool map.\n";
//step 2 get pc to center map (center*pc) with radius radius_pool for pooling
//length center num
//map[i] contains the list of old indices of connected points for new center i
//map[i][j] is [index, distance]
_pool_map = get_center_to_pc_map( _center_lst, radius_pool);
//cout<<"Get unpool map.\n";
//step 3 get center to pc map (pc*center) with radius radius_unpool for unpooling
//length center num
//map[i] contains the list of old indices of connected points for new center i
//map[i][j] is [index, distance]
vector<vector<Int2>> unpool_map_T = get_center_to_pc_map( _center_lst, radius_unpool);
_unpool_map = get_transposed_map (unpool_map_T, original_num);
//cout<<"Get center to center map.\n";
//step 4 get new (center to center) connection map
//radius = 1 among centers.
//length center num
//map[i] contains the list of new indices of connected centers for center i
_center_center_map = get_center_to_center_map(_center_lst, stride);
//update _must_include_center_lst_nex_index
_must_include_center_lst_new_index.clear();
for (int i=0;i<_must_include_center_lst.size();i++)
{
int old_index= _must_include_center_lst[i];
int new_index = _old2new_index_lst[old_index];
if(new_index == -1)
{
cout<<"Error while updating _must_include_center_lst_new_index!!!! The index is -1 in _old2new_index_lst. Very likely they are not included in the center_lst!\n";
return;
}
else
{
_must_include_center_lst_new_index.push_back(new_index);
}
}
return;
}