| 42 | std::string array_name("current_domain_example_array"); |
| 43 | |
| 44 | void create_array(Context& ctx, const std::string& array_uri) { |
| 45 | // Create a TileDB domain |
| 46 | Domain domain(ctx); |
| 47 | |
| 48 | // Add a dimension to the domain |
| 49 | auto d1 = Dimension::create<int>(ctx, "d1", {{1, 1000}}, 50); |
| 50 | domain.add_dimension(d1); |
| 51 | |
| 52 | // Create a CurrentDomain object |
| 53 | CurrentDomain current_domain(ctx); |
| 54 | |
| 55 | // Create an NDRectangle object |
| 56 | NDRectangle ndrect(ctx, domain); |
| 57 | |
| 58 | // Assign the range [1, 100] to the rectangle's first dimension |
| 59 | ndrect.set_range<int32_t>("d1", 1, 100); |
| 60 | |
| 61 | // Assign the NDRectangle to the CurrentDomain |
| 62 | current_domain.set_ndrectangle(ndrect); |
| 63 | |
| 64 | // Create a TileDB sparse array schema |
| 65 | ArraySchema schema(ctx, TILEDB_SPARSE); |
| 66 | schema.set_domain(domain) |
| 67 | .set_order({{TILEDB_ROW_MAJOR, TILEDB_ROW_MAJOR}}) |
| 68 | .set_capacity(100) |
| 69 | .set_cell_order(TILEDB_ROW_MAJOR) |
| 70 | .set_tile_order(TILEDB_ROW_MAJOR); |
| 71 | |
| 72 | // Create a single attribute |
| 73 | schema.add_attribute(Attribute::create<int>(ctx, "a")); |
| 74 | |
| 75 | // Assign the current domain to the array schema |
| 76 | ArraySchemaExperimental::set_current_domain(ctx, schema, current_domain); |
| 77 | |
| 78 | // Create the (empty) array on disk |
| 79 | Array::create(ctx, array_uri, schema); |
| 80 | } |
| 81 | |
| 82 | void print_current_domain(Context& ctx) { |
| 83 | // Get array schema |
no test coverage detected