Mercurial > repos > public > sbplib_julia
comparison src/Grids/EquidistantGrid.jl @ 1124:f5d381e66346 refactor/sbpoperators/inflation
Merge with default
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Tue, 04 Oct 2022 22:31:52 +0200 |
parents | 5b3d4a8ec3ab |
children | 4e4c5011140d |
comparison
equal
deleted
inserted
replaced
1109:69c635e1d346 | 1124:f5d381e66346 |
---|---|
114 limit_upper = grid.limit_upper[dim] | 114 limit_upper = grid.limit_upper[dim] |
115 | 115 |
116 return EquidistantGrid(size, limit_lower, limit_upper) | 116 return EquidistantGrid(size, limit_lower, limit_upper) |
117 end | 117 end |
118 | 118 |
119 | |
119 """ | 120 """ |
120 boundary_identifiers(::EquidistantGrid) | 121 boundary_identifiers(::EquidistantGrid) |
121 | 122 |
122 Returns a tuple containing the boundary identifiers for the grid, stored as | 123 Returns a tuple containing the boundary identifiers for the grid, stored as |
123 (CartesianBoundary(1,Lower), | 124 (CartesianBoundary(1,Lower), |
127 """ | 128 """ |
128 boundary_identifiers(g::EquidistantGrid) = (((ntuple(i->(CartesianBoundary{i,Lower}(),CartesianBoundary{i,Upper}()),dimension(g)))...)...,) | 129 boundary_identifiers(g::EquidistantGrid) = (((ntuple(i->(CartesianBoundary{i,Lower}(),CartesianBoundary{i,Upper}()),dimension(g)))...)...,) |
129 | 130 |
130 | 131 |
131 """ | 132 """ |
132 boundary_grid(grid::EquidistantGrid,id::CartesianBoundary) | 133 boundary_grid(grid::EquidistantGrid, id::CartesianBoundary) |
133 boundary_grid(::EquidistantGrid{1},::CartesianBoundary{1}) | |
134 | 134 |
135 Creates the lower-dimensional restriciton of `grid` spanned by the dimensions | 135 Creates the lower-dimensional restriciton of `grid` spanned by the dimensions |
136 orthogonal to the boundary specified by `id`. The boundary grid of a 1-dimensional | 136 orthogonal to the boundary specified by `id`. The boundary grid of a 1-dimensional |
137 grid is a zero-dimensional grid. | 137 grid is a zero-dimensional grid. |
138 """ | 138 """ |
139 function boundary_grid(grid::EquidistantGrid,id::CartesianBoundary) | 139 function boundary_grid(grid::EquidistantGrid, id::CartesianBoundary) |
140 dims = collect(1:dimension(grid)) | 140 dims = 1:dimension(grid) |
141 orth_dims = dims[dims .!= dim(id)] | 141 # Extract dimensions orthogonal to dim(id) |
142 orth_dims = filter(i -> i != dim(id), dims) | |
142 if orth_dims == dims | 143 if orth_dims == dims |
143 throw(DomainError("boundary identifier not matching grid")) | 144 throw(DomainError("boundary identifier not matching grid")) |
144 end | 145 end |
145 return restrict(grid,orth_dims) | 146 return restrict(grid,orth_dims) |
146 end | 147 end |