You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/dependencies/soft_dependencies.jl
+3-5Lines changed: 3 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -139,10 +139,8 @@ function soft_dependencies(d::DependencyGraph{Dict{Symbol,HardDependencyNode}},
139
139
end
140
140
141
141
# For multiscale mapping:
142
-
functionsoft_dependencies_multiscale(soft_dep_graphs_roots::DependencyGraph{Dict{String,Any}}, mapping::Dict{String,A}, hard_dep_dict::Dict{Pair{Symbol,String},HardDependencyNode}) where {A<:Any}
for (organ, (soft_dep_graph, ins, outs)) in soft_dep_graphs_roots.roots # e.g. organ = "Plant"; soft_dep_graph, ins, outs = soft_dep_graphs_roots.roots[organ]
148
146
for (proc, i) in soft_dep_graph
@@ -158,7 +156,7 @@ function soft_dependencies_multiscale(soft_dep_graphs_roots::DependencyGraph{Dic
158
156
# NB: if a node is already a hard dependency of the node, it cannot be a soft dependency
159
157
160
158
# Check if the process has soft dependencies at other scales:
@@ -314,10 +314,32 @@ function init_simulation(mtg, mapping; nsteps=1, outputs=nothing, type_promotion
314
314
@assertfalse"Error : Mapping status at $organ_with_vector level contains a vector. If this was intentional, call the function generate_models_from_status_vectors on your mapping before calling run!. And bear in mind this is not meant for production. If this wasn't intentional, then it's likely an issue on the mapping definition, or an unusual model."
# Note: we could do that in `soft_dependencies_multiscale` but we prefer to keep the function as simple as possible, and
338
+
# usable on its own.
339
+
340
+
iscyclic &&error("Cyclic dependency detected in the graph. Cycle: \n$(print_cycle(cycle_vec))\n You can break the cycle using the `PreviousTimeStep` variable in the mapping.")
341
+
# Third step, we identify which
342
+
321
343
# Print an info if models are declared for nodes that don't exist in the MTG:
Copy file name to clipboardExpand all lines: test/test-mtg-multiscale.jl
+8-5Lines changed: 8 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -127,8 +127,10 @@ end
127
127
end
128
128
129
129
@testset"Status initialisation"begin
130
-
@test_throws"Variable `carbon_biomass` is not computed by any model, not initialised by the user in the status, and not found in the MTG at scale Internode (checked for MTG node 4)." PlantSimEngine.init_statuses(mtg, mapping_1)
@test_throws"Variable `carbon_biomass` is not computed by any model, not initialised by the user in the status, and not found in the MTG at scale Internode (checked for MTG node 4)." PlantSimEngine.init_statuses(mtg, mapping_1, hard_dep_graph)
0 commit comments