1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
|
/*1:*/
#line 6 "./fine_container.cweb"
#include "fine_container.h"
#include <cmath>
/*2:*/
#line 16 "./fine_container.cweb"
SizeRefinement::SizeRefinement(const IntSequence&s,int nc,int max)
{
new_nc= 0;
for(int i= 0;i<nc;i++){
int nr= s[i]/max;
if(s[i]%max!=0)
nr++;
int ss= (nr> 0)?(int)round(((double)s[i])/nr):0;
for(int j= 0;j<nr-1;j++){
rsizes.push_back(ss);
ind_map.push_back(i);
new_nc++;
}
rsizes.push_back(s[i]-(nr-1)*ss);
ind_map.push_back(i);
new_nc++;
}
for(int i= nc;i<s.size();i++){
rsizes.push_back(s[i]);
ind_map.push_back(i);
}
}
/*:2*/
#line 11 "./fine_container.cweb"
;
/*:1*/
|