@@ -104,7 +104,7 @@ Define linear equation system "A*x=b" with `x::Vector{FloatType}`.
104
104
- If length(x) <= useRecursiveFactorizationUptoSize, then linear equation systems will be solved with
105
105
`RecursiveFactorization.jl` instead of the default `lu!(..)` and `ldiv!(..)`.
106
106
107
- For details how to use this constructor, see [`LinearEquationsIteration`](@ref).
107
+ For details how to use this constructor, see [`LinearEquationsIteration! `](@ref).
108
108
"""
109
109
mutable struct LinearEquations{FloatType <: Real }
110
110
odeMode:: Bool # Set from the calling function after LinearEquations was instantiated (default: true)
@@ -137,7 +137,7 @@ mutable struct LinearEquations{FloatType <: Real}
137
137
residuals:: Vector{FloatType} # Values of the residuals FloatType vector; length(residuals) = length(x)
138
138
139
139
# Iteration status of for-loop
140
- mode:: Int # Operational mode (see function LinearEquationsIteration)
140
+ mode:: Int # Operational mode (see function LinearEquationsIteration! )
141
141
niter:: Int # Current number of iterations in the fix point iteration scheme
142
142
niter_max:: Int # Maximum number of iterations
143
143
success:: Bool # = true, if solution of A*x = b is successfully computed
@@ -216,7 +216,7 @@ function getDerivatives!(_der_x, _x, _m, _time)::Nothing
216
216
...
217
217
_leq = _m.linearEquations[<nr>] # leq::LinearEquations{FloatType}
218
218
_leq.mode = -3 # initializes the iteration
219
- while LinearEquationsIteration(_leq, _m.isInitial, _m.solve_leq, _m.storeResult, _m.time, _m.timer)
219
+ while LinearEquationsIteration! (_leq, _m.isInitial, _m.solve_leq, _m.storeResult, _m.time, _m.timer)
220
220
x1 = _leq.x[1]
221
221
x2 = _leq.x[2]
222
222
x3 = _leq.x_vec[1]
@@ -250,7 +250,7 @@ and used in subsequent calls to solve the equation system.
250
250
251
251
- `leq::LinearEquations{FloatType}`: Instance of `LinearEquations`.
252
252
- `isInitial::Bool`: = true: Called during initialization.
253
- - `solve::Bool`: = true: leq.x is computed by LinearEquationsIteration.
253
+ - `solve::Bool`: = true: leq.x is computed by LinearEquationsIteration! .
254
254
= false: leq.x has been set by calling environment
255
255
(typically when called from DAE integrator).
256
256
Note, at events and at terminate, solve must be true).
@@ -281,7 +281,7 @@ leq.mode > 0: Compute "residuals .= A*e_i - b" # e_i = unit vector with i = l
281
281
# Hidden argument `leq.mode::Int` on input
282
282
283
283
```julia
284
- leq.mode = -3 # LinearEquationsIteration is called the first time
284
+ leq.mode = -3 # LinearEquationsIteration! is called the first time
285
285
if leq.odeMode || solve
286
286
# ODE mode or DAE mode at an event (solve "x" from equation "residuals = A*x - b")
287
287
# Initialize fixed point iteration or continue fixed point iteration (if in DAE mode)
@@ -353,7 +353,7 @@ function LinearEquationsIteration!(leq::LinearEquations{FloatType}, isInitial::B
353
353
nx = length (leq. x)
354
354
355
355
if mode == - 3
356
- # LinearEquationsIteration is called the first time in the current model evaluation
356
+ # LinearEquationsIteration! is called the first time in the current model evaluation
357
357
leq. niter = 0 # Number of event iterations
358
358
empty! (leq. inconsistentPositive)
359
359
empty! (leq. inconsistentNegative)
@@ -410,7 +410,7 @@ function LinearEquationsIteration!(leq::LinearEquations{FloatType}, isInitial::B
410
410
residuals = leq. residuals
411
411
412
412
if length (residuals) != length (x)
413
- error (" Function LinearEquationsIteration wrongly used:\n " ,
413
+ error (" Function LinearEquationsIteration! wrongly used:\n " ,
414
414
" length(leq.residuals) = " , length (leq. residuals), " , length(leq.x) = " , length (leq. x))
415
415
end
416
416
@@ -453,12 +453,12 @@ function LinearEquationsIteration!(leq::LinearEquations{FloatType}, isInitial::B
453
453
else
454
454
x .= b
455
455
if leq. useRecursiveFactorization
456
- ModiaBase. TimerOutputs. @timeit timer " ModiaBase LinearEquationsIteration (solve A*x=b Rec.Fac.)" begin
456
+ ModiaBase. TimerOutputs. @timeit timer " ModiaBase LinearEquationsIteration! (solve A*x=b Rec.Fac.)" begin
457
457
leq. luA = RecursiveFactorization. lu! (A, leq. pivots)
458
458
ldiv! (leq. luA, x)
459
459
end
460
460
else
461
- ModiaBase. TimerOutputs. @timeit timer " ModiaBase LinearEquationsIteration (solve A*x=b)" begin
461
+ ModiaBase. TimerOutputs. @timeit timer " ModiaBase LinearEquationsIteration! (solve A*x=b)" begin
462
462
leq. luA = lu! (A)
463
463
ldiv! (leq. luA, x)
464
464
end
0 commit comments