Skip to content

Commit

Permalink
🚧 Extract aliasing dicts from Internals.
Browse files Browse the repository at this point in the history
  • Loading branch information
iago-lito committed Sep 18, 2023
1 parent 6502cc2 commit ceda5ef
Show file tree
Hide file tree
Showing 8 changed files with 446 additions and 330 deletions.
4 changes: 4 additions & 0 deletions src/EcologicalNetworksDynamics.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
module EcologicalNetworksDynamics

# Improve APIs comfort.
include("./aliasing_dicts.jl")
using .AliasingDicts

# The entire implementation has been brutally made private
# so that we can focus on constructing
# an implementation-independent API on top of it, from scratch.
Expand Down
2 changes: 2 additions & 0 deletions src/Internals/Internals.jl
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ using Statistics
using Decimals
using SciMLBase

using ..AliasingDicts

const Solution = SciMLBase.AbstractODESolution

include(joinpath(".", "macros.jl"))
Expand Down
314 changes: 0 additions & 314 deletions src/Internals/aliasing_dict.jl

This file was deleted.

18 changes: 9 additions & 9 deletions src/Internals/inputs/MultiplexNetwork_signature.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
# to make the sophisticated signature of the MultiplexNetwork() function work.

# For use within this file.
pstandards() = standards(MultiplexParametersDict)
istandards() = standards(InteractionDict)
pstandard(p) = standardize(p, MultiplexParametersDict)
istandard(i) = standardize(i, InteractionDict)
p_references() = references(MultiplexParametersDict)
i_references() = references(InteractionDict)
pstandards() = AliasingDicts.standards(MultiplexParametersDict)
istandards() = AliasingDicts.standards(InteractionDict)
pstandard(p) = AliasingDicts.standardize(p, MultiplexParametersDict)
istandard(i) = AliasingDicts.standardize(i, InteractionDict)
p_references() = AliasingDicts.references(MultiplexParametersDict)
i_references() = AliasingDicts.references(InteractionDict)

############################################################################################
# Protect against aliasing ambiguity. ######################################################
Expand Down Expand Up @@ -171,7 +171,7 @@ function parse_MultiplexNetwork_arguments(foodweb, args)
for ArgType in [ParmIntNestedArg, IntParmNestedArg]
ro = reorder(ArgType)
FirstDict, NestedDict = ro(MultiplexParametersDict, InteractionDict)
if arg in references(FirstDict)
if arg in AliasingDicts.references(FirstDict)
found_transversal = true
try
# Scroll sub-arguments within the nested specification.
Expand Down Expand Up @@ -335,14 +335,14 @@ function parse_MultiplexNetwork_arguments(foodweb, args)
# Anything not provided by user is set to default.
# During this step, drop arguments name informations (eg. (arg, V) -> V).
for parm in pstandards(), int in istandards()
if isin(parm, [:C, :L, :symmetry], MultiplexParametersDict)
if AliasingDicts.isin(parm, [:C, :L, :symmetry], MultiplexParametersDict)
# These annex parameters don't need defaults.
continue
end
if !already(parm, int)
# Missing: read from defaults.
def = defaults[parm][int]
if is(parm, :A, MultiplexParametersDict)
if AliasingDicts.is(parm, :A, MultiplexParametersDict)
# Special case: this default is a function of the foodweb.
def = def(foodweb)
end
Expand Down
Loading

0 comments on commit ceda5ef

Please sign in to comment.