Skip to content

Commit

Permalink
add instructions to use the init function
Browse files Browse the repository at this point in the history
  • Loading branch information
Datseris committed Jul 13, 2024
1 parent 5bdf091 commit 61381cc
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "ProcessBasedModelling"
uuid = "ca969041-2cf3-4b10-bc21-86f4417093eb"
authors = ["Datseris <[email protected]>"]
version = "1.2.2"
version = "1.2.3"

[deps]
ModelingToolkit = "961ee093-0014-501f-94e3-6117800e7a78"
Expand Down
23 changes: 23 additions & 0 deletions src/default.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,29 @@ If `warn`, throw a warning if a default process with same LHS variable already
exists and will be overwritten.
You can use [`default_processes`](@ref) to obtain the list of tracked default processes.
!!! note "For developers"
If you are developing a new module/package that is based on ProcessBasedModelling.jl,
and within it you also register default processes, then enclose your
`register_default_process!` calls within the module's `__init__()` function.
For example:
```julia
module MyProcesses
# ...
function __init__()
register_default_process!.(
[
process1,
process2,
# ...
],
Ref(MyProcesses)
)
end
end # module
```
"""
function register_default_process!(process::Union{Process, Equation}, m::Module; warn = true)
mdict = default_processes(m)
Expand Down

0 comments on commit 61381cc

Please sign in to comment.