@@ -15,12 +15,24 @@ const Date = "2022-02-13"
1515# println("\nImporting ModiaBase Version $Version ($Date)")
1616
1717using Unitful
18- import StaticArrays
18+ using StaticArrays
1919
2020
2121# append! as needed in EquationAndStateInfo.jl and in ModiaLang/src/CodeGeneration.jl
22- appendVariable! (v1:: AbstractVector , s:: Number ) = push! (v1,s)
23- appendVariable! (v1:: AbstractVector , v2) = append! (v1,v2)
22+ appendVariable! (v1:: Vector{FloatType} , s:: FloatType ) where {FloatType} = push! (v1,s)
23+ appendVariable! (v1:: Vector{FloatType} , v2:: Vector{FloatType} ) where {FloatType} = append! (v1,v2)
24+ appendVariable! (v1:: Vector{FloatType} , v2:: SVector{N,FloatType} ) where {N,FloatType} = append! (v1,v2)
25+ appendVariable! (v1:: Vector{FloatType} , v2:: NTuple{ N,FloatType} ) where {N,FloatType} = append! (v1,v2)
26+ @inline function appendVariable! (v1:: Vector{FloatType} , v2:: NTuple{N,SVector{M,FloatType}} ) where {N,M,FloatType}
27+ @inbounds for e in v2
28+ appendVariable! (v1,e) # dispatch can be performed at compile-time, because typeof(e) = SVector{M,FloatType}
29+ end
30+ end
31+ @inline function appendVariable! (v1:: Vector{FloatType} , v2:: Tuple ) where {FloatType}
32+ @inbounds for e in v2
33+ appendVariable! (v1,e) # dispatch is performed at run-time, because typeof(e) is not known at compile-time.
34+ end
35+ end
2436
2537
2638include (" LinearIntegerEquations.jl" )
0 commit comments