From 9d1828aa6eddd907d3116eeb0d438092d15afd65 Mon Sep 17 00:00:00 2001 From: Sam Isaacson Date: Mon, 12 Aug 2024 17:47:18 -0400 Subject: [PATCH 1/9] add integrator accessors for dispatch purposes --- src/integrator_accessors.jl | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 src/integrator_accessors.jl diff --git a/src/integrator_accessors.jl b/src/integrator_accessors.jl new file mode 100644 index 000000000..92922ce0a --- /dev/null +++ b/src/integrator_accessors.jl @@ -0,0 +1,9 @@ +# the following are setup per how integrators are implemented in OrdinaryDiffEq and +# StochasticDiffEq and provide dispatch points that JumpProcesses and others can use. + +# returns if the given integrator has an integ.iter field +hasiter(integ) = true + +get_tstops(integ) = integ.opts.tstops +get_tstops_array(integ) = get_tstops(integ).valtree +get_max_tstops(integ) = maximum(get_tstops_array(integ)) From 3373394761dae9f3138970dbddb96d215ea3c781 Mon Sep 17 00:00:00 2001 From: Sam Isaacson Date: Tue, 13 Aug 2024 06:54:28 -0400 Subject: [PATCH 2/9] drop iter field check --- src/integrator_accessors.jl | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/integrator_accessors.jl b/src/integrator_accessors.jl index 92922ce0a..db62a2e57 100644 --- a/src/integrator_accessors.jl +++ b/src/integrator_accessors.jl @@ -1,9 +1,6 @@ # the following are setup per how integrators are implemented in OrdinaryDiffEq and # StochasticDiffEq and provide dispatch points that JumpProcesses and others can use. -# returns if the given integrator has an integ.iter field -hasiter(integ) = true - get_tstops(integ) = integ.opts.tstops get_tstops_array(integ) = get_tstops(integ).valtree get_max_tstops(integ) = maximum(get_tstops_array(integ)) From 28ba6a9ad41bcbb09b2dbedde100cd9d4608af43 Mon Sep 17 00:00:00 2001 From: Sam Isaacson Date: Tue, 13 Aug 2024 08:07:28 -0400 Subject: [PATCH 3/9] rename --- src/integrator_accessors.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/integrator_accessors.jl b/src/integrator_accessors.jl index db62a2e57..d6a476546 100644 --- a/src/integrator_accessors.jl +++ b/src/integrator_accessors.jl @@ -3,4 +3,4 @@ get_tstops(integ) = integ.opts.tstops get_tstops_array(integ) = get_tstops(integ).valtree -get_max_tstops(integ) = maximum(get_tstops_array(integ)) +get_tstops_max(integ) = maximum(get_tstops_array(integ)) From f921e9282bee3761cd0716d513c67e3319b9afbe Mon Sep 17 00:00:00 2001 From: Sam Isaacson Date: Tue, 13 Aug 2024 08:28:38 -0400 Subject: [PATCH 4/9] convert tstop API to errors --- src/integrator_accessors.jl | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/integrator_accessors.jl b/src/integrator_accessors.jl index d6a476546..8269aceec 100644 --- a/src/integrator_accessors.jl +++ b/src/integrator_accessors.jl @@ -1,6 +1,9 @@ # the following are setup per how integrators are implemented in OrdinaryDiffEq and # StochasticDiffEq and provide dispatch points that JumpProcesses and others can use. -get_tstops(integ) = integ.opts.tstops -get_tstops_array(integ) = get_tstops(integ).valtree -get_tstops_max(integ) = maximum(get_tstops_array(integ)) +get_tstops(integ::DEIntegrator) = + error("get_tstops not implemented for integrators of type $(typeof(iteg))") +get_tstops_array(integ::DEIntegrator) = + error("get_tstops_array not implemented for integrators of type $(typeof(iteg))") +get_tstops_max(integ::DEIntegrator) = + error("get_tstops_max not implemented for integrators of type $(typeof(iteg))") From 203a24531b27511f4c2538829e033a257212657e Mon Sep 17 00:00:00 2001 From: Sam Isaacson Date: Tue, 13 Aug 2024 08:29:08 -0400 Subject: [PATCH 5/9] fix typo --- src/integrator_accessors.jl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/integrator_accessors.jl b/src/integrator_accessors.jl index 8269aceec..cce56207a 100644 --- a/src/integrator_accessors.jl +++ b/src/integrator_accessors.jl @@ -2,8 +2,8 @@ # StochasticDiffEq and provide dispatch points that JumpProcesses and others can use. get_tstops(integ::DEIntegrator) = - error("get_tstops not implemented for integrators of type $(typeof(iteg))") + error("get_tstops not implemented for integrators of type $(typeof(integ))") get_tstops_array(integ::DEIntegrator) = - error("get_tstops_array not implemented for integrators of type $(typeof(iteg))") + error("get_tstops_array not implemented for integrators of type $(typeof(integ))") get_tstops_max(integ::DEIntegrator) = - error("get_tstops_max not implemented for integrators of type $(typeof(iteg))") + error("get_tstops_max not implemented for integrators of type $(typeof(integ))") From ae36752d5e31fe8955133125b0fdd95b66f912b1 Mon Sep 17 00:00:00 2001 From: Sam Isaacson Date: Tue, 13 Aug 2024 09:19:42 -0400 Subject: [PATCH 6/9] load tstops API funs --- src/DiffEqBase.jl | 1 + 1 file changed, 1 insertion(+) diff --git a/src/DiffEqBase.jl b/src/DiffEqBase.jl index c6cbc650b..02d5fa05b 100644 --- a/src/DiffEqBase.jl +++ b/src/DiffEqBase.jl @@ -141,6 +141,7 @@ include("forwarddiff.jl") include("termination_conditions_deprecated.jl") # TODO: remove in the next major release include("termination_conditions.jl") include("norecompile.jl") +include("integrator_accessors.jl") # This is only used for oop stiff solvers default_factorize(A) = lu(A; check = false) From dfd6fd058aa6e99f49c477606455f7db0f50f96a Mon Sep 17 00:00:00 2001 From: Sam Isaacson Date: Tue, 13 Aug 2024 13:41:26 -0400 Subject: [PATCH 7/9] allow alias_tstops kwarg --- src/solve.jl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/solve.jl b/src/solve.jl index 1e42c6cf5..b06c888fd 100644 --- a/src/solve.jl +++ b/src/solve.jl @@ -97,7 +97,9 @@ const allowedkeywords = (:dense, :trace_level, :store_trace, # Termination condition for solvers - :termination_condition) + :termination_condition, + # whether to alias the user tstops array (JumpProcesses.SSAStepper only at this time) + :alias_tstops) const KWARGWARN_MESSAGE = """ Unrecognized keyword arguments found. From c2702682779cab218ceed89b7f672e74875071df Mon Sep 17 00:00:00 2001 From: Sam Isaacson Date: Tue, 13 Aug 2024 14:03:18 -0400 Subject: [PATCH 8/9] short type info in error message --- src/integrator_accessors.jl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/integrator_accessors.jl b/src/integrator_accessors.jl index cce56207a..3a7550918 100644 --- a/src/integrator_accessors.jl +++ b/src/integrator_accessors.jl @@ -2,8 +2,8 @@ # StochasticDiffEq and provide dispatch points that JumpProcesses and others can use. get_tstops(integ::DEIntegrator) = - error("get_tstops not implemented for integrators of type $(typeof(integ))") + error("get_tstops not implemented for integrators of type $(nameof(typeof(integ)))") get_tstops_array(integ::DEIntegrator) = - error("get_tstops_array not implemented for integrators of type $(typeof(integ))") + error("get_tstops_array not implemented for integrators of type $(nameof(typeof(integ)))") get_tstops_max(integ::DEIntegrator) = - error("get_tstops_max not implemented for integrators of type $(typeof(integ))") + error("get_tstops_max not implemented for integrators of type $(nameof(typeof(integ)))") From f926626ff0c78af71b0ec73199be25c6c7f43ba9 Mon Sep 17 00:00:00 2001 From: Sam Isaacson Date: Sun, 18 Aug 2024 08:43:17 -0400 Subject: [PATCH 9/9] Update solve.jl --- src/solve.jl | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/solve.jl b/src/solve.jl index b06c888fd..1e42c6cf5 100644 --- a/src/solve.jl +++ b/src/solve.jl @@ -97,9 +97,7 @@ const allowedkeywords = (:dense, :trace_level, :store_trace, # Termination condition for solvers - :termination_condition, - # whether to alias the user tstops array (JumpProcesses.SSAStepper only at this time) - :alias_tstops) + :termination_condition) const KWARGWARN_MESSAGE = """ Unrecognized keyword arguments found.