@meshioplusplus/wasm 17.8.0 → 17.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.
package/index.d.ts CHANGED
@@ -1144,8 +1144,9 @@ export type InterpolateOnConflict = 'error' | 'overwrite' | 'suffix';
1144
1144
  * exists on the target: throw, replace, or write to `name + '_interp'`. */
1145
1145
  export type ConservativeInterpolateOnConflict = 'error' | 'overwrite' | 'suffix';
1146
1146
 
1147
- /** Partitioning backend: SFC is always available; KaHIP is never compiled
1148
- * into the WASM build, so `'kahip'` always throws and `'auto'` = `'sfc'`. */
1147
+ /** Partitioning backend: SFC is always available; KaHIP is linked only in
1148
+ * the full artifact, so `'kahip'` throws there outside it and `'auto'`
1149
+ * resolves to SFC. */
1149
1150
  export type PartitionMethod = 'sfc' | 'kahip' | 'auto';
1150
1151
 
1151
1152
  /** KaHIP preconfiguration (ignored by the SFC method). */
@@ -1743,10 +1744,18 @@ export interface MeshioPlusPlusModule {
1743
1744
 
1744
1745
  /**
1745
1746
  * Whether OpenCASCADE is linked in, so `step` and `iges` read and `fitCad`
1746
- * runs: true in the full artifact (`{full: true}`), false in the lean one.
1747
+ * has its OpenCASCADE backend: true in the full artifact (`{full: true}`),
1748
+ * false in the lean one (where `fitCad` runs the native backend).
1747
1749
  */
1748
1750
  hasOcct(): boolean;
1749
1751
 
1752
+ /**
1753
+ * Whether the KaHIP kaffpa partitioner is linked in, so `partition` with
1754
+ * `method: 'kahip'` runs: true in the full artifact (`{full: true}`),
1755
+ * false in the lean one.
1756
+ */
1757
+ hasKahip(): boolean;
1758
+
1750
1759
  /** Whether the VTK XML zstd block codec is linked in (the full artifact). */
1751
1760
  hasZstd(): boolean;
1752
1761
 
@@ -2583,7 +2592,10 @@ export interface MeshioPlusPlusModule {
2583
2592
  * feature edges. The mesh comes back unchanged plus cell data
2584
2593
  * `segment:patch` (-1 off the surface), field data `segment:adjacency`
2585
2594
  * (rows `[a, b, sharedEdges]`) and one cell region per patch,
2586
- * `<prefix>:<k>`. See doc/segment.md.
2595
+ * `<prefix>:<k>`. `method: 'primitive'` (v17.9.0) ends a patch where the
2596
+ * surface its facets lie on changes, at `tolerance` (relative to the
2597
+ * diagonal), so a fillet comes apart from its tangent planes. See
2598
+ * doc/segment.md.
2587
2599
  * @throws {Error} on an option out of range, an unknown region or a volume block.
2588
2600
  */
2589
2601
  segment(
@@ -2594,6 +2606,8 @@ export interface MeshioPlusPlusModule {
2594
2606
  minPatchCells?: number,
2595
2607
  region?: string,
2596
2608
  prefix?: string,
2609
+ method?: 'angle' | 'primitive',
2610
+ tolerance?: number,
2597
2611
  ): {
2598
2612
  mesh: Mesh;
2599
2613
  numPatches: number;
@@ -2635,10 +2649,12 @@ export interface MeshioPlusPlusModule {
2635
2649
  * output of `segment` then `fitPrimitives`): planes, spheres, cylinders,
2636
2650
  * cones and tori, fillets and blends, threads and freeform B-spline faces,
2637
2651
  * sewn and checked by OpenCASCADE, optionally written as STEP to
2638
- * `stepPath` on the virtual FS. Needs OpenCASCADE: the full artifact only.
2639
- * See doc/fit_cad.md.
2640
- * @throws {Error} in the lean artifact (naming `{full: true}`), on a bad
2641
- * option, or on a skin that is not closed.
2652
+ * `stepPath` on the virtual FS. The lean artifact (and `backend: 'native'`)
2653
+ * runs the kernel-free backend instead (v17.9.0): the fitted patches become
2654
+ * analytic STEP faces, the rest coplanar polygons, and `mesh` is the skin
2655
+ * itself. See doc/fit_cad.md.
2656
+ * @throws {Error} with `backend: 'occt'` in the lean artifact (naming
2657
+ * `{full: true}`), on a bad option, or on a skin that is not closed.
2642
2658
  */
2643
2659
  fitCad(mesh: Mesh, options?: FitCadOptions): FitCadResult;
2644
2660
 
@@ -3129,9 +3145,9 @@ export interface MeshioPlusPlusModule {
3129
3145
  * scalar `cell_data` array of per-cell weights. `ghostLayers > 0` grows
3130
3146
  * each piece by that many shared-node BFS layers of other parts' cells (a
3131
3147
  * halo), tagged `partition:ghost`.
3132
- * @throws {Error} on `method: 'kahip'` (KaHIP is never part of the WASM
3133
- * build; the message names `MESHIOPLUSPLUS_WITH_KAHIP`), `nparts < 1`,
3134
- * `ghostLayers < 0`, or a bad weights array.
3148
+ * @throws {Error} on `method: 'kahip'` outside the full artifact (KaHIP
3149
+ * is linked only there; the message names `MESHIOPLUSPLUS_WITH_KAHIP`),
3150
+ * `nparts < 1`, `ghostLayers < 0`, or a bad weights array.
3135
3151
  */
3136
3152
  partition(
3137
3153
  mesh: Mesh,
@@ -3374,6 +3390,10 @@ export interface FitCadOptions {
3374
3390
  fillets?: boolean;
3375
3391
  /** Try thread faces, tapered and of varying pitch included (default true). */
3376
3392
  threads?: boolean;
3393
+ /** Merge faces on one surface once the solid is built (default true; v17.9.0). */
3394
+ mergeFaces?: boolean;
3395
+ /** The engine: OpenCASCADE when linked in (`'auto'`, the default), or none (v17.9.0). */
3396
+ backend?: 'auto' | 'occt' | 'native';
3377
3397
  }
3378
3398
 
3379
3399
  /** What {@link MeshioPlusPlusModule.fitCad} built. */
@@ -3417,6 +3437,8 @@ export interface FitCadResult {
3417
3437
  numTaperedThread: number;
3418
3438
  /** Thread flanks whose pitch varies along the axis. */
3419
3439
  numVariablePitchThread: number;
3440
+ /** The engine that built the solid (v17.9.0). */
3441
+ backend: 'occt' | 'native';
3420
3442
  /** The solid's B-rep, for `writeMesh(path, mesh, 'cad_json', {info})`. */
3421
3443
  info: CadJsonInfo;
3422
3444
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@meshioplusplus/wasm",
3
- "version": "17.8.0",
3
+ "version": "17.9.0",
4
4
  "description": "meshio++ mesh I/O compiled to WebAssembly: read 80 and write 75 mesh formats (incl. MED, CGNS, Exodus; STEP and IGES in the full build) in the browser or Node.js",
5
5
  "type": "module",
6
6
  "main": "./src/index.mjs",
package/src/index.mjs CHANGED
@@ -32,7 +32,7 @@
32
32
  //
33
33
  // Beside that lean pair the package ships the FULL pair (roadmap 6.2),
34
34
  // meshioplusplus_wasm_full and meshioplusplus_wasm_full_mt: the same API, with
35
- // OpenCASCADE (STEP/IGES reading, fitCad), zstd, lz4 and bzip2 linked in, and
35
+ // OpenCASCADE (STEP/IGES reading, fitCad's OpenCASCADE backend), zstd, lz4 and bzip2 linked in, and
36
36
  // a mixed licence (OpenCASCADE is LGPL-2.1 with its exception; see
37
37
  // THIRD_PARTY_NOTICES.md). `{ full: true }` loads it, with the same variant
38
38
  // choice. Its import() is deliberately NOT literal: a bundler that saw it would
@@ -249,6 +249,7 @@ export class MeshioPlusPlusLoadError extends Error {
249
249
  * parallelBackend: () => string,
250
250
  * hasCgnslib: () => boolean,
251
251
  * hasOcct: () => boolean,
252
+ * hasKahip: () => boolean,
252
253
  * hasZstd: () => boolean,
253
254
  * hasLz4: () => boolean,
254
255
  * hasBzip2: () => boolean,
@@ -291,12 +292,12 @@ export class MeshioPlusPlusLoadError extends Error {
291
292
  * computeNormals: (mesh: Mesh, pointNormals?: boolean, cellNormals?: boolean, weight?: string, splitAngle?: number, recordParentIds?: boolean, region?: string) => {mesh: Mesh, numIsolated: number, numUndefined: number, numDegenerate: number, numSplitPoints: number, numAddedPoints: number, quality: {boundaryEdges: number, nonManifoldEdges: number, inconsistentPairs: number, degenerateTriangles: number, watertight: boolean}},
292
293
  * checkQuality: (mesh: Mesh, require?: string, maxInverted?: number, maxDegenerate?: number) => {passed: boolean, numCells: number, numInverted: number, numDegenerate: number, checks: Array<object>, summary: string},
293
294
  * featureEdges: (mesh: Mesh, featureAngle?: number, feature?: boolean, boundary?: boolean, nonManifold?: boolean, inconsistent?: boolean, region?: string) => {mesh: Mesh, numFeature: number, numBoundary: number, numNonManifold: number, numInconsistent: number},
294
- * segment: (mesh: Mesh, featureAngle?: number, normalTolerance?: number, curvatureTolerance?: number, minPatchCells?: number, region?: string, prefix?: string) => {mesh: Mesh, numPatches: number, numMerged: number, numFeatureEdges: number, numBoundaryEdges: number, numNonManifoldEdges: number},
295
+ * segment: (mesh: Mesh, featureAngle?: number, normalTolerance?: number, curvatureTolerance?: number, minPatchCells?: number, region?: string, prefix?: string, method?: 'angle' | 'primitive', tolerance?: number) => {mesh: Mesh, numPatches: number, numMerged: number, numFeatureEdges: number, numBoundaryEdges: number, numNonManifoldEdges: number},
295
296
  * igaRefine: (info: object, options?: {subdivisions?: number | number[], elevate?: number | number[], sampleSubdivisions?: number, trimSamples?: number, edges?: boolean, trim?: boolean}) => {mesh: Mesh, info: object},
296
297
  * igaSample: (info: object, options?: {sampleSubdivisions?: number, trimSamples?: number, edges?: boolean, trim?: boolean}) => {mesh: Mesh, info: object},
297
298
  * igaEvaluate: (info: object, patch: number, params: ArrayLike<number>, options?: {derivatives?: 0 | 1, trimSamples?: number}) => object,
298
299
  * fitPrimitives: (mesh: Mesh, patchData?: string, tolerance?: number, relative?: boolean, minInlierFraction?: number, types?: string[], maxIterations?: number) => {mesh: Mesh, numPatches: number, numPlane: number, numSphere: number, numCylinder: number, numCone: number, numTorus: number, numUnfitted: number},
299
- * fitCad: (mesh: Mesh, options?: {stepPath?: string, tolerance?: number, exactEdges?: boolean, types?: string[], meshDeflection?: number, maxDemotionRounds?: number, freeform?: boolean, freeformDegree?: number, freeformMaxControl?: number, freeformSplit?: boolean, fillets?: boolean, threads?: boolean}) => object,
300
+ * fitCad: (mesh: Mesh, options?: {stepPath?: string, tolerance?: number, exactEdges?: boolean, types?: string[], meshDeflection?: number, maxDemotionRounds?: number, freeform?: boolean, freeformDegree?: number, freeformMaxControl?: number, freeformSplit?: boolean, fillets?: boolean, threads?: boolean, mergeFaces?: boolean, backend?: 'auto' | 'occt' | 'native'}) => object,
300
301
  * tessellate: (mesh: Mesh, levels?: number, curved?: boolean, fields?: boolean, recordStencil?: boolean) => {mesh: Mesh, numSourcePoints: number, numSourceCells: number, numCurvedSourceCells: number, numPassThroughSourceCells: number, numPoints: number, numCells: number, numBoundaryFacets: number, numInteriorFacets: number, numFacetsWithBadCount: number},
301
302
  * render: (mesh: Mesh, options?: RenderOptions) => RenderedFrame,
302
303
  * renderText: (mesh: Mesh, options?: RenderOptions, text?: RenderTextOptions) => string,
@@ -601,9 +602,10 @@ export async function loadMeshioPlusPlus(
601
602
  // meshioplusplus_wasm_mt one -- which of the two this instance loaded.
602
603
  parallelBackend: () => Module.parallelBackend(),
603
604
  hasCgnslib: () => Module.hasCgnslib(),
604
- // The full artifact's libraries (roadmap 6.2): all four are true there
605
+ // The full artifact's libraries (roadmap 6.2): all five are true there
605
606
  // and false in the lean one. buildFlavour() names which loaded.
606
607
  hasOcct: () => Module.hasOcct(),
608
+ hasKahip: () => Module.hasKahip(),
607
609
  hasZstd: () => Module.hasZstd(),
608
610
  hasLz4: () => Module.hasLz4(),
609
611
  hasBzip2: () => Module.hasBzip2(),
@@ -962,9 +964,11 @@ export async function loadMeshioPlusPlus(
962
964
  minPatchCells = 1,
963
965
  region = '',
964
966
  prefix = 'patch',
967
+ method = 'angle',
968
+ tolerance = 1e-3,
965
969
  ) =>
966
970
  Module.segment(mesh, featureAngle, normalTolerance, curvatureTolerance,
967
- minPatchCells, region, prefix),
971
+ minPatchCells, region, prefix, method, tolerance),
968
972
  fitPrimitives: (
969
973
  mesh,
970
974
  patchData = 'segment:patch',