@rulecad/fea 0.2.8 → 0.2.10
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 +159 -1
- package/frame.d.mts +367 -0
- package/frame.mjs +660 -0
- package/package.json +14 -4
- package/threads.d.mts +9 -9
- package/threads.mjs +6 -1
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rulecad/fea",
|
|
3
|
-
"version": "0.2.
|
|
4
|
-
"description": "How far a part bends under load: finite elements on a grid of squares (2D) or cubes (3D), with a multigrid solver, in plain JavaScript.",
|
|
3
|
+
"version": "0.2.10",
|
|
4
|
+
"description": "How far a part bends under load: finite elements on a grid of squares (2D) or cubes (3D), with a multigrid solver, and frames of beams (static, buckling and modes), in plain JavaScript.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
7
7
|
".": {
|
|
@@ -11,6 +11,10 @@
|
|
|
11
11
|
"./threads": {
|
|
12
12
|
"types": "./threads.d.mts",
|
|
13
13
|
"default": "./threads.mjs"
|
|
14
|
+
},
|
|
15
|
+
"./frame": {
|
|
16
|
+
"types": "./frame.d.mts",
|
|
17
|
+
"default": "./frame.mjs"
|
|
14
18
|
}
|
|
15
19
|
},
|
|
16
20
|
"files": [
|
|
@@ -19,7 +23,9 @@
|
|
|
19
23
|
"README.md",
|
|
20
24
|
"LICENSE",
|
|
21
25
|
"threads.mjs",
|
|
22
|
-
"threads.d.mts"
|
|
26
|
+
"threads.d.mts",
|
|
27
|
+
"frame.mjs",
|
|
28
|
+
"frame.d.mts"
|
|
23
29
|
],
|
|
24
30
|
"license": "MIT",
|
|
25
31
|
"keywords": [
|
|
@@ -27,7 +33,11 @@
|
|
|
27
33
|
"finite-elements",
|
|
28
34
|
"stiffness",
|
|
29
35
|
"stress",
|
|
30
|
-
"plane-stress"
|
|
36
|
+
"plane-stress",
|
|
37
|
+
"frames",
|
|
38
|
+
"beams",
|
|
39
|
+
"buckling",
|
|
40
|
+
"modal-analysis"
|
|
31
41
|
],
|
|
32
42
|
"engines": {
|
|
33
43
|
"node": ">=20"
|
package/threads.d.mts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
multiply(scale:
|
|
6
|
-
diagonal(scale:
|
|
1
|
+
export const threadsBackend: {
|
|
2
|
+
name: string;
|
|
3
|
+
precision: number;
|
|
4
|
+
operator: (g: import("./fea.mjs").Grid, ke: Float64Array | null, cellMatrices?: Float64Array) => {
|
|
5
|
+
multiply: (scale: Float64Array | null, x: Float64Array, y: Float64Array) => void;
|
|
6
|
+
diagonal: (scale: Float64Array | null, d: Float64Array) => void;
|
|
7
7
|
};
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
8
|
+
dot: (a: Float64Array, b: Float64Array) => number;
|
|
9
|
+
axpy: (a: number, x: Float64Array, y: Float64Array) => void;
|
|
10
|
+
};
|
package/threads.mjs
CHANGED
|
@@ -48,7 +48,12 @@ function workers() {
|
|
|
48
48
|
return pool;
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
-
|
|
51
|
+
// On Node 20 and older the products came out wrong now and then (a few solves in sixty, more with more threads):
|
|
52
|
+
// letting go of an operator's shared memory there corrupts work still running on it, and Node 20 is past its end of
|
|
53
|
+
// life. There, this backend is plain JavaScript under another name: right, only slower. (Node 22 and later: threads)
|
|
54
|
+
const NODE = Number(process.versions.node.split('.')[0]), SHARED_OK = NODE >= 22;
|
|
55
|
+
|
|
56
|
+
export const threadsBackend = !SHARED_OK ? { ...jsBackend, name: `js (threads need Node 22; this is Node ${NODE})` } : {
|
|
52
57
|
name: `threads (${THREADS})`,
|
|
53
58
|
precision: 64,
|
|
54
59
|
operator(g, ke, cellMatrices) {
|