diff --git a/src/Grids.jl b/src/Grids.jl index 8a1c89e..7b33d68 100644 --- a/src/Grids.jl +++ b/src/Grids.jl @@ -276,9 +276,12 @@ cartesian_to_internal(grid::UnstructuredVectorGrid, griddata::AbstractArray) = g """ get_region(grid::UnstructuredVectorGrid, values; cell) -> values_subset, (dim_subset::NamedDimension, ...) + get_region(grid::UnstructuredVectorGrid, values) # Keywords for region selection: - `cell::Union{Int, Symbol}`: an Int, or a Symbol to look up in `cellnames` + +`get_region(grid, values)` is also allowed for a single-cell Domain, """ function get_region(grid::UnstructuredVectorGrid, values; cell::Union{Int, Symbol}) if cell isa Int @@ -295,6 +298,12 @@ function get_region(grid::UnstructuredVectorGrid, values; cell::Union{Int, Symbo ) end +function get_region(grid::UnstructuredVectorGrid, values) + grid.ncells == 1 || throw(ArgumentError("'cell' argument is required for an UnstructuredVectorGrid with > 1 cell")) + + return get_region(grid, values; cell=1) +end + """ create_default_cellrange(domain, grid::UnstructuredVectorGrid [; operatorID=0]) -> CellRange