src/bbox.c
static void bbox_flat(struct bbox *bb, struct intv *itv, int bpd)
{
    int dims = bb->num_dims;
    bitmask_t *sfc_coord;
    int i, j, k;
    uint64_t index;

    // sfc_coord = malloc(sizeof(bitmask_t)*dims);
    /*
    bb->lb.c[0], c[1], c[2]...c[dims]
    bb->ub.c[0], c[1], c[2]...c[dims]
    */
    // itv->lb = ~(0UL);   //TODO for 64 bits
    itv->lb = ~(0ULL); // TODO for 64 bits
    itv->ub = 0;

    // initialize sfc_coord: all the possible 2-based number with dims bits
    sfc_coord = malloc(sizeof(bitmask_t) * dims); // TODO free resource
    for(i = 0; i < (1 << dims); i++) {
        j = 0;
        for(k = 0; k < dims; k++) {
            sfc_coord[k] = bb->lb.c[k];
        }
        while(j < dims) {
            if(i & (1 << j))
                sfc_coord[j] = bb->ub.c[j];
            j++;
        }
        index = hilbert_c2i(dims, bpd, sfc_coord);
        if(index < itv->lb)
            itv->lb = index;
        else if(index > itv->ub)
            itv->ub = index;
    }
    free(sfc_coord);
}
/*
  Tranlate a bounding bb box into a 1D inteval using a SFC.
  Assumption: bb has the same size on all dimensions and the size is a
  power of 2.
*/
Tranlate a bounding bb box into a 1D inteval using a SFC.
Assumption: bb has the same size on all dimensions and the size is a
power of 2.
Tranlate a bounding bb box into a 1D inteval using a SFC . Assumption : bb has the same size on all dimensions and the size is a power of 2 .
static void bbox_flat(struct bbox *bb, struct intv *itv, int bpd)
{
    int dims = bb->num_dims;
    bitmask_t *sfc_coord;
    int i, j, k;
    uint64_t index;
    itv->lb = ~(0ULL); 
    itv->ub = 0;
    sfc_coord = malloc(sizeof(bitmask_t) * dims); 
    for(i = 0; i < (1 << dims); i++) {
        j = 0;
        for(k = 0; k < dims; k++) {
            sfc_coord[k] = bb->lb.c[k];
        }
        while(j < dims) {
            if(i & (1 << j))
                sfc_coord[j] = bb->ub.c[j];
            j++;
        }
        index = hilbert_c2i(dims, bpd, sfc_coord);
        if(index < itv->lb)
            itv->lb = index;
        else if(index > itv->ub)
            itv->ub = index;
    }
    free(sfc_coord);
}
static void bbox_flat ( struct bbox * bb , struct intv * itv , int bpd ) { int dims = bb -> num_dims ; bitmask_t * sfc_coord ; int i , j , k ; uint64_t index ; itv -> lb = ~ ( 0ULL ) ; itv -> ub = 0 ; sfc_coord = malloc ( sizeof ( bitmask_t ) * dims ) ; for ( i = 0 ; i < ( 1 << dims ) ; i ++ ) { j = 0 ; for ( k = 0 ; k < dims ; k ++ ) { sfc_coord [ k ] = bb -> lb . c [ k ] ; } while ( j < dims ) { if ( i & ( 1 << j ) ) sfc_coord [ j ] = bb -> ub . c [ j ] ; j ++ ; } index = hilbert_c2i ( dims , bpd , sfc_coord ) ; if ( index < itv -> lb ) itv -> lb = index ; else if ( index > itv -> ub ) itv -> ub = index ; } free ( sfc_coord ) ; }
Tranlate a bounding bb box into a 1D inteval using a SFC.
Tranlate a bounding bb box into a 1D inteval using a SFC .
// sfc_coord = malloc(sizeof(bitmask_t)*dims); /*
    bb->lb.c[0], c[1], c[2]...c[dims]
    bb->ub.c[0], c[1], c[2]...c[dims]
    */ // itv->lb = ~(0UL);   //TODO for 64 bits // TODO for 64 bits // initialize sfc_coord: all the possible 2-based number with dims bits // TODO free resource