| 337 | } |
| 338 | |
| 339 | void Subarray::set_subarray(const void* subarray) { |
| 340 | if (!array_->array_schema_latest().domain().all_dims_same_type()) |
| 341 | throw SubarrayException( |
| 342 | "Cannot set subarray; Function not applicable to " |
| 343 | "heterogeneous domains"); |
| 344 | |
| 345 | if (!array_->array_schema_latest().domain().all_dims_fixed()) |
| 346 | throw SubarrayException( |
| 347 | "Cannot set subarray; Function not applicable to " |
| 348 | "domains with variable-sized dimensions"); |
| 349 | |
| 350 | add_default_ranges(); |
| 351 | if (subarray != nullptr) { |
| 352 | auto dim_num = array_->array_schema_latest().dim_num(); |
| 353 | auto s_ptr = (const unsigned char*)subarray; |
| 354 | uint64_t offset = 0; |
| 355 | for (unsigned d = 0; d < dim_num; ++d) { |
| 356 | auto r_size = |
| 357 | 2 * array_->array_schema_latest().dimension_ptr(d)->coord_size(); |
| 358 | Range range(&s_ptr[offset], r_size); |
| 359 | this->add_range(d, std::move(range), err_on_range_oob_); |
| 360 | offset += r_size; |
| 361 | } |
| 362 | } |
| 363 | } |
| 364 | |
| 365 | void Subarray::set_subarray_unsafe(const void* subarray) { |
| 366 | add_default_ranges(); |
nothing calls this directly
no test coverage detected