/ concept-collection / mesh-pde-solver
Sign in
concept-collection / mesh-pde-solver
mesh-pde-solver / matlab / solver_session.m
22 lines · 693 BBlameHistoryRaw
1function solver_session()
2%SOLVER_SESSION Open the uihtml event bridge and serve solve requests.
3% The figure is never rendered — the host intercepts the uihtml component
4% and speaks its event protocol directly (see src/engine/).
6html = fileread('placeholder.html');
7fig = figure;
8uihtml(fig, 'HTMLSource', html, 'Data', struct('type', 'ready'), ...
9 'HTMLEventReceivedFcn', @on_event);
10end
12function on_event(src, ev)
13if ~strcmp(ev.HTMLEventName, 'solve')
14 return
15end
16try
17 result = solve_pde('mesh.msh', ev.HTMLEventData);
18 sendEventToHTMLSource(src, 'solution', result);
19catch err
20 sendEventToHTMLSource(src, 'solveError', struct('message', err.message));
21end
22end
moveopenescclose