Skip to content

Commit faa4c94

Browse files
committed
- Minor (efficiency) improvement of linear equation system if iteration variables are SVectors.
- Simplify appendVariable!(..) to get rid of performance problems in Modia3D.
1 parent bf74b43 commit faa4c94

File tree

5 files changed

+19
-23
lines changed

5 files changed

+19
-23
lines changed

Manifest.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -440,9 +440,9 @@ version = "0.1.0"
440440

441441
[[deps.SLEEFPirates]]
442442
deps = ["IfElse", "Static", "VectorizationBase"]
443-
git-tree-sha1 = "3a5ae1db486e4ce3ccd2b392389943481e20401f"
443+
git-tree-sha1 = "61a96d8b89083a53fb2b745f3b59a05359651bbe"
444444
uuid = "476501e8-09a2-5ece-8869-fb82de89a1fa"
445-
version = "0.6.29"
445+
version = "0.6.30"
446446

447447
[[deps.Serialization]]
448448
uuid = "9e88b42a-f829-5b0c-bbe9-9e923198166b"
@@ -478,9 +478,9 @@ version = "0.3.3"
478478

479479
[[deps.StaticArrays]]
480480
deps = ["LinearAlgebra", "Random", "Statistics"]
481-
git-tree-sha1 = "95c6a5d0e8c69555842fc4a927fc485040ccc31c"
481+
git-tree-sha1 = "6354dfaf95d398a1a70e0b28238321d5d17b2530"
482482
uuid = "90137ffa-7385-5640-81b9-e52037218182"
483-
version = "1.3.5"
483+
version = "1.4.0"
484484

485485
[[deps.Statistics]]
486486
deps = ["LinearAlgebra", "SparseArrays"]

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "ModiaBase"
22
uuid = "ec7bf1ca-419d-4510-bbab-199861c55244"
33
authors = ["Hilding Elmqvist <Hilding.Elmqvist@Mogram.net>", "Martin Otter <Martin.Otter@dlr.de>"]
4-
version = "0.9.1"
4+
version = "0.9.2"
55

66
[deps]
77
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"

docs/src/index.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,15 @@ julia> ]add ModiaBase
7777

7878
## Release Notes
7979

80+
### Version 0.9.2
81+
82+
- Minor (efficiency) improvement of linear equation system if iteration variables are SVectors.
83+
84+
85+
### Version 0.9.1
86+
87+
- Update of Manifest.toml file
88+
8089
### Version 0.9.0
8190

8291
Non-backwards compatible improvements

src/ModiaBase.jl

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ Main module of ModiaBase.
99
module ModiaBase
1010

1111
const path = dirname(dirname(@__FILE__)) # Absolute path of package directory
12-
const Version = "0.9.1"
13-
const Date = "2022-02-21"
12+
const Version = "0.9.2"
13+
const Date = "2022-02-23"
1414

1515
#println("\nImporting ModiaBase Version $Version ($Date)")
1616

@@ -19,21 +19,8 @@ using StaticArrays
1919

2020

2121
# append! as needed in EquationAndStateInfo.jl and in ModiaLang/src/CodeGeneration.jl
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
36-
22+
appendVariable!(v1::Vector{FloatType}, s::FloatType) where {FloatType} = push!(v1,s)
23+
appendVariable!(v1::Vector{FloatType}, v2) where {FloatType} = append!(v1,v2)
3724

3825
include("LinearIntegerEquations.jl")
3926

src/StateSelection.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -901,7 +901,7 @@ function addLinearEquations!(eq::EquationGraph, hasConstantCoefficients::Bool, u
901901
if v_startOrInit isa AbstractVector
902902
# v is a vector
903903
if v_unit == ""
904-
push!(while_body, :( $v_julia_name = ModiaBase.SVector{$v_length,_FloatType}(_leq_mode.x[$i1:$i2])::ModiaBase.SVector{$v_length,_FloatType}) )
904+
push!(while_body, :( $v_julia_name::ModiaBase.SVector{$v_length,_FloatType} = ModiaBase.SVector{$v_length,_FloatType}(_leq_mode.x[$i1:$i2])) )
905905
else
906906
push!(while_body, :( $v_julia_name = ModiaBase.SVector{$v_length}(_leq_mode.x[$i1:$i2])::ModiaBase.SVector{$v_length,_FloatType}*@u_str($v_unit)) )
907907
end

0 commit comments

Comments
 (0)