@ferscloud/fers-calculation 0.1.68 → 0.1.69

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/README.md CHANGED
@@ -1,20 +1,10 @@
1
- # FERS_calculations
2
-
3
- `FERS_calculations` is a high-performance library for Rust-backed calculations in mechanical engineering. It can process JSON input files to deliver fast and accurate results. While it can be run as a standalone tool, integration with `FERS_core` simplifies input creation and workflow management.
4
-
5
- ## Features
6
-
7
- - **Standalone Functionality:** Run directly by providing a valid JSON input file.
8
- - **Rust-Powered Performance:** Designed for speed and reliability in computational tasks.
9
- - **Python Integration:** Seamless integration with `FERS_core` for easy preprocessing and result handling.
10
- - **Engineer-Friendly Design:** Minimal coding effort required for complex structural engineering calculations.
11
-
12
- ---
13
-
14
- ## Usage
15
-
16
- ### Standalone
17
- You can run `FERS_calculations` without `FERS_core` by preparing a JSON input file and running the binary directly.
18
-
19
- ```bash
20
- # TODO: Add example of how to run FERS_calculations with a JSON input
1
+ # @ferscloud/fers-calculation
2
+
3
+ High-performance structural / mechanical engineering calculations compiled from Rust to WebAssembly.
4
+
5
+ This package is the WebAssembly build of your Rust solver so it can be used from JavaScript and TypeScript (browser apps with a bundler, and in some Node.js setups). It is designed to take structured input (for example JSON) and return results efficiently.
6
+
7
+ ## Installation
8
+
9
+ ```bash
10
+ npm install @ferscloud/fers-calculation
@@ -1,4 +1,6 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
+
3
4
  export function calculate_from_json(json_data: string): string;
5
+
4
6
  export function load_fers_from_file(path: string): string;
@@ -1,5 +1,9 @@
1
+ /* @ts-self-types="./fers_calculations.d.ts" */
2
+
1
3
  import * as wasm from "./fers_calculations_bg.wasm";
2
- export * from "./fers_calculations_bg.js";
3
4
  import { __wbg_set_wasm } from "./fers_calculations_bg.js";
4
5
  __wbg_set_wasm(wasm);
5
6
  wasm.__wbindgen_start();
7
+ export {
8
+ calculate_from_json, load_fers_from_file
9
+ } from "./fers_calculations_bg.js";
@@ -1,13 +1,55 @@
1
- let wasm;
2
- export function __wbg_set_wasm(val) {
3
- wasm = val;
1
+ /**
2
+ * @param {string} json_data
3
+ * @returns {string}
4
+ */
5
+ export function calculate_from_json(json_data) {
6
+ let deferred2_0;
7
+ let deferred2_1;
8
+ try {
9
+ const ptr0 = passStringToWasm0(json_data, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
10
+ const len0 = WASM_VECTOR_LEN;
11
+ const ret = wasm.calculate_from_json(ptr0, len0);
12
+ deferred2_0 = ret[0];
13
+ deferred2_1 = ret[1];
14
+ return getStringFromWasm0(ret[0], ret[1]);
15
+ } finally {
16
+ wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
17
+ }
4
18
  }
5
19
 
6
-
7
- let WASM_VECTOR_LEN = 0;
20
+ /**
21
+ * @param {string} path
22
+ * @returns {string}
23
+ */
24
+ export function load_fers_from_file(path) {
25
+ let deferred2_0;
26
+ let deferred2_1;
27
+ try {
28
+ const ptr0 = passStringToWasm0(path, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
29
+ const len0 = WASM_VECTOR_LEN;
30
+ const ret = wasm.load_fers_from_file(ptr0, len0);
31
+ deferred2_0 = ret[0];
32
+ deferred2_1 = ret[1];
33
+ return getStringFromWasm0(ret[0], ret[1]);
34
+ } finally {
35
+ wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
36
+ }
37
+ }
38
+ export function __wbindgen_init_externref_table() {
39
+ const table = wasm.__wbindgen_externrefs;
40
+ const offset = table.grow(4);
41
+ table.set(0, undefined);
42
+ table.set(offset + 0, undefined);
43
+ table.set(offset + 1, null);
44
+ table.set(offset + 2, true);
45
+ table.set(offset + 3, false);
46
+ }
47
+ function getStringFromWasm0(ptr, len) {
48
+ ptr = ptr >>> 0;
49
+ return decodeText(ptr, len);
50
+ }
8
51
 
9
52
  let cachedUint8ArrayMemory0 = null;
10
-
11
53
  function getUint8ArrayMemory0() {
12
54
  if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
13
55
  cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
@@ -15,21 +57,7 @@ function getUint8ArrayMemory0() {
15
57
  return cachedUint8ArrayMemory0;
16
58
  }
17
59
 
18
- const cachedTextEncoder = new TextEncoder();
19
-
20
- if (!('encodeInto' in cachedTextEncoder)) {
21
- cachedTextEncoder.encodeInto = function (arg, view) {
22
- const buf = cachedTextEncoder.encode(arg);
23
- view.set(buf);
24
- return {
25
- read: arg.length,
26
- written: buf.length
27
- };
28
- }
29
- }
30
-
31
60
  function passStringToWasm0(arg, malloc, realloc) {
32
-
33
61
  if (realloc === undefined) {
34
62
  const buf = cachedTextEncoder.encode(arg);
35
63
  const ptr = malloc(buf.length, 1) >>> 0;
@@ -50,7 +78,6 @@ function passStringToWasm0(arg, malloc, realloc) {
50
78
  if (code > 0x7F) break;
51
79
  mem[ptr + offset] = code;
52
80
  }
53
-
54
81
  if (offset !== len) {
55
82
  if (offset !== 0) {
56
83
  arg = arg.slice(offset);
@@ -68,9 +95,7 @@ function passStringToWasm0(arg, malloc, realloc) {
68
95
  }
69
96
 
70
97
  let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
71
-
72
98
  cachedTextDecoder.decode();
73
-
74
99
  const MAX_SAFARI_DECODE_BYTES = 2146435072;
75
100
  let numBytesDecoded = 0;
76
101
  function decodeText(ptr, len) {
@@ -83,56 +108,23 @@ function decodeText(ptr, len) {
83
108
  return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
84
109
  }
85
110
 
86
- function getStringFromWasm0(ptr, len) {
87
- ptr = ptr >>> 0;
88
- return decodeText(ptr, len);
89
- }
90
- /**
91
- * @param {string} json_data
92
- * @returns {string}
93
- */
94
- export function calculate_from_json(json_data) {
95
- let deferred2_0;
96
- let deferred2_1;
97
- try {
98
- const ptr0 = passStringToWasm0(json_data, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
99
- const len0 = WASM_VECTOR_LEN;
100
- const ret = wasm.calculate_from_json(ptr0, len0);
101
- deferred2_0 = ret[0];
102
- deferred2_1 = ret[1];
103
- return getStringFromWasm0(ret[0], ret[1]);
104
- } finally {
105
- wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
106
- }
107
- }
111
+ const cachedTextEncoder = new TextEncoder();
108
112
 
109
- /**
110
- * @param {string} path
111
- * @returns {string}
112
- */
113
- export function load_fers_from_file(path) {
114
- let deferred2_0;
115
- let deferred2_1;
116
- try {
117
- const ptr0 = passStringToWasm0(path, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
118
- const len0 = WASM_VECTOR_LEN;
119
- const ret = wasm.load_fers_from_file(ptr0, len0);
120
- deferred2_0 = ret[0];
121
- deferred2_1 = ret[1];
122
- return getStringFromWasm0(ret[0], ret[1]);
123
- } finally {
124
- wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
125
- }
113
+ if (!('encodeInto' in cachedTextEncoder)) {
114
+ cachedTextEncoder.encodeInto = function (arg, view) {
115
+ const buf = cachedTextEncoder.encode(arg);
116
+ view.set(buf);
117
+ return {
118
+ read: arg.length,
119
+ written: buf.length
120
+ };
121
+ };
126
122
  }
127
123
 
128
- export function __wbindgen_init_externref_table() {
129
- const table = wasm.__wbindgen_export_0;
130
- const offset = table.grow(4);
131
- table.set(0, undefined);
132
- table.set(offset + 0, undefined);
133
- table.set(offset + 1, null);
134
- table.set(offset + 2, true);
135
- table.set(offset + 3, false);
136
- ;
137
- };
124
+ let WASM_VECTOR_LEN = 0;
125
+
138
126
 
127
+ let wasm;
128
+ export function __wbg_set_wasm(val) {
129
+ wasm = val;
130
+ }
Binary file
package/package.json CHANGED
@@ -1,10 +1,7 @@
1
1
  {
2
2
  "name": "@ferscloud/fers-calculation",
3
- "publishConfig": {
4
- "access": "public"
5
- },
6
3
  "type": "module",
7
- "version": "0.1.68",
4
+ "version": "0.1.69",
8
5
  "files": [
9
6
  "fers_calculations_bg.wasm",
10
7
  "fers_calculations.js",
@@ -16,5 +13,12 @@
16
13
  "sideEffects": [
17
14
  "./fers_calculations.js",
18
15
  "./snippets/*"
19
- ]
16
+ ],
17
+ "publishConfig": {
18
+ "access": "public"
19
+ },
20
+ "repository": {
21
+ "type": "git",
22
+ "url": "git+https://github.com/Jeroen124/FERS_calculations.git"
23
+ }
20
24
  }