#include #include #include #include extern "C" void get_iblk_ids(int *ichando, int *nchdo, int* mt, int *iblk, int *nblk ) { assert( *nchdo > 0 ); std::vector ibands; for(int i=0; i< *nchdo; ++i) { int isig = ichando[i] ; assert( isig >= 1 && isig <= 32); if( isig > 16 && isig < 25) { //difference signals ibands.push_back( 2*(isig-17)+1 ); ibands.push_back( 2*(isig-17)+2 ); } else if( isig >= 25 && isig <= 32) { ibands.push_back(17); // this is the sun sensor } else { ibands.push_back(isig); } } std::sort(ibands.begin(),ibands.end() ); std::vector::iterator new_end = std::unique(ibands.begin(), ibands.end() ); *nblk = (int)std::distance(ibands.begin(), new_end); assert( *nblk <= *mt ); std::copy(ibands.begin(), new_end, iblk); }