Skip to content

Commit

Permalink
refactor: Define type AbstractGrids
Browse files Browse the repository at this point in the history
Define an abstract type `AbstractGrids`.  This is a supertype for other
grids types, allowing dispatch on them more elegantly than dispatch on
`Union{Grids,PencilGrids}`.
  • Loading branch information
musoke committed May 6, 2022
1 parent bfbc091 commit 532987e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
10 changes: 9 additions & 1 deletion src/grids.jl
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
"""
AbstractGrids
Abstract type for grids containing simulation data
"""

abstract type AbstractGrids end

"""
struct containing grids used in a simulation
Expand All @@ -15,7 +23,7 @@ julia> Grids(len, resol);
```
"""
struct Grids
struct Grids <: AbstractGrids
"Array of x positions"
x::Array{Float64,3}
"Array of y positions"
Expand Down
2 changes: 1 addition & 1 deletion src/pencil_grids.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ julia> PencilGrids(len, resol);
```
"""
struct PencilGrids{K, RX, RK, CX, CK, FFT, RFFT, M}
struct PencilGrids{K, RX, RK, CX, CK, FFT, RFFT, M} <: AbstractGrids
"Array of x positions"
x::Array{Float64,3}
"Array of y positions"
Expand Down

0 comments on commit 532987e

Please sign in to comment.