Skip to content

Commit d0b8f71

Browse files
committed
WIP: simulate -> run
1 parent 75e697b commit d0b8f71

9 files changed

Lines changed: 33 additions & 33 deletions

File tree

packages/frontend/src/stdlib/analyses.tsx

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ const TabularView = lazy(() => import("./analyses/tabular_view"));
5555

5656
export function kuramoto(
5757
options: Partial<AnalysisOptions> & {
58-
simulate: Simulators.KuramotoSimulator;
58+
run: Simulators.KuramotoSimulator;
5959
parameterLabels?: {
6060
coupling?: string;
6161
damping?: string;
@@ -68,17 +68,17 @@ export function kuramoto(
6868
name = "Kuramoto dynamics",
6969
description = "Simulate the system using the Kuramoto dynamical model",
7070
help = "kuramoto",
71-
simulate,
71+
run,
7272
} = options;
7373
return {
7474
id,
7575
name,
7676
description,
7777
help,
78-
simulate,
78+
run,
7979
component: (props) => (
8080
<Kuramoto
81-
simulate={simulate}
81+
simulate={run}
8282
title={name}
8383
couplingLabel={options.parameterLabels?.coupling}
8484
dampingLabel={options.parameterLabels?.damping}
@@ -102,23 +102,23 @@ const Kuramoto = lazy(() => import("./analyses/kuramoto"));
102102

103103
export function linearODE(
104104
options: Partial<AnalysisOptions> & {
105-
simulate: Simulators.LinearODESimulator;
105+
run: Simulators.LinearODESimulator;
106106
},
107107
): ModelAnalysisMeta<Simulators.LinearODEProblemData> {
108108
const {
109109
id = "linear-ode",
110110
name = "Linear ODE dynamics",
111111
description = "Simulate the system using a constant-coefficient linear first-order ODE",
112112
help = "linear-ode",
113-
simulate,
113+
run,
114114
} = options;
115115
return {
116116
id,
117117
name,
118118
description,
119119
help,
120-
simulate,
121-
component: (props) => <LinearODE simulate={simulate} title={name} {...props} />,
120+
run,
121+
component: (props) => <LinearODE simulate={run} title={name} {...props} />,
122122
initialContent: () => ({
123123
coefficients: {},
124124
initialValues: {},
@@ -131,23 +131,23 @@ const LinearODE = lazy(() => import("./analyses/linear_ode"));
131131

132132
export function lotkaVolterra(
133133
options: Partial<AnalysisOptions> & {
134-
simulate: Simulators.LotkaVolterraSimulator;
134+
run: Simulators.LotkaVolterraSimulator;
135135
},
136136
): ModelAnalysisMeta<Simulators.LotkaVolterraProblemData> {
137137
const {
138138
id = "lotka-volterra",
139139
name = "Lotka-Volterra dynamics",
140140
description = "Simulate the system using a Lotka-Volterra ODE",
141141
help = "lotka-volterra",
142-
simulate,
142+
run,
143143
} = options;
144144
return {
145145
id,
146146
name,
147147
description,
148148
help,
149-
simulate,
150-
component: (props) => <LotkaVolterra simulate={simulate} title={name} {...props} />,
149+
run,
150+
component: (props) => <LotkaVolterra simulate={run} title={name} {...props} />,
151151
initialContent: () => ({
152152
interactionCoefficients: {},
153153
growthRates: {},
@@ -161,7 +161,7 @@ const LotkaVolterra = lazy(() => import("./analyses/lotka_volterra"));
161161

162162
export function massAction(
163163
options: Partial<AnalysisOptions> & {
164-
simulate: Simulators.MassActionSimulator;
164+
run: Simulators.MassActionSimulator;
165165
stateType?: ObType;
166166
transitionType?: MorType;
167167
},
@@ -178,7 +178,7 @@ export function massAction(
178178
name,
179179
description,
180180
help,
181-
simulate: otherOptions.simulate,
181+
run: otherOptions.run,
182182
component: (props) => <MassAction title={name} {...otherOptions} {...props} />,
183183
initialContent: () => ({
184184
massConservationType: { type: "Balanced" },
@@ -254,7 +254,7 @@ const UnbalancedMassActionEquationsDisplay = lazy(
254254

255255
export function stochasticMassAction(
256256
options: Partial<AnalysisOptions> & {
257-
simulate: Simulators.StochasticMassActionSimulator;
257+
run: Simulators.StochasticMassActionSimulator;
258258
stateType?: ObType;
259259
transitionType?: MorType;
260260
},
@@ -271,7 +271,7 @@ export function stochasticMassAction(
271271
name,
272272
description,
273273
help,
274-
simulate: otherOptions.simulate,
274+
run: otherOptions.run,
275275
component: (props) => <StochasticMassAction title={name} {...otherOptions} {...props} />,
276276
initialContent: () => ({
277277
rates: {},
@@ -349,7 +349,7 @@ export function reachability(
349349
name,
350350
description,
351351
help,
352-
simulate: otherOptions.check,
352+
run: otherOptions.check,
353353
component: (props) => <Reachability title={name} {...otherOptions} {...props} />,
354354
initialContent: () => ({ tokens: {}, forbidden: {} }),
355355
};

packages/frontend/src/stdlib/notebook_backwards_compat.db-dump-test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -147,14 +147,14 @@ describe("Database dump backward compatibility", () => {
147147
continue;
148148
}
149149

150-
if (!analysisSpec.simulate) {
151-
// Analysis type has no simulate function (e.g., visualization-only).
150+
if (!analysisSpec.run) {
151+
// Analysis type has no run function (e.g., visualization-only).
152152
// These don't deserialize content through WASM, so nothing to test.
153153
continue;
154154
}
155155

156156
try {
157-
analysisSpec.simulate(compiledModel, analysisCell.content);
157+
analysisSpec.run(compiledModel, analysisCell.content);
158158
} catch (e) {
159159
const msg = e instanceof Error ? e.message : String(e);
160160
failures.push(` cell ${cellId} (${analysisId}): ${msg}`);

packages/frontend/src/stdlib/theories/causal-loop.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,12 @@ export default function createCausalLoopTheory(theoryMeta: TheoryMeta): Theory {
6666
},
6767
}),
6868
analyses.linearODE({
69-
simulate: (model, data) => thSignedCategory.linearODE(model, data),
69+
run: (model, data) => thSignedCategory.linearODE(model, data),
7070
}),
7171
analyses.lotkaVolterra({
72-
simulate: (model, data) => thSignedCategory.lotkaVolterra(model, data),
72+
run(model, data) {
73+
return thSignedCategory.lotkaVolterra(model, data);
74+
},
7375
}),
7476
],
7577
});

packages/frontend/src/stdlib/theories/petri-net.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ export default function createPetriNetTheory(theoryMeta: TheoryMeta): Theory {
4242
help: "visualization",
4343
}),
4444
analyses.massAction({
45-
simulate(model, data) {
45+
run(model, data) {
4646
return thSymMonoidalCategory.massAction(model, data);
4747
},
4848
}),
@@ -61,7 +61,7 @@ export default function createPetriNetTheory(theoryMeta: TheoryMeta): Theory {
6161
name: "Stochastic mass-action dynamics",
6262
description: "Simulate a stochastic system using the law of mass action",
6363
help: "stochastic-mass-action",
64-
simulate(model, data) {
64+
run(model, data) {
6565
return thSymMonoidalCategory.stochasticMassAction(model, data);
6666
},
6767
}),

packages/frontend/src/stdlib/theories/power-system.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ export default function createPowerSystemsTheory(theoryMeta: TheoryMeta): Theory
5454
help: "visualization",
5555
}),
5656
analyses.kuramoto({
57-
simulate: (model, data) => thPowerSystem.kuramoto(model, data),
57+
run: (model, data) => thPowerSystem.kuramoto(model, data),
5858
parameterLabels: {
5959
coupling: "Capacity",
6060
forcing: "Input power",

packages/frontend/src/stdlib/theories/primitive-signed-stock-flow.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ export default function createPrimitiveSignedStockFlowTheory(theoryMeta: TheoryM
5959
help: "visualization",
6060
}),
6161
analyses.massAction({
62-
simulate(model, data) {
62+
run(model, data) {
6363
return thCategorySignedLinks.massAction(model, data);
6464
},
6565
transitionType: {

packages/frontend/src/stdlib/theories/primitive-stock-flow.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ export default function createPrimitiveStockFlowTheory(theoryMeta: TheoryMeta):
5050
help: "visualization",
5151
}),
5252
analyses.massAction({
53-
simulate(model, data) {
53+
run(model, data) {
5454
return thCategoryLinks.massAction(model, data);
5555
},
5656
transitionType: {

packages/frontend/src/stdlib/theories/reg-net.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,10 @@ export default function createRegulatoryNetworkTheory(theoryMeta: TheoryMeta): T
6565
},
6666
}),
6767
analyses.linearODE({
68-
simulate: (model, data) => thSignedCategory.linearODE(model, data),
68+
run: (model, data) => thSignedCategory.linearODE(model, data),
6969
}),
7070
analyses.lotkaVolterra({
71-
simulate(model, data) {
72-
return thSignedCategory.lotkaVolterra(model, data);
73-
},
71+
run: (model, data) => thSignedCategory.lotkaVolterra(model, data),
7472
}),
7573
],
7674
});

packages/frontend/src/theory/theory.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -293,13 +293,13 @@ export type ModelAnalysisMeta<T = any> = AnalysisMeta<T> & {
293293
/** Component that renders the analysis. */
294294
component: ModelAnalysisComponent<T>;
295295

296-
/** Optional simulate function for testing backward compatibility.
296+
/** Optional run function for testing backward compatibility.
297297
298298
When present, this function takes a compiled model and analysis content and
299299
runs the analysis. It exercises the same WASM deserialization path as the
300300
component would at runtime.
301301
*/
302-
simulate?: (model: DblModel, data: T) => unknown;
302+
run?: (model: DblModel, data: T) => unknown;
303303
};
304304

305305
/** Specifies a diagram analysis with descriptive metadata. */

0 commit comments

Comments
 (0)