diff src/Grids/EquidistantGrid.jl @ 661:f0ceddeae993 feature/get_boundary_identifiers

Fix and test type stability of boundary_identifiers.
author Vidar Stiernström <vidar.stiernstrom@it.uu.se>
date Sun, 31 Jan 2021 13:04:19 +0100
parents aa3066010569
children 1d3e29ffc6c6
line wrap: on
line diff
--- a/src/Grids/EquidistantGrid.jl	Sat Jan 30 20:30:55 2021 +0100
+++ b/src/Grids/EquidistantGrid.jl	Sun Jan 31 13:04:19 2021 +0100
@@ -41,7 +41,6 @@
 
 Base.size(g::EquidistantGrid) = g.size
 
-# TODO: Change to ndims? Seem to be the julia naming convention, at least for AbstractArrays.
 """
     dimension(grid::EquidistantGrid)
 
@@ -103,13 +102,5 @@
 	 CartesianBoundary(2,Lower),
 	 ...)
 """
-function boundary_identifiers(g::EquidistantGrid)
-    bids = ()
-    for i=1:dimension(g)
-        for r ∈ (Lower,Upper)
-            bids = (bids...,CartesianBoundary{i,r}())
-        end
-    end
-    return bids
-end
+boundary_identifiers(g::EquidistantGrid) = (((ntuple(i->(CartesianBoundary{i,Lower}(),CartesianBoundary{i,Upper}()),dimension(g)))...)...,)
 export boundary_identifiers