@meshioplusplus/wasm 16.41.0 → 17.0.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
|
@@ -202,7 +202,8 @@ export type MeshInfo =
|
|
|
202
202
|
| UnvInfo
|
|
203
203
|
| GmshInfo
|
|
204
204
|
| ExodusInfo
|
|
205
|
-
| MfemInfo
|
|
205
|
+
| MfemInfo
|
|
206
|
+
| CadJsonInfo;
|
|
206
207
|
|
|
207
208
|
/** OpenFOAM's side channel: `readMeshSelective`'s cell_tags/patch-type map, reshaped per patch. */
|
|
208
209
|
export interface OpenFoamInfo {
|
|
@@ -306,6 +307,92 @@ export interface GmshInfo {
|
|
|
306
307
|
periodic?: { entity: number[]; affine: number[]; nodePairs: BigInt64Array | number[] }[];
|
|
307
308
|
}
|
|
308
309
|
|
|
310
|
+
/** One NURBS curve of a B-rep: a trimming curve in a face's (u, v), or an edge's 3-D curve. */
|
|
311
|
+
export interface BrepCurve {
|
|
312
|
+
degree: number;
|
|
313
|
+
/** The full knot vector (`n + degree + 1` knots). */
|
|
314
|
+
knots: number[];
|
|
315
|
+
/** Whether the file wrote Kratos's reduced form (without the outer knots). */
|
|
316
|
+
reducedKnots: boolean;
|
|
317
|
+
rational: boolean;
|
|
318
|
+
/** (points, 3) control points; a trimming curve's are (u, v, 0). */
|
|
319
|
+
controlPoints: Float64Array;
|
|
320
|
+
weights: Float64Array;
|
|
321
|
+
/** The control points' ids (Kratos node ids), empty when the file gives none. */
|
|
322
|
+
ids: BigInt64Array | number[];
|
|
323
|
+
/** `[t0, t1]`, or empty. */
|
|
324
|
+
activeRange: number[];
|
|
325
|
+
/** Members not modelled, as compact JSON object text. */
|
|
326
|
+
extra: string;
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
/** A trimming curve of a loop, or an embedded edge of a face. */
|
|
330
|
+
export interface BrepTrim {
|
|
331
|
+
/** -1 when the file gives none. */
|
|
332
|
+
trimIndex: number;
|
|
333
|
+
direction: boolean;
|
|
334
|
+
curve: BrepCurve;
|
|
335
|
+
extra: string;
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
/** A topology entry: the face (and trim) an edge or vertex lies on. */
|
|
339
|
+
export interface BrepRef {
|
|
340
|
+
/** -1 when the entity is named instead. */
|
|
341
|
+
id: number;
|
|
342
|
+
name: string;
|
|
343
|
+
/** -1 when absent. */
|
|
344
|
+
trimIndex: number;
|
|
345
|
+
/** 1 true, 0 false, -1 absent. */
|
|
346
|
+
relativeDirection: number;
|
|
347
|
+
localCoordinates: number[];
|
|
348
|
+
extra: string;
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
/**
|
|
352
|
+
* Kratos CAD JSON's side channel: the NURBS boundary representation (C++
|
|
353
|
+
* `BrepInfo`) the mesh was sampled from -- trimmed faces, their loops, edges
|
|
354
|
+
* and vertices, as Kratos's `CadJsonInput` reads them. Every index is 0-based;
|
|
355
|
+
* ids are -1 where an entity is named by `name` instead. `writeMesh` writes it
|
|
356
|
+
* back as CAD JSON.
|
|
357
|
+
*/
|
|
358
|
+
/** Sampling options of `igaRefine` / `igaSample`. */
|
|
359
|
+
export interface IgaOptions {
|
|
360
|
+
/** Cells per knot span and direction of the sampling; 0 is automatic. */
|
|
361
|
+
sampleSubdivisions?: number;
|
|
362
|
+
/** B-rep: points per knot span a trimming curve is sampled at (2..4096). */
|
|
363
|
+
trimSamples?: number;
|
|
364
|
+
/** B-rep: sample the edges that have a 3-D curve. */
|
|
365
|
+
edges?: boolean;
|
|
366
|
+
/** B-rep: keep only the cells inside the trimming loops. */
|
|
367
|
+
trim?: boolean;
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
export interface CadJsonInfo {
|
|
371
|
+
format: 'cad_json';
|
|
372
|
+
/** The face surfaces: two degrees, two full knot vectors, (points, 3) control net (u fastest). */
|
|
373
|
+
patches: { degrees: number[]; knots: number[][]; controlPoints: Float64Array; weights: Float64Array }[];
|
|
374
|
+
breps: { id: number; name: string; faces: number[]; edges: number[]; vertices: number[]; extra: string }[];
|
|
375
|
+
faces: {
|
|
376
|
+
id: number;
|
|
377
|
+
name: string;
|
|
378
|
+
/** Index into `patches`. */
|
|
379
|
+
patch: number;
|
|
380
|
+
swappedNormal: boolean;
|
|
381
|
+
trimmed: boolean;
|
|
382
|
+
rational: boolean;
|
|
383
|
+
reducedKnots: boolean;
|
|
384
|
+
controlPointIds: BigInt64Array | number[];
|
|
385
|
+
loops: { type: string; trims: BrepTrim[]; extra: string }[];
|
|
386
|
+
embeddedEdges: BrepTrim[];
|
|
387
|
+
surfaceExtra: string;
|
|
388
|
+
extra: string;
|
|
389
|
+
}[];
|
|
390
|
+
edges: { id: number; name: string; curve: BrepCurve | null; topology: BrepRef[]; extra: string }[];
|
|
391
|
+
vertices: { id: number; name: string; topology: BrepRef[]; extra: string }[];
|
|
392
|
+
/** The file's other top-level members (Kratos: tolerances, version_number). */
|
|
393
|
+
extra: string;
|
|
394
|
+
}
|
|
395
|
+
|
|
309
396
|
/**
|
|
310
397
|
* MFEM's side channel (v16.40.0): the NURBS patches an `MFEM NURBS mesh` was
|
|
311
398
|
* sampled from (C++ `NurbsInfo`). Arrays are flat, their widths given beside
|
|
@@ -2429,6 +2516,91 @@ export interface MeshioPlusPlusModule {
|
|
|
2429
2516
|
numUnfitted: number;
|
|
2430
2517
|
};
|
|
2431
2518
|
|
|
2519
|
+
/**
|
|
2520
|
+
* Refine every patch (every face surface of a B-rep) of a NURBS model
|
|
2521
|
+
* exactly: degree elevation by `elevate`, then knot insertion splitting each
|
|
2522
|
+
* knot span in `subdivisions` parts (a number, or one per direction; an
|
|
2523
|
+
* `mfem` model refines every direction alike). `info` is the side channel
|
|
2524
|
+
* of `readMeshSelective(path, {info: true})` for an MFEM NURBS mesh or a
|
|
2525
|
+
* CAD JSON file. Returns the refined model sampled (`sampleSubdivisions`
|
|
2526
|
+
* cells per span, 0 automatic) and the refined model, which `writeMesh`
|
|
2527
|
+
* writes back with the mesh. The geometry, the fields and a trimmed face's
|
|
2528
|
+
* trimming loops do not change. See doc/iga.md.
|
|
2529
|
+
* @throws {Error} on a bad option, a non-NURBS info or an inconsistent model.
|
|
2530
|
+
*/
|
|
2531
|
+
igaRefine(
|
|
2532
|
+
info: MfemInfo | CadJsonInfo,
|
|
2533
|
+
options?: IgaOptions & {
|
|
2534
|
+
subdivisions?: number | number[];
|
|
2535
|
+
elevate?: number | number[];
|
|
2536
|
+
},
|
|
2537
|
+
): { mesh: Mesh; info: MfemInfo | CadJsonInfo };
|
|
2538
|
+
|
|
2539
|
+
/** Sample a NURBS model into Lagrange cells; see `igaRefine`. */
|
|
2540
|
+
igaSample(
|
|
2541
|
+
info: MfemInfo | CadJsonInfo,
|
|
2542
|
+
options?: IgaOptions,
|
|
2543
|
+
): { mesh: Mesh; info: MfemInfo | CadJsonInfo };
|
|
2544
|
+
|
|
2545
|
+
/**
|
|
2546
|
+
* Evaluate patch `patch` (0-based; the face of a B-rep) at `params`, a flat
|
|
2547
|
+
* array with the parametric dimension's worth of numbers per point.
|
|
2548
|
+
* `derivatives: 1` adds the first derivatives (`(N, d, spaceDim)`) and the
|
|
2549
|
+
* unit normals of a surface in 3-D; a B-rep face also reports `inside`
|
|
2550
|
+
* (1 where its trimming loops contain the point).
|
|
2551
|
+
*/
|
|
2552
|
+
igaEvaluate(
|
|
2553
|
+
info: MfemInfo | CadJsonInfo,
|
|
2554
|
+
patch: number,
|
|
2555
|
+
params: ArrayLike<number>,
|
|
2556
|
+
options?: { derivatives?: 0 | 1; trimSamples?: number },
|
|
2557
|
+
): {
|
|
2558
|
+
spaceDim: number;
|
|
2559
|
+
points: Float64Array;
|
|
2560
|
+
fields: Float64Array[];
|
|
2561
|
+
fieldComponents: number[];
|
|
2562
|
+
derivatives?: Float64Array;
|
|
2563
|
+
normals?: Float64Array;
|
|
2564
|
+
inside?: Uint8Array;
|
|
2565
|
+
};
|
|
2566
|
+
|
|
2567
|
+
/**
|
|
2568
|
+
* Isoparametric tessellation of curved (quadratic) cells: every
|
|
2569
|
+
* `triangle6`, `quad8`, `quad9`, `tetra10` and `hexahedron27` cell is sampled
|
|
2570
|
+
* on a reference lattice and mapped through its own shape functions, curved
|
|
2571
|
+
* surface cells becoming one `triangle` block and curved volume cells one
|
|
2572
|
+
* `tetra` block; every other cell passes through unchanged. `levels` is
|
|
2573
|
+
* divisions per axis for `quad8`/`quad9`/`hexahedron27` and recursive splits
|
|
2574
|
+
* (`2^levels` divisions per edge) for `triangle6`/`tetra10`; `curved = false`
|
|
2575
|
+
* passes every cell through. The output carries `tessellate:source_point`
|
|
2576
|
+
* (point data, -1 for a new point), `tessellate:source_cell` and
|
|
2577
|
+
* `tessellate:sub_index` (cell data); `fields` interpolates point data and
|
|
2578
|
+
* copies cell data onto the children, and `recordStencil` adds
|
|
2579
|
+
* `tessellate:stencil`/`tessellate:weights` (`(P, 27)` point data). Facet
|
|
2580
|
+
* counts are over the output `tetra` block: `numFacetsWithBadCount` is 0
|
|
2581
|
+
* for a conforming tessellation. See doc/tessellation.md.
|
|
2582
|
+
* @throws {Error} on `levels` outside 0..20 or not an integer, or a point
|
|
2583
|
+
* data array whose row count is not the number of points.
|
|
2584
|
+
*/
|
|
2585
|
+
tessellate(
|
|
2586
|
+
mesh: Mesh,
|
|
2587
|
+
levels?: number,
|
|
2588
|
+
curved?: boolean,
|
|
2589
|
+
fields?: boolean,
|
|
2590
|
+
recordStencil?: boolean,
|
|
2591
|
+
): {
|
|
2592
|
+
mesh: Mesh;
|
|
2593
|
+
numSourcePoints: number;
|
|
2594
|
+
numSourceCells: number;
|
|
2595
|
+
numCurvedSourceCells: number;
|
|
2596
|
+
numPassThroughSourceCells: number;
|
|
2597
|
+
numPoints: number;
|
|
2598
|
+
numCells: number;
|
|
2599
|
+
numBoundaryFacets: number;
|
|
2600
|
+
numInteriorFacets: number;
|
|
2601
|
+
numFacetsWithBadCount: number;
|
|
2602
|
+
};
|
|
2603
|
+
|
|
2432
2604
|
/**
|
|
2433
2605
|
* The (sampled) Hausdorff distance between the surfaces of two meshes; a
|
|
2434
2606
|
* volume mesh contributes its skin. `faceSamples = s > 0` also samples the
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@meshioplusplus/wasm",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "17.0.0",
|
|
4
4
|
"description": "meshio++ mesh I/O compiled to WebAssembly: read 76 and write 68 mesh formats (incl. MED, CGNS, Exodus) in the browser or Node.js",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.mjs",
|
package/src/index.mjs
CHANGED
|
@@ -256,7 +256,11 @@ export class MeshioPlusPlusLoadError extends Error {
|
|
|
256
256
|
* checkQuality: (mesh: Mesh, require?: string, maxInverted?: number, maxDegenerate?: number) => {passed: boolean, numCells: number, numInverted: number, numDegenerate: number, checks: Array<object>, summary: string},
|
|
257
257
|
* 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},
|
|
258
258
|
* 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},
|
|
259
|
+
* igaRefine: (info: object, options?: {subdivisions?: number | number[], elevate?: number | number[], sampleSubdivisions?: number, trimSamples?: number, edges?: boolean, trim?: boolean}) => {mesh: Mesh, info: object},
|
|
260
|
+
* igaSample: (info: object, options?: {sampleSubdivisions?: number, trimSamples?: number, edges?: boolean, trim?: boolean}) => {mesh: Mesh, info: object},
|
|
261
|
+
* igaEvaluate: (info: object, patch: number, params: ArrayLike<number>, options?: {derivatives?: 0 | 1, trimSamples?: number}) => object,
|
|
259
262
|
* 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},
|
|
263
|
+
* 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},
|
|
260
264
|
* render: (mesh: Mesh, options?: RenderOptions) => RenderedFrame,
|
|
261
265
|
* renderText: (mesh: Mesh, options?: RenderOptions, text?: RenderTextOptions) => string,
|
|
262
266
|
* renderPng: (mesh: Mesh, options?: RenderOptions, compress?: number) => Uint8Array,
|
|
@@ -858,6 +862,12 @@ export async function loadMeshioPlusPlus(moduleOverrides = {}, { variant = 'auto
|
|
|
858
862
|
) =>
|
|
859
863
|
Module.fitPrimitives(mesh, patchData, tolerance, relative, minInlierFraction,
|
|
860
864
|
Array.isArray(types) ? types : [types], maxIterations),
|
|
865
|
+
igaRefine: (info, options = {}) => Module.igaRefine(info, options),
|
|
866
|
+
igaSample: (info, options = {}) => Module.igaSample(info, options),
|
|
867
|
+
igaEvaluate: (info, patch, params, options = {}) =>
|
|
868
|
+
Module.igaEvaluate(info, patch, params, options),
|
|
869
|
+
tessellate: (mesh, levels = 2, curved = true, fields = true, recordStencil = false) =>
|
|
870
|
+
Module.tessellate(mesh, levels, curved, fields, recordStencil),
|
|
861
871
|
render: (mesh, options = {}) => Module.render(mesh, options),
|
|
862
872
|
renderText: (mesh, options = {}, text = {}) => Module.renderText(mesh, options, text),
|
|
863
873
|
renderPng: (mesh, options = {}, compress = 0) => Module.renderPng(mesh, options, compress),
|