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
The function parse_static_and_time is very type unstable, because it does a lot of different things for a lot of different types. I propose the following stages in parameter initializations for nodes:
Retrieve the node ids with get_node_ids(db, node_type_string)
Initialize the node object making as much use of @kwdef and the zeros(T, length(node_ids)) and otherwise Vector{T}(undef, length(node_ids)) patterns as possible, not caring yet about the actual parameter values
Load the relevant tables with load_structvector(db, config, MyTableV1)
which is a trimmed down version of parse_static_and_time. Here the old time_interpolatables and interpolation_type are inferred from T. This for instance allows different fields of the same node type to have different interpolation types.
Lastly, call a separate function build_control_mapping! to initialize control states, also split out from parse_static_and_time.
This approach makes the parameter parsing less opaque, and gets rid of the parse_static_and_time versus 'completely custom implementation' divide, for instance in the case of TabulatedRatingCurve. If it makes much more sense to parse certain parameters together, specific methods for that can be written. Another advantage of this approach is that the constructors of the node objects are less likely to bloat up when new features and/or fields are added.
The text was updated successfully, but these errors were encountered:
The function
parse_static_and_time
is very type unstable, because it does a lot of different things for a lot of different types. I propose the following stages in parameter initializations for nodes:get_node_ids(db, node_type_string)
@kwdef
and thezeros(T, length(node_ids))
and otherwiseVector{T}(undef, length(node_ids))
patterns as possible, not caring yet about the actual parameter valuesload_structvector(db, config, MyTableV1)
which is a trimmed down version of
parse_static_and_time
. Here the oldtime_interpolatables
andinterpolation_type
are inferred fromT
. This for instance allows different fields of the same node type to have different interpolation types.build_control_mapping!
to initialize control states, also split out fromparse_static_and_time
.This approach makes the parameter parsing less opaque, and gets rid of the
parse_static_and_time
versus 'completely custom implementation' divide, for instance in the case ofTabulatedRatingCurve
. If it makes much more sense to parse certain parameters together, specific methods for that can be written. Another advantage of this approach is that the constructors of the node objects are less likely to bloat up when new features and/or fields are added.The text was updated successfully, but these errors were encountered: