Skip to content
Merged
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
70 changes: 35 additions & 35 deletions src/ModelingToolkit.jl
Original file line number Diff line number Diff line change
Expand Up @@ -242,41 +242,6 @@ const D_nounits = Differential(t_nounits)
const D_unitful = Differential(t_unitful)
const D = Differential(t)

PrecompileTools.@compile_workload begin
using ModelingToolkit
@variables x(ModelingToolkit.t_nounits)
@named sys = System([ModelingToolkit.D_nounits(x) ~ -x], ModelingToolkit.t_nounits)
prob = ODEProblem(mtkcompile(sys), [x => 30.0], (0, 100), jac = true)
@mtkmodel __testmod__ begin
@constants begin
c = 1.0
end
@structural_parameters begin
structp = false
end
if structp
@variables begin
x(t) = 0.0, [description = "foo", guess = 1.0]
end
else
@variables begin
x(t) = 0.0, [description = "foo w/o structp", guess = 1.0]
end
end
@parameters begin
a = 1.0, [description = "bar"]
if structp
b = 2 * a, [description = "if"]
else
c
end
end
@equations begin
x ~ a + b
end
end
end

export ODEFunction, convert_system_indepvar,
System, OptimizationSystem, JumpSystem, SDESystem, NonlinearSystem, ODESystem
export SDEFunction
Expand Down Expand Up @@ -378,4 +343,39 @@ for prop in [SYS_PROPS; [:continuous_events, :discrete_events]]
@eval @public $getter, $hasfn
end

PrecompileTools.@compile_workload begin
using ModelingToolkit
@variables x(ModelingToolkit.t_nounits)
@named sys = System([ModelingToolkit.D_nounits(x) ~ -x], ModelingToolkit.t_nounits)
prob = ODEProblem(mtkcompile(sys), [x => 30.0], (0, 100), jac = true)
@mtkmodel __testmod__ begin
@constants begin
c = 1.0
end
@structural_parameters begin
structp = false
end
if structp
@variables begin
x(t) = 0.0, [description = "foo", guess = 1.0]
end
else
@variables begin
x(t) = 0.0, [description = "foo w/o structp", guess = 1.0]
end
end
@parameters begin
a = 1.0, [description = "bar"]
if structp
b = 2 * a, [description = "if"]
else
c
end
end
@equations begin
x ~ a + b
end
end
end

end # module
Loading