Skip to content

Commit 208077a

Browse files
Conditionally overload Krylov.ktypeof
1 parent cbb347b commit 208077a

File tree

3 files changed

+25
-0
lines changed

3 files changed

+25
-0
lines changed

Project.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ IntervalSets = "8197267c-284f-5f27-9208-e0e47529a953"
2121
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
2222
PkgVersion = "eebad327-c553-4316-9ea0-9fa01ccd7688"
2323
RecursiveArrayTools = "731186ca-8d62-57ce-b412-fbd966d074cd"
24+
Requires = "ae029012-a4dd-5104-9daa-d747884805df"
2425
RootSolvers = "7181ea78-2dcb-4de3-ab41-2b8ab5a31e74"
2526
Rotations = "6038ab10-8711-5258-84ad-4b1120ba62dc"
2627
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"

src/ClimaCore.jl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,14 @@ include("Hypsography/Hypsography.jl")
1818
include("Limiters/Limiters.jl")
1919
include("InputOutput/InputOutput.jl")
2020

21+
using Requires
22+
function __init__()
23+
@require Krylov = "ba0b0d4f-ebba-5204-a429-3ac8c609bfb7" include(
24+
joinpath("weak_deps", "Krylov.jl"),
25+
)
26+
return nothing
27+
end
28+
2129
include("deprecated.jl")
2230

2331
end # module

src/weak_deps/Krylov.jl

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#=
2+
`Krylov.ktypeof` is defined here, if `Krylov`
3+
is loaded to avoid the need for type piracy.
4+
5+
```julia
6+
using Krylov # to load this file
7+
using ClimaCore
8+
```
9+
10+
TODO: Use package extensions when we upgrade to Julia 1.9.
11+
=#
12+
13+
import ClimaComms
14+
import .Krylov
15+
Krylov.ktypeof(x::Fields.FieldVector) =
16+
ClimaComms.array_type(x){eltype(parent(x)), 1}

0 commit comments

Comments
 (0)