| 48 | #include <tiledb/tiledb_experimental.h> |
| 49 | |
| 50 | void create_array(const char* array_name, tiledb_array_type_t type) { |
| 51 | // Create TileDB context |
| 52 | tiledb_ctx_t* ctx; |
| 53 | tiledb_ctx_alloc(NULL, &ctx); |
| 54 | |
| 55 | // The array will be 4x4 with dimensions "rows" and "cols", with domain [1,4]. |
| 56 | int dim_domain[] = {1, 4, 1, 4}; |
| 57 | int tile_extents[] = {4, 4}; |
| 58 | tiledb_dimension_t* d1; |
| 59 | tiledb_dimension_alloc( |
| 60 | ctx, "rows", TILEDB_INT32, &dim_domain[0], &tile_extents[0], &d1); |
| 61 | tiledb_dimension_t* d2; |
| 62 | tiledb_dimension_alloc( |
| 63 | ctx, "cols", TILEDB_INT32, &dim_domain[2], &tile_extents[1], &d2); |
| 64 | |
| 65 | // Create domain |
| 66 | tiledb_domain_t* domain; |
| 67 | tiledb_domain_alloc(ctx, &domain); |
| 68 | tiledb_domain_add_dimension(ctx, domain, d1); |
| 69 | tiledb_domain_add_dimension(ctx, domain, d2); |
| 70 | |
| 71 | // Create a single attribute "a" so each (i,j) cell can store an integer |
| 72 | tiledb_attribute_t* a; |
| 73 | tiledb_attribute_alloc(ctx, "a", TILEDB_INT32, &a); |
| 74 | |
| 75 | // Create array schema |
| 76 | tiledb_array_schema_t* array_schema; |
| 77 | tiledb_array_schema_alloc(ctx, type, &array_schema); |
| 78 | tiledb_array_schema_set_cell_order(ctx, array_schema, TILEDB_ROW_MAJOR); |
| 79 | tiledb_array_schema_set_tile_order(ctx, array_schema, TILEDB_ROW_MAJOR); |
| 80 | tiledb_array_schema_set_domain(ctx, array_schema, domain); |
| 81 | tiledb_array_schema_add_attribute(ctx, array_schema, a); |
| 82 | |
| 83 | // Create array |
| 84 | tiledb_array_create(ctx, array_name, array_schema); |
| 85 | |
| 86 | // Clean up |
| 87 | tiledb_attribute_free(&a); |
| 88 | tiledb_dimension_free(&d1); |
| 89 | tiledb_dimension_free(&d2); |
| 90 | tiledb_domain_free(&domain); |
| 91 | tiledb_array_schema_free(&array_schema); |
| 92 | tiledb_ctx_free(&ctx); |
| 93 | } |
| 94 | |
| 95 | void create_arrays_groups() { |
| 96 | // Create context |
no test coverage detected