@@ -10,6 +10,26 @@ struct MTKParameters{T, I, D, C, N, H}
1010 constant:: C
1111 nonnumeric:: N
1212 caches:: H
13+
14+ function MTKParameters {T, I, D, C, N, H} (tunables:: T , initials:: I , discrete:: D ,
15+ constant:: C , nonnumeric:: N ,
16+ caches:: H ) where {T, I, D, C, N, H}
17+ if tunables isa StaticVector{0 }
18+ tunables = SVector {0, eltype(tunables)} ()
19+ end
20+ if initials isa StaticVector{0 }
21+ initials = SVector {0, eltype(initials)} ()
22+ end
23+ return new {typeof(tunables), typeof(initials), D, C, N, H} (tunables, initials,
24+ discrete, constant,
25+ nonnumeric, caches)
26+ end
27+ function MTKParameters (tunables:: T , initials:: I , discrete:: D ,
28+ constant:: C , nonnumeric:: N ,
29+ caches:: H ) where {T, I, D, C, N, H}
30+ return MTKParameters {T, I, D, C, N, H} (tunables, initials, discrete, constant,
31+ nonnumeric, caches)
32+ end
1333end
1434
1535"""
@@ -138,11 +158,11 @@ function MTKParameters(
138158 end
139159 tunable_buffer = narrow_buffer_type (tunable_buffer; p_constructor)
140160 if isempty (tunable_buffer)
141- tunable_buffer = SizedVector {0, Float64} ()
161+ tunable_buffer = SVector {0, Float64} ()
142162 end
143163 initials_buffer = narrow_buffer_type (initials_buffer; p_constructor)
144164 if isempty (initials_buffer)
145- initials_buffer = SizedVector {0, Float64} ()
165+ initials_buffer = SVector {0, Float64} ()
146166 end
147167 disc_buffer = narrow_buffer_type .(disc_buffer; p_constructor)
148168 const_buffer = narrow_buffer_type .(const_buffer; p_constructor)
@@ -879,10 +899,10 @@ end
879899@generated function Base. getindex (
880900 ps:: MTKParameters{T, I, D, C, N, H} , idx:: Int ) where {T, I, D, C, N, H}
881901 paths = []
882- if ! (T <: SizedVector {0} )
902+ if ! (T <: StaticVector {0} )
883903 push! (paths, :(ps. tunable))
884904 end
885- if ! (I <: SizedVector {0} )
905+ if ! (I <: StaticVector {0} )
886906 push! (paths, :(ps. initials))
887907 end
888908 for i in 1 : fieldcount (D)
@@ -909,10 +929,10 @@ end
909929@generated function Base. length (ps:: MTKParameters {
910930 T, I, D, C, N, H}) where {T, I, D, C, N, H}
911931 len = 0
912- if ! (T <: SizedVector {0} )
932+ if ! (T <: SVector {0} )
913933 len += 1
914934 end
915- if ! (I <: SizedVector {0} )
935+ if ! (I <: SVector {0} )
916936 len += 1
917937 end
918938 len += fieldcount (D) + fieldcount (C) + fieldcount (N) + fieldcount (H)
0 commit comments