Skip to content

Commit eb5f1fd

Browse files
refactor: mark VariableType, MTKVariableTypeCtx as public
1 parent 9cfba5b commit eb5f1fd

File tree

3 files changed

+23
-0
lines changed

3 files changed

+23
-0
lines changed

docs/src/API/variables.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,15 @@ hasunit
263263
getunit
264264
```
265265

266+
## Variable type
267+
268+
This metadata is used by the [`System`](@ref) constructor for automatically identifying the different types of variables in a system.
269+
270+
```@docs
271+
ModelingToolkit.VariableType
272+
ModelingToolkit.MTKVariableTypeCtx
273+
```
274+
266275
## Miscellaneous metadata
267276

268277
User-defined metadata can be added using the `misc` metadata. This can be queried

src/ModelingToolkit.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,7 @@ export DynamicOptSolution
339339
@public AbstractSystem, CheckAll, CheckNone, CheckComponents, CheckUnits
340340
@public t, D, t_nounits, D_nounits, t_unitful, D_unitful
341341
@public SymbolicContinuousCallback, SymbolicDiscreteCallback
342+
@public VariableType, MTKVariableTypeCtx
342343

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

src/parameters.jl

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,18 @@
11
import SymbolicUtils: symtype, term, hasmetadata, issym
2+
3+
"""
4+
@enum VariableType
5+
6+
The type of the declared variable, used for automatic identification of
7+
variables/parameters/brownians/etc. by the `System` constructor.
8+
"""
29
@enum VariableType VARIABLE PARAMETER BROWNIAN
10+
11+
"""
12+
$TYPEDEF
13+
14+
The symbolic metadata key for storing the `VariableType`.
15+
"""
316
struct MTKVariableTypeCtx end
417

518
getvariabletype(x, def = VARIABLE) = getmetadata(unwrap(x), MTKVariableTypeCtx, def)

0 commit comments

Comments
 (0)