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 lib/ModelingToolkitTearing/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ DocStringExtensions = "0.7, 0.8, 0.9"
Graphs = "1"
LinearAlgebra = "1"
ModelingToolkit = "11"
ModelingToolkitBase = "1.13"
ModelingToolkitBase = "1.23"
Moshi = "0.3"
OffsetArrays = "1"
OrderedCollections = "1.8.1"
Expand Down
21 changes: 19 additions & 2 deletions lib/ModelingToolkitTearing/src/reassemble.jl
Original file line number Diff line number Diff line change
Expand Up @@ -575,8 +575,25 @@ function get_linear_scc_linsol(state::TearingState, alg_eqs::Vector{Int},
lu !== nothing && return BSImpl.Const{VartypeT}((lu \ b)::Vector{SymbolicT})
end
# Turn into symbolic arrays
A = SU.Const{VartypeT}(A)
b = SU.Const{VartypeT}(b)
sys = state.sys
reference_idx = findfirst(!SU.isconst, A)
if reference_idx === nothing
reference_idx = findfirst(!SU.isconst, b)
if reference_idx === nothing
reference = first(A)
else
reference = A[reference_idx]
end
else
reference = A[reference_idx]
end
sys, A_cache = MTKBase.add_diffcache(sys, length(A))
A_allocator = A_cache(reference)
A = SU.Code.with_allocator(A_allocator, SU.Const{VartypeT}(A))
sys, b_cache = MTKBase.add_diffcache(sys, length(b))
b_allocator = b_cache(reference)
b = SU.Code.with_allocator(b_allocator, SU.Const{VartypeT}(b))
state.sys = sys
return INLINE_LINEAR_SCC_OP(A, b)
end

Expand Down
Loading