Skip to content

Commit

Permalink
Merge pull request #3155 from AayushSabharwal/as/getproperty
Browse files Browse the repository at this point in the history
fix: fix flattening in `complete`
  • Loading branch information
ChrisRackauckas authored Oct 28, 2024
2 parents 29084c3 + 21efe80 commit 5031a9d
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 44 deletions.
7 changes: 4 additions & 3 deletions src/systems/abstractsystem.jl
Original file line number Diff line number Diff line change
Expand Up @@ -932,10 +932,11 @@ function complete(sys::AbstractSystem; split = true, flatten = true)
@set! sys.ps = unique!(vcat(get_ps(sys), collect(newparams)))
end
if flatten
if sys isa Union{OptimizationSystem, ConstraintsSystem, JumpSystem}
newsys = sys
else
if (eqs = equations(sys)) isa Vector &&
any(eq -> eq isa Equation && isconnection(eq.lhs), eqs)
newsys = expand_connections(sys)
else
newsys = sys
end
newsys = ModelingToolkit.flatten(newsys)
if has_parent(newsys) && get_parent(sys) === nothing
Expand Down
82 changes: 41 additions & 41 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -19,48 +19,48 @@ end
@time begin
if GROUP == "All" || GROUP == "InterfaceI"
@testset "InterfaceI" begin
# @safetestset "Linear Algebra Test" include("linalg.jl")
# @safetestset "AbstractSystem Test" include("abstractsystem.jl")
# @safetestset "Variable Scope Tests" include("variable_scope.jl")
# @safetestset "Symbolic Parameters Test" include("symbolic_parameters.jl")
# @safetestset "Parsing Test" include("variable_parsing.jl")
# @safetestset "Simplify Test" include("simplify.jl")
# @safetestset "Direct Usage Test" include("direct.jl")
# @safetestset "System Linearity Test" include("linearity.jl")
# @safetestset "Input Output Test" include("input_output_handling.jl")
# @safetestset "Clock Test" include("clock.jl")
# @safetestset "ODESystem Test" include("odesystem.jl")
# @safetestset "Dynamic Quantities Test" include("dq_units.jl")
# @safetestset "Unitful Quantities Test" include("units.jl")
# @safetestset "Mass Matrix Test" include("mass_matrix.jl")
# @safetestset "InitializationSystem Test" include("initializationsystem.jl")
# @safetestset "Guess Propagation" include("guess_propagation.jl")
# @safetestset "Hierarchical Initialization Equations" include("hierarchical_initialization_eqs.jl")
# @safetestset "Reduction Test" include("reduction.jl")
# @safetestset "Split Parameters Test" include("split_parameters.jl")
# @safetestset "StaticArrays Test" include("static_arrays.jl")
# @safetestset "Components Test" include("components.jl")
# @safetestset "Model Parsing Test" include("model_parsing.jl")
# @safetestset "Error Handling" include("error_handling.jl")
# @safetestset "StructuralTransformations" include("structural_transformation/runtests.jl")
# @safetestset "State Selection Test" include("state_selection.jl")
# @safetestset "Symbolic Event Test" include("symbolic_events.jl")
# @safetestset "Stream Connect Test" include("stream_connectors.jl")
# @safetestset "Domain Connect Test" include("domain_connectors.jl")
# @safetestset "Lowering Integration Test" include("lowering_solving.jl")
# @safetestset "Dependency Graph Test" include("dep_graphs.jl")
# @safetestset "Function Registration Test" include("function_registration.jl")
# @safetestset "Precompiled Modules Test" include("precompile_test.jl")
# @safetestset "DAE Jacobians Test" include("dae_jacobian.jl")
# @safetestset "Jacobian Sparsity" include("jacobiansparsity.jl")
@safetestset "Linear Algebra Test" include("linalg.jl")
@safetestset "AbstractSystem Test" include("abstractsystem.jl")
@safetestset "Variable Scope Tests" include("variable_scope.jl")
@safetestset "Symbolic Parameters Test" include("symbolic_parameters.jl")
@safetestset "Parsing Test" include("variable_parsing.jl")
@safetestset "Simplify Test" include("simplify.jl")
@safetestset "Direct Usage Test" include("direct.jl")
@safetestset "System Linearity Test" include("linearity.jl")
@safetestset "Input Output Test" include("input_output_handling.jl")
@safetestset "Clock Test" include("clock.jl")
@safetestset "ODESystem Test" include("odesystem.jl")
@safetestset "Dynamic Quantities Test" include("dq_units.jl")
@safetestset "Unitful Quantities Test" include("units.jl")
@safetestset "Mass Matrix Test" include("mass_matrix.jl")
@safetestset "InitializationSystem Test" include("initializationsystem.jl")
@safetestset "Guess Propagation" include("guess_propagation.jl")
@safetestset "Hierarchical Initialization Equations" include("hierarchical_initialization_eqs.jl")
@safetestset "Reduction Test" include("reduction.jl")
@safetestset "Split Parameters Test" include("split_parameters.jl")
@safetestset "StaticArrays Test" include("static_arrays.jl")
@safetestset "Components Test" include("components.jl")
@safetestset "Model Parsing Test" include("model_parsing.jl")
@safetestset "Error Handling" include("error_handling.jl")
@safetestset "StructuralTransformations" include("structural_transformation/runtests.jl")
@safetestset "State Selection Test" include("state_selection.jl")
@safetestset "Symbolic Event Test" include("symbolic_events.jl")
@safetestset "Stream Connect Test" include("stream_connectors.jl")
@safetestset "Domain Connect Test" include("domain_connectors.jl")
@safetestset "Lowering Integration Test" include("lowering_solving.jl")
@safetestset "Dependency Graph Test" include("dep_graphs.jl")
@safetestset "Function Registration Test" include("function_registration.jl")
@safetestset "Precompiled Modules Test" include("precompile_test.jl")
@safetestset "DAE Jacobians Test" include("dae_jacobian.jl")
@safetestset "Jacobian Sparsity" include("jacobiansparsity.jl")
@safetestset "Modelingtoolkitize Test" include("modelingtoolkitize.jl")
# @safetestset "FuncAffect Test" include("funcaffect.jl")
# @safetestset "Constants Test" include("constants.jl")
# @safetestset "Parameter Dependency Test" include("parameter_dependencies.jl")
# @safetestset "Generate Custom Function Test" include("generate_custom_function.jl")
# @safetestset "Initial Values Test" include("initial_values.jl")
# @safetestset "Equation Type Accessors Test" include("equation_type_accessors.jl")
# @safetestset "Equations with complex values" include("complex.jl")
@safetestset "FuncAffect Test" include("funcaffect.jl")
@safetestset "Constants Test" include("constants.jl")
@safetestset "Parameter Dependency Test" include("parameter_dependencies.jl")
@safetestset "Generate Custom Function Test" include("generate_custom_function.jl")
@safetestset "Initial Values Test" include("initial_values.jl")
@safetestset "Equation Type Accessors Test" include("equation_type_accessors.jl")
@safetestset "Equations with complex values" include("complex.jl")
end
end

Expand Down

0 comments on commit 5031a9d

Please sign in to comment.