Skip to content

Commit 7e25179

Browse files
feat: add check_is_continuous to relevant compatibility checks
1 parent ec1241f commit 7e25179

File tree

5 files changed

+13
-0
lines changed

5 files changed

+13
-0
lines changed

src/problems/compatibility.jl

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,15 @@ function check_is_discrete(sys::System, T)
107107
end
108108
end
109109

110+
function check_is_continuous(sys::System, T)
111+
altT = has_alg_equations(sys) ? ImplicitDiscreteProblem : DiscreteProblem
112+
if is_discrete_system(sys)
113+
throw(SystemCompatibilityError("""
114+
A discrete system cannot be used to construct a `$T`. Consider a `$altT` instead.
115+
"""))
116+
end
117+
end
118+
110119
function check_is_explicit(sys::System, T, altT)
111120
if has_alg_equations(sys)
112121
throw(SystemCompatibilityError("""

src/problems/ddeproblem.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,4 +69,5 @@ function check_compatible_system(T::Union{Type{DDEFunction}, Type{DDEProblem}},
6969
check_no_constraints(sys, T)
7070
check_no_jumps(sys, T)
7171
check_no_noise(sys, T)
72+
check_is_continuous(sys, T)
7273
end

src/problems/odeproblem.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,4 +81,5 @@ function check_compatible_system(
8181
check_no_constraints(sys, T)
8282
check_no_jumps(sys, T)
8383
check_no_noise(sys, T)
84+
check_is_continuous(sys, T)
8485
end

src/problems/sddeproblem.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,4 +74,5 @@ function check_compatible_system(
7474
check_no_constraints(sys, T)
7575
check_no_jumps(sys, T)
7676
check_has_noise(sys, T)
77+
check_is_continuous(sys, T)
7778
end

src/problems/sdeproblem.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ function check_compatible_system(T::Union{Type{SDEFunction}, Type{SDEProblem}},
8282
check_no_constraints(sys, T)
8383
check_no_jumps(sys, T)
8484
check_has_noise(sys, T)
85+
check_is_continuous(sys, T)
8586
end
8687

8788
function calculate_noise_and_rate_prototype(sys::System, u0; sparsenoise = false)

0 commit comments

Comments
 (0)