openseesjs 0.2.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.
Potentially problematic release.
This version of openseesjs might be problematic. Click here for more details.
- package/API_COVERAGE.md +242 -0
- package/API_REFERENCE.md +2267 -0
- package/CHANGELOG.md +42 -0
- package/LICENSE +34 -0
- package/README.md +150 -0
- package/THIRD_PARTY_NOTICES.md +25 -0
- package/dist/native/OpenSeesCommandError.d.ts +13 -0
- package/dist/native/OpenSeesCommandError.d.ts.map +1 -0
- package/dist/native/OpenSeesCommandError.js +23 -0
- package/dist/native/OpenSeesCommandError.js.map +1 -0
- package/dist/native/OpenSeesNativeBindingLoader.d.ts +5 -0
- package/dist/native/OpenSeesNativeBindingLoader.d.ts.map +1 -0
- package/dist/native/OpenSeesNativeBindingLoader.js +91 -0
- package/dist/native/OpenSeesNativeBindingLoader.js.map +1 -0
- package/dist/native/OpenSeesNativeQueries.d.ts +74 -0
- package/dist/native/OpenSeesNativeQueries.d.ts.map +1 -0
- package/dist/native/OpenSeesNativeQueries.js +151 -0
- package/dist/native/OpenSeesNativeQueries.js.map +1 -0
- package/dist/native/OpenSeesNativeSession.d.ts +33 -0
- package/dist/native/OpenSeesNativeSession.d.ts.map +1 -0
- package/dist/native/OpenSeesNativeSession.js +96 -0
- package/dist/native/OpenSeesNativeSession.js.map +1 -0
- package/dist/native/OpenSeesOps.d.ts +14 -0
- package/dist/native/OpenSeesOps.d.ts.map +1 -0
- package/dist/native/OpenSeesOps.js +44 -0
- package/dist/native/OpenSeesOps.js.map +1 -0
- package/dist/native/flattenArguments.d.ts +4 -0
- package/dist/native/flattenArguments.d.ts.map +1 -0
- package/dist/native/flattenArguments.js +36 -0
- package/dist/native/flattenArguments.js.map +1 -0
- package/dist/native/types.d.ts +34 -0
- package/dist/native/types.d.ts.map +1 -0
- package/dist/native/types.js +2 -0
- package/dist/native/types.js.map +1 -0
- package/dist/native-index.d.ts +12 -0
- package/dist/native-index.d.ts.map +1 -0
- package/dist/native-index.js +7 -0
- package/dist/native-index.js.map +1 -0
- package/dist/openseespy/generated/OpenSeesPyApi.generated.d.ts +1417 -0
- package/dist/openseespy/generated/OpenSeesPyApi.generated.d.ts.map +1 -0
- package/dist/openseespy/generated/OpenSeesPyApi.generated.js +237 -0
- package/dist/openseespy/generated/OpenSeesPyApi.generated.js.map +1 -0
- package/dist/openseespy/types.d.ts +12 -0
- package/dist/openseespy/types.d.ts.map +1 -0
- package/dist/openseespy/types.js +2 -0
- package/dist/openseespy/types.js.map +1 -0
- package/licenses/AMD.txt +91 -0
- package/licenses/ARPACK-NG.txt +45 -0
- package/licenses/GCC-Runtime.txt +265 -0
- package/licenses/LAPACK.txt +48 -0
- package/licenses/OpenBLAS.txt +29 -0
- package/licenses/OpenSees-COPYRIGHT.txt +32 -0
- package/licenses/Tcl.txt +357 -0
- package/licenses/UMFPACK.txt +38 -0
- package/licenses/zlib.txt +22 -0
- package/package.json +77 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 0.2.1 - 2026-09-26
|
|
4
|
+
|
|
5
|
+
- Move the Windows native runtime to the organization-owned package
|
|
6
|
+
`@openseesjs/native-win32-x64`.
|
|
7
|
+
- Remove the maintainer's personal npm scope from new installations.
|
|
8
|
+
|
|
9
|
+
## 0.2.0 - 2026-09-26
|
|
10
|
+
|
|
11
|
+
- Add the lazy OpenSeesPy-style global `ops` facade with automatic cleanup.
|
|
12
|
+
- Split native binaries into an optional platform-specific package.
|
|
13
|
+
- Add contextual native errors, bulk model commands and structured result helpers.
|
|
14
|
+
- Generate API documentation and editor hints from the command metadata.
|
|
15
|
+
- Use native Tcl flags as the single typed command convention and remove the
|
|
16
|
+
duplicated generated options-object overloads.
|
|
17
|
+
- Add complete `node` flag inference for `-ndf`, `-mass`, `-disp`, `-vel` and
|
|
18
|
+
`-accel` in one-, two- and three-dimensional models.
|
|
19
|
+
- Make `printA`/`printB` flags optional and return matrix/vector data directly
|
|
20
|
+
from the global API when `-ret` is requested.
|
|
21
|
+
- Support native `modalProperties` flags, including simultaneous report-file
|
|
22
|
+
output and strongly typed property results.
|
|
23
|
+
- Replace public rest parameters with explicit overloads and named arrays for
|
|
24
|
+
genuinely variable-length OpenSees lists.
|
|
25
|
+
- Add a publication check that rejects rest parameters in public declarations.
|
|
26
|
+
|
|
27
|
+
## 0.1.1 - 2026-09-25
|
|
28
|
+
|
|
29
|
+
- Publish only the native OpenSees runtime, typed commands, and direct queries.
|
|
30
|
+
- Exclude Tcl generation, visualization, examples, and application-specific analysis modules.
|
|
31
|
+
|
|
32
|
+
## 0.1.0 - 2026-09-25
|
|
33
|
+
|
|
34
|
+
- Added a strongly typed OpenSeesPy-compatible command surface.
|
|
35
|
+
- Added the embedded OpenSees native runtime and direct TypeScript queries.
|
|
36
|
+
- Added the Windows x64 in-process OpenSees 3.8.0 backend using Node-API 8.
|
|
37
|
+
- Added direct typed queries, bulk response extraction and modal response-spectrum analysis.
|
|
38
|
+
- Added model visualization and recorder parsers.
|
|
39
|
+
- Added native/executable parity tests, release provenance and third-party license notices.
|
|
40
|
+
|
|
41
|
+
Native limitations: one active session per Node.js process; `Dodd-Restrepo`,
|
|
42
|
+
`StressDensity` and `PML` are not available in this package version.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
APP-ALBA TypeScript wrapper license
|
|
2
|
+
===================================
|
|
3
|
+
|
|
4
|
+
Copyright (c) 2026 APP-ALBA contributors
|
|
5
|
+
|
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
of the original TypeScript/JavaScript wrapper code in this package (excluding
|
|
8
|
+
the bundled OpenSees native binary and third-party components), to deal in the
|
|
9
|
+
wrapper code without restriction, including without limitation the rights to
|
|
10
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
|
11
|
+
of the wrapper code, and to permit persons to whom the wrapper code is
|
|
12
|
+
furnished to do so, subject to the following conditions:
|
|
13
|
+
|
|
14
|
+
The above copyright notice and this permission notice shall be included in all
|
|
15
|
+
copies or substantial portions of the wrapper code.
|
|
16
|
+
|
|
17
|
+
THE WRAPPER CODE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
18
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
19
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
20
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
21
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
22
|
+
OUT OF OR IN CONNECTION WITH THE WRAPPER CODE OR THE USE OR OTHER DEALINGS IN
|
|
23
|
+
THE WRAPPER CODE.
|
|
24
|
+
|
|
25
|
+
Bundled third-party software
|
|
26
|
+
============================
|
|
27
|
+
|
|
28
|
+
This package includes a native binary derived from OpenSees and redistributes
|
|
29
|
+
other third-party runtime libraries. Those components are NOT licensed under
|
|
30
|
+
the wrapper license above. Their respective copyright notices, license terms,
|
|
31
|
+
commercial-use conditions and disclaimers remain in force.
|
|
32
|
+
|
|
33
|
+
See THIRD_PARTY_NOTICES.md and the licenses/ directory before redistributing
|
|
34
|
+
the package or incorporating it into a commercial product.
|
package/README.md
ADDED
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
# openseesjs
|
|
2
|
+
|
|
3
|
+
API de OpenSees 3.8 para Node.js y TypeScript mediante un addon nativo. Los
|
|
4
|
+
modelos se ejecutan dentro del proceso y los resultados regresan directamente
|
|
5
|
+
a JavaScript, sin generar ni ejecutar archivos Tcl intermedios.
|
|
6
|
+
|
|
7
|
+
## Instalacion
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install openseesjs
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Requiere Node.js 22 o posterior. El runtime opcional actual incluye un binario
|
|
14
|
+
precompilado para Windows x64.
|
|
15
|
+
|
|
16
|
+
## Uso minimo
|
|
17
|
+
|
|
18
|
+
La sesión se crea al usar el primer comando y se libera automáticamente al
|
|
19
|
+
terminar el proceso:
|
|
20
|
+
|
|
21
|
+
```ts
|
|
22
|
+
import { ops } from 'openseesjs';
|
|
23
|
+
|
|
24
|
+
ops.wipe();
|
|
25
|
+
ops.model('basic', '-ndm', 2, '-ndf', 2);
|
|
26
|
+
ops.node(1, 0, 0);
|
|
27
|
+
ops.node(2, 1, 0);
|
|
28
|
+
ops.fix(1, 1, 1);
|
|
29
|
+
ops.fix(2, 0, 1);
|
|
30
|
+
ops.uniaxialMaterial('Elastic', 1, 1000);
|
|
31
|
+
ops.element('truss', 1, 1, 2, 1, 1);
|
|
32
|
+
ops.timeSeries('Linear', 1);
|
|
33
|
+
ops.pattern('Plain', 1, 1);
|
|
34
|
+
ops.load(2, 10, 0);
|
|
35
|
+
ops.system('BandGeneral');
|
|
36
|
+
ops.numberer('RCM');
|
|
37
|
+
ops.constraints('Plain');
|
|
38
|
+
ops.integrator('LoadControl', 1);
|
|
39
|
+
ops.algorithm('Linear');
|
|
40
|
+
ops.analysis('Static');
|
|
41
|
+
|
|
42
|
+
if (ops.analyze(1) !== 0) throw new Error('Analysis failed.');
|
|
43
|
+
ops.reactions();
|
|
44
|
+
console.log(ops.nodeDisp(2));
|
|
45
|
+
console.log(ops.nodeReaction(1));
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Los comandos conservan la forma de Tcl mediante banderas explícitas. Cuando
|
|
49
|
+
una lista aparece antes de otra bandera se entrega como arreglo y el puente la
|
|
50
|
+
expande antes de invocar OpenSees:
|
|
51
|
+
|
|
52
|
+
```ts
|
|
53
|
+
ops.geomTransf('Linear', 1, '-jntOffset', [0, 0, 0, 0]);
|
|
54
|
+
ops.node(2, 1, 2, '-mass', [10, 10, 0], '-disp', [0, 0, 0]);
|
|
55
|
+
ops.timeSeries('Linear', 1, '-factor', 2);
|
|
56
|
+
ops.pattern('Plain', 1, 1, '-fact', 1);
|
|
57
|
+
ops.eleLoad('-ele', [1, 2], '-type', '-beamUniform', [-10, 0, 0]);
|
|
58
|
+
ops.recorder(
|
|
59
|
+
'Node', '-file', 'disp.out',
|
|
60
|
+
'-node', [2, 3], '-dof', [1, 2], 'disp',
|
|
61
|
+
);
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
La API publica no usa parametros `...rest`. Los comandos con una cantidad
|
|
65
|
+
finita de argumentos tienen overloads completos; las colecciones de longitud
|
|
66
|
+
realmente variable se reciben como arreglos con nombre y tipos de elementos
|
|
67
|
+
concretos.
|
|
68
|
+
|
|
69
|
+
## Organizacion recomendada
|
|
70
|
+
|
|
71
|
+
Mantenga un único `ops`, porque OpenSees utiliza un dominio global, y separe el
|
|
72
|
+
modelo en módulos ES: `geometry`, `materials`, `loads`, `analysis` y `results`.
|
|
73
|
+
Los módulos son preferibles a `namespace`: conservan imports explícitos,
|
|
74
|
+
aislamiento de responsabilidades y mejor compatibilidad con herramientas ESM.
|
|
75
|
+
|
|
76
|
+
## Sesion explicita
|
|
77
|
+
|
|
78
|
+
```ts
|
|
79
|
+
import { OpenSeesNativeSession, inspectNativeBackend } from 'openseesjs';
|
|
80
|
+
|
|
81
|
+
const availability = inspectNativeBackend();
|
|
82
|
+
if (!availability.available) throw new Error(availability.reason);
|
|
83
|
+
|
|
84
|
+
const model = new OpenSeesNativeSession();
|
|
85
|
+
|
|
86
|
+
try {
|
|
87
|
+
const ops = model.ops;
|
|
88
|
+
|
|
89
|
+
ops.wipe();
|
|
90
|
+
ops.model('basic', '-ndm', 2, '-ndf', 2);
|
|
91
|
+
ops.node(1, 0, 0);
|
|
92
|
+
ops.node(2, 1, 0);
|
|
93
|
+
ops.fix(1, 1, 1);
|
|
94
|
+
ops.fix(2, 0, 1);
|
|
95
|
+
ops.uniaxialMaterial('Elastic', 1, 1000);
|
|
96
|
+
ops.element('truss', 1, 1, 2, 1, 1);
|
|
97
|
+
ops.timeSeries('Linear', 1);
|
|
98
|
+
ops.pattern('Plain', 1, 1);
|
|
99
|
+
ops.load(2, 10, 0);
|
|
100
|
+
ops.system('BandGeneral');
|
|
101
|
+
ops.numberer('RCM');
|
|
102
|
+
ops.constraints('Plain');
|
|
103
|
+
ops.integrator('LoadControl', 1);
|
|
104
|
+
ops.algorithm('Linear');
|
|
105
|
+
ops.analysis('Static');
|
|
106
|
+
|
|
107
|
+
if (model.query.analyze(1) !== 0) throw new Error('Analysis failed.');
|
|
108
|
+
ops.reactions();
|
|
109
|
+
|
|
110
|
+
console.log(model.query.nodeDisp(2));
|
|
111
|
+
console.log(model.query.nodeReaction(1));
|
|
112
|
+
} finally {
|
|
113
|
+
model.close();
|
|
114
|
+
}
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
Las consultas por lote reducen los cruces entre JavaScript y C++:
|
|
118
|
+
|
|
119
|
+
```ts
|
|
120
|
+
const displacements = model.query.nodeDisplacements(nodeTags);
|
|
121
|
+
const reactions = model.query.nodeReactions(supportTags);
|
|
122
|
+
const forces = model.query.elementForces(elementTags);
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
Para crear modelos grandes con una sola llamada nativa:
|
|
126
|
+
|
|
127
|
+
```ts
|
|
128
|
+
ops.nodes([[1, 0, 0], [2, 1, 0], [3, 2, 0]]);
|
|
129
|
+
ops.loads([[2, 10, 0], [3, 20, 0]]);
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
La referencia generada de todos los comandos, firmas y opciones está en
|
|
133
|
+
[API_REFERENCE.md](API_REFERENCE.md). La cobertura está en
|
|
134
|
+
[API_COVERAGE.md](API_COVERAGE.md).
|
|
135
|
+
|
|
136
|
+
## Alcance
|
|
137
|
+
|
|
138
|
+
- API tipada basada en los comandos de OpenSeesPy 3.8.0.0.
|
|
139
|
+
- Resultados nodales, fuerzas de elementos, valores propios y propiedades
|
|
140
|
+
modales disponibles directamente en TypeScript.
|
|
141
|
+
- Una sesion nativa activa por proceso, debido al estado global de OpenSees.
|
|
142
|
+
- Para paralelismo deben utilizarse procesos Node.js independientes.
|
|
143
|
+
- Los binarios se distribuyen en paquetes opcionales con scope por plataforma; npm solo
|
|
144
|
+
instala el correspondiente al sistema actual.
|
|
145
|
+
- Las familias `Dodd-Restrepo`, `StressDensity` y `PML` no estan incluidas en
|
|
146
|
+
el binario portatil actual.
|
|
147
|
+
|
|
148
|
+
Este proyecto es independiente y no esta afiliado con los desarrolladores de
|
|
149
|
+
OpenSees. Consulte [LICENSE](LICENSE) y
|
|
150
|
+
[THIRD_PARTY_NOTICES.md](THIRD_PARTY_NOTICES.md) antes de redistribuirlo.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Third-party notices
|
|
2
|
+
|
|
3
|
+
The Windows x64 native backend contains or dynamically loads the components
|
|
4
|
+
listed below. The corresponding license texts are distributed in `licenses/`.
|
|
5
|
+
|
|
6
|
+
| Component | Purpose | Notice |
|
|
7
|
+
|---|---|---|
|
|
8
|
+
| OpenSees 3.8.0 | Structural analysis engine embedded in `opensees.node` | `licenses/OpenSees-COPYRIGHT.txt` |
|
|
9
|
+
| Tcl 8.6 | Embedded command interpreter | `licenses/Tcl.txt` |
|
|
10
|
+
| OpenBLAS | BLAS implementation | `licenses/OpenBLAS.txt` |
|
|
11
|
+
| LAPACK | Dense linear algebra | `licenses/LAPACK.txt` |
|
|
12
|
+
| ARPACK-NG | Eigenvalue solver | `licenses/ARPACK-NG.txt` |
|
|
13
|
+
| SuiteSparse AMD | Sparse ordering, statically linked | `licenses/AMD.txt` |
|
|
14
|
+
| SuiteSparse UMFPACK | Sparse solver, statically linked | `licenses/UMFPACK.txt` |
|
|
15
|
+
| zlib | Tcl runtime dependency | `licenses/zlib.txt` |
|
|
16
|
+
| GCC runtime libraries | Fortran/MinGW runtime used by numerical DLLs | `licenses/GCC-Runtime.txt` |
|
|
17
|
+
|
|
18
|
+
OpenSees is copyrighted by The Regents of the University of California. Its
|
|
19
|
+
license permits specified noncommercial and internal uses, requires its notice
|
|
20
|
+
to accompany binary redistributions, and directs commercial product
|
|
21
|
+
distribution requests to UC Berkeley. Publishing this npm package does not
|
|
22
|
+
grant additional commercial rights.
|
|
23
|
+
|
|
24
|
+
The package is not affiliated with, endorsed by, or sponsored by the OpenSees
|
|
25
|
+
project, PEER, or the University of California.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { OpenSeesNativeScalar } from './types.js';
|
|
2
|
+
export declare class OpenSeesCommandError extends Error {
|
|
3
|
+
readonly command: string;
|
|
4
|
+
readonly arguments_: readonly OpenSeesNativeScalar[];
|
|
5
|
+
readonly name = "OpenSeesCommandError";
|
|
6
|
+
constructor(command: string, arguments_: readonly OpenSeesNativeScalar[], message: string, options?: {
|
|
7
|
+
readonly cause?: unknown;
|
|
8
|
+
readonly rowIndex?: number;
|
|
9
|
+
});
|
|
10
|
+
readonly rowIndex: number | undefined;
|
|
11
|
+
}
|
|
12
|
+
export declare function invokeNative(invoke: () => unknown, command: string, args: readonly OpenSeesNativeScalar[], rowIndex?: number): unknown;
|
|
13
|
+
//# sourceMappingURL=OpenSeesCommandError.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OpenSeesCommandError.d.ts","sourceRoot":"","sources":["../../src/native/OpenSeesCommandError.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAEvD,qBAAa,oBAAqB,SAAQ,KAAK;aAI3B,OAAO,EAAE,MAAM;aACf,UAAU,EAAE,SAAS,oBAAoB,EAAE;IAJ7D,SAAyB,IAAI,0BAA0B;gBAGrC,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,SAAS,oBAAoB,EAAE,EAC3D,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE;QAAE,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC;QAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAE;IAMpE,SAAgB,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;CAC9C;AAED,wBAAgB,YAAY,CAC1B,MAAM,EAAE,MAAM,OAAO,EACrB,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,SAAS,oBAAoB,EAAE,EACrC,QAAQ,CAAC,EAAE,MAAM,GAChB,OAAO,CAaT"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export class OpenSeesCommandError extends Error {
|
|
2
|
+
command;
|
|
3
|
+
arguments_;
|
|
4
|
+
name = 'OpenSeesCommandError';
|
|
5
|
+
constructor(command, arguments_, message, options) {
|
|
6
|
+
super(message, { cause: options?.cause });
|
|
7
|
+
this.command = command;
|
|
8
|
+
this.arguments_ = arguments_;
|
|
9
|
+
this.rowIndex = options?.rowIndex;
|
|
10
|
+
}
|
|
11
|
+
rowIndex;
|
|
12
|
+
}
|
|
13
|
+
export function invokeNative(invoke, command, args, rowIndex) {
|
|
14
|
+
try {
|
|
15
|
+
return invoke();
|
|
16
|
+
}
|
|
17
|
+
catch (cause) {
|
|
18
|
+
const detail = cause instanceof Error ? cause.message : String(cause);
|
|
19
|
+
const row = rowIndex === undefined ? '' : ` at batch row ${rowIndex}`;
|
|
20
|
+
throw new OpenSeesCommandError(command, args, `OpenSees command "${command}" failed${row}: ${detail}`, { cause, ...(rowIndex === undefined ? {} : { rowIndex }) });
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=OpenSeesCommandError.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OpenSeesCommandError.js","sourceRoot":"","sources":["../../src/native/OpenSeesCommandError.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,oBAAqB,SAAQ,KAAK;IAI3B;IACA;IAJO,IAAI,GAAG,sBAAsB,CAAC;IAEvD,YACkB,OAAe,EACf,UAA2C,EAC3D,OAAe,EACf,OAAkE;QAElE,KAAK,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,CAAC;QAL1B,YAAO,GAAP,OAAO,CAAQ;QACf,eAAU,GAAV,UAAU,CAAiC;QAK3D,IAAI,CAAC,QAAQ,GAAG,OAAO,EAAE,QAAQ,CAAC;IACpC,CAAC;IAEe,QAAQ,CAAqB;CAC9C;AAED,MAAM,UAAU,YAAY,CAC1B,MAAqB,EACrB,OAAe,EACf,IAAqC,EACrC,QAAiB;IAEjB,IAAI,CAAC;QACH,OAAO,MAAM,EAAE,CAAC;IAClB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,MAAM,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QACtE,MAAM,GAAG,GAAG,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,iBAAiB,QAAQ,EAAE,CAAC;QACtE,MAAM,IAAI,oBAAoB,CAC5B,OAAO,EACP,IAAI,EACJ,qBAAqB,OAAO,WAAW,GAAG,KAAK,MAAM,EAAE,EACvD,EAAE,KAAK,EAAE,GAAG,CAAC,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,CAC3D,CAAC;IACJ,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { OpenSeesNativeAvailability, OpenSeesNativeBinding } from './types.js';
|
|
2
|
+
export declare function defaultNativeBindingPath(): string;
|
|
3
|
+
export declare function inspectNativeBackend(bindingPath?: string): OpenSeesNativeAvailability;
|
|
4
|
+
export declare function loadNativeBinding(bindingPath?: string): OpenSeesNativeBinding;
|
|
5
|
+
//# sourceMappingURL=OpenSeesNativeBindingLoader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OpenSeesNativeBindingLoader.d.ts","sourceRoot":"","sources":["../../src/native/OpenSeesNativeBindingLoader.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,0BAA0B,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAgCpF,wBAAgB,wBAAwB,IAAI,MAAM,CAEjD;AAED,wBAAgB,oBAAoB,CAAC,WAAW,SAA6B,GAAG,0BAA0B,CA0BzG;AAuBD,wBAAgB,iBAAiB,CAAC,WAAW,SAA6B,GAAG,qBAAqB,CAWjG"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { existsSync, readFileSync } from 'node:fs';
|
|
2
|
+
import { createRequire } from 'node:module';
|
|
3
|
+
import { dirname, resolve } from 'node:path';
|
|
4
|
+
import { fileURLToPath } from 'node:url';
|
|
5
|
+
const require = createRequire(import.meta.url);
|
|
6
|
+
function platformPackageName() {
|
|
7
|
+
return `@openseesjs/native-${process.platform}-${process.arch}`;
|
|
8
|
+
}
|
|
9
|
+
function resolveBinding() {
|
|
10
|
+
const override = process.env.OPEN_SEES_NODE_BINDING;
|
|
11
|
+
if (override)
|
|
12
|
+
return { path: resolve(override), distribution: 'environment' };
|
|
13
|
+
try {
|
|
14
|
+
return {
|
|
15
|
+
path: require.resolve(`${platformPackageName()}/opensees.node`),
|
|
16
|
+
distribution: 'platform-package',
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
catch {
|
|
20
|
+
const packageRoot = resolve(dirname(fileURLToPath(import.meta.url)), '..', '..');
|
|
21
|
+
return {
|
|
22
|
+
path: resolve(packageRoot, 'native', 'prebuilds', `${process.platform}-${process.arch}`, 'opensees.node'),
|
|
23
|
+
distribution: 'bundled',
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
export function defaultNativeBindingPath() {
|
|
28
|
+
return resolveBinding().path;
|
|
29
|
+
}
|
|
30
|
+
export function inspectNativeBackend(bindingPath = defaultNativeBindingPath()) {
|
|
31
|
+
const resolved = resolve(bindingPath);
|
|
32
|
+
const automatic = resolveBinding();
|
|
33
|
+
const distribution = resolved === automatic.path ? automatic.distribution : 'explicit';
|
|
34
|
+
const base = { bindingPath: resolved, platform: process.platform, arch: process.arch, distribution };
|
|
35
|
+
if (!existsSync(resolved)) {
|
|
36
|
+
return {
|
|
37
|
+
available: false,
|
|
38
|
+
...base,
|
|
39
|
+
reason: `No native OpenSees runtime is available for ${process.platform}-${process.arch}. Install ${platformPackageName()} or set OPEN_SEES_NODE_BINDING.`,
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
try {
|
|
43
|
+
const loaded = require(resolved);
|
|
44
|
+
if (typeof loaded.createSession !== 'function') {
|
|
45
|
+
return { available: false, ...base, reason: 'The native addon does not export createSession().' };
|
|
46
|
+
}
|
|
47
|
+
return { available: true, ...base, ...readBuildInfo(resolved) };
|
|
48
|
+
}
|
|
49
|
+
catch (error) {
|
|
50
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
51
|
+
return {
|
|
52
|
+
available: false,
|
|
53
|
+
...base,
|
|
54
|
+
reason: `The native addon or one of its runtime libraries could not be loaded: ${message}`,
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
function readBuildInfo(bindingPath) {
|
|
59
|
+
const candidates = [
|
|
60
|
+
resolve(dirname(bindingPath), 'BUILD_INFO.json'),
|
|
61
|
+
resolve(dirname(bindingPath), '..', '..', 'BUILD_INFO.json'),
|
|
62
|
+
];
|
|
63
|
+
for (const candidate of candidates) {
|
|
64
|
+
if (!existsSync(candidate))
|
|
65
|
+
continue;
|
|
66
|
+
try {
|
|
67
|
+
const info = JSON.parse(readFileSync(candidate, 'utf8'));
|
|
68
|
+
return {
|
|
69
|
+
...(info.openSeesVersion === undefined ? {} : { openSeesVersion: info.openSeesVersion }),
|
|
70
|
+
...(info.openSeesSourceRevision === undefined ? {} : { sourceRevision: info.openSeesSourceRevision }),
|
|
71
|
+
...(info.nodeApi === undefined ? {} : { nodeApi: info.nodeApi }),
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
catch {
|
|
75
|
+
return {};
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
return {};
|
|
79
|
+
}
|
|
80
|
+
export function loadNativeBinding(bindingPath = defaultNativeBindingPath()) {
|
|
81
|
+
const availability = inspectNativeBackend(bindingPath);
|
|
82
|
+
if (!availability.available) {
|
|
83
|
+
throw new Error(`${availability.reason} Expected: ${availability.bindingPath}`);
|
|
84
|
+
}
|
|
85
|
+
const loaded = require(availability.bindingPath);
|
|
86
|
+
if (typeof loaded.createSession !== 'function') {
|
|
87
|
+
throw new Error(`Invalid OpenSees native addon at ${availability.bindingPath}: createSession() is missing.`);
|
|
88
|
+
}
|
|
89
|
+
return loaded;
|
|
90
|
+
}
|
|
91
|
+
//# sourceMappingURL=OpenSeesNativeBindingLoader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OpenSeesNativeBindingLoader.js","sourceRoot":"","sources":["../../src/native/OpenSeesNativeBindingLoader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAGzC,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAQ/C,SAAS,mBAAmB;IAC1B,OAAO,sBAAsB,OAAO,CAAC,QAAQ,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC;AAClE,CAAC;AAED,SAAS,cAAc;IACrB,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,sBAAsB,CAAC;IACpD,IAAI,QAAQ;QAAE,OAAO,EAAE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,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,eAAe,EAAE,IAAI,CAAC,eAAe,EAAE,CAAC;gBACxF,GAAG,CAAC,IAAI,CAAC,sBAAsB,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,cAAc,EAAE,IAAI,CAAC,sBAAsB,EAAE,CAAC;gBACrG,GAAG,CAAC,IAAI,CAAC,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,CAAC;aACjE,CAAC;QACJ,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,EAAE,CAAC;QACZ,CAAC;IACH,CAAC;IACD,OAAO,EAAE,CAAC;AACZ,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,WAAW,GAAG,wBAAwB,EAAE;IACxE,MAAM,YAAY,GAAG,oBAAoB,CAAC,WAAW,CAAC,CAAC;IACvD,IAAI,CAAC,YAAY,CAAC,SAAS,EAAE,CAAC;QAC5B,MAAM,IAAI,KAAK,CAAC,GAAG,YAAY,CAAC,MAAM,cAAc,YAAY,CAAC,WAAW,EAAE,CAAC,CAAC;IAClF,CAAC;IAED,MAAM,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC,WAAW,CAAmC,CAAC;IACnF,IAAI,OAAO,MAAM,CAAC,aAAa,KAAK,UAAU,EAAE,CAAC;QAC/C,MAAM,IAAI,KAAK,CAAC,oCAAoC,YAAY,CAAC,WAAW,+BAA+B,CAAC,CAAC;IAC/G,CAAC;IACD,OAAO,MAA+B,CAAC;AACzC,CAAC"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import type { OpenSeesPyArgument } from '../openseespy/types.js';
|
|
2
|
+
import type { OpenSeesNativeBindingSession, OpenSeesNativeValue } from './types.js';
|
|
3
|
+
export type OpenSeesEigenSolver = '-genBandArpack' | '-symmBandLapack' | '-fullGenLapack';
|
|
4
|
+
export type OpenSeesModalProperties = Readonly<Record<string, number | readonly number[]>>;
|
|
5
|
+
export type OpenSeesResponseRecord = Readonly<Record<number, readonly number[]>>;
|
|
6
|
+
export interface OpenSeesElementEndForces2D {
|
|
7
|
+
readonly axial: number;
|
|
8
|
+
readonly shear: number;
|
|
9
|
+
readonly moment: number;
|
|
10
|
+
}
|
|
11
|
+
export interface OpenSeesElementLocalForces2D {
|
|
12
|
+
readonly i: OpenSeesElementEndForces2D;
|
|
13
|
+
readonly j: OpenSeesElementEndForces2D;
|
|
14
|
+
readonly raw: readonly number[];
|
|
15
|
+
}
|
|
16
|
+
export interface OpenSeesModalResult {
|
|
17
|
+
readonly mode: number;
|
|
18
|
+
readonly eigenvalue: number;
|
|
19
|
+
readonly omega: number;
|
|
20
|
+
readonly frequency: number;
|
|
21
|
+
readonly period: number;
|
|
22
|
+
}
|
|
23
|
+
export declare class OpenSeesNativeQueries {
|
|
24
|
+
private readonly session;
|
|
25
|
+
constructor(session: OpenSeesNativeBindingSession);
|
|
26
|
+
analyze(numIncr?: number, dt?: number, dtMin?: number, dtMax?: number, jd?: number): number;
|
|
27
|
+
getTime(): number;
|
|
28
|
+
getLoadFactor(patternTag: number): number;
|
|
29
|
+
getNodeTags(meshTag?: number): number[];
|
|
30
|
+
getEleTags(meshTag?: number): number[];
|
|
31
|
+
nodeCoord(nodeTag: number): number[];
|
|
32
|
+
nodeCoord(nodeTag: number, dimension: number): number;
|
|
33
|
+
nodeDisp(nodeTag: number): number[];
|
|
34
|
+
nodeDisp(nodeTag: number, dof: number): number;
|
|
35
|
+
nodeVel(nodeTag: number): number[];
|
|
36
|
+
nodeVel(nodeTag: number, dof: number): number;
|
|
37
|
+
nodeAccel(nodeTag: number): number[];
|
|
38
|
+
nodeAccel(nodeTag: number, dof: number): number;
|
|
39
|
+
nodeReaction(nodeTag: number): number[];
|
|
40
|
+
nodeReaction(nodeTag: number, dof: number): number;
|
|
41
|
+
nodeDisplacements(nodeTags: readonly number[]): OpenSeesResponseRecord;
|
|
42
|
+
nodeReactions(nodeTags: readonly number[]): OpenSeesResponseRecord;
|
|
43
|
+
eleResponse(eleTag: number, response: readonly OpenSeesPyArgument[]): number[];
|
|
44
|
+
eleForce(eleTag: number): number[];
|
|
45
|
+
eleForce(eleTag: number, dof: number): number;
|
|
46
|
+
elementForces(elementTags: readonly number[]): OpenSeesResponseRecord;
|
|
47
|
+
printA(): number;
|
|
48
|
+
printA(fileFlag: '-file', filename: string): number;
|
|
49
|
+
printA(retFlag: '-ret'): number[];
|
|
50
|
+
printA(fileFlag: '-file', filename: string, retFlag: '-ret'): number[];
|
|
51
|
+
printB(): number;
|
|
52
|
+
printB(fileFlag: '-file', filename: string): number;
|
|
53
|
+
printB(retFlag: '-ret'): number[];
|
|
54
|
+
printB(fileFlag: '-file', filename: string, retFlag: '-ret'): number[];
|
|
55
|
+
elementLocalForces2D(eleTag: number): OpenSeesElementLocalForces2D;
|
|
56
|
+
eigen(numModes: number): number[];
|
|
57
|
+
eigen(solver: OpenSeesEigenSolver, numModes: number): number[];
|
|
58
|
+
modalResults(numModes: number, solver?: OpenSeesEigenSolver): OpenSeesModalResult[];
|
|
59
|
+
nodeEigenvector(nodeTag: number, mode: number): number[];
|
|
60
|
+
nodeEigenvector(nodeTag: number, mode: number, dof: number): number;
|
|
61
|
+
modalProperties(): OpenSeesModalProperties;
|
|
62
|
+
modalProperties(printFlag: '-print'): OpenSeesModalProperties;
|
|
63
|
+
modalProperties(fileFlag: '-file', reportFileName: string): OpenSeesModalProperties;
|
|
64
|
+
modalProperties(unormFlag: '-unorm'): OpenSeesModalProperties;
|
|
65
|
+
modalProperties(fileFlag: '-file', reportFileName: string, unormFlag: '-unorm'): OpenSeesModalProperties;
|
|
66
|
+
modalProperties(printFlag: '-print', fileFlag: '-file', reportFileName: string, unormFlag?: '-unorm'): OpenSeesModalProperties;
|
|
67
|
+
version(): string;
|
|
68
|
+
/** Escape hatch tipado para resultados todavía no especializados. */
|
|
69
|
+
call(command: string, args?: readonly OpenSeesPyArgument[]): OpenSeesNativeValue;
|
|
70
|
+
private number;
|
|
71
|
+
private numbers;
|
|
72
|
+
private vectorRecord;
|
|
73
|
+
}
|
|
74
|
+
//# sourceMappingURL=OpenSeesNativeQueries.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OpenSeesNativeQueries.d.ts","sourceRoot":"","sources":["../../src/native/OpenSeesNativeQueries.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAGjE,OAAO,KAAK,EAAE,4BAA4B,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAEpF,MAAM,MAAM,mBAAmB,GAC3B,gBAAgB,GAChB,iBAAiB,GACjB,gBAAgB,CAAC;AAErB,MAAM,MAAM,uBAAuB,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,CAAC,CAAC,CAAC;AAC3F,MAAM,MAAM,sBAAsB,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC,CAAC,CAAC;AAEjF,MAAM,WAAW,0BAA0B;IACzC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,4BAA4B;IAC3C,QAAQ,CAAC,CAAC,EAAE,0BAA0B,CAAC;IACvC,QAAQ,CAAC,CAAC,EAAE,0BAA0B,CAAC;IACvC,QAAQ,CAAC,GAAG,EAAE,SAAS,MAAM,EAAE,CAAC;CACjC;AAED,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAA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AAe,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM;IAMnE,eAAe,IAAI,uBAAuB;IAC1C,eAAe,CAAC,SAAS,EAAE,QAAQ,GAAG,uBAAuB;IAC7D,eAAe,CAAC,QAAQ,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,GAAG,uBAAuB;IACnF,eAAe,CAAC,SAAS,EAAE,QAAQ,GAAG,uBAAuB;IAC7D,eAAe,CAAC,QAAQ,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,GAAG,uBAAuB;IACxG,eAAe,CAAC,SAAS,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,QAAQ,GAAG,uBAAuB;IAkB9H,OAAO,IAAI,MAAM;IAMjB,qEAAqE;IACrE,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,GAAE,SAAS,kBAAkB,EAAO,GAAG,mBAAmB;IAKpF,OAAO,CAAC,MAAM;IAMd,OAAO,CAAC,OAAO;IAQf,OAAO,CAAC,YAAY;CAerB"}
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import { flattenNativeArguments } from './flattenArguments.js';
|
|
2
|
+
import { invokeNative } from './OpenSeesCommandError.js';
|
|
3
|
+
export class OpenSeesNativeQueries {
|
|
4
|
+
session;
|
|
5
|
+
constructor(session) {
|
|
6
|
+
this.session = session;
|
|
7
|
+
}
|
|
8
|
+
analyze(numIncr = 1, dt, dtMin, dtMax, jd) {
|
|
9
|
+
return this.number('analyze', numIncr, dt, dtMin, dtMax, jd);
|
|
10
|
+
}
|
|
11
|
+
getTime() { return this.number('getTime'); }
|
|
12
|
+
getLoadFactor(patternTag) { return this.number('getLoadFactor', patternTag); }
|
|
13
|
+
getNodeTags(meshTag) { return this.numbers('getNodeTags', meshTag === undefined ? undefined : { mesh: meshTag }); }
|
|
14
|
+
getEleTags(meshTag) { return this.numbers('getEleTags', meshTag === undefined ? undefined : { mesh: meshTag }); }
|
|
15
|
+
nodeCoord(nodeTag, dimension) {
|
|
16
|
+
return dimension === undefined ? this.numbers('nodeCoord', nodeTag) : this.number('nodeCoord', nodeTag, dimension);
|
|
17
|
+
}
|
|
18
|
+
nodeDisp(nodeTag, dof) {
|
|
19
|
+
return dof === undefined ? this.numbers('nodeDisp', nodeTag) : this.number('nodeDisp', nodeTag, dof);
|
|
20
|
+
}
|
|
21
|
+
nodeVel(nodeTag, dof) {
|
|
22
|
+
return dof === undefined ? this.numbers('nodeVel', nodeTag) : this.number('nodeVel', nodeTag, dof);
|
|
23
|
+
}
|
|
24
|
+
nodeAccel(nodeTag, dof) {
|
|
25
|
+
return dof === undefined ? this.numbers('nodeAccel', nodeTag) : this.number('nodeAccel', nodeTag, dof);
|
|
26
|
+
}
|
|
27
|
+
nodeReaction(nodeTag, dof) {
|
|
28
|
+
return dof === undefined ? this.numbers('nodeReaction', nodeTag) : this.number('nodeReaction', nodeTag, dof);
|
|
29
|
+
}
|
|
30
|
+
nodeDisplacements(nodeTags) {
|
|
31
|
+
return this.vectorRecord('nodeDisp', nodeTags);
|
|
32
|
+
}
|
|
33
|
+
nodeReactions(nodeTags) {
|
|
34
|
+
return this.vectorRecord('nodeReaction', nodeTags);
|
|
35
|
+
}
|
|
36
|
+
eleResponse(eleTag, response) {
|
|
37
|
+
return this.numbers('eleResponse', eleTag, response);
|
|
38
|
+
}
|
|
39
|
+
eleForce(eleTag, dof) {
|
|
40
|
+
return dof === undefined ? this.numbers('eleForce', eleTag) : this.number('eleForce', eleTag, dof);
|
|
41
|
+
}
|
|
42
|
+
elementForces(elementTags) {
|
|
43
|
+
return this.vectorRecord('eleForce', elementTags);
|
|
44
|
+
}
|
|
45
|
+
printA(...args) {
|
|
46
|
+
return args.some(argument => argument === '-ret')
|
|
47
|
+
? this.numbers('printA', ...args)
|
|
48
|
+
: this.number('printA', ...args);
|
|
49
|
+
}
|
|
50
|
+
printB(...args) {
|
|
51
|
+
return args.some(argument => argument === '-ret')
|
|
52
|
+
? this.numbers('printB', ...args)
|
|
53
|
+
: this.number('printB', ...args);
|
|
54
|
+
}
|
|
55
|
+
elementLocalForces2D(eleTag) {
|
|
56
|
+
const raw = this.eleResponse(eleTag, ['localForce']);
|
|
57
|
+
if (raw.length < 6)
|
|
58
|
+
throw resultTypeError('eleResponse localForce', 'at least six values', raw);
|
|
59
|
+
return {
|
|
60
|
+
i: { axial: raw[0], shear: raw[1], moment: raw[2] },
|
|
61
|
+
j: { axial: raw[3], shear: raw[4], moment: raw[5] },
|
|
62
|
+
raw,
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
eigen(solverOrModes, numModes) {
|
|
66
|
+
return typeof solverOrModes === 'number'
|
|
67
|
+
? this.numbers('eigen', solverOrModes)
|
|
68
|
+
: this.numbers('eigen', solverOrModes, numModes);
|
|
69
|
+
}
|
|
70
|
+
modalResults(numModes, solver = '-genBandArpack') {
|
|
71
|
+
return this.eigen(solver, numModes).map((eigenvalue, index) => {
|
|
72
|
+
const omega = Math.sqrt(eigenvalue);
|
|
73
|
+
const frequency = omega / (2 * Math.PI);
|
|
74
|
+
return {
|
|
75
|
+
mode: index + 1,
|
|
76
|
+
eigenvalue,
|
|
77
|
+
omega,
|
|
78
|
+
frequency,
|
|
79
|
+
period: frequency === 0 ? Number.POSITIVE_INFINITY : 1 / frequency,
|
|
80
|
+
};
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
nodeEigenvector(nodeTag, mode, dof) {
|
|
84
|
+
return dof === undefined
|
|
85
|
+
? this.numbers('nodeEigenvector', nodeTag, mode)
|
|
86
|
+
: this.number('nodeEigenvector', nodeTag, mode, dof);
|
|
87
|
+
}
|
|
88
|
+
modalProperties(...flags) {
|
|
89
|
+
const value = this.call('modalProperties', [...flags, '-return']);
|
|
90
|
+
if (!Array.isArray(value) || value.length % 2 !== 0) {
|
|
91
|
+
throw resultTypeError('modalProperties', 'Tcl dictionary', value);
|
|
92
|
+
}
|
|
93
|
+
const properties = {};
|
|
94
|
+
for (let index = 0; index < value.length; index += 2) {
|
|
95
|
+
const key = value[index];
|
|
96
|
+
const entry = value[index + 1];
|
|
97
|
+
if (typeof key !== 'string' || !isNumericValue(entry)) {
|
|
98
|
+
throw resultTypeError('modalProperties', 'numeric Tcl dictionary', value);
|
|
99
|
+
}
|
|
100
|
+
properties[key] = entry;
|
|
101
|
+
}
|
|
102
|
+
return properties;
|
|
103
|
+
}
|
|
104
|
+
version() {
|
|
105
|
+
const value = this.call('version');
|
|
106
|
+
if (typeof value !== 'string')
|
|
107
|
+
throw resultTypeError('version', 'string', value);
|
|
108
|
+
return value;
|
|
109
|
+
}
|
|
110
|
+
/** Escape hatch tipado para resultados todavía no especializados. */
|
|
111
|
+
call(command, args = []) {
|
|
112
|
+
const flattened = flattenNativeArguments(args);
|
|
113
|
+
return invokeNative(() => this.session.invoke(command, flattened), command, flattened);
|
|
114
|
+
}
|
|
115
|
+
number(command, ...args) {
|
|
116
|
+
const value = this.call(command, args);
|
|
117
|
+
if (typeof value !== 'number')
|
|
118
|
+
throw resultTypeError(command, 'number', value);
|
|
119
|
+
return value;
|
|
120
|
+
}
|
|
121
|
+
numbers(command, ...args) {
|
|
122
|
+
const value = this.call(command, args);
|
|
123
|
+
if (!Array.isArray(value) || !value.every((item) => typeof item === 'number')) {
|
|
124
|
+
throw resultTypeError(command, 'number[]', value);
|
|
125
|
+
}
|
|
126
|
+
return value;
|
|
127
|
+
}
|
|
128
|
+
vectorRecord(command, tags) {
|
|
129
|
+
const rows = tags.map(tag => [tag]);
|
|
130
|
+
const values = this.session.invokeMany === undefined
|
|
131
|
+
? rows.map((row, index) => invokeNative(() => this.session.invoke(command, row), command, row, index))
|
|
132
|
+
: invokeNative(() => this.session.invokeMany(command, rows), command, []);
|
|
133
|
+
const record = {};
|
|
134
|
+
for (let index = 0; index < tags.length; index++) {
|
|
135
|
+
const value = values[index];
|
|
136
|
+
if (!Array.isArray(value) || !value.every(item => typeof item === 'number')) {
|
|
137
|
+
throw resultTypeError(command, 'number[]', value);
|
|
138
|
+
}
|
|
139
|
+
record[tags[index]] = value;
|
|
140
|
+
}
|
|
141
|
+
return record;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
function isNumericValue(value) {
|
|
145
|
+
return typeof value === 'number'
|
|
146
|
+
|| (Array.isArray(value) && value.every(item => typeof item === 'number'));
|
|
147
|
+
}
|
|
148
|
+
function resultTypeError(command, expected, actual) {
|
|
149
|
+
return new TypeError(`${command} returned ${JSON.stringify(actual)}; expected ${expected}.`);
|
|
150
|
+
}
|
|
151
|
+
//# sourceMappingURL=OpenSeesNativeQueries.js.map
|