| 88 | } |
| 89 | |
| 90 | void create_array(const char* array_name, tiledb_array_type_t type) { |
| 91 | // Create TileDB context |
| 92 | tiledb_ctx_t* ctx; |
| 93 | tiledb_ctx_alloc(NULL, &ctx); |
| 94 | |
| 95 | // The array will be 4x4 with dimensions "rows" and "cols", with domain [1,4]. |
| 96 | int dim_domain[] = {1, 4, 1, 4}; |
| 97 | int tile_extents[] = {4, 4}; |
| 98 | tiledb_dimension_t* d1; |
| 99 | tiledb_dimension_alloc( |
| 100 | ctx, "rows", TILEDB_INT32, &dim_domain[0], &tile_extents[0], &d1); |
| 101 | tiledb_dimension_t* d2; |
| 102 | tiledb_dimension_alloc( |
| 103 | ctx, "cols", TILEDB_INT32, &dim_domain[2], &tile_extents[1], &d2); |
| 104 | |
| 105 | // Create domain |
| 106 | tiledb_domain_t* domain; |
| 107 | tiledb_domain_alloc(ctx, &domain); |
| 108 | tiledb_domain_add_dimension(ctx, domain, d1); |
| 109 | tiledb_domain_add_dimension(ctx, domain, d2); |
| 110 | |
| 111 | // Create a single attribute "a" so each (i,j) cell can store an integer |
| 112 | tiledb_attribute_t* a; |
| 113 | tiledb_attribute_alloc(ctx, "a", TILEDB_INT32, &a); |
| 114 | |
| 115 | // Create array schema |
| 116 | tiledb_array_schema_t* array_schema; |
| 117 | tiledb_array_schema_alloc(ctx, type, &array_schema); |
| 118 | tiledb_array_schema_set_cell_order(ctx, array_schema, TILEDB_ROW_MAJOR); |
| 119 | tiledb_array_schema_set_tile_order(ctx, array_schema, TILEDB_ROW_MAJOR); |
| 120 | tiledb_array_schema_set_domain(ctx, array_schema, domain); |
| 121 | tiledb_array_schema_add_attribute(ctx, array_schema, a); |
| 122 | |
| 123 | // Create array |
| 124 | tiledb_array_create(ctx, array_name, array_schema); |
| 125 | |
| 126 | // Clean up |
| 127 | tiledb_attribute_free(&a); |
| 128 | tiledb_dimension_free(&d1); |
| 129 | tiledb_dimension_free(&d2); |
| 130 | tiledb_domain_free(&domain); |
| 131 | tiledb_array_schema_free(&array_schema); |
| 132 | tiledb_ctx_free(&ctx); |
| 133 | } |
| 134 | |
| 135 | void move_remove_obj() { |
| 136 | // Create context |
no test coverage detected