Skip to content

Commit cdb7ad5

Browse files
ChrisRackauckas-ClaudeChrisRackauckasclaude
authored
Make ProblemTypeCtx public API (#4842)
`ProblemTypeCtx` is the documented metadata key that controls `prob.problem_type`, read by `ODEProblem` and `NonlinearProblem` construction. SciMLBase's `wrap_sol` dispatches on that value, so PDE discretization packages must set it to have their solutions wrapped in `PDETimeSeriesSolution` / `PDENoTimeSolution`. It is a cross-package protocol key, but was neither exported nor `public`, so downstream users had no non-internal way to reach it. Mark it `@public` and add it to the rendered docs. `MTKVariableTypeCtx` is already public, so this follows the existing treatment of metadata context types. Claude-Session: https://claude.ai/code/session_0117aJvytDT3y2jMi5Ng6Q5m Co-authored-by: ChrisRackauckas-Claude <accounts@chrisrackauckas.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
1 parent dad829b commit cdb7ad5

3 files changed

Lines changed: 12 additions & 1 deletion

File tree

docs/src/API/problems.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,16 @@ SciMLBase.HomotopyNonlinearFunction
4848
SciMLBase.LinearProblem
4949
```
5050

51+
## Problem type metadata
52+
53+
Systems can carry a `problem_type` that is forwarded to the constructed problem. This is
54+
how discretization packages attach their own metadata to a generated problem and recover
55+
it downstream, for example to wrap a solution in a richer solution type.
56+
57+
```@docs
58+
ModelingToolkit.ProblemTypeCtx
59+
```
60+
5161
## Optimization and optimal control
5262

5363
```@docs

lib/ModelingToolkitBase/Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "ModelingToolkitBase"
22
uuid = "7771a370-6774-4173-bd38-47e70ca0b839"
33
authors = ["Yingbo Ma <mayingbo5@gmail.com>", "Chris Rackauckas <accounts@chrisrackauckas.com> and contributors"]
4-
version = "1.57.1"
4+
version = "1.58.0"
55

66
[deps]
77
ADTypes = "47edcb42-4c32-4615-8424-f2b9edc5f35b"

lib/ModelingToolkitBase/src/ModelingToolkitBase.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -406,6 +406,7 @@ const set_scalar_metadata = setmetadata
406406
@public Both
407407
@public SymbolicADDisallowed, check_symbolic_ad_allowed
408408
@public tobrownian, toparam
409+
@public ProblemTypeCtx
409410

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

0 commit comments

Comments
 (0)