Skip to content

Commit 900ef7e

Browse files
Merge pull request #5 from SciML/default-to-false
Default `is_*_sym` to false, update docstrings
2 parents c2ddad1 + 72f50b0 commit 900ef7e

File tree

5 files changed

+34
-35
lines changed

5 files changed

+34
-35
lines changed

docs/make.jl

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,14 @@ cp("./docs/Project.toml", "./docs/src/assets/Project.toml", force = true)
55

66
include("pages.jl")
77

8-
makedocs(
9-
sitename="SymbolicIndexingInterface.jl",
10-
authors="Chris Rackauckas",
11-
modules=[SymbolicIndexingInterface],
12-
clean=true,doctest=false,
13-
format = Documenter.HTML(analytics = "UA-90474609-3",
14-
assets = ["assets/favicon.ico"],
15-
canonical="https://docs.sciml.ai/SymbolicIndexingInterface/stable/"),
16-
pages=pages
17-
)
8+
makedocs(sitename = "SymbolicIndexingInterface.jl",
9+
authors = "Chris Rackauckas",
10+
modules = [SymbolicIndexingInterface],
11+
clean = true, doctest = false,
12+
format = Documenter.HTML(analytics = "UA-90474609-3",
13+
assets = ["assets/favicon.ico"],
14+
canonical = "https://docs.sciml.ai/SymbolicIndexingInterface/stable/"),
15+
pages = pages)
1816

19-
deploydocs(
20-
repo = "github.com/SciML/SymbolicIndexingInterface.jl.git";
21-
push_preview = true
22-
)
17+
deploydocs(repo = "github.com/SciML/SymbolicIndexingInterface.jl.git";
18+
push_preview = true)

docs/pages.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Put in a separate page so it can be used by SciMLDocs.jl
22

3-
pages=[
3+
pages = [
44
"Home" => "index.md",
55
"API" => "api.md",
6-
]
6+
]

src/interface.jl

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ function independent_variables end
88
"""
99
$(TYPEDSIGNATURES)
1010
11-
Check if the given sym is an independent variable in the given system.
11+
Check if the given sym is an independent variable in the given system. Defaults
12+
to `false` if not implemented for the given system/container type.
1213
"""
1314
function is_indep_sym end
1415

@@ -29,7 +30,8 @@ function state_sym_to_index end
2930
"""
3031
$(TYPEDSIGNATURES)
3132
32-
Check if the given sym is a state variable in the given system.
33+
Check if the given sym is a state variable in the given system. Defaults
34+
to `false` if not implemented for the given system/container type.
3335
"""
3436
function is_state_sym end
3537

@@ -50,6 +52,7 @@ function param_sym_to_index end
5052
"""
5153
$(TYPEDSIGNATURES)
5254
53-
Check if the given sym is a parameter variable in the given system.
55+
Check if the given sym is a parameter variable in the given system. Defaults
56+
to `false` if not implemented for the given system/container type.
5457
"""
55-
function is_param_sym end
58+
function is_param_sym end

src/symbolcache.jl

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,29 @@
1-
struct SymbolCache{S,T,U}
1+
struct SymbolCache{S, T, U}
22
syms::S
33
indepsym::T
44
paramsyms::U
55
end
66

7-
87
independent_variables(sc::SymbolCache) = sc.indepsym
9-
independent_variables(::SymbolCache{S,Nothing}) where {S} = []
8+
independent_variables(::SymbolCache{S, Nothing}) where {S} = []
9+
is_indep_sum(::Any, _) = false
1010
is_indep_sym(sc::SymbolCache, sym) = any(isequal(sym), sc.indepsym)
11-
is_indep_sym(::SymbolCache{S,Nothing}, _) where {S} = false
11+
is_indep_sym(::SymbolCache{S, Nothing}, _) where {S} = false
1212
states(sc::SymbolCache) = sc.syms
1313
states(::SymbolCache{Nothing}) = []
1414
state_sym_to_index(sc::SymbolCache, sym) = findfirst(isequal(sym), sc.syms)
1515
state_sym_to_index(::SymbolCache{Nothing}, _) = nothing
16+
is_state_sym(::Any, _) = false
1617
is_state_sym(sc::SymbolCache, sym) = !isnothing(state_sym_to_index(sc, sym))
1718
parameters(sc::SymbolCache) = sc.paramsyms
18-
parameters(::SymbolCache{S,T,Nothing}) where {S,T} = []
19+
parameters(::SymbolCache{S, T, Nothing}) where {S, T} = []
1920
param_sym_to_index(sc::SymbolCache, sym) = findfirst(isequal(sym), sc.paramsyms)
20-
param_sym_to_index(::SymbolCache{S,T,Nothing}, _) where {S,T} = nothing
21+
param_sym_to_index(::SymbolCache{S, T, Nothing}, _) where {S, T} = nothing
22+
is_param_sym(::Any, _) = false
2123
is_param_sym(sc::SymbolCache, sym) = !isnothing(param_sym_to_index(sc, sym))
22-
23-
Base.copy(VA::SymbolCache) = typeof(VA)(
24-
(VA.syms===nothing) ? nothing : copy(VA.syms),
25-
(VA.indepsym===nothing) ? nothing : copy(VA.indepsym),
26-
(VA.paramsyms===nothing) ? nothing : copy(VA.paramsyms),
27-
)
24+
25+
function Base.copy(VA::SymbolCache)
26+
typeof(VA)((VA.syms === nothing) ? nothing : copy(VA.syms),
27+
(VA.indepsym === nothing) ? nothing : copy(VA.indepsym),
28+
(VA.paramsyms === nothing) ? nothing : copy(VA.paramsyms))
29+
end

test/runtests.jl

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
using SymbolicIndexingInterface
22
using Test
33

4-
@time begin
5-
@time @testset begin include("symbolcache.jl") end
6-
end
4+
@time begin @time @testset begin include("symbolcache.jl") end end

0 commit comments

Comments
 (0)