Skip to content

Commit 6cdd775

Browse files
committed
Include model information in webWorker examples
1 parent 468e04a commit 6cdd775

2 files changed

Lines changed: 12 additions & 4 deletions

File tree

tutorials/heat-conduction-2d-fin-worker.html

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,8 @@ <h2 id="webworkerimplementation"><a name="Web Worker Implementation"></a>Web Wor
197197
const result = await model.solve();
198198

199199
// Plot results
200-
plotSolution(model, result, "contour", "resultsCanvas");
200+
const modelInfo = await model.getModelInfo(); // Get model info for plotting
201+
plotSolution(modelInfo, result, "contour", "resultsCanvas");
201202

202203
// Terminate the worker
203204
model.terminate();
@@ -273,11 +274,14 @@ <h2 id="results"><a name="Results"></a>Results</h2>
273274
// Solve the problem and get the solution
274275
const result = await model.solve();
275276

277+
// Get model info for plotting
278+
const modelInfo = await model.getModelInfo();
279+
276280
// Hide loading indicator
277281
document.getElementById("loading").style.display = "none";
278282

279283
// Plot the solution as a 2D contour plot
280-
plotSolution(model, result, "contour", "resultsCanvas");
284+
plotSolution(modelInfo, result, "contour", "resultsCanvas");
281285

282286
// Terminate the worker
283287
model.terminate();

tutorials/solidification-front-2d-worker.html

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,8 @@ <h2 id="webworkerimplementation"><a name="Web Worker Implementation"></a>Web Wor
199199
const result = await model.solve();
200200

201201
// Plot results
202-
plotSolution(model, result, "contour", "resultsCanvas");
202+
const modelInfo = await model.getModelInfo(); // Get model info for plotting
203+
plotSolution(modelInfo, result, "contour", "resultsCanvas");
203204

204205
// Terminate the worker
205206
model.terminate();
@@ -278,8 +279,11 @@ <h2 id="results"><a name="Results"></a>Results</h2>
278279
// Solve the problem and get the solution
279280
const result = await model.solve();
280281

282+
// Get model info for plotting
283+
const modelInfo = await model.getModelInfo();
284+
281285
// Plot the solution as a 2D contour plot
282-
plotSolution(model, result, "contour", "resultsCanvas");
286+
plotSolution(modelInfo, result, "contour", "resultsCanvas");
283287
} catch (error) {
284288
console.error("Error in worker execution:", error);
285289
alert("Error executing the solver. Check console for details.");

0 commit comments

Comments
 (0)