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
@@ -185,10 +173,21 @@ function pre_allocate_outputs(statuses, statuses_template, reverse_multiscale_ma
185
173
186
174
outs_tuple =Dict(i =>Tuple(x for x in outs_[i]) for i inkeys(outs_))
187
175
176
+
node_types = []
177
+
for o inkeys(statuses)
178
+
iflength(statuses[o]) >0
179
+
push!(node_types, typeof(statuses[o][1].node))
180
+
end
181
+
end
182
+
183
+
node_type =unique(node_types)
184
+
@assertlength(node_type) ==1"All plant graph nodes should have the same type, found $(unique(node_type))."
185
+
node_type =only(node_type)
186
+
188
187
# Making the pre-allocated outputs:
189
-
Dict(organ =>Dict(var => [typeof(statuses_[organ][1][var])[] for n in1:nsteps] for var in vars) for (organ, vars) in outs_tuple)
190
-
# Note: we use the type of the variable from the first status for each organ to pre-allocate the outputs, because they are
191
-
#all the same type for others.
188
+
returnDict(organ =>Dict(var => [var ==:node? node_type[] :typeof(status_from_template(statuses_template[organ])[var])[] for n in1:nsteps] for var in vars) for (organ, vars) in outs_tuple)
189
+
# Note: we use the type of the variable from the status template for each organ to pre-allocate the outputs. We transform the status template into a status to get the types of the variables
190
+
#without the reference types, e.g. RefVector{Float64} becomes Vector{Float64}.
0 commit comments