@jtgtools/xbeam 0.0.1
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/LICENSE +21 -0
- package/README.md +64 -0
- package/dist/index.cjs +682 -0
- package/dist/index.d.cts +150 -0
- package/dist/index.d.ts +150 -0
- package/dist/index.js +649 -0
- package/package.json +31 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 JTG Tools
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# xbeam
|
|
2
|
+
|
|
3
|
+
A fast Euler-Bernoulli beam finite element solver in TypeScript with chart-ready output.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- 2-node Hermite beam elements
|
|
8
|
+
- distributed loads, point loads, and applied moments
|
|
9
|
+
- simply supported, cantilever, fixed, and propped support conditions
|
|
10
|
+
- full stiffness assembly with banded storage
|
|
11
|
+
- Cholesky solve with buffered reuse for speed
|
|
12
|
+
- support reaction and equilibrium checks
|
|
13
|
+
- deflection, moment, and shear diagram sampling
|
|
14
|
+
- demo page with Chart.js visualization
|
|
15
|
+
|
|
16
|
+
## Install
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
npm install
|
|
20
|
+
npm run build
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Scripts
|
|
24
|
+
|
|
25
|
+
- `npm test` — run tests with Vitest
|
|
26
|
+
- `npm run demo` — build and serve demo UI on http://localhost:3000
|
|
27
|
+
- `npm run bench` — run benchmark suite
|
|
28
|
+
|
|
29
|
+
## Usage
|
|
30
|
+
|
|
31
|
+
```ts
|
|
32
|
+
import { analyzeBeam, analyzeBeamChartReady } from '@jtgtools/xbeam';
|
|
33
|
+
|
|
34
|
+
const beam = {
|
|
35
|
+
length: 5,
|
|
36
|
+
modulusOfElasticity: 200e9,
|
|
37
|
+
momentOfInertia: 1e-6,
|
|
38
|
+
supports: [{ kind: 'PINNED', position: 0 }, { kind: 'ROLLER', position: 5 }],
|
|
39
|
+
pointLoads: [],
|
|
40
|
+
distributedLoads: [{ startMagnitude: -1000, endMagnitude: -1000, startPosition: 0, endPosition: 5 }],
|
|
41
|
+
appliedMoments: []
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
const results = analyzeBeam(beam);
|
|
45
|
+
// results.deflections, results.rotations, results.reactions...
|
|
46
|
+
|
|
47
|
+
const { results: chartResults, diagrams } = analyzeBeamChartReady(beam);
|
|
48
|
+
// diagrams.deflection, diagrams.moment, diagrams.shear
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Project structure
|
|
52
|
+
|
|
53
|
+
- `src/` — TypeScript source
|
|
54
|
+
- `tests/` — unit and regression tests
|
|
55
|
+
- `demo/` — pictorial demo page
|
|
56
|
+
- `dist/` — generated build output
|
|
57
|
+
|
|
58
|
+
## TypeScript
|
|
59
|
+
|
|
60
|
+
This project uses strict TS typings. If the compiler reports `Support kind` type errors in tests, ensure support objects are defined with literal `as const` or typed as `Support`.
|
|
61
|
+
|
|
62
|
+
## License
|
|
63
|
+
|
|
64
|
+
MIT
|