From 00c96d6357a22d5f3137e9b97d3f9a70e960b3d6 Mon Sep 17 00:00:00 2001 From: Stuart Daines Date: Sun, 5 Jan 2025 15:58:59 +0000 Subject: [PATCH] Consistency fix for grid methods with no grid subsitute_cell_names column_indices generic fallbacks include no grid case (grid == nothing) --- src/CoordsDims.jl | 2 +- src/Grids.jl | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/CoordsDims.jl b/src/CoordsDims.jl index ee6a11e..1ebdbb2 100644 --- a/src/CoordsDims.jl +++ b/src/CoordsDims.jl @@ -50,7 +50,7 @@ PALEO convention is that where possible `coordinates` contains: function set_coordinates! end """ - function get_coordinates(obj, dimname) -> coordinates::Vector{String} + function get_coordinates(obj, dimname) -> coordinates::Vector Get coordinates (if any) attached to `dimname` for PALEO object `obj` diff --git a/src/Grids.jl b/src/Grids.jl index 99eaa5d..16af7f7 100644 --- a/src/Grids.jl +++ b/src/Grids.jl @@ -321,12 +321,12 @@ function _show_subdomains_dimensions_coordinates(io, grid::PB.AbstractMesh) end # generic fallback for named cells -substitute_cell_names(grid::PB.AbstractMesh, cells) = cells -substitute_cell_names(grid::PB.AbstractMesh, cells::Union{Number, Symbol}) = +substitute_cell_names(grid::PB.AbstractMeshOrNothing, cells) = cells +substitute_cell_names(grid::PB.AbstractMeshOrNothing, cells::Union{Number, Symbol}) = substitute_cell_names(grid, [cells])[] # generic fallback for column indices -function column_indices(grid::PB.AbstractMesh, column) +function column_indices(grid::PB.AbstractMeshOrNothing, column) throw(ArgumentError("grid $grid does not support column selection")) end