Skip to content

Commit 61381cc

Browse files
committed
add instructions to use the init function
1 parent 5bdf091 commit 61381cc

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "ProcessBasedModelling"
22
uuid = "ca969041-2cf3-4b10-bc21-86f4417093eb"
33
authors = ["Datseris <[email protected]>"]
4-
version = "1.2.2"
4+
version = "1.2.3"
55

66
[deps]
77
ModelingToolkit = "961ee093-0014-501f-94e3-6117800e7a78"

src/default.jl

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,29 @@ If `warn`, throw a warning if a default process with same LHS variable already
1111
exists and will be overwritten.
1212
1313
You can use [`default_processes`](@ref) to obtain the list of tracked default processes.
14+
15+
!!! note "For developers"
16+
If you are developing a new module/package that is based on ProcessBasedModelling.jl,
17+
and within it you also register default processes, then enclose your
18+
`register_default_process!` calls within the module's `__init__()` function.
19+
For example:
20+
```julia
21+
module MyProcesses
22+
# ...
23+
24+
function __init__()
25+
register_default_process!.(
26+
[
27+
process1,
28+
process2,
29+
# ...
30+
],
31+
Ref(MyProcesses)
32+
)
33+
end
34+
35+
end # module
36+
```
1437
"""
1538
function register_default_process!(process::Union{Process, Equation}, m::Module; warn = true)
1639
mdict = default_processes(m)

0 commit comments

Comments
 (0)