Mercurial > repos > public > sbplib_julia
comparison src/Grids/zero_dim_grid.jl @ 1395:bdcdbd4ea9cd feature/boundary_conditions
Merge with default. Comment out broken tests for boundary_conditions at sat
author | Vidar Stiernström <vidar.stiernstrom@it.uu.se> |
---|---|
date | Wed, 26 Jul 2023 21:35:50 +0200 |
parents | 8860bfcaedaa |
children | 4ad1282f8bab |
comparison
equal
deleted
inserted
replaced
1217:ea2e8254820a | 1395:bdcdbd4ea9cd |
---|---|
1 """ | |
2 ZeroDimGrid{T} <: Grid{T,0} | |
3 | |
4 A zero dimensional grid consisting of a single point. | |
5 """ | |
6 struct ZeroDimGrid{T} <: Grid{T,0} | |
7 point::T | |
8 end | |
9 | |
10 # Indexing interface | |
11 Base.getindex(g::ZeroDimGrid) = g.point | |
12 Base.eachindex(g::ZeroDimGrid) = CartesianIndices(()) | |
13 | |
14 # Iteration interface | |
15 Base.iterate(g::ZeroDimGrid) = (g.point, nothing) | |
16 Base.iterate(g::ZeroDimGrid, ::Any) = nothing | |
17 | |
18 Base.IteratorSize(::Type{<:ZeroDimGrid}) = Base.HasShape{0}() | |
19 Base.length(g::ZeroDimGrid) = 1 | |
20 Base.size(g::ZeroDimGrid) = () | |
21 | |
22 | |
23 refine(g::ZeroDimGrid, ::Int) = g | |
24 coarsen(g::ZeroDimGrid, ::Int) = g | |
25 | |
26 boundary_identifiers(g::ZeroDimGrid) = () | |
27 boundary_grid(g::ZeroDimGrid, ::Any) = throw(ArgumentError("ZeroDimGrid has no boundaries")) |