@meshioplusplus/wasm 10.6.0 → 10.14.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
|
@@ -302,6 +302,19 @@ export type OpSpec =
|
|
|
302
302
|
output?: string;
|
|
303
303
|
component?: number;
|
|
304
304
|
}
|
|
305
|
+
| {
|
|
306
|
+
/**
|
|
307
|
+
* The Hessian (second derivative) of a scalar `point_data` field --
|
|
308
|
+
* `gradient`'s companion one order further, for curvature-based
|
|
309
|
+
* adaptive refinement. A pure data step: geometry is untouched and
|
|
310
|
+
* one new (n,9) array is attached.
|
|
311
|
+
*/
|
|
312
|
+
op: 'hessian';
|
|
313
|
+
array: string;
|
|
314
|
+
method?: GradientMethod;
|
|
315
|
+
location?: 'point' | 'cell';
|
|
316
|
+
output?: string;
|
|
317
|
+
}
|
|
305
318
|
| {
|
|
306
319
|
/**
|
|
307
320
|
* The ZZ recovery-based error indicator of a `point_data` field, plus
|
|
@@ -391,6 +404,9 @@ export type ErrorMethod = 'zz';
|
|
|
391
404
|
/** `estimateError`'s marking policy. See doc/error.md. */
|
|
392
405
|
export type ErrorMarking = 'none' | 'absolute' | 'fraction' | 'dorfler';
|
|
393
406
|
|
|
407
|
+
/** `remesh`'s clustering objective. See doc/remesh.md. */
|
|
408
|
+
export type RemeshMetric = 'isotropic' | 'quadric' | 'anisotropic';
|
|
409
|
+
|
|
394
410
|
/** One data array's location: `point_data`, `cell_data`, or `field_data`. */
|
|
395
411
|
export type DataLocation = 'point' | 'cell' | 'field';
|
|
396
412
|
|
|
@@ -428,8 +444,11 @@ export type MergeDataPolicy = 'intersection' | 'fill';
|
|
|
428
444
|
/** Element-representation conversion performed by `convertCells`. */
|
|
429
445
|
export type ConvertCellsMode = 'linearize' | 'simplexify' | 'elevate';
|
|
430
446
|
|
|
431
|
-
/** Smoothing operator applied by `smooth`. `'taubin'` is shrink-free.
|
|
432
|
-
|
|
447
|
+
/** Smoothing operator applied by `smooth`. `'taubin'` is shrink-free.
|
|
448
|
+
* `'odt'` (optimal-Delaunay-triangulation smoothing) is tet-only and
|
|
449
|
+
* moves each free interior vertex toward the volume-weighted average of
|
|
450
|
+
* its incident tets' circumcenters. See doc/smooth.md. */
|
|
451
|
+
export type SmoothMethod = 'laplacian' | 'taubin' | 'odt';
|
|
433
452
|
|
|
434
453
|
/**
|
|
435
454
|
* How `refine` resolves the hanging nodes a partial refinement leaves behind.
|
|
@@ -494,6 +513,10 @@ export type InterpolateMethod = 'nearest' | 'barycentric';
|
|
|
494
513
|
* target: throw, replace, or write to `name + '_interp'`. */
|
|
495
514
|
export type InterpolateOnConflict = 'error' | 'overwrite' | 'suffix';
|
|
496
515
|
|
|
516
|
+
/** What `conservativeInterpolate` does when a transferred name already
|
|
517
|
+
* exists on the target: throw, replace, or write to `name + '_interp'`. */
|
|
518
|
+
export type ConservativeInterpolateOnConflict = 'error' | 'overwrite' | 'suffix';
|
|
519
|
+
|
|
497
520
|
/** Partitioning backend: SFC is always available; KaHIP is never compiled
|
|
498
521
|
* into the WASM build, so `'kahip'` always throws and `'auto'` = `'sfc'`. */
|
|
499
522
|
export type PartitionMethod = 'sfc' | 'kahip' | 'auto';
|
|
@@ -527,6 +550,41 @@ export interface DataArrayInfo {
|
|
|
527
550
|
inconsistentBlocks: boolean;
|
|
528
551
|
}
|
|
529
552
|
|
|
553
|
+
/** Cell-measure-weighted reduction of one array over one set of cells (the
|
|
554
|
+
* whole mesh, or one named Cell region) -- see `dataIntegrate`. */
|
|
555
|
+
export interface FieldIntegralRegion {
|
|
556
|
+
/** The region's name; absent on the whole-mesh `domain` entry. */
|
|
557
|
+
name?: string;
|
|
558
|
+
/** Cells with a computable measure. */
|
|
559
|
+
numCells: number;
|
|
560
|
+
/** Cells excluded: unmeasurable geometry (ragged, unsupported type, or
|
|
561
|
+
* degenerate). */
|
|
562
|
+
numSkipped: number;
|
|
563
|
+
/** `sum(value * |measure|)` over cells finite in component k. */
|
|
564
|
+
totalPerComponent: number[];
|
|
565
|
+
/** `totalPerComponent[k] / domainMeasurePerComponent[k]`, or NaN when that
|
|
566
|
+
* denominator is zero. */
|
|
567
|
+
meanPerComponent: number[];
|
|
568
|
+
/** `sum(|measure|)` over cells finite in component k. */
|
|
569
|
+
domainMeasurePerComponent: number[];
|
|
570
|
+
/** Measurable cells excluded from component k because its value was
|
|
571
|
+
* non-finite there. */
|
|
572
|
+
numNanPerComponent: number[];
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
/** One array's field integral, returned by `dataIntegrate` --
|
|
576
|
+
* `gradient`'s integration counterpart. See doc/field_integration.md. */
|
|
577
|
+
export interface FieldIntegralArray {
|
|
578
|
+
name: string;
|
|
579
|
+
numComponents: number;
|
|
580
|
+
/** The whole-mesh reduction. */
|
|
581
|
+
domain: FieldIntegralRegion;
|
|
582
|
+
/** One independent entry per named Cell region present on the mesh -- a
|
|
583
|
+
* cell in two regions contributes fully to both, one in none contributes
|
|
584
|
+
* to neither. */
|
|
585
|
+
regions: FieldIntegralRegion[];
|
|
586
|
+
}
|
|
587
|
+
|
|
530
588
|
/** Heavy-data layout of a transient XDMF series. */
|
|
531
589
|
export type XdmfDataFormat = 'HDF' | 'XML' | 'Binary';
|
|
532
590
|
|
|
@@ -1014,6 +1072,29 @@ export interface MeshioPlusPlusModule {
|
|
|
1014
1072
|
onConflict?: InterpolateOnConflict,
|
|
1015
1073
|
): Mesh;
|
|
1016
1074
|
|
|
1075
|
+
/**
|
|
1076
|
+
* Mass-preserving cross-mesh field transfer: an exact overlap-measure
|
|
1077
|
+
* weighted remap, so that over the region the two meshes share,
|
|
1078
|
+
* sum(target value * target measure) equals sum(source value * source
|
|
1079
|
+
* measure) — the property `interpolate`'s `'barycentric'` mode does not
|
|
1080
|
+
* have. Both meshes are simplexified first (accepting ragged/polyhedron
|
|
1081
|
+
* blocks for free, unlike a restricted cell-type scope). Unlike
|
|
1082
|
+
* `interpolate`, an empty `arrays` transfers every source point_data AND
|
|
1083
|
+
* cell_data array — there is one algorithm regardless of location. Output
|
|
1084
|
+
* arrays are always Float64.
|
|
1085
|
+
* @throws {Error} on an unknown onConflict, an unknown array name, a name
|
|
1086
|
+
* collision under `'error'`, mismatched maximum topological dimensions
|
|
1087
|
+
* between the two meshes, or no triangle/tetrahedron cells on either
|
|
1088
|
+
* side after simplexification.
|
|
1089
|
+
*/
|
|
1090
|
+
conservativeInterpolate(
|
|
1091
|
+
source: Mesh,
|
|
1092
|
+
target: Mesh,
|
|
1093
|
+
arrays?: string[],
|
|
1094
|
+
defaultValue?: number,
|
|
1095
|
+
onConflict?: ConservativeInterpolateOnConflict,
|
|
1096
|
+
): Mesh;
|
|
1097
|
+
|
|
1017
1098
|
/**
|
|
1018
1099
|
* Green-element undo: restore `fine`'s transitional (closure-only) cells
|
|
1019
1100
|
* back to their original parent, read verbatim from `coarse` — a lookup,
|
|
@@ -1248,6 +1329,41 @@ export interface MeshioPlusPlusModule {
|
|
|
1248
1329
|
overwrite?: boolean,
|
|
1249
1330
|
): { mesh: Mesh; numSkipped: number; numFallback: number };
|
|
1250
1331
|
|
|
1332
|
+
/**
|
|
1333
|
+
* The Hessian (second derivative) of a **scalar** `point_data` field --
|
|
1334
|
+
* `gradient`'s companion one order further, for curvature-based adaptive
|
|
1335
|
+
* refinement.
|
|
1336
|
+
*
|
|
1337
|
+
* A composition of TWO `gradient` calls, not a new numerical kernel: the
|
|
1338
|
+
* field is differentiated once (point location), then that `(n, 3)`
|
|
1339
|
+
* gradient is differentiated again with the default gradient operator,
|
|
1340
|
+
* producing `(n, 9)` -- the flattened row-major 3x3 Hessian, `H[i][j]` at
|
|
1341
|
+
* index `i*3+j`. `method` is forwarded to BOTH internal passes. The width
|
|
1342
|
+
* travels with the array in the returned mesh's `point_data_components` /
|
|
1343
|
+
* `cell_data_components` maps, exactly as `gradient`'s own output does.
|
|
1344
|
+
*
|
|
1345
|
+
* A field that is at most LINEAR has an exactly zero Hessian everywhere --
|
|
1346
|
+
* the one mesh-shape-independent guarantee. For a genuinely quadratic
|
|
1347
|
+
* field the composition is exact on a structured/symmetric mesh away from
|
|
1348
|
+
* its own boundary and a good, standard, but genuinely approximate
|
|
1349
|
+
* curvature estimate on an irregular mesh (see doc/hessian.md).
|
|
1350
|
+
*
|
|
1351
|
+
* A curvature-driven refinement indicator needs no new API: `norm(...)`
|
|
1352
|
+
* in `dataCalc` on the 9-component output is exactly its Frobenius norm,
|
|
1353
|
+
* ready for `refine`'s `where` selector.
|
|
1354
|
+
* @throws {Error} when `array` names a `cell_data` array (piecewise
|
|
1355
|
+
* constant, so it has no derivative), an unknown array, or an array
|
|
1356
|
+
* with more than one component (hessian is scalar-only).
|
|
1357
|
+
*/
|
|
1358
|
+
hessian(
|
|
1359
|
+
mesh: Mesh,
|
|
1360
|
+
array: string,
|
|
1361
|
+
method?: GradientMethod,
|
|
1362
|
+
location?: 'point' | 'cell',
|
|
1363
|
+
output?: string,
|
|
1364
|
+
overwrite?: boolean,
|
|
1365
|
+
): { mesh: Mesh; numSkipped: number; numFallback: number };
|
|
1366
|
+
|
|
1251
1367
|
/**
|
|
1252
1368
|
* The Zienkiewicz-Zhu (ZZ) recovery-based error indicator of a `point_data`
|
|
1253
1369
|
* field, plus optional marking. A composition of `gradient` (Green-Gauss,
|
|
@@ -1283,6 +1399,134 @@ export interface MeshioPlusPlusModule {
|
|
|
1283
1399
|
overwrite?: boolean,
|
|
1284
1400
|
): { mesh: Mesh; globalError: number; numSkipped: number; numMarked: number };
|
|
1285
1401
|
|
|
1402
|
+
/**
|
|
1403
|
+
* Remesh a surface by approximated centroidal Voronoi diagram (ACVD)
|
|
1404
|
+
* clustering: replace its triangulation with a new, near-uniformly-sized,
|
|
1405
|
+
* well-shaped one at `numClusters` vertices. Unlike every other
|
|
1406
|
+
* resolution-changing operation, the output has NEW points and NEW
|
|
1407
|
+
* connectivity with no correspondence to the input — `point_data`,
|
|
1408
|
+
* `cell_data` and named regions are dropped, `field_data` is carried.
|
|
1409
|
+
*
|
|
1410
|
+
* `metric` is `"isotropic"` (default; area-weighted centroidal distance,
|
|
1411
|
+
* fast, rounds sharp features), `"quadric"` (Garland-Heckbert quadric
|
|
1412
|
+
* error, preserves sharp edges/corners at extra cost per candidate move),
|
|
1413
|
+
* or `"anisotropic"` (clusters shaped by a local curvature tensor —
|
|
1414
|
+
* elongated along low-curvature directions, compact across sharp ones —
|
|
1415
|
+
* see `maxAnisotropy`). `subdivide` defaults to automatic (`-1`): the
|
|
1416
|
+
* smallest count of uniform `refine` passes reaching `subsampleRatio`
|
|
1417
|
+
* items per cluster, capped at `maxSubdivide`; `0` disables subdivision.
|
|
1418
|
+
* `gradation` is the curvature-gradation exponent `gamma` in the item
|
|
1419
|
+
* weight `area * kappa^gamma` (`0.0`, the default, disables gradation
|
|
1420
|
+
* entirely and reproduces plain area weighting). `preserveBoundary`
|
|
1421
|
+
* (default `true`) detects the input's open boundary (if any), seeds it
|
|
1422
|
+
* before the interior, and emits a `line` dual cell along boundary edges
|
|
1423
|
+
* whose endpoints land in different clusters — a no-op on a closed mesh.
|
|
1424
|
+
* `maxAnisotropy` (default `4.0`, a measured value) is, under
|
|
1425
|
+
* `metric = "anisotropic"`, the maximum ratio between the two in-plane
|
|
1426
|
+
* target edge lengths a curvature tensor may request; `1.0` recovers the
|
|
1427
|
+
* isotropic shape exactly. Must be at least `1.0`, and an error to set
|
|
1428
|
+
* away from the default under any other metric.
|
|
1429
|
+
* `numIsolatedClusters` and `numNonManifoldVertices` are two distinct
|
|
1430
|
+
* causes of non-manifold output (disconnected clusters vs. "bowtie"
|
|
1431
|
+
* vertices) that repair could not fully fix; check both rather than
|
|
1432
|
+
* assuming.
|
|
1433
|
+
* @throws {Error} on a cluster count below 4 or above the subdivided
|
|
1434
|
+
* input's vertex count, or on any block outside the surface scope (3D
|
|
1435
|
+
* volume cells, higher-order cells, ragged polygon/polyhedron blocks).
|
|
1436
|
+
*/
|
|
1437
|
+
remesh(
|
|
1438
|
+
mesh: Mesh,
|
|
1439
|
+
numClusters: number,
|
|
1440
|
+
subdivide?: number,
|
|
1441
|
+
subsampleRatio?: number,
|
|
1442
|
+
maxSubdivide?: number,
|
|
1443
|
+
maxIterations?: number,
|
|
1444
|
+
maxRepairPasses?: number,
|
|
1445
|
+
metric?: RemeshMetric,
|
|
1446
|
+
gradation?: number,
|
|
1447
|
+
preserveBoundary?: boolean,
|
|
1448
|
+
maxAnisotropy?: number,
|
|
1449
|
+
): {
|
|
1450
|
+
mesh: Mesh;
|
|
1451
|
+
numClusters: number;
|
|
1452
|
+
numIterations: number;
|
|
1453
|
+
subdivideApplied: number;
|
|
1454
|
+
numIsolatedClusters: number;
|
|
1455
|
+
numNonManifoldVertices: number;
|
|
1456
|
+
};
|
|
1457
|
+
|
|
1458
|
+
/**
|
|
1459
|
+
* Retetrahedralize a volume mesh (or a closed surface) at a caller-chosen
|
|
1460
|
+
* resolution by isosurface stuffing — the volumetric sibling of `remesh`.
|
|
1461
|
+
* Unlike `remesh`, this accepts a VOLUME mesh directly (its boundary is
|
|
1462
|
+
* extracted internally) as well as a closed surface. Same
|
|
1463
|
+
* no-correspondence-with-the-input output contract as `remesh`: new
|
|
1464
|
+
* points, new connectivity, `point_data`/`cell_data`/named regions
|
|
1465
|
+
* dropped, `field_data` carried.
|
|
1466
|
+
*
|
|
1467
|
+
* Exactly one of `resolution`/`cellSize` must be given, sizing a body-
|
|
1468
|
+
* centered cubic (BCC) lattice whose uncut tets have dihedral angles from
|
|
1469
|
+
* a fixed, mesh-size-independent set. `warpFraction` (default `0.35`)
|
|
1470
|
+
* moves lattice vertices near the surface onto it, trading a small,
|
|
1471
|
+
* measured chance of non-manifold boundary edges (reported as
|
|
1472
|
+
* `numNonManifoldEdges`) for substantially better boundary tet quality;
|
|
1473
|
+
* `0` disables warping and gives an exactly watertight but lower-quality
|
|
1474
|
+
* boundary. See doc/remesh_volume.md for the measured tradeoff.
|
|
1475
|
+
* @throws {Error} when neither or both of `resolution`/`cellSize` are
|
|
1476
|
+
* set, on a non-positive resolution/cell size, on a negative
|
|
1477
|
+
* `warpFraction`, when the root lattice would exceed `maxCells`, when
|
|
1478
|
+
* the cut output would exceed `maxTets`, and on any input the boundary
|
|
1479
|
+
* extraction itself refuses.
|
|
1480
|
+
*/
|
|
1481
|
+
remeshVolume(
|
|
1482
|
+
mesh: Mesh,
|
|
1483
|
+
resolution?: number[] | null,
|
|
1484
|
+
cellSize?: number,
|
|
1485
|
+
bounds?: number[] | null,
|
|
1486
|
+
padding?: number,
|
|
1487
|
+
paddingRelative?: number,
|
|
1488
|
+
maxCells?: number,
|
|
1489
|
+
maxTets?: number,
|
|
1490
|
+
warpFraction?: number,
|
|
1491
|
+
sign?: SdfSign,
|
|
1492
|
+
watertightCheck?: SdfWatertightCheck,
|
|
1493
|
+
): {
|
|
1494
|
+
mesh: Mesh;
|
|
1495
|
+
numTets: number;
|
|
1496
|
+
numVerticesWarped: number;
|
|
1497
|
+
numTetsRejected: number;
|
|
1498
|
+
numNonManifoldEdges: number;
|
|
1499
|
+
};
|
|
1500
|
+
|
|
1501
|
+
/**
|
|
1502
|
+
* ODT-remesh a tetrahedral mesh: raise its worst element quality by
|
|
1503
|
+
* relocating vertices AND flipping connectivity (2-3/3-2, predicate-free).
|
|
1504
|
+
* The genuine "ODT remeshing" sibling of `remeshVolume` (which generates a
|
|
1505
|
+
* fresh lattice mesh) and of `smooth` method `"odt"` (which only moves
|
|
1506
|
+
* points on fixed connectivity). Tet-only. The point set is invariant, so
|
|
1507
|
+
* point_data/field_data and Point regions carry; cell_data + Cell/Side
|
|
1508
|
+
* regions are dropped. With `preserveBoundary` the boundary surface is
|
|
1509
|
+
* exactly preserved. See doc/optimize_volume.md.
|
|
1510
|
+
* @throws {Error} when the mesh contains a non-`tetra` block or no tetra.
|
|
1511
|
+
*/
|
|
1512
|
+
optimizeVolume(
|
|
1513
|
+
mesh: Mesh,
|
|
1514
|
+
maxIterations?: number,
|
|
1515
|
+
relocate?: boolean,
|
|
1516
|
+
flip?: boolean,
|
|
1517
|
+
preserveBoundary?: boolean,
|
|
1518
|
+
minImprovement?: number,
|
|
1519
|
+
): {
|
|
1520
|
+
mesh: Mesh;
|
|
1521
|
+
numFlips: number;
|
|
1522
|
+
num23Flips: number;
|
|
1523
|
+
num32Flips: number;
|
|
1524
|
+
numVerticesMoved: number;
|
|
1525
|
+
numTets: number;
|
|
1526
|
+
minQualityBefore: number;
|
|
1527
|
+
minQualityAfter: number;
|
|
1528
|
+
};
|
|
1529
|
+
|
|
1286
1530
|
/** Partition a mesh into submeshes by type, connected component, or tag. */
|
|
1287
1531
|
split(mesh: Mesh, by: SplitBy, tagName?: string): { key: string; mesh: Mesh }[];
|
|
1288
1532
|
|
|
@@ -1472,6 +1716,14 @@ export interface MeshioPlusPlusModule {
|
|
|
1472
1716
|
/** Read-only per-array summary of every data array the mesh carries. */
|
|
1473
1717
|
dataInfo(mesh: Mesh): DataArrayInfo[];
|
|
1474
1718
|
|
|
1719
|
+
/**
|
|
1720
|
+
* Cell-measure-weighted total/mean of one or more cell_data arrays --
|
|
1721
|
+
* gradient's integration counterpart. `arrays` empty/undefined means
|
|
1722
|
+
* every cell_data array. A point_data-only name throws naming
|
|
1723
|
+
* dataPointToCell as the fix. See doc/field_integration.md.
|
|
1724
|
+
*/
|
|
1725
|
+
dataIntegrate(mesh: Mesh, arrays?: string[]): FieldIntegralArray[];
|
|
1726
|
+
|
|
1475
1727
|
/**
|
|
1476
1728
|
* Open a transient (time-series) XDMF writer on the virtual filesystem --
|
|
1477
1729
|
* the one stateful object in this API. See {@link XdmfTimeSeriesWriter} for
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@meshioplusplus/wasm",
|
|
3
|
-
"version": "10.
|
|
3
|
+
"version": "10.14.0",
|
|
4
4
|
"description": "meshio++ mesh I/O compiled to WebAssembly: read/write 41 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
|
@@ -160,7 +160,11 @@ function resolveVariant(variant) {
|
|
|
160
160
|
* distanceToSurface: (query: Mesh, surface: Mesh, sign?: string, location?: string, band?: number, recordInside?: boolean, watertightCheck?: string) => {mesh: Mesh, numBanded: number, quality: object},
|
|
161
161
|
* computeSdf: (surface: Mesh, structure?: string, resolution?: number[], cellSize?: number, bounds?: number[], padding?: number, paddingRelative?: number, rootResolution?: number, maxDepth?: number, bandCells?: number, recordLevels?: boolean, maxCells?: number, sign?: string, location?: string, band?: number, watertightCheck?: string) => {mesh: Mesh, dims: number[], origin: number[], spacing: number[], maxDepth: number, numBanded: number, quality: object},
|
|
162
162
|
* gradient: (mesh: Mesh, array: string, operator?: string, method?: string, location?: string, output?: string, component?: number, overwrite?: boolean) => {mesh: Mesh, numSkipped: number, numFallback: number},
|
|
163
|
+
* hessian: (mesh: Mesh, array: string, method?: string, location?: string, output?: string, overwrite?: boolean) => {mesh: Mesh, numSkipped: number, numFallback: number},
|
|
163
164
|
* estimateError: (mesh: Mesh, array: string, method?: string, marking?: string, markingValue?: number, output?: string, marked?: string, overwrite?: boolean) => {mesh: Mesh, globalError: number, numSkipped: number, numMarked: number},
|
|
165
|
+
* remesh: (mesh: Mesh, numClusters: number, subdivide?: number, subsampleRatio?: number, maxSubdivide?: number, maxIterations?: number, maxRepairPasses?: number, metric?: string, gradation?: number, preserveBoundary?: boolean, maxAnisotropy?: number) => {mesh: Mesh, numClusters: number, numIterations: number, subdivideApplied: number, numIsolatedClusters: number, numNonManifoldVertices: number},
|
|
166
|
+
* remeshVolume: (mesh: Mesh, resolution?: number[], cellSize?: number, bounds?: number[], padding?: number, paddingRelative?: number, maxCells?: number, maxTets?: number, warpFraction?: number, sign?: string, watertightCheck?: string) => {mesh: Mesh, numTets: number, numVerticesWarped: number, numTetsRejected: number, numNonManifoldEdges: number},
|
|
167
|
+
* optimizeVolume: (mesh: Mesh, maxIterations?: number, relocate?: boolean, flip?: boolean, preserveBoundary?: boolean, minImprovement?: number) => {mesh: Mesh, numFlips: number, num23Flips: number, num32Flips: number, numVerticesMoved: number, numTets: number, minQualityBefore: number, minQualityAfter: number},
|
|
164
168
|
* split: (mesh: Mesh, by: string, tagName?: string) => {key: string, mesh: Mesh}[],
|
|
165
169
|
* convertCells: (mesh: Mesh, mode?: string, recordParentIds?: boolean) => Mesh,
|
|
166
170
|
* subdivide: (mesh: Mesh, recordParentIds?: boolean) => Mesh,
|
|
@@ -177,6 +181,7 @@ function resolveVariant(variant) {
|
|
|
177
181
|
* dataCalc: (mesh: Mesh, expression: string, location: string, outputName: string, overwrite?: boolean) => Mesh,
|
|
178
182
|
* dataCondition: (mesh: Mesh, location: string, names?: string[], mode?: string, lo?: number, hi?: number, scope?: string, nanPolicy?: string, nanReplacement?: number, suffix?: string) => Mesh,
|
|
179
183
|
* dataInfo: (mesh: Mesh) => object[],
|
|
184
|
+
* dataIntegrate: (mesh: Mesh, arrays?: string[]) => object[],
|
|
180
185
|
* createXdmfTimeSeriesWriter: (path: string, options?: {dataFormat?: string, gzipLevel?: number, mode?: 'truncate'|'append', autoFlush?: boolean}) => XdmfTimeSeriesWriter,
|
|
181
186
|
* }>}
|
|
182
187
|
*/
|
|
@@ -355,6 +360,23 @@ export async function loadMeshioPlusPlus(moduleOverrides = {}, { variant = 'auto
|
|
|
355
360
|
defaultValue,
|
|
356
361
|
onConflict,
|
|
357
362
|
),
|
|
363
|
+
// Mass-preserving cross-mesh field transfer: an exact overlap-measure
|
|
364
|
+
// weighted remap (unlike interpolate's pointwise sampling). An empty
|
|
365
|
+
// `arrays` = every source point_data AND cell_data array.
|
|
366
|
+
conservativeInterpolate: (
|
|
367
|
+
source,
|
|
368
|
+
target,
|
|
369
|
+
arrays = [],
|
|
370
|
+
defaultValue = 0,
|
|
371
|
+
onConflict = 'error',
|
|
372
|
+
) =>
|
|
373
|
+
Module.conservativeInterpolate(
|
|
374
|
+
source,
|
|
375
|
+
target,
|
|
376
|
+
arrays,
|
|
377
|
+
defaultValue,
|
|
378
|
+
onConflict,
|
|
379
|
+
),
|
|
358
380
|
// Restore `fine`'s transitional (green) cells to their coarse parent,
|
|
359
381
|
// read verbatim from `coarse` (a lookup, not a reconstruction).
|
|
360
382
|
undoGreen: (coarse, fine) => Module.undoGreen(coarse, fine),
|
|
@@ -437,6 +459,14 @@ export async function loadMeshioPlusPlus(moduleOverrides = {}, { variant = 'auto
|
|
|
437
459
|
overwrite = false,
|
|
438
460
|
) =>
|
|
439
461
|
Module.gradient(mesh, array, operator, method, location, output, component, overwrite),
|
|
462
|
+
hessian: (
|
|
463
|
+
mesh,
|
|
464
|
+
array,
|
|
465
|
+
method = 'green-gauss',
|
|
466
|
+
location = 'cell',
|
|
467
|
+
output = '',
|
|
468
|
+
overwrite = false,
|
|
469
|
+
) => Module.hessian(mesh, array, method, location, output, overwrite),
|
|
440
470
|
estimateError: (
|
|
441
471
|
mesh,
|
|
442
472
|
array,
|
|
@@ -457,6 +487,57 @@ export async function loadMeshioPlusPlus(moduleOverrides = {}, { variant = 'auto
|
|
|
457
487
|
marked,
|
|
458
488
|
overwrite,
|
|
459
489
|
),
|
|
490
|
+
remesh: (
|
|
491
|
+
mesh,
|
|
492
|
+
numClusters,
|
|
493
|
+
subdivide = -1,
|
|
494
|
+
subsampleRatio = 10.0,
|
|
495
|
+
maxSubdivide = 4,
|
|
496
|
+
maxIterations = 100,
|
|
497
|
+
maxRepairPasses = 10,
|
|
498
|
+
metric = 'isotropic',
|
|
499
|
+
gradation = 0.0,
|
|
500
|
+
preserveBoundary = true,
|
|
501
|
+
maxAnisotropy = 4.0,
|
|
502
|
+
) =>
|
|
503
|
+
Module.remesh(
|
|
504
|
+
mesh,
|
|
505
|
+
numClusters,
|
|
506
|
+
subdivide,
|
|
507
|
+
subsampleRatio,
|
|
508
|
+
maxSubdivide,
|
|
509
|
+
maxIterations,
|
|
510
|
+
maxRepairPasses,
|
|
511
|
+
metric,
|
|
512
|
+
gradation,
|
|
513
|
+
preserveBoundary,
|
|
514
|
+
maxAnisotropy,
|
|
515
|
+
),
|
|
516
|
+
remeshVolume: (
|
|
517
|
+
mesh,
|
|
518
|
+
resolution = null,
|
|
519
|
+
cellSize = 0,
|
|
520
|
+
bounds = null,
|
|
521
|
+
padding = 0,
|
|
522
|
+
paddingRelative = 0.1,
|
|
523
|
+
maxCells = 20000000,
|
|
524
|
+
maxTets = 20000000,
|
|
525
|
+
warpFraction = 0.35,
|
|
526
|
+
sign = 'pseudonormal',
|
|
527
|
+
watertightCheck = 'warn',
|
|
528
|
+
) =>
|
|
529
|
+
Module.remeshVolume(mesh, resolution, cellSize, bounds, padding, paddingRelative,
|
|
530
|
+
maxCells, maxTets, warpFraction, sign, watertightCheck),
|
|
531
|
+
optimizeVolume: (
|
|
532
|
+
mesh,
|
|
533
|
+
maxIterations = 10,
|
|
534
|
+
relocate = true,
|
|
535
|
+
flip = true,
|
|
536
|
+
preserveBoundary = true,
|
|
537
|
+
minImprovement = 1e-6,
|
|
538
|
+
) =>
|
|
539
|
+
Module.optimizeVolume(mesh, maxIterations, relocate, flip, preserveBoundary,
|
|
540
|
+
minImprovement),
|
|
460
541
|
split: (mesh, by, tagName = '') => Module.split(mesh, by, tagName),
|
|
461
542
|
convertCells: (mesh, mode = 'linearize', recordParentIds = false) =>
|
|
462
543
|
Module.convertCells(mesh, mode, recordParentIds),
|
|
@@ -547,6 +628,7 @@ export async function loadMeshioPlusPlus(moduleOverrides = {}, { variant = 'auto
|
|
|
547
628
|
mesh, location, names, mode, lo, hi, scope, nanPolicy, nanReplacement, suffix,
|
|
548
629
|
),
|
|
549
630
|
dataInfo: (mesh) => Module.dataInfo(mesh),
|
|
631
|
+
dataIntegrate: (mesh, arrays = []) => Module.dataIntegrate(mesh, arrays),
|
|
550
632
|
// Transient (time-series) XDMF -- the one *stateful* thing in this API.
|
|
551
633
|
// The raw binding is an opaque integer handle plus seven free
|
|
552
634
|
// functions (see bindings/wasm/js_bindings.cpp for why it is not an
|