Skip to content

Commit d4f4af6

Browse files
refactor: document check keyword flags, mark as public
1 parent 97e23d6 commit d4f4af6

File tree

3 files changed

+37
-1
lines changed

3 files changed

+37
-1
lines changed

docs/src/API/System.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,3 +186,17 @@ ModelingToolkit.is_bound
186186
```@docs
187187
debug_system
188188
```
189+
190+
## Input validation
191+
192+
The following values can be passed to the `check` keyword of `System` to toggle validation
193+
of input. Flags can be combined with bitwise `|` and `&`.
194+
195+
```@docs
196+
ModelingToolkit.CheckAll
197+
ModelingToolkit.CheckNone
198+
ModelingToolkit.CheckComponents
199+
ModelingToolkit.CheckUnits
200+
```
201+
202+
These can also be used by custom `AbstractSystem` subtypes.

src/ModelingToolkit.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ export DynamicOptSolution
336336
@public is_diff_equation, Equality, linearize_symbolic, reorder_unknowns
337337
@public similarity_transform, inputs, outputs, bound_inputs, unbound_inputs, bound_outputs
338338
@public unbound_outputs, is_bound
339-
@public AbstractSystem
339+
@public AbstractSystem, CheckAll, CheckNone, CheckComponents, CheckUnits
340340

341341
for prop in [SYS_PROPS; [:continuous_events, :discrete_events]]
342342
getter = Symbol(:get_, prop)

src/utils.jl

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,31 @@ function readable_code(expr)
8888
end
8989

9090
# System validation enums
91+
"""
92+
const CheckNone
93+
94+
Value that can be provided to the `check` keyword of `System` to disable checking of input.
95+
"""
9196
const CheckNone = 0
97+
"""
98+
const CheckAll
99+
100+
Value that can be provided to the `check` keyword of `System` to enable all input
101+
validation.
102+
"""
92103
const CheckAll = 1 << 0
104+
"""
105+
const CheckComponents
106+
107+
Value that can be provided to the `check` keyword of `System` to only enable checking of
108+
basic components of the system, such as equations, variables, etc.
109+
"""
93110
const CheckComponents = 1 << 1
111+
"""
112+
const CheckUnits
113+
114+
Value that can be provided to the `check` keyword of `System` to enable checking of units.
115+
"""
94116
const CheckUnits = 1 << 2
95117

96118
function check_independent_variables(ivs)

0 commit comments

Comments
 (0)