Skip to content

Commit

Permalink
implement broadcastable() for basic SBML structs
Browse files Browse the repository at this point in the history
closes #263
  • Loading branch information
exaexa committed Jan 5, 2025
1 parent a9cecd7 commit b9c6c3b
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions src/structs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -524,3 +524,47 @@ Base.@kwdef struct Model
sbo::Maybe{String} = nothing
cv_terms::Vector{CVTerm} = []
end

# Explicitly make all SBML structs "broadcastable" as scalars.
# (This must be updated if any of the structs are added or removed.)
#
# Use this to regenerate the Union contents moreless automatically:
#
# sed -ne 's/.*\<struct \([A-Z][A-Za-z0-9]*\)\>.*/\1,/p' src/structs.jl
Base.Broadcast.broadcastable(
x::T,
) where {
T<:Union{
UnitPart,
UnitDefinition,
GPARef,
GPAAnd,
GPAOr,
MathVal,
MathIdent,
MathConst,
MathTime,
MathAvogadro,
MathApply,
MathLambda,
CVTerm,
Parameter,
Compartment,
SpeciesReference,
Reaction,
AlgebraicRule,
AssignmentRule,
RateRule,
Constraint,
Species,
GeneProduct,
FunctionDefinition,
EventAssignment,
Trigger,
Objective,
Event,
Member,
Group,
Model,
},
} = Ref(x)

0 comments on commit b9c6c3b

Please sign in to comment.