/ concept-collection / fastandaccurate
Sign in
concept-collection / fastandaccurate
fastandaccurate / src / app / matlabSources.ts
26 lines · 809 BBlameHistoryRaw
1// The MATLAB sources, inlined into the bundle by vite. Used by the worker
2// (and only there; the node CLI reads the same files from disk).
4const files = import.meta.glob("../{problems,solvers}/**/*.m", {
5 query: "?raw",
6 import: "default",
7 eager: true,
8}) as Record<string, string>;
10function get(path: string): string {
11 const src = files[path];
12 if (!src) throw new Error(`missing MATLAB source: ${path}`);
13 return src;
16export function matlabBase() {
17 return {
18 buildProblem: get("../problems/laplace2d/matlab/build_problem.m"),
19 bdata: get("../problems/laplace2d/matlab/laplace2d_bdata.m"),
20 bdataBranch: get("../problems/laplace2d/matlab/laplace2d_bdata_branch.m"),
21 };
24export function solverSource(solverId: string): string {
25 return get(`../solvers/${solverId}/solver.m`);
moveopenescclose