static ADIOS_SELECTION* getAdiosDefaultBoundingBox(ADIOS_VARINFO* v) { if (v->ndim == 0) { return NULL; } /*uint64_t start[v->ndim]; uint64_t count[v->ndim]; int i=0; for (i=0; i<v->ndim; i++) { start[i] = 0; count[i] = v->dims[i]; } */ uint64_t* start = malloc(v->ndim * sizeof(uint64_t)); uint64_t* count = malloc(v->ndim * sizeof(uint64_t)); int i=0; for (i=0; i<v->ndim; i++) { start[i] = 0; count[i] = v->dims[i]; } ADIOS_SELECTION* result = common_read_selection_boundingbox(v->ndim, start, count); return result; }
// Creates a bounding box from a given ADIOS_VARBLOCK inline static const ADIOS_SELECTION * create_pg_bounds_from_varblock(int ndim, const ADIOS_VARBLOCK *orig_vb) { // Commented out for performance //const uint64_t *new_start = (uint64_t*)bufdup(orig_vb->start, sizeof(uint64_t), ndim); //const uint64_t *new_count = (uint64_t*)bufdup(orig_vb->count, sizeof(uint64_t), ndim); //return common_read_selection_boundingbox(ndim, new_start, new_count); return common_read_selection_boundingbox(ndim, orig_vb->start, orig_vb->count); }
static ADIOS_SELECTION * convertWriteblockToBoundingBox(ADIOS_QUERY *q, ADIOS_SELECTION_WRITEBLOCK_STRUCT *wb, int timestep) { assert(!wb->is_absolute_index && !wb->is_sub_pg_selection); // The user should not be using the internal ADIOS writeblock flags int pg_ndim; ADIOS_VARBLOCK *pg_bounds = computePGBounds(q, wb->index, timestep, &pg_ndim); if (!pg_bounds) return NULL; ADIOS_SELECTION *bb = common_read_selection_boundingbox(pg_ndim, pg_bounds->start, pg_bounds->count); return bb; }
// // One-on-one global intersection functions // ADIOS_SELECTION * adios_selection_intersect_bb_bb(const ADIOS_SELECTION_BOUNDINGBOX_STRUCT *bb1, const ADIOS_SELECTION_BOUNDINGBOX_STRUCT *bb2) { const int ndim = bb1->ndim; uint64_t *new_start = malloc(ndim * sizeof(uint64_t)); uint64_t *new_count = malloc(ndim * sizeof(uint64_t)); assert(bb1->ndim == bb2->ndim); if (!new_start || !new_count) { adios_error(err_no_memory, "Cannot allocate memory for BOUNDINGBOX-BOUNDINGBOX selection intersection"); return NULL; } if (intersect_bb(bb1, bb2, new_start, NULL, NULL, new_count)) { return common_read_selection_boundingbox(ndim, new_start, new_count); } else { free(new_start); free(new_count); return NULL; } }
ADIOS_SELECTION * adios_selection_boundingbox (int ndim, const uint64_t *start, const uint64_t *count) { return common_read_selection_boundingbox (ndim, start, count); }
// Extracts a selection corresponding to the subvolume within the destination buffer ADIOS_SELECTION * adios_copyspec_to_dst_selection(adios_subvolume_copy_spec *copy_spec) { return common_read_selection_boundingbox(copy_spec->ndim, bufdup(copy_spec->dst_subv_offsets, sizeof(uint64_t), copy_spec->ndim), bufdup(copy_spec->subv_dims, sizeof(uint64_t), copy_spec->ndim)); }
inline static ADIOS_SELECTION * create_pg_bounds(int ndim, ADIOS_VARBLOCK *orig_vb) { return common_read_selection_boundingbox(ndim, orig_vb->start, orig_vb->count); }