changeset 1111:5b3d4a8ec3ab

Change to using filter for picking out orthogonal dimensions
author Vidar Stiernström <vidar.stiernstrom@it.uu.se>
date Mon, 04 Jul 2022 22:55:32 +0200
parents 74c54996de6a
children b2afacd57635 4e4c5011140d 6104db60b7a3 5f701e795d44 87576b0ca0e3
files src/Grids/EquidistantGrid.jl
diffstat 1 files changed, 6 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/Grids/EquidistantGrid.jl	Sun May 08 11:35:22 2022 +0200
+++ b/src/Grids/EquidistantGrid.jl	Mon Jul 04 22:55:32 2022 +0200
@@ -116,6 +116,7 @@
     return EquidistantGrid(size, limit_lower, limit_upper)
 end
 
+
 """
     boundary_identifiers(::EquidistantGrid)
 
@@ -129,16 +130,16 @@
 
 
 """
-    boundary_grid(grid::EquidistantGrid,id::CartesianBoundary)
-	boundary_grid(::EquidistantGrid{1},::CartesianBoundary{1})
+    boundary_grid(grid::EquidistantGrid, id::CartesianBoundary)
 
 Creates the lower-dimensional restriciton of `grid` spanned by the dimensions
 orthogonal to the boundary specified by `id`. The boundary grid of a 1-dimensional
 grid is a zero-dimensional grid.
 """
-function boundary_grid(grid::EquidistantGrid,id::CartesianBoundary)
-	dims = collect(1:dimension(grid))
-	orth_dims = dims[dims .!= dim(id)]
+function boundary_grid(grid::EquidistantGrid, id::CartesianBoundary)
+	dims = 1:dimension(grid)
+    # Extract dimensions orthogonal to dim(id)
+    orth_dims = filter(i -> i != dim(id), dims)
 	if orth_dims == dims
 		throw(DomainError("boundary identifier not matching grid"))
 	end