| 1431 | } |
| 1432 | |
| 1433 | void ArraySchema::set_domain(shared_ptr<Domain> domain) { |
| 1434 | if (domain == nullptr) { |
| 1435 | throw ArraySchemaException("Cannot set domain; Input domain is nullptr"); |
| 1436 | } |
| 1437 | |
| 1438 | if (domain->dim_num() == 0) { |
| 1439 | throw ArraySchemaException( |
| 1440 | "Cannot set domain; Domain must contain at least one dimension"); |
| 1441 | } |
| 1442 | |
| 1443 | if (array_type_ == ArrayType::DENSE) { |
| 1444 | if (!domain->all_dims_same_type()) { |
| 1445 | throw ArraySchemaException( |
| 1446 | "Cannot set domain; In dense arrays, all " |
| 1447 | "dimensions must have the same datatype"); |
| 1448 | } |
| 1449 | |
| 1450 | auto type{domain->dimension_ptr(0)->type()}; |
| 1451 | if (!datatype_is_integer(type) && !datatype_is_datetime(type) && |
| 1452 | !datatype_is_time(type)) { |
| 1453 | throw ArraySchemaException( |
| 1454 | std::string("Cannot set domain; Dense arrays " |
| 1455 | "do not support dimension datatype '") + |
| 1456 | datatype_str(type) + "'"); |
| 1457 | } |
| 1458 | } |
| 1459 | |
| 1460 | if (cell_order_ != Layout::HILBERT) { |
| 1461 | domain->set_null_tile_extents_to_range(); |
| 1462 | } |
| 1463 | |
| 1464 | // Set domain |
| 1465 | domain_ = domain; |
| 1466 | |
| 1467 | // Create dimension map |
| 1468 | dim_map_.clear(); |
| 1469 | auto dim_num = domain_->dim_num(); |
| 1470 | for (dimension_size_type d = 0; d < dim_num; ++d) { |
| 1471 | auto dim{dimension_ptr(d)}; |
| 1472 | dim_map_[dim->name()] = dim; |
| 1473 | } |
| 1474 | } |
| 1475 | |
| 1476 | void ArraySchema::set_tile_order(Layout tile_order) { |
| 1477 | if (tile_order == Layout::HILBERT) { |
no test coverage detected