@molcrafts/molrs 0.0.14 → 0.0.15
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/molrs.d.ts +1316 -291
- package/molrs.js +1 -1
- package/molrs_bg.js +3023 -705
- package/molrs_bg.wasm +0 -0
- package/package.json +1 -1
package/molrs_bg.js
CHANGED
|
@@ -28,7 +28,6 @@
|
|
|
28
28
|
*/
|
|
29
29
|
export class Block {
|
|
30
30
|
static __wrap(ptr) {
|
|
31
|
-
ptr = ptr >>> 0;
|
|
32
31
|
const obj = Object.create(Block.prototype);
|
|
33
32
|
obj.__wbg_ptr = ptr;
|
|
34
33
|
BlockFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
@@ -368,7 +367,7 @@ export class Block {
|
|
|
368
367
|
if (ret[2]) {
|
|
369
368
|
throw takeFromExternrefTable0(ret[1]);
|
|
370
369
|
}
|
|
371
|
-
this.__wbg_ptr = ret[0]
|
|
370
|
+
this.__wbg_ptr = ret[0];
|
|
372
371
|
BlockFinalization.register(this, this.__wbg_ptr, this);
|
|
373
372
|
return this;
|
|
374
373
|
}
|
|
@@ -555,6 +554,71 @@ export class Block {
|
|
|
555
554
|
throw takeFromExternrefTable0(ret[0]);
|
|
556
555
|
}
|
|
557
556
|
}
|
|
557
|
+
/**
|
|
558
|
+
* Declare this block as N-dimensional with the given `shape`.
|
|
559
|
+
*
|
|
560
|
+
* `shape.iter().product()` must equal the block's current `nrows`
|
|
561
|
+
* when the block has columns. Pass an empty array to clear the
|
|
562
|
+
* shape and revert to plain row-table semantics.
|
|
563
|
+
*
|
|
564
|
+
* This does **not** reshape column storage — columns remain
|
|
565
|
+
* row-major 1D buffers of length `product(shape)`. `shape` is
|
|
566
|
+
* structural metadata; consumers (e.g. the volumetric renderer in
|
|
567
|
+
* MolVis) use it to unflatten the row index back into N-D
|
|
568
|
+
* coordinates.
|
|
569
|
+
*
|
|
570
|
+
* # Errors
|
|
571
|
+
*
|
|
572
|
+
* Throws if `shape.iter().product()` does not match the block's
|
|
573
|
+
* existing `nrows`, or if the block handle has been invalidated.
|
|
574
|
+
*
|
|
575
|
+
* # Example (JavaScript)
|
|
576
|
+
*
|
|
577
|
+
* ```js
|
|
578
|
+
* const grid = frame.createBlock("grid");
|
|
579
|
+
* grid.setColF("electron_density", values); // values.length === 32*32*32
|
|
580
|
+
* grid.setShape(new Uint32Array([32, 32, 32]));
|
|
581
|
+
* ```
|
|
582
|
+
* @param {Uint32Array} shape
|
|
583
|
+
*/
|
|
584
|
+
setShape(shape) {
|
|
585
|
+
const ret = wasm.block_setShape(this.__wbg_ptr, shape);
|
|
586
|
+
if (ret[1]) {
|
|
587
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
588
|
+
}
|
|
589
|
+
}
|
|
590
|
+
/**
|
|
591
|
+
* Return the structural shape of the block as a `Uint32Array`.
|
|
592
|
+
*
|
|
593
|
+
* - Plain row tables (atoms, bonds): `[nrows]` — single-axis.
|
|
594
|
+
* - Volumetric grids: `[Nx, Ny, Nz]` — explicitly declared via
|
|
595
|
+
* [`setShape`](Self::set_shape).
|
|
596
|
+
* - Empty blocks: `[]`.
|
|
597
|
+
*
|
|
598
|
+
* `block.shape()` is uniform across all block kinds — the rank of
|
|
599
|
+
* the returned array is what distinguishes a plain table from a
|
|
600
|
+
* volumetric grid. The product of the shape always equals
|
|
601
|
+
* `block.nrows()`.
|
|
602
|
+
*
|
|
603
|
+
* # Errors
|
|
604
|
+
*
|
|
605
|
+
* Throws if the block handle has been invalidated.
|
|
606
|
+
*
|
|
607
|
+
* # Example (JavaScript)
|
|
608
|
+
*
|
|
609
|
+
* ```js
|
|
610
|
+
* const atomsShape = atoms.shape(); // Uint32Array([1000])
|
|
611
|
+
* const gridShape = grid.shape(); // Uint32Array([32, 32, 32])
|
|
612
|
+
* ```
|
|
613
|
+
* @returns {Uint32Array}
|
|
614
|
+
*/
|
|
615
|
+
shape() {
|
|
616
|
+
const ret = wasm.block_shape(this.__wbg_ptr);
|
|
617
|
+
if (ret[2]) {
|
|
618
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
619
|
+
}
|
|
620
|
+
return takeFromExternrefTable0(ret[0]);
|
|
621
|
+
}
|
|
558
622
|
/**
|
|
559
623
|
* Zero-copy JS float typed-array view into WASM linear memory.
|
|
560
624
|
*
|
|
@@ -681,7 +745,6 @@ if (Symbol.dispose) Block.prototype[Symbol.dispose] = Block.prototype.free;
|
|
|
681
745
|
*/
|
|
682
746
|
export class Box {
|
|
683
747
|
static __wrap(ptr) {
|
|
684
|
-
ptr = ptr >>> 0;
|
|
685
748
|
const obj = Object.create(Box.prototype);
|
|
686
749
|
obj.__wbg_ptr = ptr;
|
|
687
750
|
BoxFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
@@ -845,22 +908,32 @@ export class Box {
|
|
|
845
908
|
return WasmArray.__wrap(ret);
|
|
846
909
|
}
|
|
847
910
|
/**
|
|
848
|
-
* Return the box
|
|
849
|
-
*
|
|
850
|
-
*
|
|
851
|
-
*
|
|
911
|
+
* Return the box's 3×3 cell matrix `h` as a `WasmArray` with shape
|
|
912
|
+
* `[9]`, **column-major** (column j of `h` is the j-th lattice
|
|
913
|
+
* vector). Suitable for direct consumption by `marchingCubes` and
|
|
914
|
+
* other code that expects the cell as a flat 3×3 column-major
|
|
915
|
+
* `Float64Array`.
|
|
852
916
|
*
|
|
853
917
|
* # Returns
|
|
854
918
|
*
|
|
855
|
-
* `WasmArray`
|
|
919
|
+
* `WasmArray` of length 9: `[h00, h10, h20, h01, h11, h21, h02, h12, h22]`,
|
|
920
|
+
* in angstrom (A).
|
|
856
921
|
*
|
|
857
922
|
* # Example (JavaScript)
|
|
858
923
|
*
|
|
859
924
|
* ```js
|
|
860
|
-
* const
|
|
925
|
+
* const cell = box.hMatrix().toCopy(); // Float64Array, length 9
|
|
926
|
+
* // col0 = a-vector = cell[0..3]
|
|
861
927
|
* ```
|
|
862
928
|
* @returns {WasmArray}
|
|
863
929
|
*/
|
|
930
|
+
hMatrix() {
|
|
931
|
+
const ret = wasm.box_hMatrix(this.__wbg_ptr);
|
|
932
|
+
return WasmArray.__wrap(ret);
|
|
933
|
+
}
|
|
934
|
+
/**
|
|
935
|
+
* @returns {WasmArray}
|
|
936
|
+
*/
|
|
864
937
|
lengths() {
|
|
865
938
|
const ret = wasm.box_lengths(this.__wbg_ptr);
|
|
866
939
|
return WasmArray.__wrap(ret);
|
|
@@ -907,7 +980,7 @@ export class Box {
|
|
|
907
980
|
if (ret[2]) {
|
|
908
981
|
throw takeFromExternrefTable0(ret[1]);
|
|
909
982
|
}
|
|
910
|
-
this.__wbg_ptr = ret[0]
|
|
983
|
+
this.__wbg_ptr = ret[0];
|
|
911
984
|
BoxFinalization.register(this, this.__wbg_ptr, this);
|
|
912
985
|
return this;
|
|
913
986
|
}
|
|
@@ -973,6 +1046,40 @@ export class Box {
|
|
|
973
1046
|
}
|
|
974
1047
|
return Box.__wrap(ret[0]);
|
|
975
1048
|
}
|
|
1049
|
+
/**
|
|
1050
|
+
* Return the box edge lengths as a `WasmArray` with shape `[3]`.
|
|
1051
|
+
*
|
|
1052
|
+
* For orthorhombic boxes these are `[lx, ly, lz]`. For triclinic
|
|
1053
|
+
* boxes these are the lengths of the three cell vectors.
|
|
1054
|
+
*
|
|
1055
|
+
* # Returns
|
|
1056
|
+
*
|
|
1057
|
+
* `WasmArray` containing `[lx, ly, lz]` in angstrom (A).
|
|
1058
|
+
*
|
|
1059
|
+
* # Example (JavaScript)
|
|
1060
|
+
*
|
|
1061
|
+
* ```js
|
|
1062
|
+
* const L = box.lengths().toCopy(); // Float32Array or Float64Array [10, 10, 10]
|
|
1063
|
+
* ```
|
|
1064
|
+
* Return the per-axis periodic boundary flags as a `Uint8Array`
|
|
1065
|
+
* of length 3 (`[px, py, pz]`, 1 = periodic, 0 = open).
|
|
1066
|
+
*
|
|
1067
|
+
* Renderers that respect PBC (isosurface marching cubes,
|
|
1068
|
+
* bond minimum-image, atom wrap-around) need this to decide
|
|
1069
|
+
* whether to wrap coordinates across the cell.
|
|
1070
|
+
*
|
|
1071
|
+
* # Example (JavaScript)
|
|
1072
|
+
*
|
|
1073
|
+
* ```js
|
|
1074
|
+
* const pbc = box.pbc(); // Uint8Array [1, 1, 1] for fully periodic
|
|
1075
|
+
* const fullyPeriodic = pbc[0] === 1 && pbc[1] === 1 && pbc[2] === 1;
|
|
1076
|
+
* ```
|
|
1077
|
+
* @returns {Uint8Array}
|
|
1078
|
+
*/
|
|
1079
|
+
pbc() {
|
|
1080
|
+
const ret = wasm.box_pbc(this.__wbg_ptr);
|
|
1081
|
+
return ret;
|
|
1082
|
+
}
|
|
976
1083
|
/**
|
|
977
1084
|
* Return the box tilt factors as a `WasmArray` with shape `[3]`.
|
|
978
1085
|
*
|
|
@@ -1227,6 +1334,212 @@ export class Box {
|
|
|
1227
1334
|
}
|
|
1228
1335
|
if (Symbol.dispose) Box.prototype[Symbol.dispose] = Box.prototype.free;
|
|
1229
1336
|
|
|
1337
|
+
/**
|
|
1338
|
+
* VASP CHGCAR / CHGDIF volumetric data reader.
|
|
1339
|
+
*
|
|
1340
|
+
* Reads VASP-format charge density files (extension-less canonical name
|
|
1341
|
+
* `CHGCAR` or `CHGCAR_*`). Produces a [`Frame`] with:
|
|
1342
|
+
* - `"atoms"` block: `element` (string), `x`/`y`/`z` (F, Cartesian Å).
|
|
1343
|
+
* - `"grid"` block: structural shape `[nx, ny, nz]`, columns
|
|
1344
|
+
* `total` (always) and `diff` (when ISPIN=2).
|
|
1345
|
+
* - `simbox`: triclinic POSCAR lattice in Å, fully periodic.
|
|
1346
|
+
*
|
|
1347
|
+
* CHGCAR is single-frame; only `step = 0` is valid.
|
|
1348
|
+
*
|
|
1349
|
+
* # Example (JavaScript)
|
|
1350
|
+
*
|
|
1351
|
+
* ```js
|
|
1352
|
+
* const content = await file.text();
|
|
1353
|
+
* const reader = new CHGCARReader(content);
|
|
1354
|
+
* const frame = reader.read(0);
|
|
1355
|
+
* const grid = frame.getBlock("grid");
|
|
1356
|
+
* const total = grid.copyColF("total");
|
|
1357
|
+
* ```
|
|
1358
|
+
*/
|
|
1359
|
+
export class CHGCARReader {
|
|
1360
|
+
__destroy_into_raw() {
|
|
1361
|
+
const ptr = this.__wbg_ptr;
|
|
1362
|
+
this.__wbg_ptr = 0;
|
|
1363
|
+
CHGCARReaderFinalization.unregister(this);
|
|
1364
|
+
return ptr;
|
|
1365
|
+
}
|
|
1366
|
+
free() {
|
|
1367
|
+
const ptr = this.__destroy_into_raw();
|
|
1368
|
+
wasm.__wbg_chgcarreader_free(ptr, 0);
|
|
1369
|
+
}
|
|
1370
|
+
/**
|
|
1371
|
+
* @returns {boolean}
|
|
1372
|
+
*/
|
|
1373
|
+
isEmpty() {
|
|
1374
|
+
const ret = wasm.chgcarreader_isEmpty(this.__wbg_ptr);
|
|
1375
|
+
if (ret[2]) {
|
|
1376
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1377
|
+
}
|
|
1378
|
+
return ret[0] !== 0;
|
|
1379
|
+
}
|
|
1380
|
+
/**
|
|
1381
|
+
* @returns {number}
|
|
1382
|
+
*/
|
|
1383
|
+
len() {
|
|
1384
|
+
const ret = wasm.chgcarreader_len(this.__wbg_ptr);
|
|
1385
|
+
if (ret[2]) {
|
|
1386
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1387
|
+
}
|
|
1388
|
+
return ret[0] >>> 0;
|
|
1389
|
+
}
|
|
1390
|
+
/**
|
|
1391
|
+
* Create a new CHGCAR reader from the file's text content.
|
|
1392
|
+
* @param {string} content
|
|
1393
|
+
*/
|
|
1394
|
+
constructor(content) {
|
|
1395
|
+
const ptr0 = passStringToWasm0(content, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
|
|
1396
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1397
|
+
const ret = wasm.chgcarreader_new(ptr0, len0);
|
|
1398
|
+
this.__wbg_ptr = ret;
|
|
1399
|
+
CHGCARReaderFinalization.register(this, this.__wbg_ptr, this);
|
|
1400
|
+
return this;
|
|
1401
|
+
}
|
|
1402
|
+
/**
|
|
1403
|
+
* Read the frame at `step`. CHGCAR is single-frame.
|
|
1404
|
+
*
|
|
1405
|
+
* # Errors
|
|
1406
|
+
*
|
|
1407
|
+
* Throws a `JsValue` string on parse errors.
|
|
1408
|
+
* @param {number} step
|
|
1409
|
+
* @returns {Frame | undefined}
|
|
1410
|
+
*/
|
|
1411
|
+
read(step) {
|
|
1412
|
+
const ret = wasm.chgcarreader_read(this.__wbg_ptr, step);
|
|
1413
|
+
if (ret[2]) {
|
|
1414
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1415
|
+
}
|
|
1416
|
+
return ret[0] === 0 ? undefined : Frame.__wrap(ret[0]);
|
|
1417
|
+
}
|
|
1418
|
+
}
|
|
1419
|
+
if (Symbol.dispose) CHGCARReader.prototype[Symbol.dispose] = CHGCARReader.prototype.free;
|
|
1420
|
+
|
|
1421
|
+
/**
|
|
1422
|
+
* Crystallographic Information File (CIF / mmCIF) reader.
|
|
1423
|
+
*
|
|
1424
|
+
* Each `data_*` block in the file becomes one [`Frame`]. Most CIF files
|
|
1425
|
+
* contain a single block (one structure), but multi-block files (e.g.
|
|
1426
|
+
* polymorphs of the same compound) are also supported and are exposed
|
|
1427
|
+
* as a multi-frame sequence. The unit cell parameters
|
|
1428
|
+
* (`_cell_length_a`, `_b`, `_c`, `_cell_angle_alpha`, `_beta`,
|
|
1429
|
+
* `_gamma`) are converted to a 3x3 h-matrix on the Rust side and
|
|
1430
|
+
* surface on the JS side as `frame.simbox`.
|
|
1431
|
+
*
|
|
1432
|
+
* Produces a [`Frame`] with an `"atoms"` block containing
|
|
1433
|
+
* `element` (string), `x`, `y`, `z` (F, angstrom in Cartesian
|
|
1434
|
+
* coordinates) and (when present in the file) `label`, `occupancy`,
|
|
1435
|
+
* `bfactor` columns.
|
|
1436
|
+
*
|
|
1437
|
+
* CIF parsing reads the entire file on each `read(step)` call --
|
|
1438
|
+
* random access is therefore O(file_size), but typical CIF files are
|
|
1439
|
+
* small (< 1 MB) and the molvis lazy trajectory caches frames at the
|
|
1440
|
+
* JS level, so this is rarely a bottleneck.
|
|
1441
|
+
*
|
|
1442
|
+
* # Example (JavaScript)
|
|
1443
|
+
*
|
|
1444
|
+
* ```js
|
|
1445
|
+
* const content = await file.text();
|
|
1446
|
+
* const reader = new CIFReader(content);
|
|
1447
|
+
* const frame = reader.read(0);
|
|
1448
|
+
* const atoms = frame.getBlock("atoms");
|
|
1449
|
+
* const box = frame.simbox; // populated from the unit cell
|
|
1450
|
+
* ```
|
|
1451
|
+
*/
|
|
1452
|
+
export class CIFReader {
|
|
1453
|
+
__destroy_into_raw() {
|
|
1454
|
+
const ptr = this.__wbg_ptr;
|
|
1455
|
+
this.__wbg_ptr = 0;
|
|
1456
|
+
CIFReaderFinalization.unregister(this);
|
|
1457
|
+
return ptr;
|
|
1458
|
+
}
|
|
1459
|
+
free() {
|
|
1460
|
+
const ptr = this.__destroy_into_raw();
|
|
1461
|
+
wasm.__wbg_cifreader_free(ptr, 0);
|
|
1462
|
+
}
|
|
1463
|
+
/**
|
|
1464
|
+
* Check whether the file contains no valid blocks.
|
|
1465
|
+
*
|
|
1466
|
+
* # Errors
|
|
1467
|
+
*
|
|
1468
|
+
* Throws a `JsValue` string on parse errors.
|
|
1469
|
+
* @returns {boolean}
|
|
1470
|
+
*/
|
|
1471
|
+
isEmpty() {
|
|
1472
|
+
const ret = wasm.cifreader_isEmpty(this.__wbg_ptr);
|
|
1473
|
+
if (ret[2]) {
|
|
1474
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1475
|
+
}
|
|
1476
|
+
return ret[0] !== 0;
|
|
1477
|
+
}
|
|
1478
|
+
/**
|
|
1479
|
+
* Return the number of `data_*` blocks in the file.
|
|
1480
|
+
*
|
|
1481
|
+
* # Errors
|
|
1482
|
+
*
|
|
1483
|
+
* Throws a `JsValue` string on parse errors.
|
|
1484
|
+
* @returns {number}
|
|
1485
|
+
*/
|
|
1486
|
+
len() {
|
|
1487
|
+
const ret = wasm.cifreader_len(this.__wbg_ptr);
|
|
1488
|
+
if (ret[2]) {
|
|
1489
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1490
|
+
}
|
|
1491
|
+
return ret[0] >>> 0;
|
|
1492
|
+
}
|
|
1493
|
+
/**
|
|
1494
|
+
* Create a new CIF reader from a string containing the file content.
|
|
1495
|
+
*
|
|
1496
|
+
* # Arguments
|
|
1497
|
+
*
|
|
1498
|
+
* * `content` - The full text content of a CIF file
|
|
1499
|
+
*
|
|
1500
|
+
* # Example (JavaScript)
|
|
1501
|
+
*
|
|
1502
|
+
* ```js
|
|
1503
|
+
* const reader = new CIFReader(cifString);
|
|
1504
|
+
* ```
|
|
1505
|
+
* @param {string} content
|
|
1506
|
+
*/
|
|
1507
|
+
constructor(content) {
|
|
1508
|
+
const ptr0 = passStringToWasm0(content, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
|
|
1509
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1510
|
+
const ret = wasm.cifreader_new(ptr0, len0);
|
|
1511
|
+
this.__wbg_ptr = ret;
|
|
1512
|
+
CIFReaderFinalization.register(this, this.__wbg_ptr, this);
|
|
1513
|
+
return this;
|
|
1514
|
+
}
|
|
1515
|
+
/**
|
|
1516
|
+
* Read the frame at the given block index.
|
|
1517
|
+
*
|
|
1518
|
+
* # Arguments
|
|
1519
|
+
*
|
|
1520
|
+
* * `step` - 0-based index of the `data_*` block to return
|
|
1521
|
+
*
|
|
1522
|
+
* # Returns
|
|
1523
|
+
*
|
|
1524
|
+
* A [`Frame`] for the requested block, or `undefined` when
|
|
1525
|
+
* `step >= len()`.
|
|
1526
|
+
*
|
|
1527
|
+
* # Errors
|
|
1528
|
+
*
|
|
1529
|
+
* Throws a `JsValue` string on parse errors.
|
|
1530
|
+
* @param {number} step
|
|
1531
|
+
* @returns {Frame | undefined}
|
|
1532
|
+
*/
|
|
1533
|
+
read(step) {
|
|
1534
|
+
const ret = wasm.cifreader_read(this.__wbg_ptr, step);
|
|
1535
|
+
if (ret[2]) {
|
|
1536
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1537
|
+
}
|
|
1538
|
+
return ret[0] === 0 ? undefined : Frame.__wrap(ret[0]);
|
|
1539
|
+
}
|
|
1540
|
+
}
|
|
1541
|
+
if (Symbol.dispose) CIFReader.prototype[Symbol.dispose] = CIFReader.prototype.free;
|
|
1542
|
+
|
|
1230
1543
|
/**
|
|
1231
1544
|
* Mass-weighted cluster center calculator.
|
|
1232
1545
|
*/
|
|
@@ -1266,7 +1579,7 @@ export class CenterOfMass {
|
|
|
1266
1579
|
var ptr0 = isLikeNone(masses) ? 0 : passArrayF64ToWasm0(masses, wasm.__wbindgen_malloc_command_export);
|
|
1267
1580
|
var len0 = WASM_VECTOR_LEN;
|
|
1268
1581
|
const ret = wasm.centerofmass_new(ptr0, len0);
|
|
1269
|
-
this.__wbg_ptr = ret
|
|
1582
|
+
this.__wbg_ptr = ret;
|
|
1270
1583
|
CenterOfMassFinalization.register(this, this.__wbg_ptr, this);
|
|
1271
1584
|
return this;
|
|
1272
1585
|
}
|
|
@@ -1286,7 +1599,6 @@ if (Symbol.dispose) CenterOfMass.prototype[Symbol.dispose] = CenterOfMass.protot
|
|
|
1286
1599
|
*/
|
|
1287
1600
|
export class CenterOfMassResult {
|
|
1288
1601
|
static __wrap(ptr) {
|
|
1289
|
-
ptr = ptr >>> 0;
|
|
1290
1602
|
const obj = Object.create(CenterOfMassResult.prototype);
|
|
1291
1603
|
obj.__wbg_ptr = ptr;
|
|
1292
1604
|
CenterOfMassResultFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
@@ -1416,7 +1728,7 @@ export class Cluster {
|
|
|
1416
1728
|
*/
|
|
1417
1729
|
constructor(min_cluster_size) {
|
|
1418
1730
|
const ret = wasm.cluster_new(min_cluster_size);
|
|
1419
|
-
this.__wbg_ptr = ret
|
|
1731
|
+
this.__wbg_ptr = ret;
|
|
1420
1732
|
ClusterFinalization.register(this, this.__wbg_ptr, this);
|
|
1421
1733
|
return this;
|
|
1422
1734
|
}
|
|
@@ -1463,7 +1775,7 @@ export class ClusterCenters {
|
|
|
1463
1775
|
}
|
|
1464
1776
|
constructor() {
|
|
1465
1777
|
const ret = wasm.clustercenters_new();
|
|
1466
|
-
this.__wbg_ptr = ret
|
|
1778
|
+
this.__wbg_ptr = ret;
|
|
1467
1779
|
ClusterCentersFinalization.register(this, this.__wbg_ptr, this);
|
|
1468
1780
|
return this;
|
|
1469
1781
|
}
|
|
@@ -1490,7 +1802,6 @@ if (Symbol.dispose) ClusterCenters.prototype[Symbol.dispose] = ClusterCenters.pr
|
|
|
1490
1802
|
*/
|
|
1491
1803
|
export class ClusterResult {
|
|
1492
1804
|
static __wrap(ptr) {
|
|
1493
|
-
ptr = ptr >>> 0;
|
|
1494
1805
|
const obj = Object.create(ClusterResult.prototype);
|
|
1495
1806
|
obj.__wbg_ptr = ptr;
|
|
1496
1807
|
ClusterResultFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
@@ -1547,64 +1858,293 @@ export class ClusterResult {
|
|
|
1547
1858
|
if (Symbol.dispose) ClusterResult.prototype[Symbol.dispose] = ClusterResult.prototype.free;
|
|
1548
1859
|
|
|
1549
1860
|
/**
|
|
1550
|
-
*
|
|
1551
|
-
*
|
|
1552
|
-
* A `Frame` owns a set of named blocks (column stores) and an optional
|
|
1553
|
-
* simulation box ([`Box`](super::region::simbox::Box)). This is the
|
|
1554
|
-
* primary interchange type for molecular data in the WASM API.
|
|
1861
|
+
* Gaussian Cube file reader.
|
|
1555
1862
|
*
|
|
1556
|
-
*
|
|
1863
|
+
* Cube files describe a single voxel grid with embedded atom geometry.
|
|
1864
|
+
* The reader produces a [`Frame`] with:
|
|
1865
|
+
* - `"atoms"` block: `element` (string), `atomic_number` (i32),
|
|
1866
|
+
* `charge` (F), `x`/`y`/`z` (F, **always Å** — Bohr files are converted
|
|
1867
|
+
* on read).
|
|
1868
|
+
* - `"grid"` block: structural shape `[nx, ny, nz]` and one f64 column
|
|
1869
|
+
* per scalar field — `density` for single-density files,
|
|
1870
|
+
* `mo_<idx>` for negative-natoms multi-orbital files.
|
|
1871
|
+
* - `simbox`: voxel cell × dims in Å.
|
|
1557
1872
|
*
|
|
1558
|
-
* -
|
|
1559
|
-
* (string), `x`/`y`/`z` (F, coordinates in angstrom), and optionally
|
|
1560
|
-
* `mass` (F, atomic mass units) and `charge` (F, elementary charges).
|
|
1561
|
-
* - The `"bonds"` block should contain bond topology: `i`/`j` (u32,
|
|
1562
|
-
* zero-based atom indices) and `order` (F, bond order: 1.0 = single,
|
|
1563
|
-
* 1.5 = aromatic, 2.0 = double, 3.0 = triple).
|
|
1873
|
+
* Cube is inherently single-frame (only `step = 0` is valid).
|
|
1564
1874
|
*
|
|
1565
1875
|
* # Example (JavaScript)
|
|
1566
1876
|
*
|
|
1567
1877
|
* ```js
|
|
1568
|
-
* const
|
|
1569
|
-
* const
|
|
1570
|
-
*
|
|
1878
|
+
* const content = await file.text();
|
|
1879
|
+
* const reader = new CubeReader(content);
|
|
1880
|
+
* const frame = reader.read(0);
|
|
1881
|
+
* const grid = frame.getBlock("grid"); // shape [nx, ny, nz]
|
|
1882
|
+
* const density = grid.copyColF("density"); // owned Float64Array
|
|
1571
1883
|
* ```
|
|
1572
1884
|
*/
|
|
1573
|
-
export class
|
|
1574
|
-
static __wrap(ptr) {
|
|
1575
|
-
ptr = ptr >>> 0;
|
|
1576
|
-
const obj = Object.create(Frame.prototype);
|
|
1577
|
-
obj.__wbg_ptr = ptr;
|
|
1578
|
-
FrameFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
1579
|
-
return obj;
|
|
1580
|
-
}
|
|
1885
|
+
export class CubeReader {
|
|
1581
1886
|
__destroy_into_raw() {
|
|
1582
1887
|
const ptr = this.__wbg_ptr;
|
|
1583
1888
|
this.__wbg_ptr = 0;
|
|
1584
|
-
|
|
1889
|
+
CubeReaderFinalization.unregister(this);
|
|
1585
1890
|
return ptr;
|
|
1586
1891
|
}
|
|
1587
1892
|
free() {
|
|
1588
1893
|
const ptr = this.__destroy_into_raw();
|
|
1589
|
-
wasm.
|
|
1894
|
+
wasm.__wbg_cubereader_free(ptr, 0);
|
|
1590
1895
|
}
|
|
1591
1896
|
/**
|
|
1592
|
-
*
|
|
1593
|
-
*
|
|
1594
|
-
* # Errors
|
|
1595
|
-
*
|
|
1596
|
-
* Throws a `JsValue` string if the frame has already been dropped.
|
|
1597
|
-
*
|
|
1598
|
-
* # Example (JavaScript)
|
|
1599
|
-
*
|
|
1600
|
-
* ```js
|
|
1601
|
-
* frame.clear();
|
|
1602
|
-
* ```
|
|
1897
|
+
* @returns {boolean}
|
|
1603
1898
|
*/
|
|
1604
|
-
|
|
1605
|
-
const ret = wasm.
|
|
1606
|
-
if (ret[
|
|
1607
|
-
throw takeFromExternrefTable0(ret[
|
|
1899
|
+
isEmpty() {
|
|
1900
|
+
const ret = wasm.cubereader_isEmpty(this.__wbg_ptr);
|
|
1901
|
+
if (ret[2]) {
|
|
1902
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1903
|
+
}
|
|
1904
|
+
return ret[0] !== 0;
|
|
1905
|
+
}
|
|
1906
|
+
/**
|
|
1907
|
+
* Return the number of frames (always 0 or 1).
|
|
1908
|
+
* @returns {number}
|
|
1909
|
+
*/
|
|
1910
|
+
len() {
|
|
1911
|
+
const ret = wasm.cubereader_len(this.__wbg_ptr);
|
|
1912
|
+
if (ret[2]) {
|
|
1913
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1914
|
+
}
|
|
1915
|
+
return ret[0] >>> 0;
|
|
1916
|
+
}
|
|
1917
|
+
/**
|
|
1918
|
+
* Create a new Cube reader from the file's text content.
|
|
1919
|
+
* @param {string} content
|
|
1920
|
+
*/
|
|
1921
|
+
constructor(content) {
|
|
1922
|
+
const ptr0 = passStringToWasm0(content, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
|
|
1923
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1924
|
+
const ret = wasm.cubereader_new(ptr0, len0);
|
|
1925
|
+
this.__wbg_ptr = ret;
|
|
1926
|
+
CubeReaderFinalization.register(this, this.__wbg_ptr, this);
|
|
1927
|
+
return this;
|
|
1928
|
+
}
|
|
1929
|
+
/**
|
|
1930
|
+
* Read the frame at `step`. Cube files are single-frame, so any
|
|
1931
|
+
* `step != 0` returns `undefined`.
|
|
1932
|
+
*
|
|
1933
|
+
* # Errors
|
|
1934
|
+
*
|
|
1935
|
+
* Throws a `JsValue` string on parse errors.
|
|
1936
|
+
* @param {number} step
|
|
1937
|
+
* @returns {Frame | undefined}
|
|
1938
|
+
*/
|
|
1939
|
+
read(step) {
|
|
1940
|
+
const ret = wasm.cubereader_read(this.__wbg_ptr, step);
|
|
1941
|
+
if (ret[2]) {
|
|
1942
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1943
|
+
}
|
|
1944
|
+
return ret[0] === 0 ? undefined : Frame.__wrap(ret[0]);
|
|
1945
|
+
}
|
|
1946
|
+
}
|
|
1947
|
+
if (Symbol.dispose) CubeReader.prototype[Symbol.dispose] = CubeReader.prototype.free;
|
|
1948
|
+
|
|
1949
|
+
/**
|
|
1950
|
+
* DCD trajectory file reader.
|
|
1951
|
+
*
|
|
1952
|
+
* DCD is a binary multi-frame trajectory format originally used by
|
|
1953
|
+
* CHARMM and now widely produced by NAMD / OpenMM / GROMACS-via-VMD.
|
|
1954
|
+
* This wrapper accepts the file as raw bytes (`Uint8Array`) since
|
|
1955
|
+
* DCD is not text-encoded — passing a JS string would corrupt the
|
|
1956
|
+
* fixed-width Fortran record markers.
|
|
1957
|
+
*
|
|
1958
|
+
* Each frame produces a [`Frame`] with an `"atoms"` block carrying
|
|
1959
|
+
* `x`, `y`, `z` (F, angstrom). Box/cell information, when the DCD
|
|
1960
|
+
* header declares it present, is attached as the frame's `simbox`.
|
|
1961
|
+
*
|
|
1962
|
+
* # Example (JavaScript)
|
|
1963
|
+
*
|
|
1964
|
+
* ```js
|
|
1965
|
+
* const bytes = new Uint8Array(await blob.arrayBuffer());
|
|
1966
|
+
* const reader = new DCDReader(bytes);
|
|
1967
|
+
* console.log(reader.len()); // number of frames
|
|
1968
|
+
*
|
|
1969
|
+
* const frame = reader.read(0); // first frame
|
|
1970
|
+
* const atoms = frame.getBlock("atoms");
|
|
1971
|
+
* const x = atoms.copyColF("x");
|
|
1972
|
+
* ```
|
|
1973
|
+
*/
|
|
1974
|
+
export class DCDReader {
|
|
1975
|
+
__destroy_into_raw() {
|
|
1976
|
+
const ptr = this.__wbg_ptr;
|
|
1977
|
+
this.__wbg_ptr = 0;
|
|
1978
|
+
DCDReaderFinalization.unregister(this);
|
|
1979
|
+
return ptr;
|
|
1980
|
+
}
|
|
1981
|
+
free() {
|
|
1982
|
+
const ptr = this.__destroy_into_raw();
|
|
1983
|
+
wasm.__wbg_dcdreader_free(ptr, 0);
|
|
1984
|
+
}
|
|
1985
|
+
/**
|
|
1986
|
+
* Check whether the file contains no frames.
|
|
1987
|
+
*
|
|
1988
|
+
* # Errors
|
|
1989
|
+
*
|
|
1990
|
+
* Throws a `JsValue` string if the header cannot be parsed.
|
|
1991
|
+
* @returns {boolean}
|
|
1992
|
+
*/
|
|
1993
|
+
isEmpty() {
|
|
1994
|
+
const ret = wasm.dcdreader_isEmpty(this.__wbg_ptr);
|
|
1995
|
+
if (ret[2]) {
|
|
1996
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1997
|
+
}
|
|
1998
|
+
return ret[0] !== 0;
|
|
1999
|
+
}
|
|
2000
|
+
/**
|
|
2001
|
+
* Return the number of frames in the DCD file.
|
|
2002
|
+
*
|
|
2003
|
+
* # Errors
|
|
2004
|
+
*
|
|
2005
|
+
* Throws a `JsValue` string if the header cannot be parsed.
|
|
2006
|
+
* @returns {number}
|
|
2007
|
+
*/
|
|
2008
|
+
len() {
|
|
2009
|
+
const ret = wasm.dcdreader_len(this.__wbg_ptr);
|
|
2010
|
+
if (ret[2]) {
|
|
2011
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
2012
|
+
}
|
|
2013
|
+
return ret[0] >>> 0;
|
|
2014
|
+
}
|
|
2015
|
+
/**
|
|
2016
|
+
* Create a new DCD reader from the file's raw bytes.
|
|
2017
|
+
*
|
|
2018
|
+
* # Arguments
|
|
2019
|
+
*
|
|
2020
|
+
* * `bytes` - The full binary content of a DCD file. The reader
|
|
2021
|
+
* takes ownership of an internal copy, so the caller is free
|
|
2022
|
+
* to discard the buffer immediately after this returns.
|
|
2023
|
+
*
|
|
2024
|
+
* # Example (JavaScript)
|
|
2025
|
+
*
|
|
2026
|
+
* ```js
|
|
2027
|
+
* const bytes = new Uint8Array(await file.arrayBuffer());
|
|
2028
|
+
* const reader = new DCDReader(bytes);
|
|
2029
|
+
* ```
|
|
2030
|
+
* @param {Uint8Array} bytes
|
|
2031
|
+
*/
|
|
2032
|
+
constructor(bytes) {
|
|
2033
|
+
const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc_command_export);
|
|
2034
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2035
|
+
const ret = wasm.dcdreader_new(ptr0, len0);
|
|
2036
|
+
this.__wbg_ptr = ret;
|
|
2037
|
+
DCDReaderFinalization.register(this, this.__wbg_ptr, this);
|
|
2038
|
+
return this;
|
|
2039
|
+
}
|
|
2040
|
+
/**
|
|
2041
|
+
* Read a frame at the given step index.
|
|
2042
|
+
*
|
|
2043
|
+
* # Arguments
|
|
2044
|
+
*
|
|
2045
|
+
* * `step` - Zero-based frame index
|
|
2046
|
+
*
|
|
2047
|
+
* # Returns
|
|
2048
|
+
*
|
|
2049
|
+
* A [`Frame`] if the step exists, or `undefined` if `step` is
|
|
2050
|
+
* out of range.
|
|
2051
|
+
*
|
|
2052
|
+
* # Errors
|
|
2053
|
+
*
|
|
2054
|
+
* Throws a `JsValue` string on parse errors (truncated record,
|
|
2055
|
+
* malformed header, byte-order mismatch).
|
|
2056
|
+
* @param {number} step
|
|
2057
|
+
* @returns {Frame | undefined}
|
|
2058
|
+
*/
|
|
2059
|
+
read(step) {
|
|
2060
|
+
const ret = wasm.dcdreader_read(this.__wbg_ptr, step);
|
|
2061
|
+
if (ret[2]) {
|
|
2062
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
2063
|
+
}
|
|
2064
|
+
return ret[0] === 0 ? undefined : Frame.__wrap(ret[0]);
|
|
2065
|
+
}
|
|
2066
|
+
}
|
|
2067
|
+
if (Symbol.dispose) DCDReader.prototype[Symbol.dispose] = DCDReader.prototype.free;
|
|
2068
|
+
|
|
2069
|
+
/**
|
|
2070
|
+
* Hierarchical data container mapping string keys to typed [`Block`]s.
|
|
2071
|
+
*
|
|
2072
|
+
* A `Frame` owns a set of named blocks (column stores) and an optional
|
|
2073
|
+
* simulation box ([`Box`](super::region::simbox::Box)). This is the
|
|
2074
|
+
* primary interchange type for molecular data in the WASM API.
|
|
2075
|
+
*
|
|
2076
|
+
* # Conventions
|
|
2077
|
+
*
|
|
2078
|
+
* - The `"atoms"` block should contain per-atom properties: `symbol`
|
|
2079
|
+
* (string), `x`/`y`/`z` (F, coordinates in angstrom), and optionally
|
|
2080
|
+
* `mass` (F, atomic mass units) and `charge` (F, elementary charges).
|
|
2081
|
+
* - The `"bonds"` block should contain bond topology: `i`/`j` (u32,
|
|
2082
|
+
* zero-based atom indices) and `order` (F, bond order: 1.0 = single,
|
|
2083
|
+
* 1.5 = aromatic, 2.0 = double, 3.0 = triple).
|
|
2084
|
+
*
|
|
2085
|
+
* # Example (JavaScript)
|
|
2086
|
+
*
|
|
2087
|
+
* ```js
|
|
2088
|
+
* const frame = new Frame();
|
|
2089
|
+
* const atoms = frame.createBlock("atoms");
|
|
2090
|
+
* atoms.setColF("x", xCoords);
|
|
2091
|
+
* ```
|
|
2092
|
+
*/
|
|
2093
|
+
export class Frame {
|
|
2094
|
+
static __wrap(ptr) {
|
|
2095
|
+
const obj = Object.create(Frame.prototype);
|
|
2096
|
+
obj.__wbg_ptr = ptr;
|
|
2097
|
+
FrameFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
2098
|
+
return obj;
|
|
2099
|
+
}
|
|
2100
|
+
__destroy_into_raw() {
|
|
2101
|
+
const ptr = this.__wbg_ptr;
|
|
2102
|
+
this.__wbg_ptr = 0;
|
|
2103
|
+
FrameFinalization.unregister(this);
|
|
2104
|
+
return ptr;
|
|
2105
|
+
}
|
|
2106
|
+
free() {
|
|
2107
|
+
const ptr = this.__destroy_into_raw();
|
|
2108
|
+
wasm.__wbg_frame_free(ptr, 0);
|
|
2109
|
+
}
|
|
2110
|
+
/**
|
|
2111
|
+
* Return the names of all blocks attached to this frame.
|
|
2112
|
+
*
|
|
2113
|
+
* Iteration order matches the underlying `HashMap` and is therefore
|
|
2114
|
+
* not stable across runs — callers that need a deterministic order
|
|
2115
|
+
* must sort on the JS side. Returns an empty array if the frame
|
|
2116
|
+
* has been dropped.
|
|
2117
|
+
*
|
|
2118
|
+
* # Example (JavaScript)
|
|
2119
|
+
*
|
|
2120
|
+
* ```js
|
|
2121
|
+
* const names = frame.blockNames(); // e.g. ["atoms", "bonds"]
|
|
2122
|
+
* ```
|
|
2123
|
+
* @returns {string[]}
|
|
2124
|
+
*/
|
|
2125
|
+
blockNames() {
|
|
2126
|
+
const ret = wasm.frame_blockNames(this.__wbg_ptr);
|
|
2127
|
+
var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
|
|
2128
|
+
wasm.__wbindgen_free_command_export(ret[0], ret[1] * 4, 4);
|
|
2129
|
+
return v1;
|
|
2130
|
+
}
|
|
2131
|
+
/**
|
|
2132
|
+
* Remove all blocks from this frame (but keep the frame alive).
|
|
2133
|
+
*
|
|
2134
|
+
* # Errors
|
|
2135
|
+
*
|
|
2136
|
+
* Throws a `JsValue` string if the frame has already been dropped.
|
|
2137
|
+
*
|
|
2138
|
+
* # Example (JavaScript)
|
|
2139
|
+
*
|
|
2140
|
+
* ```js
|
|
2141
|
+
* frame.clear();
|
|
2142
|
+
* ```
|
|
2143
|
+
*/
|
|
2144
|
+
clear() {
|
|
2145
|
+
const ret = wasm.frame_clear(this.__wbg_ptr);
|
|
2146
|
+
if (ret[1]) {
|
|
2147
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
1608
2148
|
}
|
|
1609
2149
|
}
|
|
1610
2150
|
/**
|
|
@@ -1696,38 +2236,6 @@ export class Frame {
|
|
|
1696
2236
|
const ret = wasm.frame_getBlock(this.__wbg_ptr, ptr0, len0);
|
|
1697
2237
|
return ret === 0 ? undefined : Block.__wrap(ret);
|
|
1698
2238
|
}
|
|
1699
|
-
/**
|
|
1700
|
-
* Retrieve a named grid attached to this frame.
|
|
1701
|
-
*
|
|
1702
|
-
* Returns a cloned [`Grid`] wrapper, or `undefined` if the grid does
|
|
1703
|
-
* not exist. The returned object is independent of the frame — mutations
|
|
1704
|
-
* to it are not reflected in the frame without a subsequent
|
|
1705
|
-
* [`insertGrid`](Frame::insert_grid) call.
|
|
1706
|
-
*
|
|
1707
|
-
* # Arguments
|
|
1708
|
-
*
|
|
1709
|
-
* * `name` — Grid name to retrieve.
|
|
1710
|
-
*
|
|
1711
|
-
* # Example (JavaScript)
|
|
1712
|
-
*
|
|
1713
|
-
* ```js
|
|
1714
|
-
* const g = frame.getGrid("chgcar");
|
|
1715
|
-
* if (g) {
|
|
1716
|
-
* const arr = g.getArray("rho");
|
|
1717
|
-
* }
|
|
1718
|
-
* ```
|
|
1719
|
-
* @param {string} name
|
|
1720
|
-
* @returns {Grid | undefined}
|
|
1721
|
-
*/
|
|
1722
|
-
getGrid(name) {
|
|
1723
|
-
const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
|
|
1724
|
-
const len0 = WASM_VECTOR_LEN;
|
|
1725
|
-
const ret = wasm.frame_getGrid(this.__wbg_ptr, ptr0, len0);
|
|
1726
|
-
if (ret[2]) {
|
|
1727
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
1728
|
-
}
|
|
1729
|
-
return ret[0] === 0 ? undefined : Grid.__wrap(ret[0]);
|
|
1730
|
-
}
|
|
1731
2239
|
/**
|
|
1732
2240
|
* Read a per-frame metadata value as a numeric scalar.
|
|
1733
2241
|
*
|
|
@@ -1760,47 +2268,6 @@ export class Frame {
|
|
|
1760
2268
|
const ret = wasm.frame_getMetaScalar(this.__wbg_ptr, ptr0, len0);
|
|
1761
2269
|
return ret[0] === 0 ? undefined : ret[1];
|
|
1762
2270
|
}
|
|
1763
|
-
/**
|
|
1764
|
-
* Return the names of all grids attached to this frame.
|
|
1765
|
-
*
|
|
1766
|
-
* # Example (JavaScript)
|
|
1767
|
-
*
|
|
1768
|
-
* ```js
|
|
1769
|
-
* const names = frame.gridNames(); // e.g. ["chgcar", "spin"]
|
|
1770
|
-
* ```
|
|
1771
|
-
* @returns {Array<any>}
|
|
1772
|
-
*/
|
|
1773
|
-
gridNames() {
|
|
1774
|
-
const ret = wasm.frame_gridNames(this.__wbg_ptr);
|
|
1775
|
-
if (ret[2]) {
|
|
1776
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
1777
|
-
}
|
|
1778
|
-
return takeFromExternrefTable0(ret[0]);
|
|
1779
|
-
}
|
|
1780
|
-
/**
|
|
1781
|
-
* Returns `true` if a named grid is attached to this frame.
|
|
1782
|
-
*
|
|
1783
|
-
* # Arguments
|
|
1784
|
-
*
|
|
1785
|
-
* * `name` — Grid name to look up.
|
|
1786
|
-
*
|
|
1787
|
-
* # Example (JavaScript)
|
|
1788
|
-
*
|
|
1789
|
-
* ```js
|
|
1790
|
-
* frame.hasGrid("chgcar"); // true or false
|
|
1791
|
-
* ```
|
|
1792
|
-
* @param {string} name
|
|
1793
|
-
* @returns {boolean}
|
|
1794
|
-
*/
|
|
1795
|
-
hasGrid(name) {
|
|
1796
|
-
const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
|
|
1797
|
-
const len0 = WASM_VECTOR_LEN;
|
|
1798
|
-
const ret = wasm.frame_hasGrid(this.__wbg_ptr, ptr0, len0);
|
|
1799
|
-
if (ret[2]) {
|
|
1800
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
1801
|
-
}
|
|
1802
|
-
return ret[0] !== 0;
|
|
1803
|
-
}
|
|
1804
2271
|
/**
|
|
1805
2272
|
* Insert a block by deep-copying its data into this frame's store.
|
|
1806
2273
|
*
|
|
@@ -1840,52 +2307,16 @@ export class Frame {
|
|
|
1840
2307
|
}
|
|
1841
2308
|
}
|
|
1842
2309
|
/**
|
|
1843
|
-
*
|
|
1844
|
-
*
|
|
1845
|
-
* If a grid with the same name already exists it is replaced. The grid
|
|
1846
|
-
* data is moved into the frame; the JS `Grid` object becomes empty after
|
|
1847
|
-
* this call and should not be reused.
|
|
1848
|
-
*
|
|
1849
|
-
* # Arguments
|
|
1850
|
-
*
|
|
1851
|
-
* * `name` — Name to store the grid under (e.g., `"chgcar"`).
|
|
1852
|
-
* * `grid` — The [`Grid`] to attach.
|
|
1853
|
-
*
|
|
1854
|
-
* # Errors
|
|
2310
|
+
* Return the names of all metadata keys on this frame.
|
|
1855
2311
|
*
|
|
1856
|
-
*
|
|
2312
|
+
* Includes all keys regardless of whether their values are numeric
|
|
2313
|
+
* or categorical. To filter to numeric keys, iterate and call
|
|
2314
|
+
* [`getMetaScalar`](Self::get_meta_scalar) on each.
|
|
1857
2315
|
*
|
|
1858
2316
|
* # Example (JavaScript)
|
|
1859
2317
|
*
|
|
1860
2318
|
* ```js
|
|
1861
|
-
* const
|
|
1862
|
-
* grid.insertArray("rho", rhoData);
|
|
1863
|
-
* frame.insertGrid("chgcar", grid);
|
|
1864
|
-
* ```
|
|
1865
|
-
* @param {string} name
|
|
1866
|
-
* @param {Grid} grid
|
|
1867
|
-
*/
|
|
1868
|
-
insertGrid(name, grid) {
|
|
1869
|
-
const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
|
|
1870
|
-
const len0 = WASM_VECTOR_LEN;
|
|
1871
|
-
_assertClass(grid, Grid);
|
|
1872
|
-
var ptr1 = grid.__destroy_into_raw();
|
|
1873
|
-
const ret = wasm.frame_insertGrid(this.__wbg_ptr, ptr0, len0, ptr1);
|
|
1874
|
-
if (ret[1]) {
|
|
1875
|
-
throw takeFromExternrefTable0(ret[0]);
|
|
1876
|
-
}
|
|
1877
|
-
}
|
|
1878
|
-
/**
|
|
1879
|
-
* Return the names of all metadata keys on this frame.
|
|
1880
|
-
*
|
|
1881
|
-
* Includes all keys regardless of whether their values are numeric
|
|
1882
|
-
* or categorical. To filter to numeric keys, iterate and call
|
|
1883
|
-
* [`getMetaScalar`](Self::get_meta_scalar) on each.
|
|
1884
|
-
*
|
|
1885
|
-
* # Example (JavaScript)
|
|
1886
|
-
*
|
|
1887
|
-
* ```js
|
|
1888
|
-
* const names = frame.metaNames(); // e.g. ["energy", "config", "temp"]
|
|
2319
|
+
* const names = frame.metaNames(); // e.g. ["energy", "config", "temp"]
|
|
1889
2320
|
* ```
|
|
1890
2321
|
* @returns {string[]}
|
|
1891
2322
|
*/
|
|
@@ -1906,7 +2337,7 @@ export class Frame {
|
|
|
1906
2337
|
*/
|
|
1907
2338
|
constructor() {
|
|
1908
2339
|
const ret = wasm.frame_new();
|
|
1909
|
-
this.__wbg_ptr = ret
|
|
2340
|
+
this.__wbg_ptr = ret;
|
|
1910
2341
|
FrameFinalization.register(this, this.__wbg_ptr, this);
|
|
1911
2342
|
return this;
|
|
1912
2343
|
}
|
|
@@ -1937,32 +2368,6 @@ export class Frame {
|
|
|
1937
2368
|
throw takeFromExternrefTable0(ret[0]);
|
|
1938
2369
|
}
|
|
1939
2370
|
}
|
|
1940
|
-
/**
|
|
1941
|
-
* Remove a named grid from this frame.
|
|
1942
|
-
*
|
|
1943
|
-
* # Arguments
|
|
1944
|
-
*
|
|
1945
|
-
* * `name` — Grid name to remove.
|
|
1946
|
-
*
|
|
1947
|
-
* # Errors
|
|
1948
|
-
*
|
|
1949
|
-
* Throws a `JsValue` string if the frame has been dropped.
|
|
1950
|
-
*
|
|
1951
|
-
* # Example (JavaScript)
|
|
1952
|
-
*
|
|
1953
|
-
* ```js
|
|
1954
|
-
* frame.removeGrid("chgcar");
|
|
1955
|
-
* ```
|
|
1956
|
-
* @param {string} name
|
|
1957
|
-
*/
|
|
1958
|
-
removeGrid(name) {
|
|
1959
|
-
const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
|
|
1960
|
-
const len0 = WASM_VECTOR_LEN;
|
|
1961
|
-
const ret = wasm.frame_removeGrid(this.__wbg_ptr, ptr0, len0);
|
|
1962
|
-
if (ret[1]) {
|
|
1963
|
-
throw takeFromExternrefTable0(ret[0]);
|
|
1964
|
-
}
|
|
1965
|
-
}
|
|
1966
2371
|
/**
|
|
1967
2372
|
* Rename a block from `old_key` to `new_key`.
|
|
1968
2373
|
*
|
|
@@ -2138,304 +2543,49 @@ export class Frame {
|
|
|
2138
2543
|
if (Symbol.dispose) Frame.prototype[Symbol.dispose] = Frame.prototype.free;
|
|
2139
2544
|
|
|
2140
2545
|
/**
|
|
2141
|
-
*
|
|
2546
|
+
* One frame's location inside the source byte stream.
|
|
2142
2547
|
*
|
|
2143
|
-
*
|
|
2144
|
-
*
|
|
2145
|
-
*
|
|
2146
|
-
*
|
|
2147
|
-
*
|
|
2148
|
-
*
|
|
2149
|
-
* ```js
|
|
2150
|
-
* // Create a 10×10×10 cubic grid
|
|
2151
|
-
* const origin = new Float32Array([0, 0, 0]);
|
|
2152
|
-
* const cell = new Float32Array([
|
|
2153
|
-
* 10, 0, 0, // first column (a vector)
|
|
2154
|
-
* 0,10, 0, // second column (b vector)
|
|
2155
|
-
* 0, 0,10, // third column (c vector)
|
|
2156
|
-
* ]);
|
|
2157
|
-
* const grid = new Grid(10, 10, 10, origin, cell, true, true, true);
|
|
2158
|
-
*
|
|
2159
|
-
* // Insert a density array (must have length = 10*10*10 = 1000)
|
|
2160
|
-
* const rho = new Float32Array(1000).fill(1.0);
|
|
2161
|
-
* grid.insertArray("rho", rho);
|
|
2162
|
-
*
|
|
2163
|
-
* // Retrieve it
|
|
2164
|
-
* const arr = grid.getArray("rho");
|
|
2165
|
-
* console.log(arr.toCopy());
|
|
2166
|
-
* ```
|
|
2548
|
+
* `byteOffset` is the absolute byte position of the frame's first byte
|
|
2549
|
+
* inside the source (round-tripped through `f64`; the spec caps source
|
|
2550
|
+
* size at 1 TB which is well within `Number.MAX_SAFE_INTEGER`).
|
|
2551
|
+
* `byteLen` is `u32` — per-frame size never exceeds the worker chunk
|
|
2552
|
+
* size plus a small slack.
|
|
2167
2553
|
*/
|
|
2168
|
-
export class
|
|
2554
|
+
export class FrameIndexEntry {
|
|
2169
2555
|
static __wrap(ptr) {
|
|
2170
|
-
|
|
2171
|
-
const obj = Object.create(Grid.prototype);
|
|
2556
|
+
const obj = Object.create(FrameIndexEntry.prototype);
|
|
2172
2557
|
obj.__wbg_ptr = ptr;
|
|
2173
|
-
|
|
2558
|
+
FrameIndexEntryFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
2174
2559
|
return obj;
|
|
2175
2560
|
}
|
|
2176
2561
|
__destroy_into_raw() {
|
|
2177
2562
|
const ptr = this.__wbg_ptr;
|
|
2178
2563
|
this.__wbg_ptr = 0;
|
|
2179
|
-
|
|
2564
|
+
FrameIndexEntryFinalization.unregister(this);
|
|
2180
2565
|
return ptr;
|
|
2181
2566
|
}
|
|
2182
2567
|
free() {
|
|
2183
2568
|
const ptr = this.__destroy_into_raw();
|
|
2184
|
-
wasm.
|
|
2185
|
-
}
|
|
2186
|
-
/**
|
|
2187
|
-
* Names of all scalar arrays stored in this grid.
|
|
2188
|
-
*
|
|
2189
|
-
* # Example (JavaScript)
|
|
2190
|
-
*
|
|
2191
|
-
* ```js
|
|
2192
|
-
* const names = grid.arrayNames(); // e.g. ["rho", "spin"]
|
|
2193
|
-
* ```
|
|
2194
|
-
* @returns {Array<any>}
|
|
2195
|
-
*/
|
|
2196
|
-
arrayNames() {
|
|
2197
|
-
const ret = wasm.grid_arrayNames(this.__wbg_ptr);
|
|
2198
|
-
return ret;
|
|
2199
|
-
}
|
|
2200
|
-
/**
|
|
2201
|
-
* Cell matrix in Ångström as a flat array of length 9 in column-major
|
|
2202
|
-
* order (columns are lattice vectors, matching VASP/molrs convention).
|
|
2203
|
-
*
|
|
2204
|
-
* Layout: `[col0_x, col0_y, col0_z, col1_x, col1_y, col1_z, col2_x, col2_y, col2_z]`
|
|
2205
|
-
*
|
|
2206
|
-
* # Example (JavaScript)
|
|
2207
|
-
*
|
|
2208
|
-
* ```js
|
|
2209
|
-
* const c = grid.cell();
|
|
2210
|
-
* const flat = c.toCopy(); // Float32Array of length 9
|
|
2211
|
-
* ```
|
|
2212
|
-
* @returns {WasmArray}
|
|
2213
|
-
*/
|
|
2214
|
-
cell() {
|
|
2215
|
-
const ret = wasm.grid_cell(this.__wbg_ptr);
|
|
2216
|
-
return WasmArray.__wrap(ret);
|
|
2217
|
-
}
|
|
2218
|
-
/**
|
|
2219
|
-
* Grid dimensions `[nx, ny, nz]`.
|
|
2220
|
-
*
|
|
2221
|
-
* # Example (JavaScript)
|
|
2222
|
-
*
|
|
2223
|
-
* ```js
|
|
2224
|
-
* console.log(grid.dim()); // [10, 10, 10]
|
|
2225
|
-
* ```
|
|
2226
|
-
* @returns {Uint32Array}
|
|
2227
|
-
*/
|
|
2228
|
-
dim() {
|
|
2229
|
-
const ret = wasm.grid_dim(this.__wbg_ptr);
|
|
2230
|
-
var v1 = getArrayU32FromWasm0(ret[0], ret[1]).slice();
|
|
2231
|
-
wasm.__wbindgen_free_command_export(ret[0], ret[1] * 4, 4);
|
|
2232
|
-
return v1;
|
|
2233
|
-
}
|
|
2234
|
-
/**
|
|
2235
|
-
* Retrieve a named scalar array as a zero-copy `Float64Array` view
|
|
2236
|
-
* over the underlying WASM memory. Flat row-major order, length
|
|
2237
|
-
* `nx * ny * nz`. Use [`Grid::dim`] for shape.
|
|
2238
|
-
*
|
|
2239
|
-
* **Warning**: the view is invalidated on any WASM memory growth.
|
|
2240
|
-
* Copy it in JS (`new Float64Array(view)`) if it needs to outlive
|
|
2241
|
-
* subsequent allocations.
|
|
2242
|
-
*
|
|
2243
|
-
* Returns `undefined` if the named array does not exist.
|
|
2244
|
-
*
|
|
2245
|
-
* # Example (JavaScript)
|
|
2246
|
-
*
|
|
2247
|
-
* ```js
|
|
2248
|
-
* const view = grid.getArray("rho"); // zero-copy
|
|
2249
|
-
* const copy = new Float64Array(view); // owned copy if needed
|
|
2250
|
-
* ```
|
|
2251
|
-
* @param {string} name
|
|
2252
|
-
* @returns {Float64Array | undefined}
|
|
2253
|
-
*/
|
|
2254
|
-
getArray(name) {
|
|
2255
|
-
const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
|
|
2256
|
-
const len0 = WASM_VECTOR_LEN;
|
|
2257
|
-
const ret = wasm.grid_getArray(this.__wbg_ptr, ptr0, len0);
|
|
2258
|
-
return ret;
|
|
2259
|
-
}
|
|
2260
|
-
/**
|
|
2261
|
-
* Returns `true` if a named array is present in this grid.
|
|
2262
|
-
*
|
|
2263
|
-
* # Arguments
|
|
2264
|
-
*
|
|
2265
|
-
* * `name` — Array name to look up.
|
|
2266
|
-
*
|
|
2267
|
-
* # Example (JavaScript)
|
|
2268
|
-
*
|
|
2269
|
-
* ```js
|
|
2270
|
-
* grid.hasArray("rho"); // true or false
|
|
2271
|
-
* ```
|
|
2272
|
-
* @param {string} name
|
|
2273
|
-
* @returns {boolean}
|
|
2274
|
-
*/
|
|
2275
|
-
hasArray(name) {
|
|
2276
|
-
const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
|
|
2277
|
-
const len0 = WASM_VECTOR_LEN;
|
|
2278
|
-
const ret = wasm.grid_hasArray(this.__wbg_ptr, ptr0, len0);
|
|
2279
|
-
return ret !== 0;
|
|
2280
|
-
}
|
|
2281
|
-
/**
|
|
2282
|
-
* Insert (or replace) a named scalar array.
|
|
2283
|
-
*
|
|
2284
|
-
* The provided `data` must have exactly `nx * ny * nz` elements in
|
|
2285
|
-
* row-major `(ix, iy, iz)` order.
|
|
2286
|
-
*
|
|
2287
|
-
* # Arguments
|
|
2288
|
-
*
|
|
2289
|
-
* * `name` — Array name.
|
|
2290
|
-
* * `data` — Float32Array with length equal to `grid.total()`.
|
|
2291
|
-
*
|
|
2292
|
-
* # Errors
|
|
2293
|
-
*
|
|
2294
|
-
* Throws if `data.length != nx * ny * nz`.
|
|
2295
|
-
*
|
|
2296
|
-
* # Example (JavaScript)
|
|
2297
|
-
*
|
|
2298
|
-
* ```js
|
|
2299
|
-
* const rho = new Float32Array(grid.total()).fill(0.5);
|
|
2300
|
-
* grid.insertArray("rho", rho);
|
|
2301
|
-
* ```
|
|
2302
|
-
* @param {string} name
|
|
2303
|
-
* @param {Float64Array} data
|
|
2304
|
-
*/
|
|
2305
|
-
insertArray(name, data) {
|
|
2306
|
-
const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
|
|
2307
|
-
const len0 = WASM_VECTOR_LEN;
|
|
2308
|
-
const ptr1 = passArrayF64ToWasm0(data, wasm.__wbindgen_malloc_command_export);
|
|
2309
|
-
const len1 = WASM_VECTOR_LEN;
|
|
2310
|
-
const ret = wasm.grid_insertArray(this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
2311
|
-
if (ret[1]) {
|
|
2312
|
-
throw takeFromExternrefTable0(ret[0]);
|
|
2313
|
-
}
|
|
2314
|
-
}
|
|
2315
|
-
/**
|
|
2316
|
-
* Returns `true` if no arrays are stored.
|
|
2317
|
-
*
|
|
2318
|
-
* # Example (JavaScript)
|
|
2319
|
-
*
|
|
2320
|
-
* ```js
|
|
2321
|
-
* console.log(grid.isEmpty()); // true for a freshly created grid
|
|
2322
|
-
* ```
|
|
2323
|
-
* @returns {boolean}
|
|
2324
|
-
*/
|
|
2325
|
-
isEmpty() {
|
|
2326
|
-
const ret = wasm.grid_isEmpty(this.__wbg_ptr);
|
|
2327
|
-
return ret !== 0;
|
|
2569
|
+
wasm.__wbg_frameindexentry_free(ptr, 0);
|
|
2328
2570
|
}
|
|
2329
2571
|
/**
|
|
2330
|
-
*
|
|
2331
|
-
*
|
|
2332
|
-
* # Example (JavaScript)
|
|
2333
|
-
*
|
|
2334
|
-
* ```js
|
|
2335
|
-
* console.log(grid.len()); // e.g. 2
|
|
2336
|
-
* ```
|
|
2572
|
+
* Size of this frame's encoded byte range, in bytes.
|
|
2337
2573
|
* @returns {number}
|
|
2338
2574
|
*/
|
|
2339
|
-
|
|
2340
|
-
const ret = wasm.
|
|
2575
|
+
get byteLen() {
|
|
2576
|
+
const ret = wasm.frameindexentry_byteLen(this.__wbg_ptr);
|
|
2341
2577
|
return ret >>> 0;
|
|
2342
2578
|
}
|
|
2343
2579
|
/**
|
|
2344
|
-
*
|
|
2345
|
-
*
|
|
2346
|
-
* # Arguments
|
|
2347
|
-
*
|
|
2348
|
-
* * `dim_x`, `dim_y`, `dim_z` — Number of grid points along each axis.
|
|
2349
|
-
* * `origin` — Float32Array of length 3: Cartesian origin in Ångström.
|
|
2350
|
-
* * `cell` — Float32Array of length 9: cell matrix in column-major order.
|
|
2351
|
-
* `cell[0..3]` is the first lattice vector (a), `cell[3..6]` is b,
|
|
2352
|
-
* `cell[6..9]` is c (matching VASP/molrs convention where columns are
|
|
2353
|
-
* lattice vectors).
|
|
2354
|
-
* * `pbc_x`, `pbc_y`, `pbc_z` — Periodic boundary flags for each axis.
|
|
2355
|
-
*
|
|
2356
|
-
* # Errors
|
|
2357
|
-
*
|
|
2358
|
-
* Throws if `origin` does not have length 3, or `cell` does not have
|
|
2359
|
-
* length 9.
|
|
2360
|
-
*
|
|
2361
|
-
* # Example (JavaScript)
|
|
2362
|
-
*
|
|
2363
|
-
* ```js
|
|
2364
|
-
* const origin = new Float32Array([0, 0, 0]);
|
|
2365
|
-
* const cell = new Float32Array([10,0,0, 0,10,0, 0,0,10]);
|
|
2366
|
-
* const grid = new Grid(10, 10, 10, origin, cell, true, true, true);
|
|
2367
|
-
* ```
|
|
2368
|
-
* @param {number} dim_x
|
|
2369
|
-
* @param {number} dim_y
|
|
2370
|
-
* @param {number} dim_z
|
|
2371
|
-
* @param {Float64Array} origin
|
|
2372
|
-
* @param {Float64Array} cell
|
|
2373
|
-
* @param {boolean} pbc_x
|
|
2374
|
-
* @param {boolean} pbc_y
|
|
2375
|
-
* @param {boolean} pbc_z
|
|
2376
|
-
*/
|
|
2377
|
-
constructor(dim_x, dim_y, dim_z, origin, cell, pbc_x, pbc_y, pbc_z) {
|
|
2378
|
-
const ptr0 = passArrayF64ToWasm0(origin, wasm.__wbindgen_malloc_command_export);
|
|
2379
|
-
const len0 = WASM_VECTOR_LEN;
|
|
2380
|
-
const ptr1 = passArrayF64ToWasm0(cell, wasm.__wbindgen_malloc_command_export);
|
|
2381
|
-
const len1 = WASM_VECTOR_LEN;
|
|
2382
|
-
const ret = wasm.grid_new(dim_x, dim_y, dim_z, ptr0, len0, ptr1, len1, pbc_x, pbc_y, pbc_z);
|
|
2383
|
-
if (ret[2]) {
|
|
2384
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
2385
|
-
}
|
|
2386
|
-
this.__wbg_ptr = ret[0] >>> 0;
|
|
2387
|
-
GridFinalization.register(this, this.__wbg_ptr, this);
|
|
2388
|
-
return this;
|
|
2389
|
-
}
|
|
2390
|
-
/**
|
|
2391
|
-
* Cartesian origin in Ångström as a 1-D array of length 3.
|
|
2392
|
-
*
|
|
2393
|
-
* # Example (JavaScript)
|
|
2394
|
-
*
|
|
2395
|
-
* ```js
|
|
2396
|
-
* const o = grid.origin();
|
|
2397
|
-
* const arr = o.toCopy(); // Float32Array [ox, oy, oz]
|
|
2398
|
-
* ```
|
|
2399
|
-
* @returns {WasmArray}
|
|
2400
|
-
*/
|
|
2401
|
-
origin() {
|
|
2402
|
-
const ret = wasm.grid_origin(this.__wbg_ptr);
|
|
2403
|
-
return WasmArray.__wrap(ret);
|
|
2404
|
-
}
|
|
2405
|
-
/**
|
|
2406
|
-
* Periodic boundary flags as a `Uint8Array`-compatible slice.
|
|
2407
|
-
*
|
|
2408
|
-
* Each element is `1` (periodic) or `0` (not periodic).
|
|
2409
|
-
*
|
|
2410
|
-
* # Example (JavaScript)
|
|
2411
|
-
*
|
|
2412
|
-
* ```js
|
|
2413
|
-
* console.log(grid.pbc()); // [1, 1, 1]
|
|
2414
|
-
* ```
|
|
2415
|
-
* @returns {Uint8Array}
|
|
2416
|
-
*/
|
|
2417
|
-
pbc() {
|
|
2418
|
-
const ret = wasm.grid_pbc(this.__wbg_ptr);
|
|
2419
|
-
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
2420
|
-
wasm.__wbindgen_free_command_export(ret[0], ret[1] * 1, 1);
|
|
2421
|
-
return v1;
|
|
2422
|
-
}
|
|
2423
|
-
/**
|
|
2424
|
-
* Total number of voxels: `nx * ny * nz`.
|
|
2425
|
-
*
|
|
2426
|
-
* # Example (JavaScript)
|
|
2427
|
-
*
|
|
2428
|
-
* ```js
|
|
2429
|
-
* console.log(grid.total()); // 1000 for a 10×10×10 grid
|
|
2430
|
-
* ```
|
|
2580
|
+
* Absolute byte offset of this frame inside the source (in bytes).
|
|
2431
2581
|
* @returns {number}
|
|
2432
2582
|
*/
|
|
2433
|
-
|
|
2434
|
-
const ret = wasm.
|
|
2435
|
-
return ret
|
|
2583
|
+
get byteOffset() {
|
|
2584
|
+
const ret = wasm.frameindexentry_byteOffset(this.__wbg_ptr);
|
|
2585
|
+
return ret;
|
|
2436
2586
|
}
|
|
2437
2587
|
}
|
|
2438
|
-
if (Symbol.dispose)
|
|
2588
|
+
if (Symbol.dispose) FrameIndexEntry.prototype[Symbol.dispose] = FrameIndexEntry.prototype.free;
|
|
2439
2589
|
|
|
2440
2590
|
/**
|
|
2441
2591
|
* Gyration tensor per cluster.
|
|
@@ -2476,7 +2626,7 @@ export class GyrationTensor {
|
|
|
2476
2626
|
}
|
|
2477
2627
|
constructor() {
|
|
2478
2628
|
const ret = wasm.gyrationtensor_new();
|
|
2479
|
-
this.__wbg_ptr = ret
|
|
2629
|
+
this.__wbg_ptr = ret;
|
|
2480
2630
|
GyrationTensorFinalization.register(this, this.__wbg_ptr, this);
|
|
2481
2631
|
return this;
|
|
2482
2632
|
}
|
|
@@ -2525,7 +2675,7 @@ export class InertiaTensor {
|
|
|
2525
2675
|
var ptr0 = isLikeNone(masses) ? 0 : passArrayF64ToWasm0(masses, wasm.__wbindgen_malloc_command_export);
|
|
2526
2676
|
var len0 = WASM_VECTOR_LEN;
|
|
2527
2677
|
const ret = wasm.inertiatensor_new(ptr0, len0);
|
|
2528
|
-
this.__wbg_ptr = ret
|
|
2678
|
+
this.__wbg_ptr = ret;
|
|
2529
2679
|
InertiaTensorFinalization.register(this, this.__wbg_ptr, this);
|
|
2530
2680
|
return this;
|
|
2531
2681
|
}
|
|
@@ -2614,7 +2764,7 @@ export class LAMMPSReader {
|
|
|
2614
2764
|
const ptr0 = passStringToWasm0(content, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
|
|
2615
2765
|
const len0 = WASM_VECTOR_LEN;
|
|
2616
2766
|
const ret = wasm.lammpsreader_new(ptr0, len0);
|
|
2617
|
-
this.__wbg_ptr = ret
|
|
2767
|
+
this.__wbg_ptr = ret;
|
|
2618
2768
|
LAMMPSReaderFinalization.register(this, this.__wbg_ptr, this);
|
|
2619
2769
|
return this;
|
|
2620
2770
|
}
|
|
@@ -2712,7 +2862,7 @@ export class LAMMPSTrajReader {
|
|
|
2712
2862
|
const ptr0 = passStringToWasm0(content, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
|
|
2713
2863
|
const len0 = WASM_VECTOR_LEN;
|
|
2714
2864
|
const ret = wasm.lammpstrajreader_new(ptr0, len0);
|
|
2715
|
-
this.__wbg_ptr = ret
|
|
2865
|
+
this.__wbg_ptr = ret;
|
|
2716
2866
|
LAMMPSTrajReaderFinalization.register(this, this.__wbg_ptr, this);
|
|
2717
2867
|
return this;
|
|
2718
2868
|
}
|
|
@@ -2817,7 +2967,7 @@ export class LinkedCell {
|
|
|
2817
2967
|
*/
|
|
2818
2968
|
constructor(cutoff) {
|
|
2819
2969
|
const ret = wasm.linkedcell_new(cutoff);
|
|
2820
|
-
this.__wbg_ptr = ret
|
|
2970
|
+
this.__wbg_ptr = ret;
|
|
2821
2971
|
LinkedCellFinalization.register(this, this.__wbg_ptr, this);
|
|
2822
2972
|
return this;
|
|
2823
2973
|
}
|
|
@@ -2950,7 +3100,7 @@ export class MSD {
|
|
|
2950
3100
|
*/
|
|
2951
3101
|
constructor() {
|
|
2952
3102
|
const ret = wasm.msd_new();
|
|
2953
|
-
this.__wbg_ptr = ret
|
|
3103
|
+
this.__wbg_ptr = ret;
|
|
2954
3104
|
MSDFinalization.register(this, this.__wbg_ptr, this);
|
|
2955
3105
|
return this;
|
|
2956
3106
|
}
|
|
@@ -2999,7 +3149,6 @@ if (Symbol.dispose) MSD.prototype[Symbol.dispose] = MSD.prototype.free;
|
|
|
2999
3149
|
*/
|
|
3000
3150
|
export class MSDResult {
|
|
3001
3151
|
static __wrap(ptr) {
|
|
3002
|
-
ptr = ptr >>> 0;
|
|
3003
3152
|
const obj = Object.create(MSDResult.prototype);
|
|
3004
3153
|
obj.__wbg_ptr = ptr;
|
|
3005
3154
|
MSDResultFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
@@ -3081,7 +3230,7 @@ export class MolRecReader {
|
|
|
3081
3230
|
if (ret[2]) {
|
|
3082
3231
|
throw takeFromExternrefTable0(ret[1]);
|
|
3083
3232
|
}
|
|
3084
|
-
this.__wbg_ptr = ret[0]
|
|
3233
|
+
this.__wbg_ptr = ret[0];
|
|
3085
3234
|
MolRecReaderFinalization.register(this, this.__wbg_ptr, this);
|
|
3086
3235
|
return this;
|
|
3087
3236
|
}
|
|
@@ -3128,7 +3277,6 @@ if (Symbol.dispose) MolRecReader.prototype[Symbol.dispose] = MolRecReader.protot
|
|
|
3128
3277
|
*/
|
|
3129
3278
|
export class NeighborList {
|
|
3130
3279
|
static __wrap(ptr) {
|
|
3131
|
-
ptr = ptr >>> 0;
|
|
3132
3280
|
const obj = Object.create(NeighborList.prototype);
|
|
3133
3281
|
obj.__wbg_ptr = ptr;
|
|
3134
3282
|
NeighborListFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
@@ -3301,7 +3449,7 @@ export class PDBReader {
|
|
|
3301
3449
|
const ptr0 = passStringToWasm0(content, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
|
|
3302
3450
|
const len0 = WASM_VECTOR_LEN;
|
|
3303
3451
|
const ret = wasm.pdbreader_new(ptr0, len0);
|
|
3304
|
-
this.__wbg_ptr = ret
|
|
3452
|
+
this.__wbg_ptr = ret;
|
|
3305
3453
|
PDBReaderFinalization.register(this, this.__wbg_ptr, this);
|
|
3306
3454
|
return this;
|
|
3307
3455
|
}
|
|
@@ -3465,7 +3613,7 @@ export class RDF {
|
|
|
3465
3613
|
if (ret[2]) {
|
|
3466
3614
|
throw takeFromExternrefTable0(ret[1]);
|
|
3467
3615
|
}
|
|
3468
|
-
this.__wbg_ptr = ret[0]
|
|
3616
|
+
this.__wbg_ptr = ret[0];
|
|
3469
3617
|
RDFFinalization.register(this, this.__wbg_ptr, this);
|
|
3470
3618
|
return this;
|
|
3471
3619
|
}
|
|
@@ -3491,7 +3639,6 @@ if (Symbol.dispose) RDF.prototype[Symbol.dispose] = RDF.prototype.free;
|
|
|
3491
3639
|
*/
|
|
3492
3640
|
export class RDFResult {
|
|
3493
3641
|
static __wrap(ptr) {
|
|
3494
|
-
ptr = ptr >>> 0;
|
|
3495
3642
|
const obj = Object.create(RDFResult.prototype);
|
|
3496
3643
|
obj.__wbg_ptr = ptr;
|
|
3497
3644
|
RDFResultFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
@@ -3613,7 +3760,7 @@ export class RadiusOfGyration {
|
|
|
3613
3760
|
var ptr0 = isLikeNone(masses) ? 0 : passArrayF64ToWasm0(masses, wasm.__wbindgen_malloc_command_export);
|
|
3614
3761
|
var len0 = WASM_VECTOR_LEN;
|
|
3615
3762
|
const ret = wasm.radiusofgyration_new(ptr0, len0);
|
|
3616
|
-
this.__wbg_ptr = ret
|
|
3763
|
+
this.__wbg_ptr = ret;
|
|
3617
3764
|
RadiusOfGyrationFinalization.register(this, this.__wbg_ptr, this);
|
|
3618
3765
|
return this;
|
|
3619
3766
|
}
|
|
@@ -3687,7 +3834,7 @@ export class SDFReader {
|
|
|
3687
3834
|
const ptr0 = passStringToWasm0(content, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
|
|
3688
3835
|
const len0 = WASM_VECTOR_LEN;
|
|
3689
3836
|
const ret = wasm.sdfreader_new(ptr0, len0);
|
|
3690
|
-
this.__wbg_ptr = ret
|
|
3837
|
+
this.__wbg_ptr = ret;
|
|
3691
3838
|
SDFReaderFinalization.register(this, this.__wbg_ptr, this);
|
|
3692
3839
|
return this;
|
|
3693
3840
|
}
|
|
@@ -3729,7 +3876,6 @@ if (Symbol.dispose) SDFReader.prototype[Symbol.dispose] = SDFReader.prototype.fr
|
|
|
3729
3876
|
*/
|
|
3730
3877
|
export class SmilesIR {
|
|
3731
3878
|
static __wrap(ptr) {
|
|
3732
|
-
ptr = ptr >>> 0;
|
|
3733
3879
|
const obj = Object.create(SmilesIR.prototype);
|
|
3734
3880
|
obj.__wbg_ptr = ptr;
|
|
3735
3881
|
SmilesIRFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
@@ -3825,7 +3971,6 @@ if (Symbol.dispose) SmilesIR.prototype[Symbol.dispose] = SmilesIR.prototype.free
|
|
|
3825
3971
|
*/
|
|
3826
3972
|
export class Topology {
|
|
3827
3973
|
static __wrap(ptr) {
|
|
3828
|
-
ptr = ptr >>> 0;
|
|
3829
3974
|
const obj = Object.create(Topology.prototype);
|
|
3830
3975
|
obj.__wbg_ptr = ptr;
|
|
3831
3976
|
TopologyFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
@@ -4022,7 +4167,7 @@ export class Topology {
|
|
|
4022
4167
|
*/
|
|
4023
4168
|
constructor(n_atoms) {
|
|
4024
4169
|
const ret = wasm.topology_new(n_atoms);
|
|
4025
|
-
this.__wbg_ptr = ret
|
|
4170
|
+
this.__wbg_ptr = ret;
|
|
4026
4171
|
TopologyFinalization.register(this, this.__wbg_ptr, this);
|
|
4027
4172
|
return this;
|
|
4028
4173
|
}
|
|
@@ -4046,7 +4191,6 @@ if (Symbol.dispose) Topology.prototype[Symbol.dispose] = Topology.prototype.free
|
|
|
4046
4191
|
*/
|
|
4047
4192
|
export class TopologyRingInfo {
|
|
4048
4193
|
static __wrap(ptr) {
|
|
4049
|
-
ptr = ptr >>> 0;
|
|
4050
4194
|
const obj = Object.create(TopologyRingInfo.prototype);
|
|
4051
4195
|
obj.__wbg_ptr = ptr;
|
|
4052
4196
|
TopologyRingInfoFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
@@ -4152,7 +4296,6 @@ if (Symbol.dispose) TopologyRingInfo.prototype[Symbol.dispose] = TopologyRingInf
|
|
|
4152
4296
|
*/
|
|
4153
4297
|
export class WasmArray {
|
|
4154
4298
|
static __wrap(ptr) {
|
|
4155
|
-
ptr = ptr >>> 0;
|
|
4156
4299
|
const obj = Object.create(WasmArray.prototype);
|
|
4157
4300
|
obj.__wbg_ptr = ptr;
|
|
4158
4301
|
WasmArrayFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
@@ -4263,7 +4406,7 @@ export class WasmArray {
|
|
|
4263
4406
|
const ptr0 = passArray32ToWasm0(shape, wasm.__wbindgen_malloc_command_export);
|
|
4264
4407
|
const len0 = WASM_VECTOR_LEN;
|
|
4265
4408
|
const ret = wasm.wasmarray_new(ptr0, len0);
|
|
4266
|
-
this.__wbg_ptr = ret
|
|
4409
|
+
this.__wbg_ptr = ret;
|
|
4267
4410
|
WasmArrayFinalization.register(this, this.__wbg_ptr, this);
|
|
4268
4411
|
return this;
|
|
4269
4412
|
}
|
|
@@ -4409,172 +4552,2296 @@ export class WasmKMeans {
|
|
|
4409
4552
|
wasm.__wbg_wasmkmeans_free(ptr, 0);
|
|
4410
4553
|
}
|
|
4411
4554
|
/**
|
|
4412
|
-
* Cluster a row-major `n_rows × n_dims` coordinate matrix.
|
|
4413
|
-
*
|
|
4414
|
-
* # Returns
|
|
4415
|
-
*
|
|
4416
|
-
* Cluster labels in `0..k` as an owned `Int32Array`, one per row.
|
|
4417
|
-
*
|
|
4418
|
-
* # Errors
|
|
4555
|
+
* Cluster a row-major `n_rows × n_dims` coordinate matrix.
|
|
4556
|
+
*
|
|
4557
|
+
* # Returns
|
|
4558
|
+
*
|
|
4559
|
+
* Cluster labels in `0..k` as an owned `Int32Array`, one per row.
|
|
4560
|
+
*
|
|
4561
|
+
* # Errors
|
|
4562
|
+
*
|
|
4563
|
+
* Throws if `k > n_rows`, `n_dims == 0`, the length does not match
|
|
4564
|
+
* `n_rows * n_dims`, or any element is non-finite.
|
|
4565
|
+
* @param {Float64Array} coords
|
|
4566
|
+
* @param {number} n_rows
|
|
4567
|
+
* @param {number} n_dims
|
|
4568
|
+
* @returns {Int32Array}
|
|
4569
|
+
*/
|
|
4570
|
+
fit(coords, n_rows, n_dims) {
|
|
4571
|
+
const ptr0 = passArrayF64ToWasm0(coords, wasm.__wbindgen_malloc_command_export);
|
|
4572
|
+
const len0 = WASM_VECTOR_LEN;
|
|
4573
|
+
const ret = wasm.wasmkmeans_fit(this.__wbg_ptr, ptr0, len0, n_rows, n_dims);
|
|
4574
|
+
if (ret[2]) {
|
|
4575
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
4576
|
+
}
|
|
4577
|
+
return takeFromExternrefTable0(ret[0]);
|
|
4578
|
+
}
|
|
4579
|
+
/**
|
|
4580
|
+
* Create a new k-means configuration.
|
|
4581
|
+
*
|
|
4582
|
+
* # Arguments
|
|
4583
|
+
*
|
|
4584
|
+
* * `k` — number of clusters (>= 1).
|
|
4585
|
+
* * `max_iter` — maximum Lloyd iterations (>= 1).
|
|
4586
|
+
* * `seed` — RNG seed for k-means++ initialization. Cast to `u64`
|
|
4587
|
+
* internally (JS numbers are `f64`; integers up to 2^53 pass
|
|
4588
|
+
* through losslessly).
|
|
4589
|
+
*
|
|
4590
|
+
* # Errors
|
|
4591
|
+
*
|
|
4592
|
+
* Throws if `k == 0` or `max_iter == 0`.
|
|
4593
|
+
* @param {number} k
|
|
4594
|
+
* @param {number} max_iter
|
|
4595
|
+
* @param {number} seed
|
|
4596
|
+
*/
|
|
4597
|
+
constructor(k, max_iter, seed) {
|
|
4598
|
+
const ret = wasm.wasmkmeans_new(k, max_iter, seed);
|
|
4599
|
+
if (ret[2]) {
|
|
4600
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
4601
|
+
}
|
|
4602
|
+
this.__wbg_ptr = ret[0];
|
|
4603
|
+
WasmKMeansFinalization.register(this, this.__wbg_ptr, this);
|
|
4604
|
+
return this;
|
|
4605
|
+
}
|
|
4606
|
+
}
|
|
4607
|
+
if (Symbol.dispose) WasmKMeans.prototype[Symbol.dispose] = WasmKMeans.prototype.free;
|
|
4608
|
+
|
|
4609
|
+
export class WasmLammpsDataStream {
|
|
4610
|
+
__destroy_into_raw() {
|
|
4611
|
+
const ptr = this.__wbg_ptr;
|
|
4612
|
+
this.__wbg_ptr = 0;
|
|
4613
|
+
WasmLammpsDataStreamFinalization.unregister(this);
|
|
4614
|
+
return ptr;
|
|
4615
|
+
}
|
|
4616
|
+
free() {
|
|
4617
|
+
const ptr = this.__destroy_into_raw();
|
|
4618
|
+
wasm.__wbg_wasmlammpsdatastream_free(ptr, 0);
|
|
4619
|
+
}
|
|
4620
|
+
/**
|
|
4621
|
+
* Resize the reusable input buffer so it can hold at least
|
|
4622
|
+
* `len` bytes, and return the WASM linear-memory pointer to
|
|
4623
|
+
* its first byte.
|
|
4624
|
+
*
|
|
4625
|
+
* CALLER MUST RE-DERIVE THIS POINTER AFTER ANY OTHER WASM CALL —
|
|
4626
|
+
* `wasm.memory.buffer` may have been detached by a `memory.grow`.
|
|
4627
|
+
* @param {number} len
|
|
4628
|
+
* @returns {number}
|
|
4629
|
+
*/
|
|
4630
|
+
allocInputBuffer(len) {
|
|
4631
|
+
const ret = wasm.wasmlammpsdatastream_allocInputBuffer(this.__wbg_ptr, len);
|
|
4632
|
+
return ret >>> 0;
|
|
4633
|
+
}
|
|
4634
|
+
/**
|
|
4635
|
+
* Number of blocks in the most recently parsed frame.
|
|
4636
|
+
* @returns {number}
|
|
4637
|
+
*/
|
|
4638
|
+
blockCount() {
|
|
4639
|
+
const ret = wasm.wasmlammpsdatastream_blockCount(this.__wbg_ptr);
|
|
4640
|
+
return ret >>> 0;
|
|
4641
|
+
}
|
|
4642
|
+
/**
|
|
4643
|
+
* Name of block `blockIdx`, or empty string if out of range.
|
|
4644
|
+
* @param {number} block_idx
|
|
4645
|
+
* @returns {string}
|
|
4646
|
+
*/
|
|
4647
|
+
blockName(block_idx) {
|
|
4648
|
+
let deferred1_0;
|
|
4649
|
+
let deferred1_1;
|
|
4650
|
+
try {
|
|
4651
|
+
const ret = wasm.wasmlammpsdatastream_blockName(this.__wbg_ptr, block_idx);
|
|
4652
|
+
deferred1_0 = ret[0];
|
|
4653
|
+
deferred1_1 = ret[1];
|
|
4654
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
4655
|
+
} finally {
|
|
4656
|
+
wasm.__wbindgen_free_command_export(deferred1_0, deferred1_1, 1);
|
|
4657
|
+
}
|
|
4658
|
+
}
|
|
4659
|
+
/**
|
|
4660
|
+
* Number of columns in block `blockIdx`.
|
|
4661
|
+
* @param {number} block_idx
|
|
4662
|
+
* @returns {number}
|
|
4663
|
+
*/
|
|
4664
|
+
columnCount(block_idx) {
|
|
4665
|
+
const ret = wasm.wasmlammpsdatastream_columnCount(this.__wbg_ptr, block_idx);
|
|
4666
|
+
return ret >>> 0;
|
|
4667
|
+
}
|
|
4668
|
+
/**
|
|
4669
|
+
* Column dtype string at `(blockIdx, colIdx)`. One of `"f64"`,
|
|
4670
|
+
* `"u32"`, `"i32"`, `"string"` — or `"bool"` / `"u8"` if a
|
|
4671
|
+
* future parser emits those (current streaming formats do not).
|
|
4672
|
+
* Empty string if the index is out of range.
|
|
4673
|
+
* @param {number} block_idx
|
|
4674
|
+
* @param {number} col_idx
|
|
4675
|
+
* @returns {string}
|
|
4676
|
+
*/
|
|
4677
|
+
columnDtype(block_idx, col_idx) {
|
|
4678
|
+
let deferred1_0;
|
|
4679
|
+
let deferred1_1;
|
|
4680
|
+
try {
|
|
4681
|
+
const ret = wasm.wasmlammpsdatastream_columnDtype(this.__wbg_ptr, block_idx, col_idx);
|
|
4682
|
+
deferred1_0 = ret[0];
|
|
4683
|
+
deferred1_1 = ret[1];
|
|
4684
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
4685
|
+
} finally {
|
|
4686
|
+
wasm.__wbindgen_free_command_export(deferred1_0, deferred1_1, 1);
|
|
4687
|
+
}
|
|
4688
|
+
}
|
|
4689
|
+
/**
|
|
4690
|
+
* Total flat element count of the column. For multi-dimensional
|
|
4691
|
+
* columns (e.g. an Nx3 positions array) this is the product of
|
|
4692
|
+
* all axes — i.e. the length of the slice the matching
|
|
4693
|
+
* `columnPtr*` points at.
|
|
4694
|
+
* @param {number} block_idx
|
|
4695
|
+
* @param {number} col_idx
|
|
4696
|
+
* @returns {number}
|
|
4697
|
+
*/
|
|
4698
|
+
columnLen(block_idx, col_idx) {
|
|
4699
|
+
const ret = wasm.wasmlammpsdatastream_columnLen(this.__wbg_ptr, block_idx, col_idx);
|
|
4700
|
+
return ret >>> 0;
|
|
4701
|
+
}
|
|
4702
|
+
/**
|
|
4703
|
+
* Column name at `(blockIdx, colIdx)`, or empty string if
|
|
4704
|
+
* either index is out of range.
|
|
4705
|
+
* @param {number} block_idx
|
|
4706
|
+
* @param {number} col_idx
|
|
4707
|
+
* @returns {string}
|
|
4708
|
+
*/
|
|
4709
|
+
columnName(block_idx, col_idx) {
|
|
4710
|
+
let deferred1_0;
|
|
4711
|
+
let deferred1_1;
|
|
4712
|
+
try {
|
|
4713
|
+
const ret = wasm.wasmlammpsdatastream_columnName(this.__wbg_ptr, block_idx, col_idx);
|
|
4714
|
+
deferred1_0 = ret[0];
|
|
4715
|
+
deferred1_1 = ret[1];
|
|
4716
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
4717
|
+
} finally {
|
|
4718
|
+
wasm.__wbindgen_free_command_export(deferred1_0, deferred1_1, 1);
|
|
4719
|
+
}
|
|
4720
|
+
}
|
|
4721
|
+
/**
|
|
4722
|
+
* Pointer to the contiguous `f64` slice backing this column,
|
|
4723
|
+
* or 0 (null) if the column is missing or has the wrong
|
|
4724
|
+
* dtype.
|
|
4725
|
+
*
|
|
4726
|
+
* **Lifetime**: valid only until the next non-trivial wasm
|
|
4727
|
+
* call. See the module-level memory-grow contract.
|
|
4728
|
+
* @param {number} block_idx
|
|
4729
|
+
* @param {number} col_idx
|
|
4730
|
+
* @returns {number}
|
|
4731
|
+
*/
|
|
4732
|
+
columnPtrF64(block_idx, col_idx) {
|
|
4733
|
+
const ret = wasm.wasmlammpsdatastream_columnPtrF64(this.__wbg_ptr, block_idx, col_idx);
|
|
4734
|
+
return ret >>> 0;
|
|
4735
|
+
}
|
|
4736
|
+
/**
|
|
4737
|
+
* Pointer to the contiguous `i32` slice backing this column,
|
|
4738
|
+
* or 0 (null) if the column is missing or has the wrong
|
|
4739
|
+
* dtype.
|
|
4740
|
+
*
|
|
4741
|
+
* **Lifetime**: valid only until the next non-trivial wasm
|
|
4742
|
+
* call. See the module-level memory-grow contract.
|
|
4743
|
+
* @param {number} block_idx
|
|
4744
|
+
* @param {number} col_idx
|
|
4745
|
+
* @returns {number}
|
|
4746
|
+
*/
|
|
4747
|
+
columnPtrI32(block_idx, col_idx) {
|
|
4748
|
+
const ret = wasm.wasmlammpsdatastream_columnPtrI32(this.__wbg_ptr, block_idx, col_idx);
|
|
4749
|
+
return ret >>> 0;
|
|
4750
|
+
}
|
|
4751
|
+
/**
|
|
4752
|
+
* Pointer to the contiguous `u32` slice backing this column,
|
|
4753
|
+
* or 0 (null) if the column is missing or has the wrong
|
|
4754
|
+
* dtype.
|
|
4755
|
+
*
|
|
4756
|
+
* **Lifetime**: valid only until the next non-trivial wasm
|
|
4757
|
+
* call. See the module-level memory-grow contract.
|
|
4758
|
+
* @param {number} block_idx
|
|
4759
|
+
* @param {number} col_idx
|
|
4760
|
+
* @returns {number}
|
|
4761
|
+
*/
|
|
4762
|
+
columnPtrU32(block_idx, col_idx) {
|
|
4763
|
+
const ret = wasm.wasmlammpsdatastream_columnPtrU32(this.__wbg_ptr, block_idx, col_idx);
|
|
4764
|
+
return ret >>> 0;
|
|
4765
|
+
}
|
|
4766
|
+
/**
|
|
4767
|
+
* Copy a string column out by value. Returns an empty array
|
|
4768
|
+
* if the column is missing or not a string column.
|
|
4769
|
+
* @param {number} block_idx
|
|
4770
|
+
* @param {number} col_idx
|
|
4771
|
+
* @returns {string[]}
|
|
4772
|
+
*/
|
|
4773
|
+
columnStrings(block_idx, col_idx) {
|
|
4774
|
+
const ret = wasm.wasmlammpsdatastream_columnStrings(this.__wbg_ptr, block_idx, col_idx);
|
|
4775
|
+
var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
|
|
4776
|
+
wasm.__wbindgen_free_command_export(ret[0], ret[1] * 4, 4);
|
|
4777
|
+
return v1;
|
|
4778
|
+
}
|
|
4779
|
+
/**
|
|
4780
|
+
* Feed the first `len` bytes of the input buffer into the
|
|
4781
|
+
* indexer at absolute source offset `globalOffset`. Returns
|
|
4782
|
+
* any frame entries that became finalized as a result.
|
|
4783
|
+
*
|
|
4784
|
+
* `globalOffset` is round-tripped through `f64`; per the
|
|
4785
|
+
* streaming protocol the source size is capped at 1 TB
|
|
4786
|
+
* (well within `Number.MAX_SAFE_INTEGER`).
|
|
4787
|
+
* @param {number} global_offset
|
|
4788
|
+
* @param {number} len
|
|
4789
|
+
* @returns {FrameIndexEntry[]}
|
|
4790
|
+
*/
|
|
4791
|
+
feedIndexChunk(global_offset, len) {
|
|
4792
|
+
const ret = wasm.wasmlammpsdatastream_feedIndexChunk(this.__wbg_ptr, global_offset, len);
|
|
4793
|
+
if (ret[3]) {
|
|
4794
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
4795
|
+
}
|
|
4796
|
+
var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
|
|
4797
|
+
wasm.__wbindgen_free_command_export(ret[0], ret[1] * 4, 4);
|
|
4798
|
+
return v1;
|
|
4799
|
+
}
|
|
4800
|
+
/**
|
|
4801
|
+
* Signal end-of-stream; return any trailing frame entry. The
|
|
4802
|
+
* indexer is consumed and further `feedIndexChunk` calls
|
|
4803
|
+
* throw.
|
|
4804
|
+
* @returns {FrameIndexEntry[]}
|
|
4805
|
+
*/
|
|
4806
|
+
finishIndex() {
|
|
4807
|
+
const ret = wasm.wasmlammpsdatastream_finishIndex(this.__wbg_ptr);
|
|
4808
|
+
if (ret[3]) {
|
|
4809
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
4810
|
+
}
|
|
4811
|
+
var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
|
|
4812
|
+
wasm.__wbindgen_free_command_export(ret[0], ret[1] * 4, 4);
|
|
4813
|
+
return v1;
|
|
4814
|
+
}
|
|
4815
|
+
/**
|
|
4816
|
+
* Number of named scalar arrays in grid `gridIdx`.
|
|
4817
|
+
* @param {number} grid_idx
|
|
4818
|
+
* @returns {number}
|
|
4819
|
+
*/
|
|
4820
|
+
gridArrayCount(grid_idx) {
|
|
4821
|
+
const ret = wasm.wasmlammpsdatastream_gridArrayCount(this.__wbg_ptr, grid_idx);
|
|
4822
|
+
return ret >>> 0;
|
|
4823
|
+
}
|
|
4824
|
+
/**
|
|
4825
|
+
* Length (number of `f64` elements) of the grid scalar field.
|
|
4826
|
+
* @param {number} grid_idx
|
|
4827
|
+
* @param {number} array_idx
|
|
4828
|
+
* @returns {number}
|
|
4829
|
+
*/
|
|
4830
|
+
gridArrayLen(grid_idx, array_idx) {
|
|
4831
|
+
const ret = wasm.wasmlammpsdatastream_gridArrayLen(this.__wbg_ptr, grid_idx, array_idx);
|
|
4832
|
+
return ret >>> 0;
|
|
4833
|
+
}
|
|
4834
|
+
/**
|
|
4835
|
+
* Name of scalar array `(gridIdx, arrayIdx)`, or empty string
|
|
4836
|
+
* if either index is out of range.
|
|
4837
|
+
* @param {number} grid_idx
|
|
4838
|
+
* @param {number} array_idx
|
|
4839
|
+
* @returns {string}
|
|
4840
|
+
*/
|
|
4841
|
+
gridArrayName(grid_idx, array_idx) {
|
|
4842
|
+
let deferred1_0;
|
|
4843
|
+
let deferred1_1;
|
|
4844
|
+
try {
|
|
4845
|
+
const ret = wasm.wasmlammpsdatastream_gridArrayName(this.__wbg_ptr, grid_idx, array_idx);
|
|
4846
|
+
deferred1_0 = ret[0];
|
|
4847
|
+
deferred1_1 = ret[1];
|
|
4848
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
4849
|
+
} finally {
|
|
4850
|
+
wasm.__wbindgen_free_command_export(deferred1_0, deferred1_1, 1);
|
|
4851
|
+
}
|
|
4852
|
+
}
|
|
4853
|
+
/**
|
|
4854
|
+
* Pointer to the contiguous `f64` slice backing the grid
|
|
4855
|
+
* scalar field, or 0 (null) if either index is out of range.
|
|
4856
|
+
*
|
|
4857
|
+
* **Lifetime**: valid only until the next non-trivial wasm
|
|
4858
|
+
* call. See the module-level memory-grow contract.
|
|
4859
|
+
* @param {number} grid_idx
|
|
4860
|
+
* @param {number} array_idx
|
|
4861
|
+
* @returns {number}
|
|
4862
|
+
*/
|
|
4863
|
+
gridArrayPtrF64(grid_idx, array_idx) {
|
|
4864
|
+
const ret = wasm.wasmlammpsdatastream_gridArrayPtrF64(this.__wbg_ptr, grid_idx, array_idx);
|
|
4865
|
+
return ret >>> 0;
|
|
4866
|
+
}
|
|
4867
|
+
/**
|
|
4868
|
+
* Grid lattice cell as a length-9 `Float64Array` (column-major:
|
|
4869
|
+
* `[col0_x, col0_y, col0_z, col1_x, col1_y, col1_z, col2_x, col2_y, col2_z]`).
|
|
4870
|
+
* @param {number} grid_idx
|
|
4871
|
+
* @returns {Float64Array}
|
|
4872
|
+
*/
|
|
4873
|
+
gridCell(grid_idx) {
|
|
4874
|
+
const ret = wasm.wasmlammpsdatastream_gridCell(this.__wbg_ptr, grid_idx);
|
|
4875
|
+
var v1 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
4876
|
+
wasm.__wbindgen_free_command_export(ret[0], ret[1] * 8, 8);
|
|
4877
|
+
return v1;
|
|
4878
|
+
}
|
|
4879
|
+
/**
|
|
4880
|
+
* Number of named grids attached to the current frame.
|
|
4881
|
+
* @returns {number}
|
|
4882
|
+
*/
|
|
4883
|
+
gridCount() {
|
|
4884
|
+
const ret = wasm.wasmlammpsdatastream_gridCount(this.__wbg_ptr);
|
|
4885
|
+
return ret >>> 0;
|
|
4886
|
+
}
|
|
4887
|
+
/**
|
|
4888
|
+
* Name of grid `gridIdx`, or empty string if out of range.
|
|
4889
|
+
* @param {number} grid_idx
|
|
4890
|
+
* @returns {string}
|
|
4891
|
+
*/
|
|
4892
|
+
gridName(grid_idx) {
|
|
4893
|
+
let deferred1_0;
|
|
4894
|
+
let deferred1_1;
|
|
4895
|
+
try {
|
|
4896
|
+
const ret = wasm.wasmlammpsdatastream_gridName(this.__wbg_ptr, grid_idx);
|
|
4897
|
+
deferred1_0 = ret[0];
|
|
4898
|
+
deferred1_1 = ret[1];
|
|
4899
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
4900
|
+
} finally {
|
|
4901
|
+
wasm.__wbindgen_free_command_export(deferred1_0, deferred1_1, 1);
|
|
4902
|
+
}
|
|
4903
|
+
}
|
|
4904
|
+
/**
|
|
4905
|
+
* Grid origin (Cartesian, Å) as a length-3 `Float64Array`.
|
|
4906
|
+
* @param {number} grid_idx
|
|
4907
|
+
* @returns {Float64Array}
|
|
4908
|
+
*/
|
|
4909
|
+
gridOrigin(grid_idx) {
|
|
4910
|
+
const ret = wasm.wasmlammpsdatastream_gridOrigin(this.__wbg_ptr, grid_idx);
|
|
4911
|
+
var v1 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
4912
|
+
wasm.__wbindgen_free_command_export(ret[0], ret[1] * 8, 8);
|
|
4913
|
+
return v1;
|
|
4914
|
+
}
|
|
4915
|
+
/**
|
|
4916
|
+
* Grid PBC flags as a length-3 `Uint8Array` (`1` = periodic,
|
|
4917
|
+
* `0` = open).
|
|
4918
|
+
* @param {number} grid_idx
|
|
4919
|
+
* @returns {Uint8Array}
|
|
4920
|
+
*/
|
|
4921
|
+
gridPbc(grid_idx) {
|
|
4922
|
+
const ret = wasm.wasmlammpsdatastream_gridPbc(this.__wbg_ptr, grid_idx);
|
|
4923
|
+
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
4924
|
+
wasm.__wbindgen_free_command_export(ret[0], ret[1] * 1, 1);
|
|
4925
|
+
return v1;
|
|
4926
|
+
}
|
|
4927
|
+
/**
|
|
4928
|
+
* Grid dimensions `[nx, ny, nz]` as a length-3 `Uint32Array`.
|
|
4929
|
+
* @param {number} grid_idx
|
|
4930
|
+
* @returns {Uint32Array}
|
|
4931
|
+
*/
|
|
4932
|
+
gridShape(grid_idx) {
|
|
4933
|
+
const ret = wasm.wasmlammpsdatastream_gridShape(this.__wbg_ptr, grid_idx);
|
|
4934
|
+
var v1 = getArrayU32FromWasm0(ret[0], ret[1]).slice();
|
|
4935
|
+
wasm.__wbindgen_free_command_export(ret[0], ret[1] * 4, 4);
|
|
4936
|
+
return v1;
|
|
4937
|
+
}
|
|
4938
|
+
/**
|
|
4939
|
+
* Current capacity (in bytes) of the reusable input buffer.
|
|
4940
|
+
* @returns {number}
|
|
4941
|
+
*/
|
|
4942
|
+
inputCapacity() {
|
|
4943
|
+
const ret = wasm.wasmlammpsdatastream_inputCapacity(this.__wbg_ptr);
|
|
4944
|
+
return ret >>> 0;
|
|
4945
|
+
}
|
|
4946
|
+
/**
|
|
4947
|
+
* Create a new streaming reader. The reusable input buffer
|
|
4948
|
+
* starts empty; call [`allocInputBuffer`] before feeding data.
|
|
4949
|
+
*/
|
|
4950
|
+
constructor() {
|
|
4951
|
+
const ret = wasm.wasmlammpsdatastream_new();
|
|
4952
|
+
this.__wbg_ptr = ret;
|
|
4953
|
+
WasmLammpsDataStreamFinalization.register(this, this.__wbg_ptr, this);
|
|
4954
|
+
return this;
|
|
4955
|
+
}
|
|
4956
|
+
/**
|
|
4957
|
+
* Decode the byte range `[offset, offset + len)` from the
|
|
4958
|
+
* reusable input buffer as a single frame. Replaces any
|
|
4959
|
+
* previously cached output; the caller must extract data
|
|
4960
|
+
* before the next `parseRangeInInput` (the same buffer can
|
|
4961
|
+
* be overwritten in between).
|
|
4962
|
+
* @param {number} offset
|
|
4963
|
+
* @param {number} len
|
|
4964
|
+
*/
|
|
4965
|
+
parseRangeInInput(offset, len) {
|
|
4966
|
+
const ret = wasm.wasmlammpsdatastream_parseRangeInInput(this.__wbg_ptr, offset, len);
|
|
4967
|
+
if (ret[1]) {
|
|
4968
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
4969
|
+
}
|
|
4970
|
+
}
|
|
4971
|
+
/**
|
|
4972
|
+
* Drop the cached output frame, releasing its memory and
|
|
4973
|
+
* invalidating any outstanding `columnPtr*` / `gridArrayPtr*`
|
|
4974
|
+
* pointers. Subsequent extraction calls return 0 / empty
|
|
4975
|
+
* until the next `parseRangeInInput`.
|
|
4976
|
+
*/
|
|
4977
|
+
releaseFrame() {
|
|
4978
|
+
wasm.wasmlammpsdatastream_releaseFrame(this.__wbg_ptr);
|
|
4979
|
+
}
|
|
4980
|
+
/**
|
|
4981
|
+
* Box H-matrix as a length-9 `Float64Array` (column-major:
|
|
4982
|
+
* `[col0_x, col0_y, col0_z, col1_x, col1_y, col1_z, col2_x, col2_y, col2_z]`),
|
|
4983
|
+
* or `undefined` if the frame has no simbox.
|
|
4984
|
+
*
|
|
4985
|
+
* Returned by VALUE — the typed array is owned by JS and is
|
|
4986
|
+
* stable across subsequent wasm calls.
|
|
4987
|
+
* @returns {Float64Array | undefined}
|
|
4988
|
+
*/
|
|
4989
|
+
simboxH() {
|
|
4990
|
+
const ret = wasm.wasmlammpsdatastream_simboxH(this.__wbg_ptr);
|
|
4991
|
+
let v1;
|
|
4992
|
+
if (ret[0] !== 0) {
|
|
4993
|
+
v1 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
4994
|
+
wasm.__wbindgen_free_command_export(ret[0], ret[1] * 8, 8);
|
|
4995
|
+
}
|
|
4996
|
+
return v1;
|
|
4997
|
+
}
|
|
4998
|
+
/**
|
|
4999
|
+
* Box origin as a length-3 `Float64Array`, or `undefined` if
|
|
5000
|
+
* the frame has no simbox.
|
|
5001
|
+
* @returns {Float64Array | undefined}
|
|
5002
|
+
*/
|
|
5003
|
+
simboxOrigin() {
|
|
5004
|
+
const ret = wasm.wasmlammpsdatastream_simboxOrigin(this.__wbg_ptr);
|
|
5005
|
+
let v1;
|
|
5006
|
+
if (ret[0] !== 0) {
|
|
5007
|
+
v1 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
5008
|
+
wasm.__wbindgen_free_command_export(ret[0], ret[1] * 8, 8);
|
|
5009
|
+
}
|
|
5010
|
+
return v1;
|
|
5011
|
+
}
|
|
5012
|
+
/**
|
|
5013
|
+
* Per-axis PBC flags as a length-3 `Uint8Array` (`1` = periodic,
|
|
5014
|
+
* `0` = open), or `undefined` if the frame has no simbox.
|
|
5015
|
+
*
|
|
5016
|
+
* (wasm-bindgen does not support `[bool; 3]` returns natively,
|
|
5017
|
+
* hence the `Uint8Array` wire format. The spec calls for
|
|
5018
|
+
* `[boolean, boolean, boolean]`; the JS side is expected to
|
|
5019
|
+
* `Boolean(arr[i])` each entry.)
|
|
5020
|
+
* @returns {Uint8Array | undefined}
|
|
5021
|
+
*/
|
|
5022
|
+
simboxPbc() {
|
|
5023
|
+
const ret = wasm.wasmlammpsdatastream_simboxPbc(this.__wbg_ptr);
|
|
5024
|
+
let v1;
|
|
5025
|
+
if (ret[0] !== 0) {
|
|
5026
|
+
v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
5027
|
+
wasm.__wbindgen_free_command_export(ret[0], ret[1] * 1, 1);
|
|
5028
|
+
}
|
|
5029
|
+
return v1;
|
|
5030
|
+
}
|
|
5031
|
+
}
|
|
5032
|
+
if (Symbol.dispose) WasmLammpsDataStream.prototype[Symbol.dispose] = WasmLammpsDataStream.prototype.free;
|
|
5033
|
+
|
|
5034
|
+
export class WasmLammpsDumpStream {
|
|
5035
|
+
__destroy_into_raw() {
|
|
5036
|
+
const ptr = this.__wbg_ptr;
|
|
5037
|
+
this.__wbg_ptr = 0;
|
|
5038
|
+
WasmLammpsDumpStreamFinalization.unregister(this);
|
|
5039
|
+
return ptr;
|
|
5040
|
+
}
|
|
5041
|
+
free() {
|
|
5042
|
+
const ptr = this.__destroy_into_raw();
|
|
5043
|
+
wasm.__wbg_wasmlammpsdumpstream_free(ptr, 0);
|
|
5044
|
+
}
|
|
5045
|
+
/**
|
|
5046
|
+
* Resize the reusable input buffer so it can hold at least
|
|
5047
|
+
* `len` bytes, and return the WASM linear-memory pointer to
|
|
5048
|
+
* its first byte.
|
|
5049
|
+
*
|
|
5050
|
+
* CALLER MUST RE-DERIVE THIS POINTER AFTER ANY OTHER WASM CALL —
|
|
5051
|
+
* `wasm.memory.buffer` may have been detached by a `memory.grow`.
|
|
5052
|
+
* @param {number} len
|
|
5053
|
+
* @returns {number}
|
|
5054
|
+
*/
|
|
5055
|
+
allocInputBuffer(len) {
|
|
5056
|
+
const ret = wasm.wasmlammpsdumpstream_allocInputBuffer(this.__wbg_ptr, len);
|
|
5057
|
+
return ret >>> 0;
|
|
5058
|
+
}
|
|
5059
|
+
/**
|
|
5060
|
+
* Number of blocks in the most recently parsed frame.
|
|
5061
|
+
* @returns {number}
|
|
5062
|
+
*/
|
|
5063
|
+
blockCount() {
|
|
5064
|
+
const ret = wasm.wasmlammpsdumpstream_blockCount(this.__wbg_ptr);
|
|
5065
|
+
return ret >>> 0;
|
|
5066
|
+
}
|
|
5067
|
+
/**
|
|
5068
|
+
* Name of block `blockIdx`, or empty string if out of range.
|
|
5069
|
+
* @param {number} block_idx
|
|
5070
|
+
* @returns {string}
|
|
5071
|
+
*/
|
|
5072
|
+
blockName(block_idx) {
|
|
5073
|
+
let deferred1_0;
|
|
5074
|
+
let deferred1_1;
|
|
5075
|
+
try {
|
|
5076
|
+
const ret = wasm.wasmlammpsdumpstream_blockName(this.__wbg_ptr, block_idx);
|
|
5077
|
+
deferred1_0 = ret[0];
|
|
5078
|
+
deferred1_1 = ret[1];
|
|
5079
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
5080
|
+
} finally {
|
|
5081
|
+
wasm.__wbindgen_free_command_export(deferred1_0, deferred1_1, 1);
|
|
5082
|
+
}
|
|
5083
|
+
}
|
|
5084
|
+
/**
|
|
5085
|
+
* Number of columns in block `blockIdx`.
|
|
5086
|
+
* @param {number} block_idx
|
|
5087
|
+
* @returns {number}
|
|
5088
|
+
*/
|
|
5089
|
+
columnCount(block_idx) {
|
|
5090
|
+
const ret = wasm.wasmlammpsdumpstream_columnCount(this.__wbg_ptr, block_idx);
|
|
5091
|
+
return ret >>> 0;
|
|
5092
|
+
}
|
|
5093
|
+
/**
|
|
5094
|
+
* Column dtype string at `(blockIdx, colIdx)`. One of `"f64"`,
|
|
5095
|
+
* `"u32"`, `"i32"`, `"string"` — or `"bool"` / `"u8"` if a
|
|
5096
|
+
* future parser emits those (current streaming formats do not).
|
|
5097
|
+
* Empty string if the index is out of range.
|
|
5098
|
+
* @param {number} block_idx
|
|
5099
|
+
* @param {number} col_idx
|
|
5100
|
+
* @returns {string}
|
|
5101
|
+
*/
|
|
5102
|
+
columnDtype(block_idx, col_idx) {
|
|
5103
|
+
let deferred1_0;
|
|
5104
|
+
let deferred1_1;
|
|
5105
|
+
try {
|
|
5106
|
+
const ret = wasm.wasmlammpsdumpstream_columnDtype(this.__wbg_ptr, block_idx, col_idx);
|
|
5107
|
+
deferred1_0 = ret[0];
|
|
5108
|
+
deferred1_1 = ret[1];
|
|
5109
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
5110
|
+
} finally {
|
|
5111
|
+
wasm.__wbindgen_free_command_export(deferred1_0, deferred1_1, 1);
|
|
5112
|
+
}
|
|
5113
|
+
}
|
|
5114
|
+
/**
|
|
5115
|
+
* Total flat element count of the column. For multi-dimensional
|
|
5116
|
+
* columns (e.g. an Nx3 positions array) this is the product of
|
|
5117
|
+
* all axes — i.e. the length of the slice the matching
|
|
5118
|
+
* `columnPtr*` points at.
|
|
5119
|
+
* @param {number} block_idx
|
|
5120
|
+
* @param {number} col_idx
|
|
5121
|
+
* @returns {number}
|
|
5122
|
+
*/
|
|
5123
|
+
columnLen(block_idx, col_idx) {
|
|
5124
|
+
const ret = wasm.wasmlammpsdumpstream_columnLen(this.__wbg_ptr, block_idx, col_idx);
|
|
5125
|
+
return ret >>> 0;
|
|
5126
|
+
}
|
|
5127
|
+
/**
|
|
5128
|
+
* Column name at `(blockIdx, colIdx)`, or empty string if
|
|
5129
|
+
* either index is out of range.
|
|
5130
|
+
* @param {number} block_idx
|
|
5131
|
+
* @param {number} col_idx
|
|
5132
|
+
* @returns {string}
|
|
5133
|
+
*/
|
|
5134
|
+
columnName(block_idx, col_idx) {
|
|
5135
|
+
let deferred1_0;
|
|
5136
|
+
let deferred1_1;
|
|
5137
|
+
try {
|
|
5138
|
+
const ret = wasm.wasmlammpsdumpstream_columnName(this.__wbg_ptr, block_idx, col_idx);
|
|
5139
|
+
deferred1_0 = ret[0];
|
|
5140
|
+
deferred1_1 = ret[1];
|
|
5141
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
5142
|
+
} finally {
|
|
5143
|
+
wasm.__wbindgen_free_command_export(deferred1_0, deferred1_1, 1);
|
|
5144
|
+
}
|
|
5145
|
+
}
|
|
5146
|
+
/**
|
|
5147
|
+
* Pointer to the contiguous `f64` slice backing this column,
|
|
5148
|
+
* or 0 (null) if the column is missing or has the wrong
|
|
5149
|
+
* dtype.
|
|
5150
|
+
*
|
|
5151
|
+
* **Lifetime**: valid only until the next non-trivial wasm
|
|
5152
|
+
* call. See the module-level memory-grow contract.
|
|
5153
|
+
* @param {number} block_idx
|
|
5154
|
+
* @param {number} col_idx
|
|
5155
|
+
* @returns {number}
|
|
5156
|
+
*/
|
|
5157
|
+
columnPtrF64(block_idx, col_idx) {
|
|
5158
|
+
const ret = wasm.wasmlammpsdumpstream_columnPtrF64(this.__wbg_ptr, block_idx, col_idx);
|
|
5159
|
+
return ret >>> 0;
|
|
5160
|
+
}
|
|
5161
|
+
/**
|
|
5162
|
+
* Pointer to the contiguous `i32` slice backing this column,
|
|
5163
|
+
* or 0 (null) if the column is missing or has the wrong
|
|
5164
|
+
* dtype.
|
|
5165
|
+
*
|
|
5166
|
+
* **Lifetime**: valid only until the next non-trivial wasm
|
|
5167
|
+
* call. See the module-level memory-grow contract.
|
|
5168
|
+
* @param {number} block_idx
|
|
5169
|
+
* @param {number} col_idx
|
|
5170
|
+
* @returns {number}
|
|
5171
|
+
*/
|
|
5172
|
+
columnPtrI32(block_idx, col_idx) {
|
|
5173
|
+
const ret = wasm.wasmlammpsdumpstream_columnPtrI32(this.__wbg_ptr, block_idx, col_idx);
|
|
5174
|
+
return ret >>> 0;
|
|
5175
|
+
}
|
|
5176
|
+
/**
|
|
5177
|
+
* Pointer to the contiguous `u32` slice backing this column,
|
|
5178
|
+
* or 0 (null) if the column is missing or has the wrong
|
|
5179
|
+
* dtype.
|
|
5180
|
+
*
|
|
5181
|
+
* **Lifetime**: valid only until the next non-trivial wasm
|
|
5182
|
+
* call. See the module-level memory-grow contract.
|
|
5183
|
+
* @param {number} block_idx
|
|
5184
|
+
* @param {number} col_idx
|
|
5185
|
+
* @returns {number}
|
|
5186
|
+
*/
|
|
5187
|
+
columnPtrU32(block_idx, col_idx) {
|
|
5188
|
+
const ret = wasm.wasmlammpsdumpstream_columnPtrU32(this.__wbg_ptr, block_idx, col_idx);
|
|
5189
|
+
return ret >>> 0;
|
|
5190
|
+
}
|
|
5191
|
+
/**
|
|
5192
|
+
* Copy a string column out by value. Returns an empty array
|
|
5193
|
+
* if the column is missing or not a string column.
|
|
5194
|
+
* @param {number} block_idx
|
|
5195
|
+
* @param {number} col_idx
|
|
5196
|
+
* @returns {string[]}
|
|
5197
|
+
*/
|
|
5198
|
+
columnStrings(block_idx, col_idx) {
|
|
5199
|
+
const ret = wasm.wasmlammpsdumpstream_columnStrings(this.__wbg_ptr, block_idx, col_idx);
|
|
5200
|
+
var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
|
|
5201
|
+
wasm.__wbindgen_free_command_export(ret[0], ret[1] * 4, 4);
|
|
5202
|
+
return v1;
|
|
5203
|
+
}
|
|
5204
|
+
/**
|
|
5205
|
+
* Feed the first `len` bytes of the input buffer into the
|
|
5206
|
+
* indexer at absolute source offset `globalOffset`. Returns
|
|
5207
|
+
* any frame entries that became finalized as a result.
|
|
5208
|
+
*
|
|
5209
|
+
* `globalOffset` is round-tripped through `f64`; per the
|
|
5210
|
+
* streaming protocol the source size is capped at 1 TB
|
|
5211
|
+
* (well within `Number.MAX_SAFE_INTEGER`).
|
|
5212
|
+
* @param {number} global_offset
|
|
5213
|
+
* @param {number} len
|
|
5214
|
+
* @returns {FrameIndexEntry[]}
|
|
5215
|
+
*/
|
|
5216
|
+
feedIndexChunk(global_offset, len) {
|
|
5217
|
+
const ret = wasm.wasmlammpsdumpstream_feedIndexChunk(this.__wbg_ptr, global_offset, len);
|
|
5218
|
+
if (ret[3]) {
|
|
5219
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
5220
|
+
}
|
|
5221
|
+
var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
|
|
5222
|
+
wasm.__wbindgen_free_command_export(ret[0], ret[1] * 4, 4);
|
|
5223
|
+
return v1;
|
|
5224
|
+
}
|
|
5225
|
+
/**
|
|
5226
|
+
* Signal end-of-stream; return any trailing frame entry. The
|
|
5227
|
+
* indexer is consumed and further `feedIndexChunk` calls
|
|
5228
|
+
* throw.
|
|
5229
|
+
* @returns {FrameIndexEntry[]}
|
|
5230
|
+
*/
|
|
5231
|
+
finishIndex() {
|
|
5232
|
+
const ret = wasm.wasmlammpsdumpstream_finishIndex(this.__wbg_ptr);
|
|
5233
|
+
if (ret[3]) {
|
|
5234
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
5235
|
+
}
|
|
5236
|
+
var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
|
|
5237
|
+
wasm.__wbindgen_free_command_export(ret[0], ret[1] * 4, 4);
|
|
5238
|
+
return v1;
|
|
5239
|
+
}
|
|
5240
|
+
/**
|
|
5241
|
+
* Number of named scalar arrays in grid `gridIdx`.
|
|
5242
|
+
* @param {number} grid_idx
|
|
5243
|
+
* @returns {number}
|
|
5244
|
+
*/
|
|
5245
|
+
gridArrayCount(grid_idx) {
|
|
5246
|
+
const ret = wasm.wasmlammpsdumpstream_gridArrayCount(this.__wbg_ptr, grid_idx);
|
|
5247
|
+
return ret >>> 0;
|
|
5248
|
+
}
|
|
5249
|
+
/**
|
|
5250
|
+
* Length (number of `f64` elements) of the grid scalar field.
|
|
5251
|
+
* @param {number} grid_idx
|
|
5252
|
+
* @param {number} array_idx
|
|
5253
|
+
* @returns {number}
|
|
5254
|
+
*/
|
|
5255
|
+
gridArrayLen(grid_idx, array_idx) {
|
|
5256
|
+
const ret = wasm.wasmlammpsdumpstream_gridArrayLen(this.__wbg_ptr, grid_idx, array_idx);
|
|
5257
|
+
return ret >>> 0;
|
|
5258
|
+
}
|
|
5259
|
+
/**
|
|
5260
|
+
* Name of scalar array `(gridIdx, arrayIdx)`, or empty string
|
|
5261
|
+
* if either index is out of range.
|
|
5262
|
+
* @param {number} grid_idx
|
|
5263
|
+
* @param {number} array_idx
|
|
5264
|
+
* @returns {string}
|
|
5265
|
+
*/
|
|
5266
|
+
gridArrayName(grid_idx, array_idx) {
|
|
5267
|
+
let deferred1_0;
|
|
5268
|
+
let deferred1_1;
|
|
5269
|
+
try {
|
|
5270
|
+
const ret = wasm.wasmlammpsdumpstream_gridArrayName(this.__wbg_ptr, grid_idx, array_idx);
|
|
5271
|
+
deferred1_0 = ret[0];
|
|
5272
|
+
deferred1_1 = ret[1];
|
|
5273
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
5274
|
+
} finally {
|
|
5275
|
+
wasm.__wbindgen_free_command_export(deferred1_0, deferred1_1, 1);
|
|
5276
|
+
}
|
|
5277
|
+
}
|
|
5278
|
+
/**
|
|
5279
|
+
* Pointer to the contiguous `f64` slice backing the grid
|
|
5280
|
+
* scalar field, or 0 (null) if either index is out of range.
|
|
5281
|
+
*
|
|
5282
|
+
* **Lifetime**: valid only until the next non-trivial wasm
|
|
5283
|
+
* call. See the module-level memory-grow contract.
|
|
5284
|
+
* @param {number} grid_idx
|
|
5285
|
+
* @param {number} array_idx
|
|
5286
|
+
* @returns {number}
|
|
5287
|
+
*/
|
|
5288
|
+
gridArrayPtrF64(grid_idx, array_idx) {
|
|
5289
|
+
const ret = wasm.wasmlammpsdumpstream_gridArrayPtrF64(this.__wbg_ptr, grid_idx, array_idx);
|
|
5290
|
+
return ret >>> 0;
|
|
5291
|
+
}
|
|
5292
|
+
/**
|
|
5293
|
+
* Grid lattice cell as a length-9 `Float64Array` (column-major:
|
|
5294
|
+
* `[col0_x, col0_y, col0_z, col1_x, col1_y, col1_z, col2_x, col2_y, col2_z]`).
|
|
5295
|
+
* @param {number} grid_idx
|
|
5296
|
+
* @returns {Float64Array}
|
|
5297
|
+
*/
|
|
5298
|
+
gridCell(grid_idx) {
|
|
5299
|
+
const ret = wasm.wasmlammpsdumpstream_gridCell(this.__wbg_ptr, grid_idx);
|
|
5300
|
+
var v1 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
5301
|
+
wasm.__wbindgen_free_command_export(ret[0], ret[1] * 8, 8);
|
|
5302
|
+
return v1;
|
|
5303
|
+
}
|
|
5304
|
+
/**
|
|
5305
|
+
* Number of named grids attached to the current frame.
|
|
5306
|
+
* @returns {number}
|
|
5307
|
+
*/
|
|
5308
|
+
gridCount() {
|
|
5309
|
+
const ret = wasm.wasmlammpsdumpstream_gridCount(this.__wbg_ptr);
|
|
5310
|
+
return ret >>> 0;
|
|
5311
|
+
}
|
|
5312
|
+
/**
|
|
5313
|
+
* Name of grid `gridIdx`, or empty string if out of range.
|
|
5314
|
+
* @param {number} grid_idx
|
|
5315
|
+
* @returns {string}
|
|
5316
|
+
*/
|
|
5317
|
+
gridName(grid_idx) {
|
|
5318
|
+
let deferred1_0;
|
|
5319
|
+
let deferred1_1;
|
|
5320
|
+
try {
|
|
5321
|
+
const ret = wasm.wasmlammpsdumpstream_gridName(this.__wbg_ptr, grid_idx);
|
|
5322
|
+
deferred1_0 = ret[0];
|
|
5323
|
+
deferred1_1 = ret[1];
|
|
5324
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
5325
|
+
} finally {
|
|
5326
|
+
wasm.__wbindgen_free_command_export(deferred1_0, deferred1_1, 1);
|
|
5327
|
+
}
|
|
5328
|
+
}
|
|
5329
|
+
/**
|
|
5330
|
+
* Grid origin (Cartesian, Å) as a length-3 `Float64Array`.
|
|
5331
|
+
* @param {number} grid_idx
|
|
5332
|
+
* @returns {Float64Array}
|
|
5333
|
+
*/
|
|
5334
|
+
gridOrigin(grid_idx) {
|
|
5335
|
+
const ret = wasm.wasmlammpsdumpstream_gridOrigin(this.__wbg_ptr, grid_idx);
|
|
5336
|
+
var v1 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
5337
|
+
wasm.__wbindgen_free_command_export(ret[0], ret[1] * 8, 8);
|
|
5338
|
+
return v1;
|
|
5339
|
+
}
|
|
5340
|
+
/**
|
|
5341
|
+
* Grid PBC flags as a length-3 `Uint8Array` (`1` = periodic,
|
|
5342
|
+
* `0` = open).
|
|
5343
|
+
* @param {number} grid_idx
|
|
5344
|
+
* @returns {Uint8Array}
|
|
5345
|
+
*/
|
|
5346
|
+
gridPbc(grid_idx) {
|
|
5347
|
+
const ret = wasm.wasmlammpsdumpstream_gridPbc(this.__wbg_ptr, grid_idx);
|
|
5348
|
+
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
5349
|
+
wasm.__wbindgen_free_command_export(ret[0], ret[1] * 1, 1);
|
|
5350
|
+
return v1;
|
|
5351
|
+
}
|
|
5352
|
+
/**
|
|
5353
|
+
* Grid dimensions `[nx, ny, nz]` as a length-3 `Uint32Array`.
|
|
5354
|
+
* @param {number} grid_idx
|
|
5355
|
+
* @returns {Uint32Array}
|
|
5356
|
+
*/
|
|
5357
|
+
gridShape(grid_idx) {
|
|
5358
|
+
const ret = wasm.wasmlammpsdumpstream_gridShape(this.__wbg_ptr, grid_idx);
|
|
5359
|
+
var v1 = getArrayU32FromWasm0(ret[0], ret[1]).slice();
|
|
5360
|
+
wasm.__wbindgen_free_command_export(ret[0], ret[1] * 4, 4);
|
|
5361
|
+
return v1;
|
|
5362
|
+
}
|
|
5363
|
+
/**
|
|
5364
|
+
* Current capacity (in bytes) of the reusable input buffer.
|
|
5365
|
+
* @returns {number}
|
|
5366
|
+
*/
|
|
5367
|
+
inputCapacity() {
|
|
5368
|
+
const ret = wasm.wasmlammpsdumpstream_inputCapacity(this.__wbg_ptr);
|
|
5369
|
+
return ret >>> 0;
|
|
5370
|
+
}
|
|
5371
|
+
/**
|
|
5372
|
+
* Create a new streaming reader. The reusable input buffer
|
|
5373
|
+
* starts empty; call [`allocInputBuffer`] before feeding data.
|
|
5374
|
+
*/
|
|
5375
|
+
constructor() {
|
|
5376
|
+
const ret = wasm.wasmlammpsdumpstream_new();
|
|
5377
|
+
this.__wbg_ptr = ret;
|
|
5378
|
+
WasmLammpsDumpStreamFinalization.register(this, this.__wbg_ptr, this);
|
|
5379
|
+
return this;
|
|
5380
|
+
}
|
|
5381
|
+
/**
|
|
5382
|
+
* Decode the byte range `[offset, offset + len)` from the
|
|
5383
|
+
* reusable input buffer as a single frame. Replaces any
|
|
5384
|
+
* previously cached output; the caller must extract data
|
|
5385
|
+
* before the next `parseRangeInInput` (the same buffer can
|
|
5386
|
+
* be overwritten in between).
|
|
5387
|
+
* @param {number} offset
|
|
5388
|
+
* @param {number} len
|
|
5389
|
+
*/
|
|
5390
|
+
parseRangeInInput(offset, len) {
|
|
5391
|
+
const ret = wasm.wasmlammpsdumpstream_parseRangeInInput(this.__wbg_ptr, offset, len);
|
|
5392
|
+
if (ret[1]) {
|
|
5393
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
5394
|
+
}
|
|
5395
|
+
}
|
|
5396
|
+
/**
|
|
5397
|
+
* Drop the cached output frame, releasing its memory and
|
|
5398
|
+
* invalidating any outstanding `columnPtr*` / `gridArrayPtr*`
|
|
5399
|
+
* pointers. Subsequent extraction calls return 0 / empty
|
|
5400
|
+
* until the next `parseRangeInInput`.
|
|
5401
|
+
*/
|
|
5402
|
+
releaseFrame() {
|
|
5403
|
+
wasm.wasmlammpsdumpstream_releaseFrame(this.__wbg_ptr);
|
|
5404
|
+
}
|
|
5405
|
+
/**
|
|
5406
|
+
* Box H-matrix as a length-9 `Float64Array` (column-major:
|
|
5407
|
+
* `[col0_x, col0_y, col0_z, col1_x, col1_y, col1_z, col2_x, col2_y, col2_z]`),
|
|
5408
|
+
* or `undefined` if the frame has no simbox.
|
|
5409
|
+
*
|
|
5410
|
+
* Returned by VALUE — the typed array is owned by JS and is
|
|
5411
|
+
* stable across subsequent wasm calls.
|
|
5412
|
+
* @returns {Float64Array | undefined}
|
|
5413
|
+
*/
|
|
5414
|
+
simboxH() {
|
|
5415
|
+
const ret = wasm.wasmlammpsdumpstream_simboxH(this.__wbg_ptr);
|
|
5416
|
+
let v1;
|
|
5417
|
+
if (ret[0] !== 0) {
|
|
5418
|
+
v1 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
5419
|
+
wasm.__wbindgen_free_command_export(ret[0], ret[1] * 8, 8);
|
|
5420
|
+
}
|
|
5421
|
+
return v1;
|
|
5422
|
+
}
|
|
5423
|
+
/**
|
|
5424
|
+
* Box origin as a length-3 `Float64Array`, or `undefined` if
|
|
5425
|
+
* the frame has no simbox.
|
|
5426
|
+
* @returns {Float64Array | undefined}
|
|
5427
|
+
*/
|
|
5428
|
+
simboxOrigin() {
|
|
5429
|
+
const ret = wasm.wasmlammpsdumpstream_simboxOrigin(this.__wbg_ptr);
|
|
5430
|
+
let v1;
|
|
5431
|
+
if (ret[0] !== 0) {
|
|
5432
|
+
v1 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
5433
|
+
wasm.__wbindgen_free_command_export(ret[0], ret[1] * 8, 8);
|
|
5434
|
+
}
|
|
5435
|
+
return v1;
|
|
5436
|
+
}
|
|
5437
|
+
/**
|
|
5438
|
+
* Per-axis PBC flags as a length-3 `Uint8Array` (`1` = periodic,
|
|
5439
|
+
* `0` = open), or `undefined` if the frame has no simbox.
|
|
5440
|
+
*
|
|
5441
|
+
* (wasm-bindgen does not support `[bool; 3]` returns natively,
|
|
5442
|
+
* hence the `Uint8Array` wire format. The spec calls for
|
|
5443
|
+
* `[boolean, boolean, boolean]`; the JS side is expected to
|
|
5444
|
+
* `Boolean(arr[i])` each entry.)
|
|
5445
|
+
* @returns {Uint8Array | undefined}
|
|
5446
|
+
*/
|
|
5447
|
+
simboxPbc() {
|
|
5448
|
+
const ret = wasm.wasmlammpsdumpstream_simboxPbc(this.__wbg_ptr);
|
|
5449
|
+
let v1;
|
|
5450
|
+
if (ret[0] !== 0) {
|
|
5451
|
+
v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
5452
|
+
wasm.__wbindgen_free_command_export(ret[0], ret[1] * 1, 1);
|
|
5453
|
+
}
|
|
5454
|
+
return v1;
|
|
5455
|
+
}
|
|
5456
|
+
}
|
|
5457
|
+
if (Symbol.dispose) WasmLammpsDumpStream.prototype[Symbol.dispose] = WasmLammpsDumpStream.prototype.free;
|
|
5458
|
+
|
|
5459
|
+
/**
|
|
5460
|
+
* Stateless wrapper for [`molrs_compute::pca::Pca2`].
|
|
5461
|
+
*
|
|
5462
|
+
* All configuration lives on [`fitTransform`](Self::fit_transform).
|
|
5463
|
+
*
|
|
5464
|
+
* # Example (JavaScript)
|
|
5465
|
+
*
|
|
5466
|
+
* ```js
|
|
5467
|
+
* const pca = new WasmPca2();
|
|
5468
|
+
* const result = pca.fitTransform(matrix, nRows, nCols);
|
|
5469
|
+
* const coords = result.coords(); // Float64Array, length 2 * nRows
|
|
5470
|
+
* const variance = result.variance(); // Float64Array, length 2
|
|
5471
|
+
* ```
|
|
5472
|
+
*/
|
|
5473
|
+
export class WasmPca2 {
|
|
5474
|
+
__destroy_into_raw() {
|
|
5475
|
+
const ptr = this.__wbg_ptr;
|
|
5476
|
+
this.__wbg_ptr = 0;
|
|
5477
|
+
WasmPca2Finalization.unregister(this);
|
|
5478
|
+
return ptr;
|
|
5479
|
+
}
|
|
5480
|
+
free() {
|
|
5481
|
+
const ptr = this.__destroy_into_raw();
|
|
5482
|
+
wasm.__wbg_wasmpca2_free(ptr, 0);
|
|
5483
|
+
}
|
|
5484
|
+
/**
|
|
5485
|
+
* Fit 2-component PCA on a row-major observation matrix and return the
|
|
5486
|
+
* projected coordinates + per-component variance.
|
|
5487
|
+
*
|
|
5488
|
+
* # Arguments
|
|
5489
|
+
*
|
|
5490
|
+
* * `matrix` — row-major `n_rows × n_cols` observation matrix.
|
|
5491
|
+
* * `n_rows` — number of observations.
|
|
5492
|
+
* * `n_cols` — number of features.
|
|
5493
|
+
*
|
|
5494
|
+
* # Errors
|
|
5495
|
+
*
|
|
5496
|
+
* Throws if `n_rows < 3`, `n_cols < 2`, the length does not match
|
|
5497
|
+
* `n_rows * n_cols`, any element is non-finite, or any column has
|
|
5498
|
+
* zero variance.
|
|
5499
|
+
* @param {Float64Array} matrix
|
|
5500
|
+
* @param {number} n_rows
|
|
5501
|
+
* @param {number} n_cols
|
|
5502
|
+
* @returns {WasmPcaResult}
|
|
5503
|
+
*/
|
|
5504
|
+
fitTransform(matrix, n_rows, n_cols) {
|
|
5505
|
+
const ptr0 = passArrayF64ToWasm0(matrix, wasm.__wbindgen_malloc_command_export);
|
|
5506
|
+
const len0 = WASM_VECTOR_LEN;
|
|
5507
|
+
const ret = wasm.wasmpca2_fitTransform(this.__wbg_ptr, ptr0, len0, n_rows, n_cols);
|
|
5508
|
+
if (ret[2]) {
|
|
5509
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
5510
|
+
}
|
|
5511
|
+
return WasmPcaResult.__wrap(ret[0]);
|
|
5512
|
+
}
|
|
5513
|
+
/**
|
|
5514
|
+
* Create a new PCA calculator. The struct carries no state — all
|
|
5515
|
+
* parameters are supplied on [`fitTransform`](Self::fit_transform).
|
|
5516
|
+
*/
|
|
5517
|
+
constructor() {
|
|
5518
|
+
const ret = wasm.wasmpca2_new();
|
|
5519
|
+
this.__wbg_ptr = ret;
|
|
5520
|
+
WasmPca2Finalization.register(this, this.__wbg_ptr, this);
|
|
5521
|
+
return this;
|
|
5522
|
+
}
|
|
5523
|
+
}
|
|
5524
|
+
if (Symbol.dispose) WasmPca2.prototype[Symbol.dispose] = WasmPca2.prototype.free;
|
|
5525
|
+
|
|
5526
|
+
/**
|
|
5527
|
+
* Result of a [`WasmPca2::fit_transform`] call.
|
|
5528
|
+
*
|
|
5529
|
+
* Each accessor returns an **owned** `Float64Array` (copy of the underlying
|
|
5530
|
+
* `Vec`) so JS is free to let this wrapper be GC'd without dangling views.
|
|
5531
|
+
*/
|
|
5532
|
+
export class WasmPcaResult {
|
|
5533
|
+
static __wrap(ptr) {
|
|
5534
|
+
const obj = Object.create(WasmPcaResult.prototype);
|
|
5535
|
+
obj.__wbg_ptr = ptr;
|
|
5536
|
+
WasmPcaResultFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
5537
|
+
return obj;
|
|
5538
|
+
}
|
|
5539
|
+
__destroy_into_raw() {
|
|
5540
|
+
const ptr = this.__wbg_ptr;
|
|
5541
|
+
this.__wbg_ptr = 0;
|
|
5542
|
+
WasmPcaResultFinalization.unregister(this);
|
|
5543
|
+
return ptr;
|
|
5544
|
+
}
|
|
5545
|
+
free() {
|
|
5546
|
+
const ptr = this.__destroy_into_raw();
|
|
5547
|
+
wasm.__wbg_wasmpcaresult_free(ptr, 0);
|
|
5548
|
+
}
|
|
5549
|
+
/**
|
|
5550
|
+
* Projected 2D coordinates as a row-major `Float64Array` of length
|
|
5551
|
+
* `2 * n_rows`. `coords[2 * i + 0]` is the PC1 score for row `i`,
|
|
5552
|
+
* `coords[2 * i + 1]` is PC2.
|
|
5553
|
+
* @returns {Float64Array}
|
|
5554
|
+
*/
|
|
5555
|
+
coords() {
|
|
5556
|
+
const ret = wasm.wasmpcaresult_coords(this.__wbg_ptr);
|
|
5557
|
+
return ret;
|
|
5558
|
+
}
|
|
5559
|
+
/**
|
|
5560
|
+
* Explained variance per component as `Float64Array` of length 2.
|
|
5561
|
+
* `variance[0] >= variance[1]` by construction.
|
|
5562
|
+
* @returns {Float64Array}
|
|
5563
|
+
*/
|
|
5564
|
+
variance() {
|
|
5565
|
+
const ret = wasm.wasmpcaresult_variance(this.__wbg_ptr);
|
|
5566
|
+
return ret;
|
|
5567
|
+
}
|
|
5568
|
+
}
|
|
5569
|
+
if (Symbol.dispose) WasmPcaResult.prototype[Symbol.dispose] = WasmPcaResult.prototype.free;
|
|
5570
|
+
|
|
5571
|
+
export class WasmPdbStream {
|
|
5572
|
+
__destroy_into_raw() {
|
|
5573
|
+
const ptr = this.__wbg_ptr;
|
|
5574
|
+
this.__wbg_ptr = 0;
|
|
5575
|
+
WasmPdbStreamFinalization.unregister(this);
|
|
5576
|
+
return ptr;
|
|
5577
|
+
}
|
|
5578
|
+
free() {
|
|
5579
|
+
const ptr = this.__destroy_into_raw();
|
|
5580
|
+
wasm.__wbg_wasmpdbstream_free(ptr, 0);
|
|
5581
|
+
}
|
|
5582
|
+
/**
|
|
5583
|
+
* Resize the reusable input buffer so it can hold at least
|
|
5584
|
+
* `len` bytes, and return the WASM linear-memory pointer to
|
|
5585
|
+
* its first byte.
|
|
5586
|
+
*
|
|
5587
|
+
* CALLER MUST RE-DERIVE THIS POINTER AFTER ANY OTHER WASM CALL —
|
|
5588
|
+
* `wasm.memory.buffer` may have been detached by a `memory.grow`.
|
|
5589
|
+
* @param {number} len
|
|
5590
|
+
* @returns {number}
|
|
5591
|
+
*/
|
|
5592
|
+
allocInputBuffer(len) {
|
|
5593
|
+
const ret = wasm.wasmpdbstream_allocInputBuffer(this.__wbg_ptr, len);
|
|
5594
|
+
return ret >>> 0;
|
|
5595
|
+
}
|
|
5596
|
+
/**
|
|
5597
|
+
* Number of blocks in the most recently parsed frame.
|
|
5598
|
+
* @returns {number}
|
|
5599
|
+
*/
|
|
5600
|
+
blockCount() {
|
|
5601
|
+
const ret = wasm.wasmpdbstream_blockCount(this.__wbg_ptr);
|
|
5602
|
+
return ret >>> 0;
|
|
5603
|
+
}
|
|
5604
|
+
/**
|
|
5605
|
+
* Name of block `blockIdx`, or empty string if out of range.
|
|
5606
|
+
* @param {number} block_idx
|
|
5607
|
+
* @returns {string}
|
|
5608
|
+
*/
|
|
5609
|
+
blockName(block_idx) {
|
|
5610
|
+
let deferred1_0;
|
|
5611
|
+
let deferred1_1;
|
|
5612
|
+
try {
|
|
5613
|
+
const ret = wasm.wasmpdbstream_blockName(this.__wbg_ptr, block_idx);
|
|
5614
|
+
deferred1_0 = ret[0];
|
|
5615
|
+
deferred1_1 = ret[1];
|
|
5616
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
5617
|
+
} finally {
|
|
5618
|
+
wasm.__wbindgen_free_command_export(deferred1_0, deferred1_1, 1);
|
|
5619
|
+
}
|
|
5620
|
+
}
|
|
5621
|
+
/**
|
|
5622
|
+
* Number of columns in block `blockIdx`.
|
|
5623
|
+
* @param {number} block_idx
|
|
5624
|
+
* @returns {number}
|
|
5625
|
+
*/
|
|
5626
|
+
columnCount(block_idx) {
|
|
5627
|
+
const ret = wasm.wasmpdbstream_columnCount(this.__wbg_ptr, block_idx);
|
|
5628
|
+
return ret >>> 0;
|
|
5629
|
+
}
|
|
5630
|
+
/**
|
|
5631
|
+
* Column dtype string at `(blockIdx, colIdx)`. One of `"f64"`,
|
|
5632
|
+
* `"u32"`, `"i32"`, `"string"` — or `"bool"` / `"u8"` if a
|
|
5633
|
+
* future parser emits those (current streaming formats do not).
|
|
5634
|
+
* Empty string if the index is out of range.
|
|
5635
|
+
* @param {number} block_idx
|
|
5636
|
+
* @param {number} col_idx
|
|
5637
|
+
* @returns {string}
|
|
5638
|
+
*/
|
|
5639
|
+
columnDtype(block_idx, col_idx) {
|
|
5640
|
+
let deferred1_0;
|
|
5641
|
+
let deferred1_1;
|
|
5642
|
+
try {
|
|
5643
|
+
const ret = wasm.wasmpdbstream_columnDtype(this.__wbg_ptr, block_idx, col_idx);
|
|
5644
|
+
deferred1_0 = ret[0];
|
|
5645
|
+
deferred1_1 = ret[1];
|
|
5646
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
5647
|
+
} finally {
|
|
5648
|
+
wasm.__wbindgen_free_command_export(deferred1_0, deferred1_1, 1);
|
|
5649
|
+
}
|
|
5650
|
+
}
|
|
5651
|
+
/**
|
|
5652
|
+
* Total flat element count of the column. For multi-dimensional
|
|
5653
|
+
* columns (e.g. an Nx3 positions array) this is the product of
|
|
5654
|
+
* all axes — i.e. the length of the slice the matching
|
|
5655
|
+
* `columnPtr*` points at.
|
|
5656
|
+
* @param {number} block_idx
|
|
5657
|
+
* @param {number} col_idx
|
|
5658
|
+
* @returns {number}
|
|
5659
|
+
*/
|
|
5660
|
+
columnLen(block_idx, col_idx) {
|
|
5661
|
+
const ret = wasm.wasmpdbstream_columnLen(this.__wbg_ptr, block_idx, col_idx);
|
|
5662
|
+
return ret >>> 0;
|
|
5663
|
+
}
|
|
5664
|
+
/**
|
|
5665
|
+
* Column name at `(blockIdx, colIdx)`, or empty string if
|
|
5666
|
+
* either index is out of range.
|
|
5667
|
+
* @param {number} block_idx
|
|
5668
|
+
* @param {number} col_idx
|
|
5669
|
+
* @returns {string}
|
|
5670
|
+
*/
|
|
5671
|
+
columnName(block_idx, col_idx) {
|
|
5672
|
+
let deferred1_0;
|
|
5673
|
+
let deferred1_1;
|
|
5674
|
+
try {
|
|
5675
|
+
const ret = wasm.wasmpdbstream_columnName(this.__wbg_ptr, block_idx, col_idx);
|
|
5676
|
+
deferred1_0 = ret[0];
|
|
5677
|
+
deferred1_1 = ret[1];
|
|
5678
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
5679
|
+
} finally {
|
|
5680
|
+
wasm.__wbindgen_free_command_export(deferred1_0, deferred1_1, 1);
|
|
5681
|
+
}
|
|
5682
|
+
}
|
|
5683
|
+
/**
|
|
5684
|
+
* Pointer to the contiguous `f64` slice backing this column,
|
|
5685
|
+
* or 0 (null) if the column is missing or has the wrong
|
|
5686
|
+
* dtype.
|
|
5687
|
+
*
|
|
5688
|
+
* **Lifetime**: valid only until the next non-trivial wasm
|
|
5689
|
+
* call. See the module-level memory-grow contract.
|
|
5690
|
+
* @param {number} block_idx
|
|
5691
|
+
* @param {number} col_idx
|
|
5692
|
+
* @returns {number}
|
|
5693
|
+
*/
|
|
5694
|
+
columnPtrF64(block_idx, col_idx) {
|
|
5695
|
+
const ret = wasm.wasmpdbstream_columnPtrF64(this.__wbg_ptr, block_idx, col_idx);
|
|
5696
|
+
return ret >>> 0;
|
|
5697
|
+
}
|
|
5698
|
+
/**
|
|
5699
|
+
* Pointer to the contiguous `i32` slice backing this column,
|
|
5700
|
+
* or 0 (null) if the column is missing or has the wrong
|
|
5701
|
+
* dtype.
|
|
5702
|
+
*
|
|
5703
|
+
* **Lifetime**: valid only until the next non-trivial wasm
|
|
5704
|
+
* call. See the module-level memory-grow contract.
|
|
5705
|
+
* @param {number} block_idx
|
|
5706
|
+
* @param {number} col_idx
|
|
5707
|
+
* @returns {number}
|
|
5708
|
+
*/
|
|
5709
|
+
columnPtrI32(block_idx, col_idx) {
|
|
5710
|
+
const ret = wasm.wasmpdbstream_columnPtrI32(this.__wbg_ptr, block_idx, col_idx);
|
|
5711
|
+
return ret >>> 0;
|
|
5712
|
+
}
|
|
5713
|
+
/**
|
|
5714
|
+
* Pointer to the contiguous `u32` slice backing this column,
|
|
5715
|
+
* or 0 (null) if the column is missing or has the wrong
|
|
5716
|
+
* dtype.
|
|
5717
|
+
*
|
|
5718
|
+
* **Lifetime**: valid only until the next non-trivial wasm
|
|
5719
|
+
* call. See the module-level memory-grow contract.
|
|
5720
|
+
* @param {number} block_idx
|
|
5721
|
+
* @param {number} col_idx
|
|
5722
|
+
* @returns {number}
|
|
5723
|
+
*/
|
|
5724
|
+
columnPtrU32(block_idx, col_idx) {
|
|
5725
|
+
const ret = wasm.wasmpdbstream_columnPtrU32(this.__wbg_ptr, block_idx, col_idx);
|
|
5726
|
+
return ret >>> 0;
|
|
5727
|
+
}
|
|
5728
|
+
/**
|
|
5729
|
+
* Copy a string column out by value. Returns an empty array
|
|
5730
|
+
* if the column is missing or not a string column.
|
|
5731
|
+
* @param {number} block_idx
|
|
5732
|
+
* @param {number} col_idx
|
|
5733
|
+
* @returns {string[]}
|
|
5734
|
+
*/
|
|
5735
|
+
columnStrings(block_idx, col_idx) {
|
|
5736
|
+
const ret = wasm.wasmpdbstream_columnStrings(this.__wbg_ptr, block_idx, col_idx);
|
|
5737
|
+
var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
|
|
5738
|
+
wasm.__wbindgen_free_command_export(ret[0], ret[1] * 4, 4);
|
|
5739
|
+
return v1;
|
|
5740
|
+
}
|
|
5741
|
+
/**
|
|
5742
|
+
* Feed the first `len` bytes of the input buffer into the
|
|
5743
|
+
* indexer at absolute source offset `globalOffset`. Returns
|
|
5744
|
+
* any frame entries that became finalized as a result.
|
|
5745
|
+
*
|
|
5746
|
+
* `globalOffset` is round-tripped through `f64`; per the
|
|
5747
|
+
* streaming protocol the source size is capped at 1 TB
|
|
5748
|
+
* (well within `Number.MAX_SAFE_INTEGER`).
|
|
5749
|
+
* @param {number} global_offset
|
|
5750
|
+
* @param {number} len
|
|
5751
|
+
* @returns {FrameIndexEntry[]}
|
|
5752
|
+
*/
|
|
5753
|
+
feedIndexChunk(global_offset, len) {
|
|
5754
|
+
const ret = wasm.wasmpdbstream_feedIndexChunk(this.__wbg_ptr, global_offset, len);
|
|
5755
|
+
if (ret[3]) {
|
|
5756
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
5757
|
+
}
|
|
5758
|
+
var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
|
|
5759
|
+
wasm.__wbindgen_free_command_export(ret[0], ret[1] * 4, 4);
|
|
5760
|
+
return v1;
|
|
5761
|
+
}
|
|
5762
|
+
/**
|
|
5763
|
+
* Signal end-of-stream; return any trailing frame entry. The
|
|
5764
|
+
* indexer is consumed and further `feedIndexChunk` calls
|
|
5765
|
+
* throw.
|
|
5766
|
+
* @returns {FrameIndexEntry[]}
|
|
5767
|
+
*/
|
|
5768
|
+
finishIndex() {
|
|
5769
|
+
const ret = wasm.wasmpdbstream_finishIndex(this.__wbg_ptr);
|
|
5770
|
+
if (ret[3]) {
|
|
5771
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
5772
|
+
}
|
|
5773
|
+
var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
|
|
5774
|
+
wasm.__wbindgen_free_command_export(ret[0], ret[1] * 4, 4);
|
|
5775
|
+
return v1;
|
|
5776
|
+
}
|
|
5777
|
+
/**
|
|
5778
|
+
* Number of named scalar arrays in grid `gridIdx`.
|
|
5779
|
+
* @param {number} grid_idx
|
|
5780
|
+
* @returns {number}
|
|
5781
|
+
*/
|
|
5782
|
+
gridArrayCount(grid_idx) {
|
|
5783
|
+
const ret = wasm.wasmpdbstream_gridArrayCount(this.__wbg_ptr, grid_idx);
|
|
5784
|
+
return ret >>> 0;
|
|
5785
|
+
}
|
|
5786
|
+
/**
|
|
5787
|
+
* Length (number of `f64` elements) of the grid scalar field.
|
|
5788
|
+
* @param {number} grid_idx
|
|
5789
|
+
* @param {number} array_idx
|
|
5790
|
+
* @returns {number}
|
|
5791
|
+
*/
|
|
5792
|
+
gridArrayLen(grid_idx, array_idx) {
|
|
5793
|
+
const ret = wasm.wasmpdbstream_gridArrayLen(this.__wbg_ptr, grid_idx, array_idx);
|
|
5794
|
+
return ret >>> 0;
|
|
5795
|
+
}
|
|
5796
|
+
/**
|
|
5797
|
+
* Name of scalar array `(gridIdx, arrayIdx)`, or empty string
|
|
5798
|
+
* if either index is out of range.
|
|
5799
|
+
* @param {number} grid_idx
|
|
5800
|
+
* @param {number} array_idx
|
|
5801
|
+
* @returns {string}
|
|
5802
|
+
*/
|
|
5803
|
+
gridArrayName(grid_idx, array_idx) {
|
|
5804
|
+
let deferred1_0;
|
|
5805
|
+
let deferred1_1;
|
|
5806
|
+
try {
|
|
5807
|
+
const ret = wasm.wasmpdbstream_gridArrayName(this.__wbg_ptr, grid_idx, array_idx);
|
|
5808
|
+
deferred1_0 = ret[0];
|
|
5809
|
+
deferred1_1 = ret[1];
|
|
5810
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
5811
|
+
} finally {
|
|
5812
|
+
wasm.__wbindgen_free_command_export(deferred1_0, deferred1_1, 1);
|
|
5813
|
+
}
|
|
5814
|
+
}
|
|
5815
|
+
/**
|
|
5816
|
+
* Pointer to the contiguous `f64` slice backing the grid
|
|
5817
|
+
* scalar field, or 0 (null) if either index is out of range.
|
|
5818
|
+
*
|
|
5819
|
+
* **Lifetime**: valid only until the next non-trivial wasm
|
|
5820
|
+
* call. See the module-level memory-grow contract.
|
|
5821
|
+
* @param {number} grid_idx
|
|
5822
|
+
* @param {number} array_idx
|
|
5823
|
+
* @returns {number}
|
|
5824
|
+
*/
|
|
5825
|
+
gridArrayPtrF64(grid_idx, array_idx) {
|
|
5826
|
+
const ret = wasm.wasmpdbstream_gridArrayPtrF64(this.__wbg_ptr, grid_idx, array_idx);
|
|
5827
|
+
return ret >>> 0;
|
|
5828
|
+
}
|
|
5829
|
+
/**
|
|
5830
|
+
* Grid lattice cell as a length-9 `Float64Array` (column-major:
|
|
5831
|
+
* `[col0_x, col0_y, col0_z, col1_x, col1_y, col1_z, col2_x, col2_y, col2_z]`).
|
|
5832
|
+
* @param {number} grid_idx
|
|
5833
|
+
* @returns {Float64Array}
|
|
5834
|
+
*/
|
|
5835
|
+
gridCell(grid_idx) {
|
|
5836
|
+
const ret = wasm.wasmpdbstream_gridCell(this.__wbg_ptr, grid_idx);
|
|
5837
|
+
var v1 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
5838
|
+
wasm.__wbindgen_free_command_export(ret[0], ret[1] * 8, 8);
|
|
5839
|
+
return v1;
|
|
5840
|
+
}
|
|
5841
|
+
/**
|
|
5842
|
+
* Number of named grids attached to the current frame.
|
|
5843
|
+
* @returns {number}
|
|
5844
|
+
*/
|
|
5845
|
+
gridCount() {
|
|
5846
|
+
const ret = wasm.wasmpdbstream_gridCount(this.__wbg_ptr);
|
|
5847
|
+
return ret >>> 0;
|
|
5848
|
+
}
|
|
5849
|
+
/**
|
|
5850
|
+
* Name of grid `gridIdx`, or empty string if out of range.
|
|
5851
|
+
* @param {number} grid_idx
|
|
5852
|
+
* @returns {string}
|
|
5853
|
+
*/
|
|
5854
|
+
gridName(grid_idx) {
|
|
5855
|
+
let deferred1_0;
|
|
5856
|
+
let deferred1_1;
|
|
5857
|
+
try {
|
|
5858
|
+
const ret = wasm.wasmpdbstream_gridName(this.__wbg_ptr, grid_idx);
|
|
5859
|
+
deferred1_0 = ret[0];
|
|
5860
|
+
deferred1_1 = ret[1];
|
|
5861
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
5862
|
+
} finally {
|
|
5863
|
+
wasm.__wbindgen_free_command_export(deferred1_0, deferred1_1, 1);
|
|
5864
|
+
}
|
|
5865
|
+
}
|
|
5866
|
+
/**
|
|
5867
|
+
* Grid origin (Cartesian, Å) as a length-3 `Float64Array`.
|
|
5868
|
+
* @param {number} grid_idx
|
|
5869
|
+
* @returns {Float64Array}
|
|
5870
|
+
*/
|
|
5871
|
+
gridOrigin(grid_idx) {
|
|
5872
|
+
const ret = wasm.wasmpdbstream_gridOrigin(this.__wbg_ptr, grid_idx);
|
|
5873
|
+
var v1 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
5874
|
+
wasm.__wbindgen_free_command_export(ret[0], ret[1] * 8, 8);
|
|
5875
|
+
return v1;
|
|
5876
|
+
}
|
|
5877
|
+
/**
|
|
5878
|
+
* Grid PBC flags as a length-3 `Uint8Array` (`1` = periodic,
|
|
5879
|
+
* `0` = open).
|
|
5880
|
+
* @param {number} grid_idx
|
|
5881
|
+
* @returns {Uint8Array}
|
|
5882
|
+
*/
|
|
5883
|
+
gridPbc(grid_idx) {
|
|
5884
|
+
const ret = wasm.wasmpdbstream_gridPbc(this.__wbg_ptr, grid_idx);
|
|
5885
|
+
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
5886
|
+
wasm.__wbindgen_free_command_export(ret[0], ret[1] * 1, 1);
|
|
5887
|
+
return v1;
|
|
5888
|
+
}
|
|
5889
|
+
/**
|
|
5890
|
+
* Grid dimensions `[nx, ny, nz]` as a length-3 `Uint32Array`.
|
|
5891
|
+
* @param {number} grid_idx
|
|
5892
|
+
* @returns {Uint32Array}
|
|
5893
|
+
*/
|
|
5894
|
+
gridShape(grid_idx) {
|
|
5895
|
+
const ret = wasm.wasmpdbstream_gridShape(this.__wbg_ptr, grid_idx);
|
|
5896
|
+
var v1 = getArrayU32FromWasm0(ret[0], ret[1]).slice();
|
|
5897
|
+
wasm.__wbindgen_free_command_export(ret[0], ret[1] * 4, 4);
|
|
5898
|
+
return v1;
|
|
5899
|
+
}
|
|
5900
|
+
/**
|
|
5901
|
+
* Current capacity (in bytes) of the reusable input buffer.
|
|
5902
|
+
* @returns {number}
|
|
5903
|
+
*/
|
|
5904
|
+
inputCapacity() {
|
|
5905
|
+
const ret = wasm.wasmpdbstream_inputCapacity(this.__wbg_ptr);
|
|
5906
|
+
return ret >>> 0;
|
|
5907
|
+
}
|
|
5908
|
+
/**
|
|
5909
|
+
* Create a new streaming reader. The reusable input buffer
|
|
5910
|
+
* starts empty; call [`allocInputBuffer`] before feeding data.
|
|
5911
|
+
*/
|
|
5912
|
+
constructor() {
|
|
5913
|
+
const ret = wasm.wasmpdbstream_new();
|
|
5914
|
+
this.__wbg_ptr = ret;
|
|
5915
|
+
WasmPdbStreamFinalization.register(this, this.__wbg_ptr, this);
|
|
5916
|
+
return this;
|
|
5917
|
+
}
|
|
5918
|
+
/**
|
|
5919
|
+
* Decode the byte range `[offset, offset + len)` from the
|
|
5920
|
+
* reusable input buffer as a single frame. Replaces any
|
|
5921
|
+
* previously cached output; the caller must extract data
|
|
5922
|
+
* before the next `parseRangeInInput` (the same buffer can
|
|
5923
|
+
* be overwritten in between).
|
|
5924
|
+
* @param {number} offset
|
|
5925
|
+
* @param {number} len
|
|
5926
|
+
*/
|
|
5927
|
+
parseRangeInInput(offset, len) {
|
|
5928
|
+
const ret = wasm.wasmpdbstream_parseRangeInInput(this.__wbg_ptr, offset, len);
|
|
5929
|
+
if (ret[1]) {
|
|
5930
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
5931
|
+
}
|
|
5932
|
+
}
|
|
5933
|
+
/**
|
|
5934
|
+
* Drop the cached output frame, releasing its memory and
|
|
5935
|
+
* invalidating any outstanding `columnPtr*` / `gridArrayPtr*`
|
|
5936
|
+
* pointers. Subsequent extraction calls return 0 / empty
|
|
5937
|
+
* until the next `parseRangeInInput`.
|
|
5938
|
+
*/
|
|
5939
|
+
releaseFrame() {
|
|
5940
|
+
wasm.wasmpdbstream_releaseFrame(this.__wbg_ptr);
|
|
5941
|
+
}
|
|
5942
|
+
/**
|
|
5943
|
+
* Box H-matrix as a length-9 `Float64Array` (column-major:
|
|
5944
|
+
* `[col0_x, col0_y, col0_z, col1_x, col1_y, col1_z, col2_x, col2_y, col2_z]`),
|
|
5945
|
+
* or `undefined` if the frame has no simbox.
|
|
5946
|
+
*
|
|
5947
|
+
* Returned by VALUE — the typed array is owned by JS and is
|
|
5948
|
+
* stable across subsequent wasm calls.
|
|
5949
|
+
* @returns {Float64Array | undefined}
|
|
5950
|
+
*/
|
|
5951
|
+
simboxH() {
|
|
5952
|
+
const ret = wasm.wasmpdbstream_simboxH(this.__wbg_ptr);
|
|
5953
|
+
let v1;
|
|
5954
|
+
if (ret[0] !== 0) {
|
|
5955
|
+
v1 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
5956
|
+
wasm.__wbindgen_free_command_export(ret[0], ret[1] * 8, 8);
|
|
5957
|
+
}
|
|
5958
|
+
return v1;
|
|
5959
|
+
}
|
|
5960
|
+
/**
|
|
5961
|
+
* Box origin as a length-3 `Float64Array`, or `undefined` if
|
|
5962
|
+
* the frame has no simbox.
|
|
5963
|
+
* @returns {Float64Array | undefined}
|
|
5964
|
+
*/
|
|
5965
|
+
simboxOrigin() {
|
|
5966
|
+
const ret = wasm.wasmpdbstream_simboxOrigin(this.__wbg_ptr);
|
|
5967
|
+
let v1;
|
|
5968
|
+
if (ret[0] !== 0) {
|
|
5969
|
+
v1 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
5970
|
+
wasm.__wbindgen_free_command_export(ret[0], ret[1] * 8, 8);
|
|
5971
|
+
}
|
|
5972
|
+
return v1;
|
|
5973
|
+
}
|
|
5974
|
+
/**
|
|
5975
|
+
* Per-axis PBC flags as a length-3 `Uint8Array` (`1` = periodic,
|
|
5976
|
+
* `0` = open), or `undefined` if the frame has no simbox.
|
|
5977
|
+
*
|
|
5978
|
+
* (wasm-bindgen does not support `[bool; 3]` returns natively,
|
|
5979
|
+
* hence the `Uint8Array` wire format. The spec calls for
|
|
5980
|
+
* `[boolean, boolean, boolean]`; the JS side is expected to
|
|
5981
|
+
* `Boolean(arr[i])` each entry.)
|
|
5982
|
+
* @returns {Uint8Array | undefined}
|
|
5983
|
+
*/
|
|
5984
|
+
simboxPbc() {
|
|
5985
|
+
const ret = wasm.wasmpdbstream_simboxPbc(this.__wbg_ptr);
|
|
5986
|
+
let v1;
|
|
5987
|
+
if (ret[0] !== 0) {
|
|
5988
|
+
v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
5989
|
+
wasm.__wbindgen_free_command_export(ret[0], ret[1] * 1, 1);
|
|
5990
|
+
}
|
|
5991
|
+
return v1;
|
|
5992
|
+
}
|
|
5993
|
+
}
|
|
5994
|
+
if (Symbol.dispose) WasmPdbStream.prototype[Symbol.dispose] = WasmPdbStream.prototype.free;
|
|
5995
|
+
|
|
5996
|
+
export class WasmSdfStream {
|
|
5997
|
+
__destroy_into_raw() {
|
|
5998
|
+
const ptr = this.__wbg_ptr;
|
|
5999
|
+
this.__wbg_ptr = 0;
|
|
6000
|
+
WasmSdfStreamFinalization.unregister(this);
|
|
6001
|
+
return ptr;
|
|
6002
|
+
}
|
|
6003
|
+
free() {
|
|
6004
|
+
const ptr = this.__destroy_into_raw();
|
|
6005
|
+
wasm.__wbg_wasmsdfstream_free(ptr, 0);
|
|
6006
|
+
}
|
|
6007
|
+
/**
|
|
6008
|
+
* Resize the reusable input buffer so it can hold at least
|
|
6009
|
+
* `len` bytes, and return the WASM linear-memory pointer to
|
|
6010
|
+
* its first byte.
|
|
6011
|
+
*
|
|
6012
|
+
* CALLER MUST RE-DERIVE THIS POINTER AFTER ANY OTHER WASM CALL —
|
|
6013
|
+
* `wasm.memory.buffer` may have been detached by a `memory.grow`.
|
|
6014
|
+
* @param {number} len
|
|
6015
|
+
* @returns {number}
|
|
6016
|
+
*/
|
|
6017
|
+
allocInputBuffer(len) {
|
|
6018
|
+
const ret = wasm.wasmsdfstream_allocInputBuffer(this.__wbg_ptr, len);
|
|
6019
|
+
return ret >>> 0;
|
|
6020
|
+
}
|
|
6021
|
+
/**
|
|
6022
|
+
* Number of blocks in the most recently parsed frame.
|
|
6023
|
+
* @returns {number}
|
|
6024
|
+
*/
|
|
6025
|
+
blockCount() {
|
|
6026
|
+
const ret = wasm.wasmsdfstream_blockCount(this.__wbg_ptr);
|
|
6027
|
+
return ret >>> 0;
|
|
6028
|
+
}
|
|
6029
|
+
/**
|
|
6030
|
+
* Name of block `blockIdx`, or empty string if out of range.
|
|
6031
|
+
* @param {number} block_idx
|
|
6032
|
+
* @returns {string}
|
|
6033
|
+
*/
|
|
6034
|
+
blockName(block_idx) {
|
|
6035
|
+
let deferred1_0;
|
|
6036
|
+
let deferred1_1;
|
|
6037
|
+
try {
|
|
6038
|
+
const ret = wasm.wasmsdfstream_blockName(this.__wbg_ptr, block_idx);
|
|
6039
|
+
deferred1_0 = ret[0];
|
|
6040
|
+
deferred1_1 = ret[1];
|
|
6041
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
6042
|
+
} finally {
|
|
6043
|
+
wasm.__wbindgen_free_command_export(deferred1_0, deferred1_1, 1);
|
|
6044
|
+
}
|
|
6045
|
+
}
|
|
6046
|
+
/**
|
|
6047
|
+
* Number of columns in block `blockIdx`.
|
|
6048
|
+
* @param {number} block_idx
|
|
6049
|
+
* @returns {number}
|
|
6050
|
+
*/
|
|
6051
|
+
columnCount(block_idx) {
|
|
6052
|
+
const ret = wasm.wasmsdfstream_columnCount(this.__wbg_ptr, block_idx);
|
|
6053
|
+
return ret >>> 0;
|
|
6054
|
+
}
|
|
6055
|
+
/**
|
|
6056
|
+
* Column dtype string at `(blockIdx, colIdx)`. One of `"f64"`,
|
|
6057
|
+
* `"u32"`, `"i32"`, `"string"` — or `"bool"` / `"u8"` if a
|
|
6058
|
+
* future parser emits those (current streaming formats do not).
|
|
6059
|
+
* Empty string if the index is out of range.
|
|
6060
|
+
* @param {number} block_idx
|
|
6061
|
+
* @param {number} col_idx
|
|
6062
|
+
* @returns {string}
|
|
6063
|
+
*/
|
|
6064
|
+
columnDtype(block_idx, col_idx) {
|
|
6065
|
+
let deferred1_0;
|
|
6066
|
+
let deferred1_1;
|
|
6067
|
+
try {
|
|
6068
|
+
const ret = wasm.wasmsdfstream_columnDtype(this.__wbg_ptr, block_idx, col_idx);
|
|
6069
|
+
deferred1_0 = ret[0];
|
|
6070
|
+
deferred1_1 = ret[1];
|
|
6071
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
6072
|
+
} finally {
|
|
6073
|
+
wasm.__wbindgen_free_command_export(deferred1_0, deferred1_1, 1);
|
|
6074
|
+
}
|
|
6075
|
+
}
|
|
6076
|
+
/**
|
|
6077
|
+
* Total flat element count of the column. For multi-dimensional
|
|
6078
|
+
* columns (e.g. an Nx3 positions array) this is the product of
|
|
6079
|
+
* all axes — i.e. the length of the slice the matching
|
|
6080
|
+
* `columnPtr*` points at.
|
|
6081
|
+
* @param {number} block_idx
|
|
6082
|
+
* @param {number} col_idx
|
|
6083
|
+
* @returns {number}
|
|
6084
|
+
*/
|
|
6085
|
+
columnLen(block_idx, col_idx) {
|
|
6086
|
+
const ret = wasm.wasmsdfstream_columnLen(this.__wbg_ptr, block_idx, col_idx);
|
|
6087
|
+
return ret >>> 0;
|
|
6088
|
+
}
|
|
6089
|
+
/**
|
|
6090
|
+
* Column name at `(blockIdx, colIdx)`, or empty string if
|
|
6091
|
+
* either index is out of range.
|
|
6092
|
+
* @param {number} block_idx
|
|
6093
|
+
* @param {number} col_idx
|
|
6094
|
+
* @returns {string}
|
|
6095
|
+
*/
|
|
6096
|
+
columnName(block_idx, col_idx) {
|
|
6097
|
+
let deferred1_0;
|
|
6098
|
+
let deferred1_1;
|
|
6099
|
+
try {
|
|
6100
|
+
const ret = wasm.wasmsdfstream_columnName(this.__wbg_ptr, block_idx, col_idx);
|
|
6101
|
+
deferred1_0 = ret[0];
|
|
6102
|
+
deferred1_1 = ret[1];
|
|
6103
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
6104
|
+
} finally {
|
|
6105
|
+
wasm.__wbindgen_free_command_export(deferred1_0, deferred1_1, 1);
|
|
6106
|
+
}
|
|
6107
|
+
}
|
|
6108
|
+
/**
|
|
6109
|
+
* Pointer to the contiguous `f64` slice backing this column,
|
|
6110
|
+
* or 0 (null) if the column is missing or has the wrong
|
|
6111
|
+
* dtype.
|
|
6112
|
+
*
|
|
6113
|
+
* **Lifetime**: valid only until the next non-trivial wasm
|
|
6114
|
+
* call. See the module-level memory-grow contract.
|
|
6115
|
+
* @param {number} block_idx
|
|
6116
|
+
* @param {number} col_idx
|
|
6117
|
+
* @returns {number}
|
|
6118
|
+
*/
|
|
6119
|
+
columnPtrF64(block_idx, col_idx) {
|
|
6120
|
+
const ret = wasm.wasmsdfstream_columnPtrF64(this.__wbg_ptr, block_idx, col_idx);
|
|
6121
|
+
return ret >>> 0;
|
|
6122
|
+
}
|
|
6123
|
+
/**
|
|
6124
|
+
* Pointer to the contiguous `i32` slice backing this column,
|
|
6125
|
+
* or 0 (null) if the column is missing or has the wrong
|
|
6126
|
+
* dtype.
|
|
6127
|
+
*
|
|
6128
|
+
* **Lifetime**: valid only until the next non-trivial wasm
|
|
6129
|
+
* call. See the module-level memory-grow contract.
|
|
6130
|
+
* @param {number} block_idx
|
|
6131
|
+
* @param {number} col_idx
|
|
6132
|
+
* @returns {number}
|
|
6133
|
+
*/
|
|
6134
|
+
columnPtrI32(block_idx, col_idx) {
|
|
6135
|
+
const ret = wasm.wasmsdfstream_columnPtrI32(this.__wbg_ptr, block_idx, col_idx);
|
|
6136
|
+
return ret >>> 0;
|
|
6137
|
+
}
|
|
6138
|
+
/**
|
|
6139
|
+
* Pointer to the contiguous `u32` slice backing this column,
|
|
6140
|
+
* or 0 (null) if the column is missing or has the wrong
|
|
6141
|
+
* dtype.
|
|
6142
|
+
*
|
|
6143
|
+
* **Lifetime**: valid only until the next non-trivial wasm
|
|
6144
|
+
* call. See the module-level memory-grow contract.
|
|
6145
|
+
* @param {number} block_idx
|
|
6146
|
+
* @param {number} col_idx
|
|
6147
|
+
* @returns {number}
|
|
6148
|
+
*/
|
|
6149
|
+
columnPtrU32(block_idx, col_idx) {
|
|
6150
|
+
const ret = wasm.wasmsdfstream_columnPtrU32(this.__wbg_ptr, block_idx, col_idx);
|
|
6151
|
+
return ret >>> 0;
|
|
6152
|
+
}
|
|
6153
|
+
/**
|
|
6154
|
+
* Copy a string column out by value. Returns an empty array
|
|
6155
|
+
* if the column is missing or not a string column.
|
|
6156
|
+
* @param {number} block_idx
|
|
6157
|
+
* @param {number} col_idx
|
|
6158
|
+
* @returns {string[]}
|
|
6159
|
+
*/
|
|
6160
|
+
columnStrings(block_idx, col_idx) {
|
|
6161
|
+
const ret = wasm.wasmsdfstream_columnStrings(this.__wbg_ptr, block_idx, col_idx);
|
|
6162
|
+
var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
|
|
6163
|
+
wasm.__wbindgen_free_command_export(ret[0], ret[1] * 4, 4);
|
|
6164
|
+
return v1;
|
|
6165
|
+
}
|
|
6166
|
+
/**
|
|
6167
|
+
* Feed the first `len` bytes of the input buffer into the
|
|
6168
|
+
* indexer at absolute source offset `globalOffset`. Returns
|
|
6169
|
+
* any frame entries that became finalized as a result.
|
|
6170
|
+
*
|
|
6171
|
+
* `globalOffset` is round-tripped through `f64`; per the
|
|
6172
|
+
* streaming protocol the source size is capped at 1 TB
|
|
6173
|
+
* (well within `Number.MAX_SAFE_INTEGER`).
|
|
6174
|
+
* @param {number} global_offset
|
|
6175
|
+
* @param {number} len
|
|
6176
|
+
* @returns {FrameIndexEntry[]}
|
|
6177
|
+
*/
|
|
6178
|
+
feedIndexChunk(global_offset, len) {
|
|
6179
|
+
const ret = wasm.wasmsdfstream_feedIndexChunk(this.__wbg_ptr, global_offset, len);
|
|
6180
|
+
if (ret[3]) {
|
|
6181
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
6182
|
+
}
|
|
6183
|
+
var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
|
|
6184
|
+
wasm.__wbindgen_free_command_export(ret[0], ret[1] * 4, 4);
|
|
6185
|
+
return v1;
|
|
6186
|
+
}
|
|
6187
|
+
/**
|
|
6188
|
+
* Signal end-of-stream; return any trailing frame entry. The
|
|
6189
|
+
* indexer is consumed and further `feedIndexChunk` calls
|
|
6190
|
+
* throw.
|
|
6191
|
+
* @returns {FrameIndexEntry[]}
|
|
6192
|
+
*/
|
|
6193
|
+
finishIndex() {
|
|
6194
|
+
const ret = wasm.wasmsdfstream_finishIndex(this.__wbg_ptr);
|
|
6195
|
+
if (ret[3]) {
|
|
6196
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
6197
|
+
}
|
|
6198
|
+
var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
|
|
6199
|
+
wasm.__wbindgen_free_command_export(ret[0], ret[1] * 4, 4);
|
|
6200
|
+
return v1;
|
|
6201
|
+
}
|
|
6202
|
+
/**
|
|
6203
|
+
* Number of named scalar arrays in grid `gridIdx`.
|
|
6204
|
+
* @param {number} grid_idx
|
|
6205
|
+
* @returns {number}
|
|
6206
|
+
*/
|
|
6207
|
+
gridArrayCount(grid_idx) {
|
|
6208
|
+
const ret = wasm.wasmsdfstream_gridArrayCount(this.__wbg_ptr, grid_idx);
|
|
6209
|
+
return ret >>> 0;
|
|
6210
|
+
}
|
|
6211
|
+
/**
|
|
6212
|
+
* Length (number of `f64` elements) of the grid scalar field.
|
|
6213
|
+
* @param {number} grid_idx
|
|
6214
|
+
* @param {number} array_idx
|
|
6215
|
+
* @returns {number}
|
|
6216
|
+
*/
|
|
6217
|
+
gridArrayLen(grid_idx, array_idx) {
|
|
6218
|
+
const ret = wasm.wasmsdfstream_gridArrayLen(this.__wbg_ptr, grid_idx, array_idx);
|
|
6219
|
+
return ret >>> 0;
|
|
6220
|
+
}
|
|
6221
|
+
/**
|
|
6222
|
+
* Name of scalar array `(gridIdx, arrayIdx)`, or empty string
|
|
6223
|
+
* if either index is out of range.
|
|
6224
|
+
* @param {number} grid_idx
|
|
6225
|
+
* @param {number} array_idx
|
|
6226
|
+
* @returns {string}
|
|
6227
|
+
*/
|
|
6228
|
+
gridArrayName(grid_idx, array_idx) {
|
|
6229
|
+
let deferred1_0;
|
|
6230
|
+
let deferred1_1;
|
|
6231
|
+
try {
|
|
6232
|
+
const ret = wasm.wasmsdfstream_gridArrayName(this.__wbg_ptr, grid_idx, array_idx);
|
|
6233
|
+
deferred1_0 = ret[0];
|
|
6234
|
+
deferred1_1 = ret[1];
|
|
6235
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
6236
|
+
} finally {
|
|
6237
|
+
wasm.__wbindgen_free_command_export(deferred1_0, deferred1_1, 1);
|
|
6238
|
+
}
|
|
6239
|
+
}
|
|
6240
|
+
/**
|
|
6241
|
+
* Pointer to the contiguous `f64` slice backing the grid
|
|
6242
|
+
* scalar field, or 0 (null) if either index is out of range.
|
|
6243
|
+
*
|
|
6244
|
+
* **Lifetime**: valid only until the next non-trivial wasm
|
|
6245
|
+
* call. See the module-level memory-grow contract.
|
|
6246
|
+
* @param {number} grid_idx
|
|
6247
|
+
* @param {number} array_idx
|
|
6248
|
+
* @returns {number}
|
|
6249
|
+
*/
|
|
6250
|
+
gridArrayPtrF64(grid_idx, array_idx) {
|
|
6251
|
+
const ret = wasm.wasmsdfstream_gridArrayPtrF64(this.__wbg_ptr, grid_idx, array_idx);
|
|
6252
|
+
return ret >>> 0;
|
|
6253
|
+
}
|
|
6254
|
+
/**
|
|
6255
|
+
* Grid lattice cell as a length-9 `Float64Array` (column-major:
|
|
6256
|
+
* `[col0_x, col0_y, col0_z, col1_x, col1_y, col1_z, col2_x, col2_y, col2_z]`).
|
|
6257
|
+
* @param {number} grid_idx
|
|
6258
|
+
* @returns {Float64Array}
|
|
6259
|
+
*/
|
|
6260
|
+
gridCell(grid_idx) {
|
|
6261
|
+
const ret = wasm.wasmsdfstream_gridCell(this.__wbg_ptr, grid_idx);
|
|
6262
|
+
var v1 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
6263
|
+
wasm.__wbindgen_free_command_export(ret[0], ret[1] * 8, 8);
|
|
6264
|
+
return v1;
|
|
6265
|
+
}
|
|
6266
|
+
/**
|
|
6267
|
+
* Number of named grids attached to the current frame.
|
|
6268
|
+
* @returns {number}
|
|
6269
|
+
*/
|
|
6270
|
+
gridCount() {
|
|
6271
|
+
const ret = wasm.wasmsdfstream_gridCount(this.__wbg_ptr);
|
|
6272
|
+
return ret >>> 0;
|
|
6273
|
+
}
|
|
6274
|
+
/**
|
|
6275
|
+
* Name of grid `gridIdx`, or empty string if out of range.
|
|
6276
|
+
* @param {number} grid_idx
|
|
6277
|
+
* @returns {string}
|
|
6278
|
+
*/
|
|
6279
|
+
gridName(grid_idx) {
|
|
6280
|
+
let deferred1_0;
|
|
6281
|
+
let deferred1_1;
|
|
6282
|
+
try {
|
|
6283
|
+
const ret = wasm.wasmsdfstream_gridName(this.__wbg_ptr, grid_idx);
|
|
6284
|
+
deferred1_0 = ret[0];
|
|
6285
|
+
deferred1_1 = ret[1];
|
|
6286
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
6287
|
+
} finally {
|
|
6288
|
+
wasm.__wbindgen_free_command_export(deferred1_0, deferred1_1, 1);
|
|
6289
|
+
}
|
|
6290
|
+
}
|
|
6291
|
+
/**
|
|
6292
|
+
* Grid origin (Cartesian, Å) as a length-3 `Float64Array`.
|
|
6293
|
+
* @param {number} grid_idx
|
|
6294
|
+
* @returns {Float64Array}
|
|
6295
|
+
*/
|
|
6296
|
+
gridOrigin(grid_idx) {
|
|
6297
|
+
const ret = wasm.wasmsdfstream_gridOrigin(this.__wbg_ptr, grid_idx);
|
|
6298
|
+
var v1 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
6299
|
+
wasm.__wbindgen_free_command_export(ret[0], ret[1] * 8, 8);
|
|
6300
|
+
return v1;
|
|
6301
|
+
}
|
|
6302
|
+
/**
|
|
6303
|
+
* Grid PBC flags as a length-3 `Uint8Array` (`1` = periodic,
|
|
6304
|
+
* `0` = open).
|
|
6305
|
+
* @param {number} grid_idx
|
|
6306
|
+
* @returns {Uint8Array}
|
|
6307
|
+
*/
|
|
6308
|
+
gridPbc(grid_idx) {
|
|
6309
|
+
const ret = wasm.wasmsdfstream_gridPbc(this.__wbg_ptr, grid_idx);
|
|
6310
|
+
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
6311
|
+
wasm.__wbindgen_free_command_export(ret[0], ret[1] * 1, 1);
|
|
6312
|
+
return v1;
|
|
6313
|
+
}
|
|
6314
|
+
/**
|
|
6315
|
+
* Grid dimensions `[nx, ny, nz]` as a length-3 `Uint32Array`.
|
|
6316
|
+
* @param {number} grid_idx
|
|
6317
|
+
* @returns {Uint32Array}
|
|
6318
|
+
*/
|
|
6319
|
+
gridShape(grid_idx) {
|
|
6320
|
+
const ret = wasm.wasmsdfstream_gridShape(this.__wbg_ptr, grid_idx);
|
|
6321
|
+
var v1 = getArrayU32FromWasm0(ret[0], ret[1]).slice();
|
|
6322
|
+
wasm.__wbindgen_free_command_export(ret[0], ret[1] * 4, 4);
|
|
6323
|
+
return v1;
|
|
6324
|
+
}
|
|
6325
|
+
/**
|
|
6326
|
+
* Current capacity (in bytes) of the reusable input buffer.
|
|
6327
|
+
* @returns {number}
|
|
6328
|
+
*/
|
|
6329
|
+
inputCapacity() {
|
|
6330
|
+
const ret = wasm.wasmsdfstream_inputCapacity(this.__wbg_ptr);
|
|
6331
|
+
return ret >>> 0;
|
|
6332
|
+
}
|
|
6333
|
+
/**
|
|
6334
|
+
* Create a new streaming reader. The reusable input buffer
|
|
6335
|
+
* starts empty; call [`allocInputBuffer`] before feeding data.
|
|
6336
|
+
*/
|
|
6337
|
+
constructor() {
|
|
6338
|
+
const ret = wasm.wasmsdfstream_new();
|
|
6339
|
+
this.__wbg_ptr = ret;
|
|
6340
|
+
WasmSdfStreamFinalization.register(this, this.__wbg_ptr, this);
|
|
6341
|
+
return this;
|
|
6342
|
+
}
|
|
6343
|
+
/**
|
|
6344
|
+
* Decode the byte range `[offset, offset + len)` from the
|
|
6345
|
+
* reusable input buffer as a single frame. Replaces any
|
|
6346
|
+
* previously cached output; the caller must extract data
|
|
6347
|
+
* before the next `parseRangeInInput` (the same buffer can
|
|
6348
|
+
* be overwritten in between).
|
|
6349
|
+
* @param {number} offset
|
|
6350
|
+
* @param {number} len
|
|
6351
|
+
*/
|
|
6352
|
+
parseRangeInInput(offset, len) {
|
|
6353
|
+
const ret = wasm.wasmsdfstream_parseRangeInInput(this.__wbg_ptr, offset, len);
|
|
6354
|
+
if (ret[1]) {
|
|
6355
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
6356
|
+
}
|
|
6357
|
+
}
|
|
6358
|
+
/**
|
|
6359
|
+
* Drop the cached output frame, releasing its memory and
|
|
6360
|
+
* invalidating any outstanding `columnPtr*` / `gridArrayPtr*`
|
|
6361
|
+
* pointers. Subsequent extraction calls return 0 / empty
|
|
6362
|
+
* until the next `parseRangeInInput`.
|
|
6363
|
+
*/
|
|
6364
|
+
releaseFrame() {
|
|
6365
|
+
wasm.wasmsdfstream_releaseFrame(this.__wbg_ptr);
|
|
6366
|
+
}
|
|
6367
|
+
/**
|
|
6368
|
+
* Box H-matrix as a length-9 `Float64Array` (column-major:
|
|
6369
|
+
* `[col0_x, col0_y, col0_z, col1_x, col1_y, col1_z, col2_x, col2_y, col2_z]`),
|
|
6370
|
+
* or `undefined` if the frame has no simbox.
|
|
6371
|
+
*
|
|
6372
|
+
* Returned by VALUE — the typed array is owned by JS and is
|
|
6373
|
+
* stable across subsequent wasm calls.
|
|
6374
|
+
* @returns {Float64Array | undefined}
|
|
6375
|
+
*/
|
|
6376
|
+
simboxH() {
|
|
6377
|
+
const ret = wasm.wasmsdfstream_simboxH(this.__wbg_ptr);
|
|
6378
|
+
let v1;
|
|
6379
|
+
if (ret[0] !== 0) {
|
|
6380
|
+
v1 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
6381
|
+
wasm.__wbindgen_free_command_export(ret[0], ret[1] * 8, 8);
|
|
6382
|
+
}
|
|
6383
|
+
return v1;
|
|
6384
|
+
}
|
|
6385
|
+
/**
|
|
6386
|
+
* Box origin as a length-3 `Float64Array`, or `undefined` if
|
|
6387
|
+
* the frame has no simbox.
|
|
6388
|
+
* @returns {Float64Array | undefined}
|
|
6389
|
+
*/
|
|
6390
|
+
simboxOrigin() {
|
|
6391
|
+
const ret = wasm.wasmsdfstream_simboxOrigin(this.__wbg_ptr);
|
|
6392
|
+
let v1;
|
|
6393
|
+
if (ret[0] !== 0) {
|
|
6394
|
+
v1 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
6395
|
+
wasm.__wbindgen_free_command_export(ret[0], ret[1] * 8, 8);
|
|
6396
|
+
}
|
|
6397
|
+
return v1;
|
|
6398
|
+
}
|
|
6399
|
+
/**
|
|
6400
|
+
* Per-axis PBC flags as a length-3 `Uint8Array` (`1` = periodic,
|
|
6401
|
+
* `0` = open), or `undefined` if the frame has no simbox.
|
|
6402
|
+
*
|
|
6403
|
+
* (wasm-bindgen does not support `[bool; 3]` returns natively,
|
|
6404
|
+
* hence the `Uint8Array` wire format. The spec calls for
|
|
6405
|
+
* `[boolean, boolean, boolean]`; the JS side is expected to
|
|
6406
|
+
* `Boolean(arr[i])` each entry.)
|
|
6407
|
+
* @returns {Uint8Array | undefined}
|
|
6408
|
+
*/
|
|
6409
|
+
simboxPbc() {
|
|
6410
|
+
const ret = wasm.wasmsdfstream_simboxPbc(this.__wbg_ptr);
|
|
6411
|
+
let v1;
|
|
6412
|
+
if (ret[0] !== 0) {
|
|
6413
|
+
v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
6414
|
+
wasm.__wbindgen_free_command_export(ret[0], ret[1] * 1, 1);
|
|
6415
|
+
}
|
|
6416
|
+
return v1;
|
|
6417
|
+
}
|
|
6418
|
+
}
|
|
6419
|
+
if (Symbol.dispose) WasmSdfStream.prototype[Symbol.dispose] = WasmSdfStream.prototype.free;
|
|
6420
|
+
|
|
6421
|
+
export class WasmXyzStream {
|
|
6422
|
+
__destroy_into_raw() {
|
|
6423
|
+
const ptr = this.__wbg_ptr;
|
|
6424
|
+
this.__wbg_ptr = 0;
|
|
6425
|
+
WasmXyzStreamFinalization.unregister(this);
|
|
6426
|
+
return ptr;
|
|
6427
|
+
}
|
|
6428
|
+
free() {
|
|
6429
|
+
const ptr = this.__destroy_into_raw();
|
|
6430
|
+
wasm.__wbg_wasmxyzstream_free(ptr, 0);
|
|
6431
|
+
}
|
|
6432
|
+
/**
|
|
6433
|
+
* Resize the reusable input buffer so it can hold at least
|
|
6434
|
+
* `len` bytes, and return the WASM linear-memory pointer to
|
|
6435
|
+
* its first byte.
|
|
6436
|
+
*
|
|
6437
|
+
* CALLER MUST RE-DERIVE THIS POINTER AFTER ANY OTHER WASM CALL —
|
|
6438
|
+
* `wasm.memory.buffer` may have been detached by a `memory.grow`.
|
|
6439
|
+
* @param {number} len
|
|
6440
|
+
* @returns {number}
|
|
6441
|
+
*/
|
|
6442
|
+
allocInputBuffer(len) {
|
|
6443
|
+
const ret = wasm.wasmxyzstream_allocInputBuffer(this.__wbg_ptr, len);
|
|
6444
|
+
return ret >>> 0;
|
|
6445
|
+
}
|
|
6446
|
+
/**
|
|
6447
|
+
* Number of blocks in the most recently parsed frame.
|
|
6448
|
+
* @returns {number}
|
|
6449
|
+
*/
|
|
6450
|
+
blockCount() {
|
|
6451
|
+
const ret = wasm.wasmxyzstream_blockCount(this.__wbg_ptr);
|
|
6452
|
+
return ret >>> 0;
|
|
6453
|
+
}
|
|
6454
|
+
/**
|
|
6455
|
+
* Name of block `blockIdx`, or empty string if out of range.
|
|
6456
|
+
* @param {number} block_idx
|
|
6457
|
+
* @returns {string}
|
|
6458
|
+
*/
|
|
6459
|
+
blockName(block_idx) {
|
|
6460
|
+
let deferred1_0;
|
|
6461
|
+
let deferred1_1;
|
|
6462
|
+
try {
|
|
6463
|
+
const ret = wasm.wasmxyzstream_blockName(this.__wbg_ptr, block_idx);
|
|
6464
|
+
deferred1_0 = ret[0];
|
|
6465
|
+
deferred1_1 = ret[1];
|
|
6466
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
6467
|
+
} finally {
|
|
6468
|
+
wasm.__wbindgen_free_command_export(deferred1_0, deferred1_1, 1);
|
|
6469
|
+
}
|
|
6470
|
+
}
|
|
6471
|
+
/**
|
|
6472
|
+
* Number of columns in block `blockIdx`.
|
|
6473
|
+
* @param {number} block_idx
|
|
6474
|
+
* @returns {number}
|
|
6475
|
+
*/
|
|
6476
|
+
columnCount(block_idx) {
|
|
6477
|
+
const ret = wasm.wasmxyzstream_columnCount(this.__wbg_ptr, block_idx);
|
|
6478
|
+
return ret >>> 0;
|
|
6479
|
+
}
|
|
6480
|
+
/**
|
|
6481
|
+
* Column dtype string at `(blockIdx, colIdx)`. One of `"f64"`,
|
|
6482
|
+
* `"u32"`, `"i32"`, `"string"` — or `"bool"` / `"u8"` if a
|
|
6483
|
+
* future parser emits those (current streaming formats do not).
|
|
6484
|
+
* Empty string if the index is out of range.
|
|
6485
|
+
* @param {number} block_idx
|
|
6486
|
+
* @param {number} col_idx
|
|
6487
|
+
* @returns {string}
|
|
6488
|
+
*/
|
|
6489
|
+
columnDtype(block_idx, col_idx) {
|
|
6490
|
+
let deferred1_0;
|
|
6491
|
+
let deferred1_1;
|
|
6492
|
+
try {
|
|
6493
|
+
const ret = wasm.wasmxyzstream_columnDtype(this.__wbg_ptr, block_idx, col_idx);
|
|
6494
|
+
deferred1_0 = ret[0];
|
|
6495
|
+
deferred1_1 = ret[1];
|
|
6496
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
6497
|
+
} finally {
|
|
6498
|
+
wasm.__wbindgen_free_command_export(deferred1_0, deferred1_1, 1);
|
|
6499
|
+
}
|
|
6500
|
+
}
|
|
6501
|
+
/**
|
|
6502
|
+
* Total flat element count of the column. For multi-dimensional
|
|
6503
|
+
* columns (e.g. an Nx3 positions array) this is the product of
|
|
6504
|
+
* all axes — i.e. the length of the slice the matching
|
|
6505
|
+
* `columnPtr*` points at.
|
|
6506
|
+
* @param {number} block_idx
|
|
6507
|
+
* @param {number} col_idx
|
|
6508
|
+
* @returns {number}
|
|
6509
|
+
*/
|
|
6510
|
+
columnLen(block_idx, col_idx) {
|
|
6511
|
+
const ret = wasm.wasmxyzstream_columnLen(this.__wbg_ptr, block_idx, col_idx);
|
|
6512
|
+
return ret >>> 0;
|
|
6513
|
+
}
|
|
6514
|
+
/**
|
|
6515
|
+
* Column name at `(blockIdx, colIdx)`, or empty string if
|
|
6516
|
+
* either index is out of range.
|
|
6517
|
+
* @param {number} block_idx
|
|
6518
|
+
* @param {number} col_idx
|
|
6519
|
+
* @returns {string}
|
|
6520
|
+
*/
|
|
6521
|
+
columnName(block_idx, col_idx) {
|
|
6522
|
+
let deferred1_0;
|
|
6523
|
+
let deferred1_1;
|
|
6524
|
+
try {
|
|
6525
|
+
const ret = wasm.wasmxyzstream_columnName(this.__wbg_ptr, block_idx, col_idx);
|
|
6526
|
+
deferred1_0 = ret[0];
|
|
6527
|
+
deferred1_1 = ret[1];
|
|
6528
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
6529
|
+
} finally {
|
|
6530
|
+
wasm.__wbindgen_free_command_export(deferred1_0, deferred1_1, 1);
|
|
6531
|
+
}
|
|
6532
|
+
}
|
|
6533
|
+
/**
|
|
6534
|
+
* Pointer to the contiguous `f64` slice backing this column,
|
|
6535
|
+
* or 0 (null) if the column is missing or has the wrong
|
|
6536
|
+
* dtype.
|
|
6537
|
+
*
|
|
6538
|
+
* **Lifetime**: valid only until the next non-trivial wasm
|
|
6539
|
+
* call. See the module-level memory-grow contract.
|
|
6540
|
+
* @param {number} block_idx
|
|
6541
|
+
* @param {number} col_idx
|
|
6542
|
+
* @returns {number}
|
|
6543
|
+
*/
|
|
6544
|
+
columnPtrF64(block_idx, col_idx) {
|
|
6545
|
+
const ret = wasm.wasmxyzstream_columnPtrF64(this.__wbg_ptr, block_idx, col_idx);
|
|
6546
|
+
return ret >>> 0;
|
|
6547
|
+
}
|
|
6548
|
+
/**
|
|
6549
|
+
* Pointer to the contiguous `i32` slice backing this column,
|
|
6550
|
+
* or 0 (null) if the column is missing or has the wrong
|
|
6551
|
+
* dtype.
|
|
6552
|
+
*
|
|
6553
|
+
* **Lifetime**: valid only until the next non-trivial wasm
|
|
6554
|
+
* call. See the module-level memory-grow contract.
|
|
6555
|
+
* @param {number} block_idx
|
|
6556
|
+
* @param {number} col_idx
|
|
6557
|
+
* @returns {number}
|
|
6558
|
+
*/
|
|
6559
|
+
columnPtrI32(block_idx, col_idx) {
|
|
6560
|
+
const ret = wasm.wasmxyzstream_columnPtrI32(this.__wbg_ptr, block_idx, col_idx);
|
|
6561
|
+
return ret >>> 0;
|
|
6562
|
+
}
|
|
6563
|
+
/**
|
|
6564
|
+
* Pointer to the contiguous `u32` slice backing this column,
|
|
6565
|
+
* or 0 (null) if the column is missing or has the wrong
|
|
6566
|
+
* dtype.
|
|
6567
|
+
*
|
|
6568
|
+
* **Lifetime**: valid only until the next non-trivial wasm
|
|
6569
|
+
* call. See the module-level memory-grow contract.
|
|
6570
|
+
* @param {number} block_idx
|
|
6571
|
+
* @param {number} col_idx
|
|
6572
|
+
* @returns {number}
|
|
6573
|
+
*/
|
|
6574
|
+
columnPtrU32(block_idx, col_idx) {
|
|
6575
|
+
const ret = wasm.wasmxyzstream_columnPtrU32(this.__wbg_ptr, block_idx, col_idx);
|
|
6576
|
+
return ret >>> 0;
|
|
6577
|
+
}
|
|
6578
|
+
/**
|
|
6579
|
+
* Copy a string column out by value. Returns an empty array
|
|
6580
|
+
* if the column is missing or not a string column.
|
|
6581
|
+
* @param {number} block_idx
|
|
6582
|
+
* @param {number} col_idx
|
|
6583
|
+
* @returns {string[]}
|
|
6584
|
+
*/
|
|
6585
|
+
columnStrings(block_idx, col_idx) {
|
|
6586
|
+
const ret = wasm.wasmxyzstream_columnStrings(this.__wbg_ptr, block_idx, col_idx);
|
|
6587
|
+
var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
|
|
6588
|
+
wasm.__wbindgen_free_command_export(ret[0], ret[1] * 4, 4);
|
|
6589
|
+
return v1;
|
|
6590
|
+
}
|
|
6591
|
+
/**
|
|
6592
|
+
* Feed the first `len` bytes of the input buffer into the
|
|
6593
|
+
* indexer at absolute source offset `globalOffset`. Returns
|
|
6594
|
+
* any frame entries that became finalized as a result.
|
|
6595
|
+
*
|
|
6596
|
+
* `globalOffset` is round-tripped through `f64`; per the
|
|
6597
|
+
* streaming protocol the source size is capped at 1 TB
|
|
6598
|
+
* (well within `Number.MAX_SAFE_INTEGER`).
|
|
6599
|
+
* @param {number} global_offset
|
|
6600
|
+
* @param {number} len
|
|
6601
|
+
* @returns {FrameIndexEntry[]}
|
|
6602
|
+
*/
|
|
6603
|
+
feedIndexChunk(global_offset, len) {
|
|
6604
|
+
const ret = wasm.wasmxyzstream_feedIndexChunk(this.__wbg_ptr, global_offset, len);
|
|
6605
|
+
if (ret[3]) {
|
|
6606
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
6607
|
+
}
|
|
6608
|
+
var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
|
|
6609
|
+
wasm.__wbindgen_free_command_export(ret[0], ret[1] * 4, 4);
|
|
6610
|
+
return v1;
|
|
6611
|
+
}
|
|
6612
|
+
/**
|
|
6613
|
+
* Signal end-of-stream; return any trailing frame entry. The
|
|
6614
|
+
* indexer is consumed and further `feedIndexChunk` calls
|
|
6615
|
+
* throw.
|
|
6616
|
+
* @returns {FrameIndexEntry[]}
|
|
6617
|
+
*/
|
|
6618
|
+
finishIndex() {
|
|
6619
|
+
const ret = wasm.wasmxyzstream_finishIndex(this.__wbg_ptr);
|
|
6620
|
+
if (ret[3]) {
|
|
6621
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
6622
|
+
}
|
|
6623
|
+
var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
|
|
6624
|
+
wasm.__wbindgen_free_command_export(ret[0], ret[1] * 4, 4);
|
|
6625
|
+
return v1;
|
|
6626
|
+
}
|
|
6627
|
+
/**
|
|
6628
|
+
* Number of named scalar arrays in grid `gridIdx`.
|
|
6629
|
+
* @param {number} grid_idx
|
|
6630
|
+
* @returns {number}
|
|
6631
|
+
*/
|
|
6632
|
+
gridArrayCount(grid_idx) {
|
|
6633
|
+
const ret = wasm.wasmxyzstream_gridArrayCount(this.__wbg_ptr, grid_idx);
|
|
6634
|
+
return ret >>> 0;
|
|
6635
|
+
}
|
|
6636
|
+
/**
|
|
6637
|
+
* Length (number of `f64` elements) of the grid scalar field.
|
|
6638
|
+
* @param {number} grid_idx
|
|
6639
|
+
* @param {number} array_idx
|
|
6640
|
+
* @returns {number}
|
|
6641
|
+
*/
|
|
6642
|
+
gridArrayLen(grid_idx, array_idx) {
|
|
6643
|
+
const ret = wasm.wasmxyzstream_gridArrayLen(this.__wbg_ptr, grid_idx, array_idx);
|
|
6644
|
+
return ret >>> 0;
|
|
6645
|
+
}
|
|
6646
|
+
/**
|
|
6647
|
+
* Name of scalar array `(gridIdx, arrayIdx)`, or empty string
|
|
6648
|
+
* if either index is out of range.
|
|
6649
|
+
* @param {number} grid_idx
|
|
6650
|
+
* @param {number} array_idx
|
|
6651
|
+
* @returns {string}
|
|
6652
|
+
*/
|
|
6653
|
+
gridArrayName(grid_idx, array_idx) {
|
|
6654
|
+
let deferred1_0;
|
|
6655
|
+
let deferred1_1;
|
|
6656
|
+
try {
|
|
6657
|
+
const ret = wasm.wasmxyzstream_gridArrayName(this.__wbg_ptr, grid_idx, array_idx);
|
|
6658
|
+
deferred1_0 = ret[0];
|
|
6659
|
+
deferred1_1 = ret[1];
|
|
6660
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
6661
|
+
} finally {
|
|
6662
|
+
wasm.__wbindgen_free_command_export(deferred1_0, deferred1_1, 1);
|
|
6663
|
+
}
|
|
6664
|
+
}
|
|
6665
|
+
/**
|
|
6666
|
+
* Pointer to the contiguous `f64` slice backing the grid
|
|
6667
|
+
* scalar field, or 0 (null) if either index is out of range.
|
|
4419
6668
|
*
|
|
4420
|
-
*
|
|
4421
|
-
*
|
|
4422
|
-
* @param {
|
|
4423
|
-
* @param {number}
|
|
4424
|
-
* @
|
|
4425
|
-
* @returns {Int32Array}
|
|
6669
|
+
* **Lifetime**: valid only until the next non-trivial wasm
|
|
6670
|
+
* call. See the module-level memory-grow contract.
|
|
6671
|
+
* @param {number} grid_idx
|
|
6672
|
+
* @param {number} array_idx
|
|
6673
|
+
* @returns {number}
|
|
4426
6674
|
*/
|
|
4427
|
-
|
|
4428
|
-
const
|
|
4429
|
-
|
|
4430
|
-
const ret = wasm.wasmkmeans_fit(this.__wbg_ptr, ptr0, len0, n_rows, n_dims);
|
|
4431
|
-
if (ret[2]) {
|
|
4432
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
4433
|
-
}
|
|
4434
|
-
return takeFromExternrefTable0(ret[0]);
|
|
6675
|
+
gridArrayPtrF64(grid_idx, array_idx) {
|
|
6676
|
+
const ret = wasm.wasmxyzstream_gridArrayPtrF64(this.__wbg_ptr, grid_idx, array_idx);
|
|
6677
|
+
return ret >>> 0;
|
|
4435
6678
|
}
|
|
4436
6679
|
/**
|
|
4437
|
-
*
|
|
4438
|
-
*
|
|
4439
|
-
*
|
|
4440
|
-
*
|
|
4441
|
-
* * `k` — number of clusters (>= 1).
|
|
4442
|
-
* * `max_iter` — maximum Lloyd iterations (>= 1).
|
|
4443
|
-
* * `seed` — RNG seed for k-means++ initialization. Cast to `u64`
|
|
4444
|
-
* internally (JS numbers are `f64`; integers up to 2^53 pass
|
|
4445
|
-
* through losslessly).
|
|
4446
|
-
*
|
|
4447
|
-
* # Errors
|
|
4448
|
-
*
|
|
4449
|
-
* Throws if `k == 0` or `max_iter == 0`.
|
|
4450
|
-
* @param {number} k
|
|
4451
|
-
* @param {number} max_iter
|
|
4452
|
-
* @param {number} seed
|
|
6680
|
+
* Grid lattice cell as a length-9 `Float64Array` (column-major:
|
|
6681
|
+
* `[col0_x, col0_y, col0_z, col1_x, col1_y, col1_z, col2_x, col2_y, col2_z]`).
|
|
6682
|
+
* @param {number} grid_idx
|
|
6683
|
+
* @returns {Float64Array}
|
|
4453
6684
|
*/
|
|
4454
|
-
|
|
4455
|
-
const ret = wasm.
|
|
4456
|
-
|
|
4457
|
-
|
|
6685
|
+
gridCell(grid_idx) {
|
|
6686
|
+
const ret = wasm.wasmxyzstream_gridCell(this.__wbg_ptr, grid_idx);
|
|
6687
|
+
var v1 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
6688
|
+
wasm.__wbindgen_free_command_export(ret[0], ret[1] * 8, 8);
|
|
6689
|
+
return v1;
|
|
6690
|
+
}
|
|
6691
|
+
/**
|
|
6692
|
+
* Number of named grids attached to the current frame.
|
|
6693
|
+
* @returns {number}
|
|
6694
|
+
*/
|
|
6695
|
+
gridCount() {
|
|
6696
|
+
const ret = wasm.wasmxyzstream_gridCount(this.__wbg_ptr);
|
|
6697
|
+
return ret >>> 0;
|
|
6698
|
+
}
|
|
6699
|
+
/**
|
|
6700
|
+
* Name of grid `gridIdx`, or empty string if out of range.
|
|
6701
|
+
* @param {number} grid_idx
|
|
6702
|
+
* @returns {string}
|
|
6703
|
+
*/
|
|
6704
|
+
gridName(grid_idx) {
|
|
6705
|
+
let deferred1_0;
|
|
6706
|
+
let deferred1_1;
|
|
6707
|
+
try {
|
|
6708
|
+
const ret = wasm.wasmxyzstream_gridName(this.__wbg_ptr, grid_idx);
|
|
6709
|
+
deferred1_0 = ret[0];
|
|
6710
|
+
deferred1_1 = ret[1];
|
|
6711
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
6712
|
+
} finally {
|
|
6713
|
+
wasm.__wbindgen_free_command_export(deferred1_0, deferred1_1, 1);
|
|
4458
6714
|
}
|
|
4459
|
-
this.__wbg_ptr = ret[0] >>> 0;
|
|
4460
|
-
WasmKMeansFinalization.register(this, this.__wbg_ptr, this);
|
|
4461
|
-
return this;
|
|
4462
6715
|
}
|
|
4463
|
-
|
|
4464
|
-
|
|
4465
|
-
|
|
4466
|
-
|
|
4467
|
-
|
|
4468
|
-
|
|
4469
|
-
|
|
4470
|
-
|
|
4471
|
-
*
|
|
4472
|
-
|
|
4473
|
-
* ```js
|
|
4474
|
-
* const pca = new WasmPca2();
|
|
4475
|
-
* const result = pca.fitTransform(matrix, nRows, nCols);
|
|
4476
|
-
* const coords = result.coords(); // Float64Array, length 2 * nRows
|
|
4477
|
-
* const variance = result.variance(); // Float64Array, length 2
|
|
4478
|
-
* ```
|
|
4479
|
-
*/
|
|
4480
|
-
export class WasmPca2 {
|
|
4481
|
-
__destroy_into_raw() {
|
|
4482
|
-
const ptr = this.__wbg_ptr;
|
|
4483
|
-
this.__wbg_ptr = 0;
|
|
4484
|
-
WasmPca2Finalization.unregister(this);
|
|
4485
|
-
return ptr;
|
|
6716
|
+
/**
|
|
6717
|
+
* Grid origin (Cartesian, Å) as a length-3 `Float64Array`.
|
|
6718
|
+
* @param {number} grid_idx
|
|
6719
|
+
* @returns {Float64Array}
|
|
6720
|
+
*/
|
|
6721
|
+
gridOrigin(grid_idx) {
|
|
6722
|
+
const ret = wasm.wasmxyzstream_gridOrigin(this.__wbg_ptr, grid_idx);
|
|
6723
|
+
var v1 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
6724
|
+
wasm.__wbindgen_free_command_export(ret[0], ret[1] * 8, 8);
|
|
6725
|
+
return v1;
|
|
4486
6726
|
}
|
|
4487
|
-
|
|
4488
|
-
|
|
4489
|
-
|
|
6727
|
+
/**
|
|
6728
|
+
* Grid PBC flags as a length-3 `Uint8Array` (`1` = periodic,
|
|
6729
|
+
* `0` = open).
|
|
6730
|
+
* @param {number} grid_idx
|
|
6731
|
+
* @returns {Uint8Array}
|
|
6732
|
+
*/
|
|
6733
|
+
gridPbc(grid_idx) {
|
|
6734
|
+
const ret = wasm.wasmxyzstream_gridPbc(this.__wbg_ptr, grid_idx);
|
|
6735
|
+
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
6736
|
+
wasm.__wbindgen_free_command_export(ret[0], ret[1] * 1, 1);
|
|
6737
|
+
return v1;
|
|
4490
6738
|
}
|
|
4491
6739
|
/**
|
|
4492
|
-
*
|
|
4493
|
-
*
|
|
4494
|
-
*
|
|
4495
|
-
* # Arguments
|
|
4496
|
-
*
|
|
4497
|
-
* * `matrix` — row-major `n_rows × n_cols` observation matrix.
|
|
4498
|
-
* * `n_rows` — number of observations.
|
|
4499
|
-
* * `n_cols` — number of features.
|
|
4500
|
-
*
|
|
4501
|
-
* # Errors
|
|
4502
|
-
*
|
|
4503
|
-
* Throws if `n_rows < 3`, `n_cols < 2`, the length does not match
|
|
4504
|
-
* `n_rows * n_cols`, any element is non-finite, or any column has
|
|
4505
|
-
* zero variance.
|
|
4506
|
-
* @param {Float64Array} matrix
|
|
4507
|
-
* @param {number} n_rows
|
|
4508
|
-
* @param {number} n_cols
|
|
4509
|
-
* @returns {WasmPcaResult}
|
|
6740
|
+
* Grid dimensions `[nx, ny, nz]` as a length-3 `Uint32Array`.
|
|
6741
|
+
* @param {number} grid_idx
|
|
6742
|
+
* @returns {Uint32Array}
|
|
4510
6743
|
*/
|
|
4511
|
-
|
|
4512
|
-
const
|
|
4513
|
-
|
|
4514
|
-
|
|
4515
|
-
|
|
4516
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
4517
|
-
}
|
|
4518
|
-
return WasmPcaResult.__wrap(ret[0]);
|
|
6744
|
+
gridShape(grid_idx) {
|
|
6745
|
+
const ret = wasm.wasmxyzstream_gridShape(this.__wbg_ptr, grid_idx);
|
|
6746
|
+
var v1 = getArrayU32FromWasm0(ret[0], ret[1]).slice();
|
|
6747
|
+
wasm.__wbindgen_free_command_export(ret[0], ret[1] * 4, 4);
|
|
6748
|
+
return v1;
|
|
4519
6749
|
}
|
|
4520
6750
|
/**
|
|
4521
|
-
*
|
|
4522
|
-
*
|
|
6751
|
+
* Current capacity (in bytes) of the reusable input buffer.
|
|
6752
|
+
* @returns {number}
|
|
6753
|
+
*/
|
|
6754
|
+
inputCapacity() {
|
|
6755
|
+
const ret = wasm.wasmxyzstream_inputCapacity(this.__wbg_ptr);
|
|
6756
|
+
return ret >>> 0;
|
|
6757
|
+
}
|
|
6758
|
+
/**
|
|
6759
|
+
* Create a new streaming reader. The reusable input buffer
|
|
6760
|
+
* starts empty; call [`allocInputBuffer`] before feeding data.
|
|
4523
6761
|
*/
|
|
4524
6762
|
constructor() {
|
|
4525
|
-
const ret = wasm.
|
|
4526
|
-
this.__wbg_ptr = ret
|
|
4527
|
-
|
|
6763
|
+
const ret = wasm.wasmxyzstream_new();
|
|
6764
|
+
this.__wbg_ptr = ret;
|
|
6765
|
+
WasmXyzStreamFinalization.register(this, this.__wbg_ptr, this);
|
|
4528
6766
|
return this;
|
|
4529
6767
|
}
|
|
4530
|
-
|
|
4531
|
-
|
|
4532
|
-
|
|
4533
|
-
|
|
4534
|
-
|
|
4535
|
-
|
|
4536
|
-
|
|
4537
|
-
|
|
4538
|
-
|
|
4539
|
-
|
|
4540
|
-
|
|
4541
|
-
|
|
4542
|
-
|
|
4543
|
-
|
|
4544
|
-
WasmPcaResultFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
4545
|
-
return obj;
|
|
6768
|
+
/**
|
|
6769
|
+
* Decode the byte range `[offset, offset + len)` from the
|
|
6770
|
+
* reusable input buffer as a single frame. Replaces any
|
|
6771
|
+
* previously cached output; the caller must extract data
|
|
6772
|
+
* before the next `parseRangeInInput` (the same buffer can
|
|
6773
|
+
* be overwritten in between).
|
|
6774
|
+
* @param {number} offset
|
|
6775
|
+
* @param {number} len
|
|
6776
|
+
*/
|
|
6777
|
+
parseRangeInInput(offset, len) {
|
|
6778
|
+
const ret = wasm.wasmxyzstream_parseRangeInInput(this.__wbg_ptr, offset, len);
|
|
6779
|
+
if (ret[1]) {
|
|
6780
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
6781
|
+
}
|
|
4546
6782
|
}
|
|
4547
|
-
|
|
4548
|
-
|
|
4549
|
-
|
|
4550
|
-
|
|
4551
|
-
|
|
6783
|
+
/**
|
|
6784
|
+
* Drop the cached output frame, releasing its memory and
|
|
6785
|
+
* invalidating any outstanding `columnPtr*` / `gridArrayPtr*`
|
|
6786
|
+
* pointers. Subsequent extraction calls return 0 / empty
|
|
6787
|
+
* until the next `parseRangeInInput`.
|
|
6788
|
+
*/
|
|
6789
|
+
releaseFrame() {
|
|
6790
|
+
wasm.wasmxyzstream_releaseFrame(this.__wbg_ptr);
|
|
4552
6791
|
}
|
|
4553
|
-
|
|
4554
|
-
|
|
4555
|
-
|
|
6792
|
+
/**
|
|
6793
|
+
* Box H-matrix as a length-9 `Float64Array` (column-major:
|
|
6794
|
+
* `[col0_x, col0_y, col0_z, col1_x, col1_y, col1_z, col2_x, col2_y, col2_z]`),
|
|
6795
|
+
* or `undefined` if the frame has no simbox.
|
|
6796
|
+
*
|
|
6797
|
+
* Returned by VALUE — the typed array is owned by JS and is
|
|
6798
|
+
* stable across subsequent wasm calls.
|
|
6799
|
+
* @returns {Float64Array | undefined}
|
|
6800
|
+
*/
|
|
6801
|
+
simboxH() {
|
|
6802
|
+
const ret = wasm.wasmxyzstream_simboxH(this.__wbg_ptr);
|
|
6803
|
+
let v1;
|
|
6804
|
+
if (ret[0] !== 0) {
|
|
6805
|
+
v1 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
6806
|
+
wasm.__wbindgen_free_command_export(ret[0], ret[1] * 8, 8);
|
|
6807
|
+
}
|
|
6808
|
+
return v1;
|
|
4556
6809
|
}
|
|
4557
6810
|
/**
|
|
4558
|
-
*
|
|
4559
|
-
*
|
|
4560
|
-
*
|
|
4561
|
-
* @returns {Float64Array}
|
|
6811
|
+
* Box origin as a length-3 `Float64Array`, or `undefined` if
|
|
6812
|
+
* the frame has no simbox.
|
|
6813
|
+
* @returns {Float64Array | undefined}
|
|
4562
6814
|
*/
|
|
4563
|
-
|
|
4564
|
-
const ret = wasm.
|
|
4565
|
-
|
|
6815
|
+
simboxOrigin() {
|
|
6816
|
+
const ret = wasm.wasmxyzstream_simboxOrigin(this.__wbg_ptr);
|
|
6817
|
+
let v1;
|
|
6818
|
+
if (ret[0] !== 0) {
|
|
6819
|
+
v1 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
6820
|
+
wasm.__wbindgen_free_command_export(ret[0], ret[1] * 8, 8);
|
|
6821
|
+
}
|
|
6822
|
+
return v1;
|
|
4566
6823
|
}
|
|
4567
6824
|
/**
|
|
4568
|
-
*
|
|
4569
|
-
* `
|
|
4570
|
-
*
|
|
6825
|
+
* Per-axis PBC flags as a length-3 `Uint8Array` (`1` = periodic,
|
|
6826
|
+
* `0` = open), or `undefined` if the frame has no simbox.
|
|
6827
|
+
*
|
|
6828
|
+
* (wasm-bindgen does not support `[bool; 3]` returns natively,
|
|
6829
|
+
* hence the `Uint8Array` wire format. The spec calls for
|
|
6830
|
+
* `[boolean, boolean, boolean]`; the JS side is expected to
|
|
6831
|
+
* `Boolean(arr[i])` each entry.)
|
|
6832
|
+
* @returns {Uint8Array | undefined}
|
|
4571
6833
|
*/
|
|
4572
|
-
|
|
4573
|
-
const ret = wasm.
|
|
4574
|
-
|
|
6834
|
+
simboxPbc() {
|
|
6835
|
+
const ret = wasm.wasmxyzstream_simboxPbc(this.__wbg_ptr);
|
|
6836
|
+
let v1;
|
|
6837
|
+
if (ret[0] !== 0) {
|
|
6838
|
+
v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
6839
|
+
wasm.__wbindgen_free_command_export(ret[0], ret[1] * 1, 1);
|
|
6840
|
+
}
|
|
6841
|
+
return v1;
|
|
4575
6842
|
}
|
|
4576
6843
|
}
|
|
4577
|
-
if (Symbol.dispose)
|
|
6844
|
+
if (Symbol.dispose) WasmXyzStream.prototype[Symbol.dispose] = WasmXyzStream.prototype.free;
|
|
4578
6845
|
|
|
4579
6846
|
/**
|
|
4580
6847
|
* XYZ / Extended XYZ file reader.
|
|
@@ -4664,7 +6931,7 @@ export class XYZReader {
|
|
|
4664
6931
|
const ptr0 = passStringToWasm0(content, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
|
|
4665
6932
|
const len0 = WASM_VECTOR_LEN;
|
|
4666
6933
|
const ret = wasm.xyzreader_new(ptr0, len0);
|
|
4667
|
-
this.__wbg_ptr = ret
|
|
6934
|
+
this.__wbg_ptr = ret;
|
|
4668
6935
|
XYZReaderFinalization.register(this, this.__wbg_ptr, this);
|
|
4669
6936
|
return this;
|
|
4670
6937
|
}
|
|
@@ -4760,7 +7027,7 @@ export function generate3D(frame, speed, seed) {
|
|
|
4760
7027
|
_assertClass(frame, Frame);
|
|
4761
7028
|
var ptr0 = isLikeNone(speed) ? 0 : passStringToWasm0(speed, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
|
|
4762
7029
|
var len0 = WASM_VECTOR_LEN;
|
|
4763
|
-
const ret = wasm.generate3D(frame.__wbg_ptr, ptr0, len0, isLikeNone(seed) ?
|
|
7030
|
+
const ret = wasm.generate3D(frame.__wbg_ptr, ptr0, len0, isLikeNone(seed) ? Number.MAX_SAFE_INTEGER : (seed) >>> 0);
|
|
4764
7031
|
if (ret[2]) {
|
|
4765
7032
|
throw takeFromExternrefTable0(ret[1]);
|
|
4766
7033
|
}
|
|
@@ -4897,18 +7164,18 @@ export function writeFrame(frame, format) {
|
|
|
4897
7164
|
wasm.__wbindgen_free_command_export(deferred3_0, deferred3_1, 1);
|
|
4898
7165
|
}
|
|
4899
7166
|
}
|
|
4900
|
-
export function
|
|
7167
|
+
export function __wbg___wbindgen_debug_string_07cb72cfcc952e2b(arg0, arg1) {
|
|
4901
7168
|
const ret = debugString(arg1);
|
|
4902
7169
|
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
|
|
4903
7170
|
const len1 = WASM_VECTOR_LEN;
|
|
4904
7171
|
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
4905
7172
|
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
4906
7173
|
}
|
|
4907
|
-
export function
|
|
7174
|
+
export function __wbg___wbindgen_memory_c2356dd1a089dfbd() {
|
|
4908
7175
|
const ret = wasm.memory;
|
|
4909
7176
|
return ret;
|
|
4910
7177
|
}
|
|
4911
|
-
export function
|
|
7178
|
+
export function __wbg___wbindgen_string_get_965592073e5d848c(arg0, arg1) {
|
|
4912
7179
|
const obj = arg1;
|
|
4913
7180
|
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
4914
7181
|
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
|
|
@@ -4916,10 +7183,10 @@ export function __wbg___wbindgen_string_get_7ed5322991caaec5(arg0, arg1) {
|
|
|
4916
7183
|
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
4917
7184
|
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
4918
7185
|
}
|
|
4919
|
-
export function
|
|
7186
|
+
export function __wbg___wbindgen_throw_9c75d47bf9e7731e(arg0, arg1) {
|
|
4920
7187
|
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
4921
7188
|
}
|
|
4922
|
-
export function
|
|
7189
|
+
export function __wbg_done_b1afd6201ac045e0(arg0) {
|
|
4923
7190
|
const ret = arg0.done;
|
|
4924
7191
|
return ret;
|
|
4925
7192
|
}
|
|
@@ -4934,38 +7201,42 @@ export function __wbg_error_a6fa202b58aa1cd3(arg0, arg1) {
|
|
|
4934
7201
|
wasm.__wbindgen_free_command_export(deferred0_0, deferred0_1, 1);
|
|
4935
7202
|
}
|
|
4936
7203
|
}
|
|
7204
|
+
export function __wbg_frameindexentry_new(arg0) {
|
|
7205
|
+
const ret = FrameIndexEntry.__wrap(arg0);
|
|
7206
|
+
return ret;
|
|
7207
|
+
}
|
|
4937
7208
|
export function __wbg_getRandomValues_3f44b700395062e5() { return handleError(function (arg0, arg1) {
|
|
4938
7209
|
globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1));
|
|
4939
7210
|
}, arguments); }
|
|
4940
|
-
export function
|
|
7211
|
+
export function __wbg_get_3b3bc8bc241720dc(arg0, arg1) {
|
|
4941
7212
|
const ret = arg0.get(arg1);
|
|
4942
7213
|
return ret;
|
|
4943
7214
|
}
|
|
4944
|
-
export function
|
|
7215
|
+
export function __wbg_get_unchecked_be562b1421656321(arg0, arg1) {
|
|
4945
7216
|
const ret = arg0[arg1 >>> 0];
|
|
4946
7217
|
return ret;
|
|
4947
7218
|
}
|
|
4948
|
-
export function
|
|
7219
|
+
export function __wbg_keys_99b59e6e5acd79e4(arg0) {
|
|
4949
7220
|
const ret = arg0.keys();
|
|
4950
7221
|
return ret;
|
|
4951
7222
|
}
|
|
4952
|
-
export function
|
|
7223
|
+
export function __wbg_length_0a6ce016dc1460b0(arg0) {
|
|
4953
7224
|
const ret = arg0.length;
|
|
4954
7225
|
return ret;
|
|
4955
7226
|
}
|
|
4956
|
-
export function
|
|
7227
|
+
export function __wbg_length_223a59fdabd2e386(arg0) {
|
|
4957
7228
|
const ret = arg0.length;
|
|
4958
7229
|
return ret;
|
|
4959
7230
|
}
|
|
4960
|
-
export function
|
|
7231
|
+
export function __wbg_length_ba3c032602efe310(arg0) {
|
|
4961
7232
|
const ret = arg0.length;
|
|
4962
7233
|
return ret;
|
|
4963
7234
|
}
|
|
4964
|
-
export function
|
|
7235
|
+
export function __wbg_length_e88e0ca29a377c1e(arg0) {
|
|
4965
7236
|
const ret = arg0.length;
|
|
4966
7237
|
return ret;
|
|
4967
7238
|
}
|
|
4968
|
-
export function
|
|
7239
|
+
export function __wbg_length_eaf0f4c1173c0a9f(arg0) {
|
|
4969
7240
|
const ret = arg0.length;
|
|
4970
7241
|
return ret;
|
|
4971
7242
|
}
|
|
@@ -4973,63 +7244,77 @@ export function __wbg_msdresult_new(arg0) {
|
|
|
4973
7244
|
const ret = MSDResult.__wrap(arg0);
|
|
4974
7245
|
return ret;
|
|
4975
7246
|
}
|
|
4976
|
-
export function __wbg_new_0c7403db6e782f19(arg0) {
|
|
4977
|
-
const ret = new Uint8Array(arg0);
|
|
4978
|
-
return ret;
|
|
4979
|
-
}
|
|
4980
7247
|
export function __wbg_new_227d7c05414eb861() {
|
|
4981
7248
|
const ret = new Error();
|
|
4982
7249
|
return ret;
|
|
4983
7250
|
}
|
|
4984
|
-
export function
|
|
7251
|
+
export function __wbg_new_3baa8d9866155c79() {
|
|
4985
7252
|
const ret = new Array();
|
|
4986
7253
|
return ret;
|
|
4987
7254
|
}
|
|
4988
|
-
export function
|
|
4989
|
-
const ret = new
|
|
7255
|
+
export function __wbg_new_8454eee672b2ba6e(arg0) {
|
|
7256
|
+
const ret = new Uint8Array(arg0);
|
|
4990
7257
|
return ret;
|
|
4991
7258
|
}
|
|
4992
|
-
export function
|
|
7259
|
+
export function __wbg_new_from_slice_3ca7c4e9a43341b6(arg0, arg1) {
|
|
4993
7260
|
const ret = new Float64Array(getArrayF64FromWasm0(arg0, arg1));
|
|
4994
7261
|
return ret;
|
|
4995
7262
|
}
|
|
4996
|
-
export function
|
|
4997
|
-
const ret = new
|
|
7263
|
+
export function __wbg_new_from_slice_823acd363b3844cf(arg0, arg1) {
|
|
7264
|
+
const ret = new Uint32Array(getArrayU32FromWasm0(arg0, arg1));
|
|
4998
7265
|
return ret;
|
|
4999
7266
|
}
|
|
5000
|
-
export function
|
|
5001
|
-
const ret = new Int32Array(arg0
|
|
7267
|
+
export function __wbg_new_from_slice_d60e366df9f55230(arg0, arg1) {
|
|
7268
|
+
const ret = new Int32Array(getArrayI32FromWasm0(arg0, arg1));
|
|
5002
7269
|
return ret;
|
|
5003
7270
|
}
|
|
5004
|
-
export function
|
|
7271
|
+
export function __wbg_new_with_length_2a29aa33411ddc89(arg0) {
|
|
5005
7272
|
const ret = new Float64Array(arg0 >>> 0);
|
|
5006
7273
|
return ret;
|
|
5007
7274
|
}
|
|
5008
|
-
export function
|
|
7275
|
+
export function __wbg_new_with_length_9011f5da794bf5d9(arg0) {
|
|
7276
|
+
const ret = new Uint8Array(arg0 >>> 0);
|
|
7277
|
+
return ret;
|
|
7278
|
+
}
|
|
7279
|
+
export function __wbg_new_with_length_b91f070a091394cc(arg0) {
|
|
7280
|
+
const ret = new Uint32Array(arg0 >>> 0);
|
|
7281
|
+
return ret;
|
|
7282
|
+
}
|
|
7283
|
+
export function __wbg_new_with_length_bc64f6940c022f00(arg0) {
|
|
7284
|
+
const ret = new Int32Array(arg0 >>> 0);
|
|
7285
|
+
return ret;
|
|
7286
|
+
}
|
|
7287
|
+
export function __wbg_next_aacee310bcfe6461() { return handleError(function (arg0) {
|
|
5009
7288
|
const ret = arg0.next();
|
|
5010
7289
|
return ret;
|
|
5011
7290
|
}, arguments); }
|
|
5012
|
-
export function
|
|
5013
|
-
|
|
7291
|
+
export function __wbg_prototypesetcall_05223d3fcba7faf9(arg0, arg1, arg2) {
|
|
7292
|
+
Uint32Array.prototype.set.call(getArrayU32FromWasm0(arg0, arg1), arg2);
|
|
5014
7293
|
}
|
|
5015
|
-
export function
|
|
7294
|
+
export function __wbg_prototypesetcall_442370bc228f2c6b(arg0, arg1, arg2) {
|
|
5016
7295
|
Float64Array.prototype.set.call(getArrayF64FromWasm0(arg0, arg1), arg2);
|
|
5017
7296
|
}
|
|
5018
|
-
export function
|
|
5019
|
-
Uint32Array.prototype.set.call(getArrayU32FromWasm0(arg0, arg1), arg2);
|
|
5020
|
-
}
|
|
5021
|
-
export function __wbg_prototypesetcall_db677c7a1d7d3039(arg0, arg1, arg2) {
|
|
7297
|
+
export function __wbg_prototypesetcall_f2173fe0ae650acf(arg0, arg1, arg2) {
|
|
5022
7298
|
Int32Array.prototype.set.call(getArrayI32FromWasm0(arg0, arg1), arg2);
|
|
5023
7299
|
}
|
|
5024
|
-
export function
|
|
7300
|
+
export function __wbg_prototypesetcall_fd4050e806e1d519(arg0, arg1, arg2) {
|
|
7301
|
+
Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
|
|
7302
|
+
}
|
|
7303
|
+
export function __wbg_push_60a5366c0bb22a7d(arg0, arg1) {
|
|
5025
7304
|
const ret = arg0.push(arg1);
|
|
5026
7305
|
return ret;
|
|
5027
7306
|
}
|
|
5028
|
-
export function
|
|
7307
|
+
export function __wbg_set_438de26465606cfb(arg0, arg1, arg2) {
|
|
7308
|
+
arg0.set(getArrayI32FromWasm0(arg1, arg2));
|
|
7309
|
+
}
|
|
7310
|
+
export function __wbg_set_e307b0b9eac6f966(arg0, arg1, arg2) {
|
|
5029
7311
|
arg0.set(getArrayF64FromWasm0(arg1, arg2));
|
|
5030
7312
|
}
|
|
5031
|
-
export function
|
|
5032
|
-
arg0
|
|
7313
|
+
export function __wbg_set_index_970e5226bce21dd8(arg0, arg1, arg2) {
|
|
7314
|
+
arg0[arg1 >>> 0] = arg2;
|
|
7315
|
+
}
|
|
7316
|
+
export function __wbg_set_index_9fd290d1cce481b3(arg0, arg1, arg2) {
|
|
7317
|
+
arg0[arg1 >>> 0] = arg2 >>> 0;
|
|
5033
7318
|
}
|
|
5034
7319
|
export function __wbg_stack_3b0d974bbf31e44f(arg0, arg1) {
|
|
5035
7320
|
const ret = arg1.stack;
|
|
@@ -5038,7 +7323,7 @@ export function __wbg_stack_3b0d974bbf31e44f(arg0, arg1) {
|
|
|
5038
7323
|
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
5039
7324
|
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
5040
7325
|
}
|
|
5041
|
-
export function
|
|
7326
|
+
export function __wbg_value_f852716acdeb3e82(arg0) {
|
|
5042
7327
|
const ret = arg0.value;
|
|
5043
7328
|
return ret;
|
|
5044
7329
|
}
|
|
@@ -5073,97 +7358,124 @@ export function __wbindgen_init_externref_table() {
|
|
|
5073
7358
|
}
|
|
5074
7359
|
const BlockFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
5075
7360
|
? { register: () => {}, unregister: () => {} }
|
|
5076
|
-
: new FinalizationRegistry(ptr => wasm.__wbg_block_free(ptr
|
|
7361
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_block_free(ptr, 1));
|
|
5077
7362
|
const BoxFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
5078
7363
|
? { register: () => {}, unregister: () => {} }
|
|
5079
|
-
: new FinalizationRegistry(ptr => wasm.__wbg_box_free(ptr
|
|
7364
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_box_free(ptr, 1));
|
|
5080
7365
|
const CenterOfMassFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
5081
7366
|
? { register: () => {}, unregister: () => {} }
|
|
5082
|
-
: new FinalizationRegistry(ptr => wasm.__wbg_centerofmass_free(ptr
|
|
7367
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_centerofmass_free(ptr, 1));
|
|
5083
7368
|
const CenterOfMassResultFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
5084
7369
|
? { register: () => {}, unregister: () => {} }
|
|
5085
|
-
: new FinalizationRegistry(ptr => wasm.__wbg_centerofmassresult_free(ptr
|
|
7370
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_centerofmassresult_free(ptr, 1));
|
|
7371
|
+
const CHGCARReaderFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
7372
|
+
? { register: () => {}, unregister: () => {} }
|
|
7373
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_chgcarreader_free(ptr, 1));
|
|
7374
|
+
const CIFReaderFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
7375
|
+
? { register: () => {}, unregister: () => {} }
|
|
7376
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_cifreader_free(ptr, 1));
|
|
5086
7377
|
const ClusterFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
5087
7378
|
? { register: () => {}, unregister: () => {} }
|
|
5088
|
-
: new FinalizationRegistry(ptr => wasm.__wbg_cluster_free(ptr
|
|
7379
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_cluster_free(ptr, 1));
|
|
5089
7380
|
const ClusterCentersFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
5090
7381
|
? { register: () => {}, unregister: () => {} }
|
|
5091
|
-
: new FinalizationRegistry(ptr => wasm.__wbg_clustercenters_free(ptr
|
|
7382
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_clustercenters_free(ptr, 1));
|
|
5092
7383
|
const ClusterResultFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
5093
7384
|
? { register: () => {}, unregister: () => {} }
|
|
5094
|
-
: new FinalizationRegistry(ptr => wasm.__wbg_clusterresult_free(ptr
|
|
5095
|
-
const
|
|
7385
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_clusterresult_free(ptr, 1));
|
|
7386
|
+
const CubeReaderFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
7387
|
+
? { register: () => {}, unregister: () => {} }
|
|
7388
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_cubereader_free(ptr, 1));
|
|
7389
|
+
const DCDReaderFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
5096
7390
|
? { register: () => {}, unregister: () => {} }
|
|
5097
|
-
: new FinalizationRegistry(ptr => wasm.
|
|
5098
|
-
const
|
|
7391
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_dcdreader_free(ptr, 1));
|
|
7392
|
+
const FrameFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
5099
7393
|
? { register: () => {}, unregister: () => {} }
|
|
5100
|
-
: new FinalizationRegistry(ptr => wasm.
|
|
7394
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_frame_free(ptr, 1));
|
|
5101
7395
|
const GyrationTensorFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
5102
7396
|
? { register: () => {}, unregister: () => {} }
|
|
5103
|
-
: new FinalizationRegistry(ptr => wasm.__wbg_gyrationtensor_free(ptr
|
|
7397
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_gyrationtensor_free(ptr, 1));
|
|
5104
7398
|
const InertiaTensorFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
5105
7399
|
? { register: () => {}, unregister: () => {} }
|
|
5106
|
-
: new FinalizationRegistry(ptr => wasm.__wbg_inertiatensor_free(ptr
|
|
7400
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_inertiatensor_free(ptr, 1));
|
|
5107
7401
|
const LAMMPSTrajReaderFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
5108
7402
|
? { register: () => {}, unregister: () => {} }
|
|
5109
|
-
: new FinalizationRegistry(ptr => wasm.__wbg_lammpstrajreader_free(ptr
|
|
7403
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_lammpstrajreader_free(ptr, 1));
|
|
5110
7404
|
const LAMMPSReaderFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
5111
7405
|
? { register: () => {}, unregister: () => {} }
|
|
5112
|
-
: new FinalizationRegistry(ptr => wasm.__wbg_lammpsreader_free(ptr
|
|
7406
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_lammpsreader_free(ptr, 1));
|
|
5113
7407
|
const LinkedCellFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
5114
7408
|
? { register: () => {}, unregister: () => {} }
|
|
5115
|
-
: new FinalizationRegistry(ptr => wasm.__wbg_linkedcell_free(ptr
|
|
7409
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_linkedcell_free(ptr, 1));
|
|
5116
7410
|
const MSDFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
5117
7411
|
? { register: () => {}, unregister: () => {} }
|
|
5118
|
-
: new FinalizationRegistry(ptr => wasm.__wbg_msd_free(ptr
|
|
7412
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_msd_free(ptr, 1));
|
|
5119
7413
|
const MSDResultFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
5120
7414
|
? { register: () => {}, unregister: () => {} }
|
|
5121
|
-
: new FinalizationRegistry(ptr => wasm.__wbg_msdresult_free(ptr
|
|
7415
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_msdresult_free(ptr, 1));
|
|
5122
7416
|
const MolRecReaderFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
5123
7417
|
? { register: () => {}, unregister: () => {} }
|
|
5124
|
-
: new FinalizationRegistry(ptr => wasm.__wbg_molrecreader_free(ptr
|
|
7418
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_molrecreader_free(ptr, 1));
|
|
5125
7419
|
const NeighborListFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
5126
7420
|
? { register: () => {}, unregister: () => {} }
|
|
5127
|
-
: new FinalizationRegistry(ptr => wasm.__wbg_neighborlist_free(ptr
|
|
7421
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_neighborlist_free(ptr, 1));
|
|
5128
7422
|
const PDBReaderFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
5129
7423
|
? { register: () => {}, unregister: () => {} }
|
|
5130
|
-
: new FinalizationRegistry(ptr => wasm.__wbg_pdbreader_free(ptr
|
|
7424
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_pdbreader_free(ptr, 1));
|
|
5131
7425
|
const RDFFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
5132
7426
|
? { register: () => {}, unregister: () => {} }
|
|
5133
|
-
: new FinalizationRegistry(ptr => wasm.__wbg_rdf_free(ptr
|
|
7427
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_rdf_free(ptr, 1));
|
|
5134
7428
|
const RDFResultFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
5135
7429
|
? { register: () => {}, unregister: () => {} }
|
|
5136
|
-
: new FinalizationRegistry(ptr => wasm.__wbg_rdfresult_free(ptr
|
|
7430
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_rdfresult_free(ptr, 1));
|
|
5137
7431
|
const RadiusOfGyrationFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
5138
7432
|
? { register: () => {}, unregister: () => {} }
|
|
5139
|
-
: new FinalizationRegistry(ptr => wasm.__wbg_radiusofgyration_free(ptr
|
|
7433
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_radiusofgyration_free(ptr, 1));
|
|
5140
7434
|
const SDFReaderFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
5141
7435
|
? { register: () => {}, unregister: () => {} }
|
|
5142
|
-
: new FinalizationRegistry(ptr => wasm.__wbg_sdfreader_free(ptr
|
|
7436
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_sdfreader_free(ptr, 1));
|
|
5143
7437
|
const TopologyRingInfoFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
5144
7438
|
? { register: () => {}, unregister: () => {} }
|
|
5145
|
-
: new FinalizationRegistry(ptr => wasm.__wbg_topologyringinfo_free(ptr
|
|
7439
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_topologyringinfo_free(ptr, 1));
|
|
5146
7440
|
const WasmArrayFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
5147
7441
|
? { register: () => {}, unregister: () => {} }
|
|
5148
|
-
: new FinalizationRegistry(ptr => wasm.__wbg_wasmarray_free(ptr
|
|
7442
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_wasmarray_free(ptr, 1));
|
|
7443
|
+
const FrameIndexEntryFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
7444
|
+
? { register: () => {}, unregister: () => {} }
|
|
7445
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_frameindexentry_free(ptr, 1));
|
|
5149
7446
|
const WasmKMeansFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
5150
7447
|
? { register: () => {}, unregister: () => {} }
|
|
5151
|
-
: new FinalizationRegistry(ptr => wasm.__wbg_wasmkmeans_free(ptr
|
|
7448
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_wasmkmeans_free(ptr, 1));
|
|
7449
|
+
const WasmLammpsDataStreamFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
7450
|
+
? { register: () => {}, unregister: () => {} }
|
|
7451
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_wasmlammpsdatastream_free(ptr, 1));
|
|
7452
|
+
const WasmLammpsDumpStreamFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
7453
|
+
? { register: () => {}, unregister: () => {} }
|
|
7454
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_wasmlammpsdumpstream_free(ptr, 1));
|
|
5152
7455
|
const WasmPca2Finalization = (typeof FinalizationRegistry === 'undefined')
|
|
5153
7456
|
? { register: () => {}, unregister: () => {} }
|
|
5154
|
-
: new FinalizationRegistry(ptr => wasm.__wbg_wasmpca2_free(ptr
|
|
7457
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_wasmpca2_free(ptr, 1));
|
|
5155
7458
|
const WasmPcaResultFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
5156
7459
|
? { register: () => {}, unregister: () => {} }
|
|
5157
|
-
: new FinalizationRegistry(ptr => wasm.__wbg_wasmpcaresult_free(ptr
|
|
7460
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_wasmpcaresult_free(ptr, 1));
|
|
7461
|
+
const WasmPdbStreamFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
7462
|
+
? { register: () => {}, unregister: () => {} }
|
|
7463
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_wasmpdbstream_free(ptr, 1));
|
|
7464
|
+
const WasmSdfStreamFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
7465
|
+
? { register: () => {}, unregister: () => {} }
|
|
7466
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_wasmsdfstream_free(ptr, 1));
|
|
5158
7467
|
const SmilesIRFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
5159
7468
|
? { register: () => {}, unregister: () => {} }
|
|
5160
|
-
: new FinalizationRegistry(ptr => wasm.__wbg_smilesir_free(ptr
|
|
7469
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_smilesir_free(ptr, 1));
|
|
5161
7470
|
const TopologyFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
5162
7471
|
? { register: () => {}, unregister: () => {} }
|
|
5163
|
-
: new FinalizationRegistry(ptr => wasm.__wbg_topology_free(ptr
|
|
7472
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_topology_free(ptr, 1));
|
|
7473
|
+
const WasmXyzStreamFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
7474
|
+
? { register: () => {}, unregister: () => {} }
|
|
7475
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_wasmxyzstream_free(ptr, 1));
|
|
5164
7476
|
const XYZReaderFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
5165
7477
|
? { register: () => {}, unregister: () => {} }
|
|
5166
|
-
: new FinalizationRegistry(ptr => wasm.__wbg_xyzreader_free(ptr
|
|
7478
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_xyzreader_free(ptr, 1));
|
|
5167
7479
|
|
|
5168
7480
|
function addToExternrefTable0(obj) {
|
|
5169
7481
|
const idx = wasm.__externref_table_alloc_command_export();
|
|
@@ -5298,8 +7610,7 @@ function getInt32ArrayMemory0() {
|
|
|
5298
7610
|
}
|
|
5299
7611
|
|
|
5300
7612
|
function getStringFromWasm0(ptr, len) {
|
|
5301
|
-
|
|
5302
|
-
return decodeText(ptr, len);
|
|
7613
|
+
return decodeText(ptr >>> 0, len);
|
|
5303
7614
|
}
|
|
5304
7615
|
|
|
5305
7616
|
let cachedUint32ArrayMemory0 = null;
|
|
@@ -5338,6 +7649,13 @@ function passArray32ToWasm0(arg, malloc) {
|
|
|
5338
7649
|
return ptr;
|
|
5339
7650
|
}
|
|
5340
7651
|
|
|
7652
|
+
function passArray8ToWasm0(arg, malloc) {
|
|
7653
|
+
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
7654
|
+
getUint8ArrayMemory0().set(arg, ptr / 1);
|
|
7655
|
+
WASM_VECTOR_LEN = arg.length;
|
|
7656
|
+
return ptr;
|
|
7657
|
+
}
|
|
7658
|
+
|
|
5341
7659
|
function passArrayF64ToWasm0(arg, malloc) {
|
|
5342
7660
|
const ptr = malloc(arg.length * 8, 8) >>> 0;
|
|
5343
7661
|
getFloat64ArrayMemory0().set(arg, ptr / 8);
|