Skip to content

Commit

Permalink
fix2
Browse files Browse the repository at this point in the history
  • Loading branch information
hexaeder committed Nov 28, 2024
1 parent d8bb381 commit edaeb65
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/component_functions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -964,7 +964,7 @@ function _fill_defaults(T, @nospecialize(kwargs))
#### External Inputs
####
if haskey(dict, :extin)
@assert dict[:extin] isa Vector{<:SymbolicIndex}
@assert dict[:extin] isa Union{Nothing, Vector{<:SymbolicIndex}}
else
dict[:extin] = nothing
end
Expand Down
2 changes: 2 additions & 0 deletions src/external_inputs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,13 @@ function ExtMap(im::IndexManager)
isempty(map) && error("There are no external inputs.")

for (vi, vm) in pairs(im.vertexm)
has_external_input(vm) || continue
for (i, si) in pairs(vm.extin)
map[im.v_ext[vi][i]] = _symidx_to_extidx(im, si)
end
end
for (ei, em) in pairs(im.edgem)
has_external_input(em) || continue
for (i, si) in pairs(em.extin)
map[im.e_ext[ei][i]] = _symidx_to_extidx(im, si)
end
Expand Down
4 changes: 2 additions & 2 deletions src/symbolicindexing.jl
Original file line number Diff line number Diff line change
Expand Up @@ -507,14 +507,14 @@ function _get_observed_f(nw::Network, cf::EdgeModel, eidx)
ur = nw.im.e_data[eidx]
esrcr = nw.im.v_out[nw.im.edgevec[eidx].src]
edstr = nw.im.v_out[nw.im.edgevec[eidx].dst]
extr = nw.im.v_out[eidx]
extr = nw.im.e_out[eidx]
pr = nw.im.e_para[eidx]
ret = Vector{Float64}(undef, N)

@closure (u, outbuf, aggbuf, extbuf, p, t) -> begin
ins = (view(outbuf, esrcr), view(outbuf, edstr))
if has_external_input(cf)
(ins..., view(aggbuf, aggr), view(extbuf, extr))
(ins..., view(extbuf, extr))
end
cf.obsf(ret, view(u, ur), ins..., view(p, pr), t)
ret
Expand Down

0 comments on commit edaeb65

Please sign in to comment.