@ifc-lite/geometry 7.7.0 → 7.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (88) hide show
  1. package/README.md +54 -0
  2. package/dist/byte-streaming-prepass-result.d.ts +11 -0
  3. package/dist/byte-streaming-prepass-result.d.ts.map +1 -1
  4. package/dist/domain-export-call.d.ts.map +1 -1
  5. package/dist/domain-export-call.js +8 -1
  6. package/dist/domain-export-call.js.map +1 -1
  7. package/dist/export-errors.d.ts +7 -0
  8. package/dist/export-errors.d.ts.map +1 -1
  9. package/dist/export-errors.js +12 -0
  10. package/dist/export-errors.js.map +1 -1
  11. package/dist/geometry-parallel-options.d.ts +15 -0
  12. package/dist/geometry-parallel-options.d.ts.map +1 -1
  13. package/dist/geometry-parallel.d.ts +2 -47
  14. package/dist/geometry-parallel.d.ts.map +1 -1
  15. package/dist/geometry-parallel.js +59 -157
  16. package/dist/geometry-parallel.js.map +1 -1
  17. package/dist/geometry-worker-pool.d.ts +72 -0
  18. package/dist/geometry-worker-pool.d.ts.map +1 -0
  19. package/dist/geometry-worker-pool.js +176 -0
  20. package/dist/geometry-worker-pool.js.map +1 -0
  21. package/dist/geometry.worker.d.ts.map +1 -1
  22. package/dist/geometry.worker.js +19 -25
  23. package/dist/geometry.worker.js.map +1 -1
  24. package/dist/hung-job-recovery.d.ts +26 -2
  25. package/dist/hung-job-recovery.d.ts.map +1 -1
  26. package/dist/hung-job-recovery.js +42 -7
  27. package/dist/hung-job-recovery.js.map +1 -1
  28. package/dist/ifc-lite-bridge.d.ts +13 -2
  29. package/dist/ifc-lite-bridge.d.ts.map +1 -1
  30. package/dist/ifc-lite-bridge.js +27 -26
  31. package/dist/ifc-lite-bridge.js.map +1 -1
  32. package/dist/in-call-heartbeat.d.ts +20 -0
  33. package/dist/in-call-heartbeat.d.ts.map +1 -0
  34. package/dist/in-call-heartbeat.js +39 -0
  35. package/dist/in-call-heartbeat.js.map +1 -0
  36. package/dist/index.d.ts +21 -8
  37. package/dist/index.d.ts.map +1 -1
  38. package/dist/index.js +27 -28
  39. package/dist/index.js.map +1 -1
  40. package/dist/landxml-terrain-export.d.ts +41 -0
  41. package/dist/landxml-terrain-export.d.ts.map +1 -0
  42. package/dist/landxml-terrain-export.js +14 -0
  43. package/dist/landxml-terrain-export.js.map +1 -0
  44. package/dist/main-engine-init.d.ts +5 -0
  45. package/dist/main-engine-init.d.ts.map +1 -0
  46. package/dist/main-engine-init.js +42 -0
  47. package/dist/main-engine-init.js.map +1 -0
  48. package/dist/perf-flags.d.ts +55 -0
  49. package/dist/perf-flags.d.ts.map +1 -0
  50. package/dist/perf-flags.js +66 -0
  51. package/dist/perf-flags.js.map +1 -0
  52. package/dist/prepass-routing.d.ts +53 -0
  53. package/dist/prepass-routing.d.ts.map +1 -0
  54. package/dist/prepass-routing.js +100 -0
  55. package/dist/prepass-routing.js.map +1 -0
  56. package/dist/scan-proposals.d.ts +132 -0
  57. package/dist/scan-proposals.d.ts.map +1 -0
  58. package/dist/scan-proposals.js +12 -0
  59. package/dist/scan-proposals.js.map +1 -0
  60. package/dist/scan-segmentation.d.ts +205 -0
  61. package/dist/scan-segmentation.d.ts.map +1 -0
  62. package/dist/scan-segmentation.js +17 -0
  63. package/dist/scan-segmentation.js.map +1 -0
  64. package/dist/warm-pool.d.ts +27 -0
  65. package/dist/warm-pool.d.ts.map +1 -0
  66. package/dist/warm-pool.js +48 -0
  67. package/dist/warm-pool.js.map +1 -0
  68. package/dist/wasm-shared-module.d.ts +17 -19
  69. package/dist/wasm-shared-module.d.ts.map +1 -1
  70. package/dist/wasm-shared-module.js +90 -77
  71. package/dist/wasm-shared-module.js.map +1 -1
  72. package/dist/wasm-streaming-guard.d.ts +2 -0
  73. package/dist/wasm-streaming-guard.d.ts.map +1 -0
  74. package/dist/wasm-streaming-guard.js +22 -0
  75. package/dist/wasm-streaming-guard.js.map +1 -0
  76. package/dist/worker-count.d.ts +10 -0
  77. package/dist/worker-count.d.ts.map +1 -1
  78. package/dist/worker-count.js +19 -0
  79. package/dist/worker-count.js.map +1 -1
  80. package/dist/worker-trace.d.ts +16 -0
  81. package/dist/worker-trace.d.ts.map +1 -0
  82. package/dist/worker-trace.js +39 -0
  83. package/dist/worker-trace.js.map +1 -0
  84. package/dist/world-frame.d.ts +24 -0
  85. package/dist/world-frame.d.ts.map +1 -1
  86. package/dist/world-frame.js +34 -0
  87. package/dist/world-frame.js.map +1 -1
  88. package/package.json +18 -7
package/README.md CHANGED
@@ -164,6 +164,60 @@ See the [exporting guide](https://ifclite.dev/docs/guide/exporting/) for the
164
164
  supported subset and warning handling. Third-party platform bridges may expose
165
165
  the optional planner capability; the bundled native bridge explicitly refuses it.
166
166
 
167
+ ## Scan plane segmentation
168
+
169
+ `@ifc-lite/geometry/scan-segmentation` types the wasm plane and cylinder
170
+ detector for point clouds. Pass xyz metres, either a whole buffer or a reservoir with a `count`.
171
+ Every option is optional; see the
172
+ [segmentation contract](https://ifclite.dev/docs/api/wasm/#scan-plane-segmentation)
173
+ for the defaults.
174
+
175
+ ```ts
176
+ import { segmentScan } from '@ifc-lite/geometry/scan-segmentation';
177
+
178
+ const api = new IfcAPI(); // after the wasm module is initialised
179
+ const positions = new Float32Array([/* x, y, z, ... in metres */]);
180
+ try {
181
+ const report = segmentScan(api, { positions }, { scannerPosition: [3, 2, 1.5] });
182
+ for (const plane of report.planes) {
183
+ console.log(plane.orientation, plane.normal, plane.d, plane.areaSquareMetres);
184
+ }
185
+ for (const cylinder of report.cylinders) {
186
+ // `faceted` is set for a polygonal column (radius is then the circumradius).
187
+ console.log(cylinder.orientation, cylinder.axisStart, cylinder.radius, cylinder.length, cylinder.faceted?.faces);
188
+ }
189
+ } finally {
190
+ api.free();
191
+ }
192
+ ```
193
+
194
+ ## Scan element proposals
195
+
196
+ `@ifc-lite/geometry/scan-proposals` turns a segmentation report into proposed
197
+ `IfcWall`, `IfcSlab`, `IfcColumn` and pipe elements in the IFC model frame (Z
198
+ up, metres): opposite wall faces pair into walls of measured thickness, floors
199
+ and ceilings into slabs, vertical cylinders into columns. See the
200
+ [proposal contract](https://ifclite.dev/docs/api/wasm/#scan-element-proposals).
201
+
202
+ ```ts
203
+ import { segmentScan } from '@ifc-lite/geometry/scan-segmentation';
204
+ import { proposeScanElements } from '@ifc-lite/geometry/scan-proposals';
205
+
206
+ const api = new IfcAPI(); // after the wasm module is initialised
207
+ const positions = new Float32Array([/* x, y, z, ... Y-up metres */]);
208
+ try {
209
+ const report = segmentScan(api, { positions }, { upAxis: [0, 1, 0] });
210
+ // Y-up (x, y, z) -> IFC Z-up (x, -z, y), row-major.
211
+ const scanToModel = [1, 0, 0, 0, 0, 0, -1, 0, 0, 1, 0, 0, 0, 0, 0, 1];
212
+ const { proposals } = proposeScanElements(api, report, { scanToModel, schema: 'IFC4' });
213
+ for (const p of proposals) {
214
+ console.log(p.id, p.ifcClass, p.basis, p.confidence.toFixed(2), p.geometry);
215
+ }
216
+ } finally {
217
+ api.free();
218
+ }
219
+ ```
220
+
167
221
  ## License
168
222
 
169
223
  [MPL-2.0](../../LICENSE)
@@ -2,6 +2,9 @@ export interface ByteStreamingPrePassResult {
2
2
  jobs: Uint32Array;
3
3
  totalJobs: number;
4
4
  unitScale: number;
5
+ /** The model's length-unit factor is unusable (#7678): `unitScale` is NaN and
6
+ * every batch router refuses, so no geometry is meshed. Absent on an older wasm. */
7
+ unitRefused?: boolean;
5
8
  rtcOffset?: Float64Array;
6
9
  needsShift: boolean;
7
10
  buildingRotation?: number | null;
@@ -20,4 +23,12 @@ export interface ByteStreamingPrePassResult {
20
23
  materialColorCounts?: Uint32Array;
21
24
  materialColors?: Uint8Array;
22
25
  }
26
+ /**
27
+ * Streamed once, right after `rtcOffset`, when the model's length-unit factor
28
+ * is unusable (#7678): every element is refused, so the stream carries no
29
+ * geometry. The data model is unaffected.
30
+ */
31
+ export interface UnitRefusedEvent {
32
+ type: 'unitRefused';
33
+ }
23
34
  //# sourceMappingURL=byte-streaming-prepass-result.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"byte-streaming-prepass-result.d.ts","sourceRoot":"","sources":["../src/byte-streaming-prepass-result.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,0BAA0B;IACzC,IAAI,EAAE,WAAW,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,YAAY,CAAC;IACzB,UAAU,EAAE,OAAO,CAAC;IACpB,gBAAgB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,QAAQ,EAAE,WAAW,CAAC;IACtB,UAAU,EAAE,WAAW,CAAC;IACxB,UAAU,EAAE,WAAW,CAAC;IACxB,QAAQ,EAAE,WAAW,CAAC;IACtB,WAAW,EAAE,UAAU,CAAC;IACxB;qEACiE;IACjE,aAAa,CAAC,EAAE,YAAY,CAAC;IAC7B,wEAAwE;IACxE,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,wEAAwE;IACxE,kBAAkB,CAAC,EAAE,WAAW,CAAC;IACjC,mBAAmB,CAAC,EAAE,WAAW,CAAC;IAClC,cAAc,CAAC,EAAE,UAAU,CAAC;CAC7B"}
1
+ {"version":3,"file":"byte-streaming-prepass-result.d.ts","sourceRoot":"","sources":["../src/byte-streaming-prepass-result.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,0BAA0B;IACzC,IAAI,EAAE,WAAW,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB;yFACqF;IACrF,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,SAAS,CAAC,EAAE,YAAY,CAAC;IACzB,UAAU,EAAE,OAAO,CAAC;IACpB,gBAAgB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,QAAQ,EAAE,WAAW,CAAC;IACtB,UAAU,EAAE,WAAW,CAAC;IACxB,UAAU,EAAE,WAAW,CAAC;IACxB,QAAQ,EAAE,WAAW,CAAC;IACtB,WAAW,EAAE,UAAU,CAAC;IACxB;qEACiE;IACjE,aAAa,CAAC,EAAE,YAAY,CAAC;IAC7B,wEAAwE;IACxE,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,wEAAwE;IACxE,kBAAkB,CAAC,EAAE,WAAW,CAAC;IACjC,mBAAmB,CAAC,EAAE,WAAW,CAAC;IAClC,cAAc,CAAC,EAAE,UAAU,CAAC;CAC7B;AAED;;;;GAIG;AACH,MAAM,WAAW,gBAAgB;IAAG,IAAI,EAAE,aAAa,CAAA;CAAE"}
@@ -1 +1 @@
1
- {"version":3,"file":"domain-export-call.d.ts","sourceRoot":"","sources":["../src/domain-export-call.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAI7C,yEAAyE;AACzE,wBAAgB,eAAe,CAAC,CAAC,EAC/B,GAAG,EAAE,MAAM,GAAG,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,CAAC,EAAE,OAAO,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,GACrH,CAAC,CASH"}
1
+ {"version":3,"file":"domain-export-call.d.ts","sourceRoot":"","sources":["../src/domain-export-call.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAK7C,yEAAyE;AACzE,wBAAgB,eAAe,CAAC,CAAC,EAC/B,GAAG,EAAE,MAAM,GAAG,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,CAAC,EAAE,OAAO,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,GACrH,CAAC,CAeH"}
@@ -2,6 +2,7 @@
2
2
  * License, v. 2.0. If a copy of the MPL was not distributed with this
3
3
  * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
4
4
  import { createLogger } from '@ifc-lite/data';
5
+ import { isNoRenderGeometryError, terrainRefusalReason } from './export-errors.js';
5
6
  const log = createLogger('Geometry');
6
7
  /** Shared initialization/error boundary for canonical domain exports. */
7
8
  export function runDomainExport(api, operation, content, run, onError) {
@@ -11,7 +12,13 @@ export function runDomainExport(api, operation, content, run, onError) {
11
12
  return run(api);
12
13
  }
13
14
  catch (error) {
14
- log.error(`Failed to ${operation}`, error, { operation, data: { contentLength: content.length } });
15
+ // A terrain refusal is the exporter's verdict on its input, shown to the
16
+ // user verbatim (#7600); logged as a failure, every preflight of a
17
+ // non-qualifying selection would read as a crash. A typed
18
+ // NO_RENDER_GEOMETRY refusal is the same kind of verdict (#7766).
19
+ if (terrainRefusalReason(error) === null && !isNoRenderGeometryError(error)) {
20
+ log.error(`Failed to ${operation}`, error, { operation, data: { contentLength: content.length } });
21
+ }
15
22
  onError(error);
16
23
  throw error;
17
24
  }
@@ -1 +1 @@
1
- {"version":3,"file":"domain-export-call.js","sourceRoot":"","sources":["../src/domain-export-call.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAE/D,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAG9C,MAAM,GAAG,GAAG,YAAY,CAAC,UAAU,CAAC,CAAC;AAErC,yEAAyE;AACzE,MAAM,UAAU,eAAe,CAC7B,GAAkB,EAAE,SAAiB,EAAE,OAAmB,EAAE,GAAuB,EAAE,OAAiC;IAEtH,IAAI,CAAC,GAAG;QAAE,MAAM,IAAI,KAAK,CAAC,8CAA8C,CAAC,CAAC;IAC1E,IAAI,CAAC;QACH,OAAO,GAAG,CAAC,GAAG,CAAC,CAAC;IAClB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,GAAG,CAAC,KAAK,CAAC,aAAa,SAAS,EAAE,EAAE,KAAK,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,EAAE,aAAa,EAAE,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;QACnG,OAAO,CAAC,KAAK,CAAC,CAAC;QACf,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC"}
1
+ {"version":3,"file":"domain-export-call.js","sourceRoot":"","sources":["../src/domain-export-call.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAE/D,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,OAAO,EAAE,uBAAuB,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAEnF,MAAM,GAAG,GAAG,YAAY,CAAC,UAAU,CAAC,CAAC;AAErC,yEAAyE;AACzE,MAAM,UAAU,eAAe,CAC7B,GAAkB,EAAE,SAAiB,EAAE,OAAmB,EAAE,GAAuB,EAAE,OAAiC;IAEtH,IAAI,CAAC,GAAG;QAAE,MAAM,IAAI,KAAK,CAAC,8CAA8C,CAAC,CAAC;IAC1E,IAAI,CAAC;QACH,OAAO,GAAG,CAAC,GAAG,CAAC,CAAC;IAClB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,yEAAyE;QACzE,mEAAmE;QACnE,0DAA0D;QAC1D,kEAAkE;QAClE,IAAI,oBAAoB,CAAC,KAAK,CAAC,KAAK,IAAI,IAAI,CAAC,uBAAuB,CAAC,KAAK,CAAC,EAAE,CAAC;YAC5E,GAAG,CAAC,KAAK,CAAC,aAAa,SAAS,EAAE,EAAE,KAAK,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,EAAE,aAAa,EAAE,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;QACrG,CAAC;QACD,OAAO,CAAC,KAAK,CAAC,CAAC;QACf,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC"}
@@ -12,4 +12,11 @@ export declare const NO_RENDER_GEOMETRY = "NO_RENDER_GEOMETRY";
12
12
  * error thrown by the wasm boundary (e.g. `exportGlb` on a geometry-less or
13
13
  * fully filtered-out model). */
14
14
  export declare function isNoRenderGeometryError(error: unknown): boolean;
15
+ /** A LandXML terrain export refused its selection: not an authored
16
+ * triangulated terrain, or missing/ambiguous georeferencing (#7600). The
17
+ * message after the code names the product or attribute at fault. */
18
+ export declare const TERRAIN_REFUSED = "TERRAIN_REFUSED";
19
+ /** The reason a terrain export was refused, or `null` when `error` is not a
20
+ * terrain refusal (a crash or any other failure). */
21
+ export declare function terrainRefusalReason(error: unknown): string | null;
15
22
  //# sourceMappingURL=export-errors.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"export-errors.d.ts","sourceRoot":"","sources":["../src/export-errors.ts"],"names":[],"mappings":"AAIA;;;;;GAKG;AAEH;;sEAEsE;AACtE,eAAO,MAAM,kBAAkB,uBAAuB,CAAC;AAEvD;;gCAEgC;AAChC,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAM/D"}
1
+ {"version":3,"file":"export-errors.d.ts","sourceRoot":"","sources":["../src/export-errors.ts"],"names":[],"mappings":"AAIA;;;;;GAKG;AAEH;;sEAEsE;AACtE,eAAO,MAAM,kBAAkB,uBAAuB,CAAC;AAEvD;;gCAEgC;AAChC,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAM/D;AAED;;qEAEqE;AACrE,eAAO,MAAM,eAAe,oBAAoB,CAAC;AAEjD;qDACqD;AACrD,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAKlE"}
@@ -19,4 +19,16 @@ export function isNoRenderGeometryError(error) {
19
19
  (error.message === NO_RENDER_GEOMETRY ||
20
20
  error.message.startsWith(`${NO_RENDER_GEOMETRY}:`)));
21
21
  }
22
+ /** A LandXML terrain export refused its selection: not an authored
23
+ * triangulated terrain, or missing/ambiguous georeferencing (#7600). The
24
+ * message after the code names the product or attribute at fault. */
25
+ export const TERRAIN_REFUSED = 'TERRAIN_REFUSED';
26
+ /** The reason a terrain export was refused, or `null` when `error` is not a
27
+ * terrain refusal (a crash or any other failure). */
28
+ export function terrainRefusalReason(error) {
29
+ const prefix = `${TERRAIN_REFUSED}:`;
30
+ return error instanceof Error && error.message.startsWith(prefix)
31
+ ? error.message.slice(prefix.length).trim()
32
+ : null;
33
+ }
22
34
  //# sourceMappingURL=export-errors.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"export-errors.js","sourceRoot":"","sources":["../src/export-errors.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAE/D;;;;;GAKG;AAEH;;sEAEsE;AACtE,MAAM,CAAC,MAAM,kBAAkB,GAAG,oBAAoB,CAAC;AAEvD;;gCAEgC;AAChC,MAAM,UAAU,uBAAuB,CAAC,KAAc;IACpD,OAAO,CACL,KAAK,YAAY,KAAK;QACtB,CAAC,KAAK,CAAC,OAAO,KAAK,kBAAkB;YACnC,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,GAAG,kBAAkB,GAAG,CAAC,CAAC,CACtD,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"export-errors.js","sourceRoot":"","sources":["../src/export-errors.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAE/D;;;;;GAKG;AAEH;;sEAEsE;AACtE,MAAM,CAAC,MAAM,kBAAkB,GAAG,oBAAoB,CAAC;AAEvD;;gCAEgC;AAChC,MAAM,UAAU,uBAAuB,CAAC,KAAc;IACpD,OAAO,CACL,KAAK,YAAY,KAAK;QACtB,CAAC,KAAK,CAAC,OAAO,KAAK,kBAAkB;YACnC,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,GAAG,kBAAkB,GAAG,CAAC,CAAC,CACtD,CAAC;AACJ,CAAC;AAED;;qEAEqE;AACrE,MAAM,CAAC,MAAM,eAAe,GAAG,iBAAiB,CAAC;AAEjD;qDACqD;AACrD,MAAM,UAAU,oBAAoB,CAAC,KAAc;IACjD,MAAM,MAAM,GAAG,GAAG,eAAe,GAAG,CAAC;IACrC,OAAO,KAAK,YAAY,KAAK,IAAI,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,MAAM,CAAC;QAC/D,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE;QAC3C,CAAC,CAAC,IAAI,CAAC;AACX,CAAC"}
@@ -1,6 +1,8 @@
1
1
  import type { TessellationQuality } from './types.js';
2
2
  import type { BatchSizingConfig } from './batch-sizing.js';
3
3
  import type { StallPhaseHandle } from './stall-phase.js';
4
+ import type { LoadTrace } from '@ifc-lite/load-trace';
5
+ import type { GeometryWorkerPool } from './geometry-worker-pool.js';
4
6
  export interface ProcessParallelOptions {
5
7
  /** Fresh per-load fingerprint cell shared only with the matching parser. */
6
8
  sourceFingerprint?: SharedArrayBuffer;
@@ -121,5 +123,18 @@ export interface ProcessParallelOptions {
121
123
  * covers, not this issue's pre-worker class.
122
124
  */
123
125
  stallPhaseHandle?: StallPhaseHandle;
126
+ /**
127
+ * Issue #6956 — the caller's load trace. The pool records `geometry.pool`,
128
+ * `geometry.firstBatch`, the shard scan/stitch and pre-pass phases on it, and
129
+ * asks its workers to post their own spans back. Omitted ⇒ nothing recorded.
130
+ */
131
+ trace?: LoadTrace;
132
+ /**
133
+ * Lease the workers a host prewarmed for this load from this pool (#7036)
134
+ * instead of spawning them; any it lacks are spawned. Every worker still
135
+ * serves only this load and is terminated by it. Omitted, every worker is
136
+ * spawned here, as before.
137
+ */
138
+ workerPool?: GeometryWorkerPool;
124
139
  }
125
140
  //# sourceMappingURL=geometry-parallel-options.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"geometry-parallel-options.d.ts","sourceRoot":"","sources":["../src/geometry-parallel-options.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AACtD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEzD,MAAM,WAAW,sBAAsB;IACrC,4EAA4E;IAC5E,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;IACtC;;;;;;OAMG;IACH,aAAa,CAAC,EAAE,CACd,GAAG,EAAE,WAAW,EAChB,MAAM,EAAE,WAAW,EACnB,OAAO,EAAE,WAAW,EAAE,gBAAgB,CAAC,EAAE,MAAM,EAAE,wBAAwB;IACzE,oBAAoB,CAAC,EAAE,MAAM,KAC1B,IAAI,CAAC;IACV;;;;;;OAMG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B;;;;;;OAMG;IACH,qBAAqB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtC;;;;;OAKG;IACH,mBAAmB,CAAC,EAAE,mBAAmB,GAAG,IAAI,CAAC;IACjD;;;;;OAKG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB;;;;;;;;;;;;OAYG;IACH,QAAQ,CAAC,EAAE;QACT,IAAI,CAAC,EAAE,MAAM,CAAC;KACf,CAAC;IACF;;;;;OAKG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC,iBAAiB,CAAC,CAAC;IACzC;;;;;;;OAOG;IACH,gBAAgB,CAAC,EAAE;QAAE,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;QAAC,gBAAgB,CAAC,EAAE,OAAO,CAAA;KAAE,CAAC;IAC5E;;;;;;;OAOG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B;;;;;;;;OAQG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B;;;;;OAKG;IACH,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB;;;;;;;;;OASG;IACH,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;CACrC"}
1
+ {"version":3,"file":"geometry-parallel-options.d.ts","sourceRoot":"","sources":["../src/geometry-parallel-options.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,YAAY,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AAE,MAAM,CAAC;IAC1B;;;;;OAKG;IACH,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB;;;;;;;;;OASG;IACH,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;IACpC;;;;OAIG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB;;;;;OAKG;IACH,UAAU,CAAC,EAAE,kBAAkB,CAAC;CACjC"}
@@ -22,53 +22,8 @@
22
22
  import type { ProcessParallelOptions } from './geometry-parallel-options.js';
23
23
  import type { CoordinateHandler } from './coordinate-handler.js';
24
24
  import type { StreamingGeometryEvent } from './index.js';
25
- /**
26
- * Prepass class-byte layout, mirroring the `PREPASS_CLASS_*` definitions in
27
- * `rust/processing/src/shard_classes.rs` (the source of truth — these are
28
- * pinned to it by `prepass-class-spans.test.ts`).
29
- *
30
- * The producer packs a named code in the LOW bits and composes FLAG bits on
31
- * top (`PREPASS_CLASS_FLAG_GEOMETRY_JOB` 0x80, `..._FLAG_TYPE_CANDIDATE`
32
- * 0x40), so a consumer must mask before comparing — the Rust consumer does
33
- * (`gpu_meshes/prepass_discovery.rs`), and so does {@link extractPrepassSpanLists}.
34
- */
35
- export declare const PREPASS_CLASS_CODE_MASK = 63;
36
- /** `IFCSTYLEDITEM`. */
37
- export declare const PREPASS_CLASS_STYLED_ITEM = 4;
38
- /** `IFCINDEXEDCOLOURMAP`. */
39
- export declare const PREPASS_CLASS_INDEXED_COLOUR_MAP = 5;
40
- /** `IFCMATERIALDEFINITIONREPRESENTATION`. */
41
- export declare const PREPASS_CLASS_MATERIAL_DEF_REPR = 6;
42
- /** `IFCRELASSOCIATESMATERIAL`. */
43
- export declare const PREPASS_CLASS_REL_ASSOCIATES_MATERIAL = 7;
44
- /** `IFCRELVOIDSELEMENT`. */
45
- export declare const PREPASS_CLASS_REL_VOIDS = 8;
46
- /** `IFCRELFILLSELEMENT`. */
47
- export declare const PREPASS_CLASS_REL_FILLS = 9;
48
- /** `IFCRELAGGREGATES`. */
49
- export declare const PREPASS_CLASS_REL_AGGREGATES = 10;
50
- /**
51
- * Build one `(id, start, length)` span list per host-consumed prepass class
52
- * from the stitched shard columns, in FILE ORDER. Every comparison goes
53
- * through {@link PREPASS_CLASS_CODE_MASK}, so a record that carries a flag bit
54
- * alongside its named code still lands in its list instead of being dropped.
55
- * Returns exact-size arrays (one entry per class in `HOST_SPAN_CLASSES`,
56
- * empty when the file has none).
57
- */
58
- export declare function extractPrepassSpanLists(classes: Uint8Array, ids: Uint32Array, starts: Uint32Array, lengths: Uint32Array): Map<number, Uint32Array>;
59
- /**
60
- * Plan content-affinity routing for one chunk: assign each job (by index) to a
61
- * worker bucket so that every job sharing an affinity key lands on the SAME
62
- * worker — across the whole stream, since `keyToWorker` is the caller's sticky
63
- * map. New keys are handed out round-robin from `startWorker`, so each worker
64
- * owns roughly `1/workerCount` of the distinct keys (≈ distinct geometries, the
65
- * dominant meshing cost). Pure: mutates only the passed `keyToWorker` and returns
66
- * the advanced round-robin cursor. (#1130 follow-up — see `affinity_key` in Rust.)
67
- */
68
- export declare function planAffinityRouting(affinity: Uint32Array, totalJobs: number, workerCount: number, keyToWorker: Map<number, number>, startWorker: number): {
69
- buckets: number[][];
70
- nextWorker: number;
71
- };
25
+ export { GeometryWorkerPool, DEFAULT_POOL_LIMITS, FRESH_WORKER_HEAP_BYTES } from './geometry-worker-pool.js';
26
+ export { PREPASS_CLASS_CODE_MASK, PREPASS_CLASS_STYLED_ITEM, PREPASS_CLASS_INDEXED_COLOUR_MAP, PREPASS_CLASS_MATERIAL_DEF_REPR, PREPASS_CLASS_REL_ASSOCIATES_MATERIAL, PREPASS_CLASS_REL_VOIDS, PREPASS_CLASS_REL_FILLS, PREPASS_CLASS_REL_AGGREGATES, extractPrepassSpanLists, planAffinityRouting, } from './prepass-routing.js';
72
27
  export type { ProcessParallelOptions } from './geometry-parallel-options.js';
73
28
  export declare function processParallel(buffer: Uint8Array, coordinator: CoordinateHandler, sharedRtcOffset?: {
74
29
  x: number;
@@ -1 +1 @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