Skip to content

Commit ee93d86

Browse files
committed
despecialize VertexModel/EdgeModel
1 parent 6ffaf5a commit ee93d86

File tree

2 files changed

+19
-19
lines changed

2 files changed

+19
-19
lines changed

src/component_functions.jl

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -247,22 +247,22 @@ Directed(s::AbstractVector{<:Symbol}) = AnnotatedSym(Directed, s)
247247

248248
abstract type ComponentModel end
249249

250-
struct VertexModel{F,G,FFT,OF,MM,EX<:Union{Nothing,Vector{<:SymbolicIndex}}} <: ComponentModel
250+
struct VertexModel <: ComponentModel
251251
name::Symbol
252252
# main function
253-
f::F
253+
f::Any
254254
sym::Vector{Symbol}
255-
mass_matrix::MM
255+
mass_matrix::Any
256256
# outputs
257-
g::G
257+
g::Any
258258
outsym::Vector{Symbol}
259-
ff::FFT
259+
ff::FeedForwardType
260260
# parameters, optional input sym and optional external inputs
261261
psym::Vector{Symbol}
262262
insym::Union{Nothing, Vector{Symbol}}
263-
extin::EX
263+
extin::Union{Nothing, Vector{<:SymbolicIndex}}
264264
# observed
265-
obsf::OF
265+
obsf::Any
266266
obssym::Vector{Symbol}
267267
# metadata
268268
symmetadata::Dict{Symbol,Dict{Symbol, Any}}
@@ -302,22 +302,22 @@ All Symbol arguments can be used to set default values, i.e. `psym=[:K=>1, :p]`.
302302
VertexModel(; kwargs...) = _construct_comp(VertexModel, Base.inferencebarrier(kwargs))
303303
VertexModel(v::VertexModel; kwargs...) = _reconstruct_comp(VertexModel, v, Base.inferencebarrier(kwargs))
304304

305-
struct EdgeModel{F,G,FFT,OF,MM,EX<:Union{Nothing,Vector{<:SymbolicIndex}}} <: ComponentModel
305+
struct EdgeModel <: ComponentModel
306306
name::Symbol
307307
# main function
308-
f::F
308+
f::Any
309309
sym::Vector{Symbol}
310-
mass_matrix::MM
310+
mass_matrix::Any
311311
# outputs
312-
g::G
312+
g::Any
313313
outsym::@NamedTuple{src::Vector{Symbol},dst::Vector{Symbol}}
314-
ff::FFT
314+
ff::FeedForwardType
315315
# parameters, optional input sym and optional external inputs
316316
psym::Vector{Symbol}
317317
insym::Union{Nothing, @NamedTuple{src::Vector{Symbol},dst::Vector{Symbol}}}
318-
extin::EX
318+
extin::Union{Nothing, Vector{<:SymbolicIndex}}
319319
# observed
320-
obsf::OF
320+
obsf::Any
321321
obssym::Vector{Symbol}
322322
# metadata
323323
symmetadata::Dict{Symbol,Dict{Symbol, Any}}
@@ -576,8 +576,8 @@ Fills up type parameters with `nothing` to ensure `Core.Compiler.isconstType`
576576
for GPU compatibility.
577577
"""
578578
dispatchT(::T) where {T<:ComponentModel} = dispatchT(T)
579-
dispatchT(T::Type{<:VertexModel}) = VertexModel{nothing,nothing,nothing,nothing,nothing,Nothing}
580-
dispatchT(T::Type{<:EdgeModel}) = EdgeModel{nothing,nothing,nothing,nothing,nothing,Nothing}
579+
dispatchT(T::Type{<:VertexModel}) = VertexModel
580+
dispatchT(T::Type{<:EdgeModel}) = EdgeModel
581581

582582
# TODO: introduce batchequal hash for faster batching of component models
583583
batchequal(a, b) = false

src/show.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ Base.show(io::IO, s::KAAggregator) = print(io, "KAAggregator($(repr(s.f)))")
4141
Base.show(io::IO, s::SequentialAggregator) = print(io, "SequentialAggregator($(repr(s.f)))")
4242
Base.show(io::IO, s::PolyesterAggregator) = print(io, "PolyesterAggregator($(repr(s.f)))")
4343

44-
function Base.show(io::IO, ::MIME"text/plain", @nospecialize(c::ComponentModel))
44+
function Base.show(io::IO, ::MIME"text/plain", c::ComponentModel)
4545
type = match(r"^(.*?)\{", string(typeof(c)))[1]
4646
print(io, type, styled" {NetworkDynamics_name::$(c.name)}")
4747
print(io, styled" {NetworkDynamics_fftype:$(fftype(c))}")
@@ -101,14 +101,14 @@ function print_states_params(io, @nospecialize(c::ComponentModel), styling)
101101

102102
print_treelike(io, align_strings(info))
103103
end
104-
function _inout_string(@nospecialize(c::VertexModel), f, name)
104+
function _inout_string(c::VertexModel, f, name)
105105
sym = f(c)
106106
num, word = maybe_plural(length(sym), name)
107107
defs = get_defaults_or_inits(c, sym)
108108
guesses = get_guesses(c, sym)
109109
styled"$num &$word: &&$(stylesymbolarray(sym, defs, guesses))"
110110
end
111-
function _inout_string(@nospecialize(c::EdgeModel), f, name)
111+
function _inout_string(c::EdgeModel, f, name)
112112
sym = f(c)
113113
word = name*"s"
114114
srcnum = length(sym.src)

0 commit comments

Comments
 (0)