Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ CommonSolve = "0.2.4"
Compat = "3.42, 4"
ConstructionBase = "1"
DataInterpolations = "7, 8"
DataStructures = "0.17, 0.18"
DataStructures = "0.17, 0.18, 0.19"
DeepDiffs = "1"
DelayDiffEq = "5.61"
DiffEqBase = "6.189.1"
Expand Down
6 changes: 6 additions & 0 deletions src/ModelingToolkit.jl
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ using LinearAlgebra, SparseArrays
using InteractiveUtils
using JumpProcesses
using DataStructures
@static if pkgversion(DataStructures) >= v"0.19"
import DataStructures: IntDisjointSet
else
import DataStructures: IntDisjointSets
const IntDisjointSet = IntDisjointSets
end
using Base.Threads
using Latexify, Unitful, ArrayInterface
using Setfield, ConstructionBase
Expand Down
18 changes: 15 additions & 3 deletions src/systems/alias_elimination.jl
Original file line number Diff line number Diff line change
Expand Up @@ -426,20 +426,32 @@ function topsort_equations(eqs, unknowns; check = true)

q = Queue{Int}(neqs)
for (i, d) in enumerate(degrees)
d == 0 && enqueue!(q, i)
@static if pkgversion(DataStructures) >= v"0.19"
d == 0 && push!(q, i)
else
d == 0 && enqueue!(q, i)
end
end

idx = 0
ordered_eqs = similar(eqs, 0)
sizehint!(ordered_eqs, neqs)
while !isempty(q)
𝑠eq = dequeue!(q)
@static if pkgversion(DataStructures) >= v"0.19"
𝑠eq = popfirst!(q)
else
𝑠eq = dequeue!(q)
end
idx += 1
push!(ordered_eqs, eqs[𝑠eq])
var = assigns[𝑠eq]
for 𝑑eq in 𝑑neighbors(graph, var)
degree = degrees[𝑑eq] = degrees[𝑑eq] - 1
degree == 0 && enqueue!(q, 𝑑eq)
@static if pkgversion(DataStructures) >= v"0.19"
degree == 0 && push!(q, 𝑑eq)
else
degree == 0 && enqueue!(q, 𝑑eq)
end
end
end

Expand Down
2 changes: 1 addition & 1 deletion src/systems/connectiongraph.jl
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@ function connectionsets(graph::HyperGraph{V}) where {V}
invmap = graph.invmap

# union all of the hyperedges
disjoint_sets = IntDisjointSets(length(invmap))
disjoint_sets = IntDisjointSet(length(invmap))
for edge_i in 𝑠vertices(bigraph)
hyperedge = 𝑠neighbors(bigraph, edge_i)
isempty(hyperedge) && continue
Expand Down
Loading