Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .github/workflows/Downstream.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@ jobs:
test:
name: ${{ matrix.package.repo }}/${{ matrix.julia-version }}
runs-on: ${{ matrix.os }}
env:
GROUP: ${{ matrix.package.group }}
strategy:
fail-fast: false
matrix:
Expand Down
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "QuestBase"
uuid = "7e80f742-43d6-403d-a9ea-981410111d43"
authors = ["Orjan Ameye <[email protected]>", "Jan Kosata <[email protected]>", "Javier del Pino <[email protected]>"]
version = "0.3.2"
version = "0.3.3"

[deps]
DocStringExtensions = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae"
Expand Down
4 changes: 4 additions & 0 deletions src/DifferentialEquation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ mutable struct DifferentialEquation
return new(eqs, OrderedDict(var => OrderedSet() for var in keys(eqs)))
end

function DifferentialEquation()
return new(OrderedDict{Num,Equation}(), OrderedDict{Num,OrderedSet{Num}}())
end

# uses the above constructor if no harmonics defined
function DifferentialEquation(eqs::Vector{Equation}, vars::Vector{Num})
if length(eqs) != length(vars)
Expand Down
21 changes: 19 additions & 2 deletions src/HarmonicEquation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,11 @@ mutable struct HarmonicEquation
jacobian::Matrix{Num}

# use a self-referential constructor with _parameters
function HarmonicEquation(equations, variables, nat_eq)
function HarmonicEquation(
equations::Vector{Equation},
variables::Vector{HarmonicVariable},
nat_eq::DifferentialEquation,
)
return (
x=new(
equations,
Expand All @@ -32,7 +36,12 @@ mutable struct HarmonicEquation
x
)
end
function HarmonicEquation(equations, variables, parameters, natural_equation)
function HarmonicEquation(
equations::Vector{Equation},
variables::Vector{HarmonicVariable},
parameters::Vector{Num},
natural_equation::DifferentialEquation,
)
return new(
equations,
variables,
Expand All @@ -41,6 +50,14 @@ mutable struct HarmonicEquation
dummy_symbolic_Jacobian(length(variables)),
)
end
function HarmonicEquation(
equations::Vector{Equation},
variables::Vector{HarmonicVariable},
parameters::Vector{Num},
jacobian::Matrix{Num},
)
return new(equations, variables, parameters, DifferentialEquation(), jacobian)
end
end

"Get the parameters (not time nor variables) of a HarmonicEquation"
Expand Down
5 changes: 5 additions & 0 deletions test/DifferentialEquations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ using QuestBase:
diff_eq3 = DifferentialEquation(expr, x)
@test length(diff_eq3.equations) == 1
@test diff_eq3.equations[x].rhs == 0

# Test empty constructor
diff = DifferentialEquation()
@test isempty(diff.equations)
@test isempty(diff.harmonics)
end

@testset "Helper Functions" begin
Expand Down
3 changes: 3 additions & 0 deletions test/HarmonicEquation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ hv2 = HarmonicVariable(v, "test", "v", Num(1.0), y)
@test heq.parameters == Num[]
@test heq.jacobian isa Matrix{Num}
end

heq3 = HarmonicEquation([eq1, eq2], [hv1, hv2], Num[], Num[1 1; 1 1])
@test isempty(heq3.natural_equation.harmonics)
end

@testset "Parameter handling" begin
Expand Down
Loading