Skip to content

Commit eb5e3c7

Browse files
Merge pull request #1157 from SebastianM-C/has_init
add `has_init`
2 parents 81f1d00 + 5b2ec39 commit eb5e3c7

File tree

5 files changed

+30
-4
lines changed

5 files changed

+30
-4
lines changed

Project.toml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "SciMLBase"
22
uuid = "0bca4576-84f4-4d90-8ffe-ffa030f20462"
3+
version = "2.122.0"
34
authors = ["Chris Rackauckas <[email protected]> and contributors"]
4-
version = "2.121.1"
55

66
[deps]
77
ADTypes = "47edcb42-4c32-4615-8424-f2b9edc5f35b"
@@ -28,6 +28,7 @@ RecursiveArrayTools = "731186ca-8d62-57ce-b412-fbd966d074cd"
2828
Reexport = "189a3867-3050-52da-a836-e630ba90ab69"
2929
RuntimeGeneratedFunctions = "7e49a35a-f44a-4d26-94aa-eba1b4ca6b47"
3030
SciMLOperators = "c0aeaf25-5076-4817-a8d5-81caf7dfa961"
31+
SciMLPublic = "431bcebd-1456-4ced-9d72-93c2757fff0b"
3132
SciMLStructures = "53ae85a6-f571-4167-b2af-e1d143709226"
3233
StaticArraysCore = "1e83bf80-4336-4d27-bf5d-d5a4f845583c"
3334
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
@@ -82,8 +83,8 @@ ConstructionBase = "1.5"
8283
Distributed = "1.10"
8384
Distributions = "0.25"
8485
DocStringExtensions = "0.9"
85-
Enzyme = "0.13"
8686
EnumX = "1"
87+
Enzyme = "0.13"
8788
ForwardDiff = "0.10.36, 1"
8889
FunctionWrappersWrappers = "0.1.3"
8990
IteratorInterfaceExtensions = "^1"
@@ -110,6 +111,7 @@ Reexport = "1"
110111
ReverseDiff = "1"
111112
RuntimeGeneratedFunctions = "0.5.12"
112113
SciMLOperators = "1.3"
114+
SciMLPublic = "1.0.0"
113115
SciMLStructures = "1.1"
114116
StableRNGs = "1.0"
115117
StaticArrays = "1.7"

docs/src/interfaces/Algorithms.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ SciMLBase.isadaptive
3535
SciMLBase.isdiscrete
3636
SciMLBase.forwarddiffs_model
3737
SciMLBase.forwarddiffs_model_time
38+
SciMLBase.has_init
39+
SciMLBase.has_step
3840
```
3941

4042
### Abstract SciML Algorithms

src/SciMLBase.jl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ import SciMLOperators:
4646

4747
@reexport using SciMLOperators
4848

49+
using SciMLPublic: @public
50+
4951
function __solve end
5052
function __init end
5153

@@ -930,4 +932,9 @@ export Clocks, TimeDomain, is_discrete_time_domain, isclock, issolverstepclock,
930932

931933
export ODEAliasSpecifier, LinearAliasSpecifier
932934

935+
# Public traits
936+
937+
@public has_init
938+
@public has_step
939+
933940
end

src/alg_traits.jl

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,8 +299,23 @@ allows_late_binding_tstops(alg::AbstractODEAlgorithm) = false
299299
"""
300300
$(TYPEDSIGNATURES)
301301
302-
Trait declaration for whether the optimization algorithm supports the `init` interface.
302+
Trait declaration for whether the optimization algorithm supports the `init` interface.
303303
304304
Deprecated as this is not an optimization-specific idea and should use the traits for general caching.
305305
"""
306306
supports_opt_cache_interface(alg) = false
307+
308+
"""
309+
$(TYPEDSIGNATURES)
310+
311+
Trait for specifying whether the passed algorithm supports `init`. Any `init`ed object can `solve!`.
312+
"""
313+
has_init(a::AbstractSciMLAlgorithm) = false
314+
315+
"""
316+
$(TYPEDSIGNATURES)
317+
318+
Trait for specifying whether the passed algorithm supports `step!`, specifying a more direct control over the internal solver process.
319+
See https://docs.sciml.ai/SciMLBase/stable/interfaces/Init_Solve/#init-and-the-Iterator-Interface for more details.
320+
"""
321+
has_step(a::AbstractSciMLAlgorithm) = false

src/integrator_interface.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ end
8383
"""
8484
ratenoise_cache(integrator::DEIntegrator)
8585
86-
Returns cache arrays for rate noise in stochastic differential equations.
86+
Returns cache arrays for rate noise in stochastic differential equations.
8787
Returns an empty tuple by default for deterministic problems.
8888
"""
8989
ratenoise_cache(i::DEIntegrator) = ()

0 commit comments

Comments
 (0)