radia 1.3.3__py3-none-any.whl → 1.3.4__py3-none-any.whl
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.
- python/nastran_mesh_import.py +441 -0
- python/netgen_mesh_import.py +572 -0
- python/radia_field_cached.py +274 -274
- python/radia_ngsolve.pyd +0 -0
- python/radia_ngsolve_utils.py +293 -0
- python/radia_vtk_export.py +106 -19
- {radia-1.3.3.dist-info → radia-1.3.4.dist-info}/METADATA +1 -4
- radia-1.3.4.dist-info/RECORD +17 -0
- {radia-1.3.3.dist-info → radia-1.3.4.dist-info}/licenses/LICENSE +93 -93
- python/nastran_reader.py +0 -295
- python/radia.pyd +0 -0
- radia-1.3.3.dist-info/RECORD +0 -15
- {radia-1.3.3.dist-info → radia-1.3.4.dist-info}/WHEEL +0 -0
- {radia-1.3.3.dist-info → radia-1.3.4.dist-info}/top_level.txt +0 -0
|
@@ -1,93 +1,93 @@
|
|
|
1
|
-
RADIA SOFTWARE LICENSE
|
|
2
|
-
======================
|
|
3
|
-
|
|
4
|
-
This software contains multiple components with different licenses:
|
|
5
|
-
|
|
6
|
-
1. RADIA Core (BSD-style License)
|
|
7
|
-
2. HACApK_LH-Cimplm Library (MIT License)
|
|
8
|
-
|
|
9
|
-
All licenses are permissive open-source licenses allowing redistribution
|
|
10
|
-
and modification.
|
|
11
|
-
|
|
12
|
-
================================================================================
|
|
13
|
-
PART 1: RADIA CORE
|
|
14
|
-
================================================================================
|
|
15
|
-
|
|
16
|
-
Copyright © 1997 - 2018, European Synchrotron Radiation Facility
|
|
17
|
-
|
|
18
|
-
The RADIA software is distributed subject to the following license conditions:
|
|
19
|
-
|
|
20
|
-
Redistribution and use in source and binary forms, with or without
|
|
21
|
-
modification, are permitted provided that the following conditions are met:
|
|
22
|
-
|
|
23
|
-
1. Redistributions of source code must retain the above copyright notice,
|
|
24
|
-
this list of conditions and the following disclaimer.
|
|
25
|
-
|
|
26
|
-
2. Redistributions in binary form must reproduce the above copyright notice,
|
|
27
|
-
this list of conditions and the following disclaimer in the documentation
|
|
28
|
-
and/or other materials provided with the distribution.
|
|
29
|
-
|
|
30
|
-
DISCLAIMER: THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS"
|
|
31
|
-
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
32
|
-
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
33
|
-
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
|
|
34
|
-
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
35
|
-
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
36
|
-
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
37
|
-
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
38
|
-
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
39
|
-
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
40
|
-
|
|
41
|
-
The views and conclusions contained in the software and documentation are
|
|
42
|
-
those of the authors and should not be interpreted as representing official
|
|
43
|
-
policies, either expressed or implied, of the RADIA project.
|
|
44
|
-
|
|
45
|
-
================================================================================
|
|
46
|
-
PART 2: HACApK_LH-Cimplm (H-matrix Library)
|
|
47
|
-
================================================================================
|
|
48
|
-
|
|
49
|
-
Software Name : HACApK
|
|
50
|
-
Version : 1.3.0
|
|
51
|
-
Location: src/ext/HACApK_LH-Cimplm/
|
|
52
|
-
|
|
53
|
-
Copyright (c) 2015 Akihiro Ida and Takeshi Iwashita
|
|
54
|
-
|
|
55
|
-
MIT License
|
|
56
|
-
|
|
57
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
58
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
59
|
-
in the Software without restriction, including without limitation the rights
|
|
60
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
61
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
62
|
-
furnished to do so, subject to the following conditions:
|
|
63
|
-
|
|
64
|
-
The above copyright notice and this permission notice shall be included in all
|
|
65
|
-
copies or substantial portions of the Software.
|
|
66
|
-
|
|
67
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
68
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
69
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
70
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
71
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
72
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
73
|
-
SOFTWARE.
|
|
74
|
-
|
|
75
|
-
ppOpen-HPC project:
|
|
76
|
-
Open Source Infrastructure for Development and Execution of Large-Scale
|
|
77
|
-
Scientific Applications on Post-Peta-Scale Supercomputers with Automatic
|
|
78
|
-
Tuning (AT).
|
|
79
|
-
|
|
80
|
-
Sponsorship:
|
|
81
|
-
Japan Science and Technology Agency (JST), Basic Research Programs: CREST,
|
|
82
|
-
Development of System Software Technologies for post-Peta Scale High
|
|
83
|
-
Performance Computing.
|
|
84
|
-
|
|
85
|
-
================================================================================
|
|
86
|
-
ADDITIONAL COMPONENTS
|
|
87
|
-
================================================================================
|
|
88
|
-
|
|
89
|
-
This software may include additional third-party libraries and components,
|
|
90
|
-
each governed by their respective licenses. Please refer to the individual
|
|
91
|
-
component directories for specific license information.
|
|
92
|
-
|
|
93
|
-
================================================================================
|
|
1
|
+
RADIA SOFTWARE LICENSE
|
|
2
|
+
======================
|
|
3
|
+
|
|
4
|
+
This software contains multiple components with different licenses:
|
|
5
|
+
|
|
6
|
+
1. RADIA Core (BSD-style License)
|
|
7
|
+
2. HACApK_LH-Cimplm Library (MIT License)
|
|
8
|
+
|
|
9
|
+
All licenses are permissive open-source licenses allowing redistribution
|
|
10
|
+
and modification.
|
|
11
|
+
|
|
12
|
+
================================================================================
|
|
13
|
+
PART 1: RADIA CORE
|
|
14
|
+
================================================================================
|
|
15
|
+
|
|
16
|
+
Copyright © 1997 - 2018, European Synchrotron Radiation Facility
|
|
17
|
+
|
|
18
|
+
The RADIA software is distributed subject to the following license conditions:
|
|
19
|
+
|
|
20
|
+
Redistribution and use in source and binary forms, with or without
|
|
21
|
+
modification, are permitted provided that the following conditions are met:
|
|
22
|
+
|
|
23
|
+
1. Redistributions of source code must retain the above copyright notice,
|
|
24
|
+
this list of conditions and the following disclaimer.
|
|
25
|
+
|
|
26
|
+
2. Redistributions in binary form must reproduce the above copyright notice,
|
|
27
|
+
this list of conditions and the following disclaimer in the documentation
|
|
28
|
+
and/or other materials provided with the distribution.
|
|
29
|
+
|
|
30
|
+
DISCLAIMER: THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS"
|
|
31
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
32
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
33
|
+
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
|
|
34
|
+
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
35
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
36
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
37
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
38
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
39
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
40
|
+
|
|
41
|
+
The views and conclusions contained in the software and documentation are
|
|
42
|
+
those of the authors and should not be interpreted as representing official
|
|
43
|
+
policies, either expressed or implied, of the RADIA project.
|
|
44
|
+
|
|
45
|
+
================================================================================
|
|
46
|
+
PART 2: HACApK_LH-Cimplm (H-matrix Library)
|
|
47
|
+
================================================================================
|
|
48
|
+
|
|
49
|
+
Software Name : HACApK
|
|
50
|
+
Version : 1.3.0
|
|
51
|
+
Location: src/ext/HACApK_LH-Cimplm/
|
|
52
|
+
|
|
53
|
+
Copyright (c) 2015 Akihiro Ida and Takeshi Iwashita
|
|
54
|
+
|
|
55
|
+
MIT License
|
|
56
|
+
|
|
57
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
58
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
59
|
+
in the Software without restriction, including without limitation the rights
|
|
60
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
61
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
62
|
+
furnished to do so, subject to the following conditions:
|
|
63
|
+
|
|
64
|
+
The above copyright notice and this permission notice shall be included in all
|
|
65
|
+
copies or substantial portions of the Software.
|
|
66
|
+
|
|
67
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
68
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
69
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
70
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
71
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
72
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
73
|
+
SOFTWARE.
|
|
74
|
+
|
|
75
|
+
ppOpen-HPC project:
|
|
76
|
+
Open Source Infrastructure for Development and Execution of Large-Scale
|
|
77
|
+
Scientific Applications on Post-Peta-Scale Supercomputers with Automatic
|
|
78
|
+
Tuning (AT).
|
|
79
|
+
|
|
80
|
+
Sponsorship:
|
|
81
|
+
Japan Science and Technology Agency (JST), Basic Research Programs: CREST,
|
|
82
|
+
Development of System Software Technologies for post-Peta Scale High
|
|
83
|
+
Performance Computing.
|
|
84
|
+
|
|
85
|
+
================================================================================
|
|
86
|
+
ADDITIONAL COMPONENTS
|
|
87
|
+
================================================================================
|
|
88
|
+
|
|
89
|
+
This software may include additional third-party libraries and components,
|
|
90
|
+
each governed by their respective licenses. Please refer to the individual
|
|
91
|
+
component directories for specific license information.
|
|
92
|
+
|
|
93
|
+
================================================================================
|
python/nastran_reader.py
DELETED
|
@@ -1,295 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env python
|
|
2
|
-
# -*- coding: utf-8 -*-
|
|
3
|
-
"""
|
|
4
|
-
Nastran Mesh Reader for Radia
|
|
5
|
-
|
|
6
|
-
Reads Nastran .nas/.bdf files and converts to Python data structures.
|
|
7
|
-
Supports GRID (nodes), CHEXA (hexahedron), CPENTA (pentahedron), CTETRA (tetrahedron), and CTRIA3 (triangle) elements.
|
|
8
|
-
|
|
9
|
-
For surface meshes (CTRIA3), triangles with the same material ID (PID) are grouped into a single polyhedron,
|
|
10
|
-
which is useful for linear magnetic analysis where only the surface representation is needed.
|
|
11
|
-
|
|
12
|
-
Usage:
|
|
13
|
-
from nastran_reader import read_nastran_mesh
|
|
14
|
-
|
|
15
|
-
mesh = read_nastran_mesh('sphere.bdf')
|
|
16
|
-
nodes = mesh['nodes'] # numpy array (N, 3)
|
|
17
|
-
hex_elements = mesh['hex_elements'] # list of [n1, ..., n8]
|
|
18
|
-
penta_elements = mesh['penta_elements'] # list of [n1, ..., n6]
|
|
19
|
-
tetra_elements = mesh['tetra_elements'] # list of [n1, ..., n4]
|
|
20
|
-
tria_groups = mesh['tria_groups'] # dict {material_id: {'faces': [[n1,n2,n3], ...], 'nodes': set(...)}}
|
|
21
|
-
|
|
22
|
-
Date: 2025-11-01
|
|
23
|
-
"""
|
|
24
|
-
|
|
25
|
-
import re
|
|
26
|
-
import numpy as np
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
def read_nastran_mesh(filename, verbose=True):
|
|
30
|
-
"""
|
|
31
|
-
Read Nastran mesh file (.nas/.bdf format).
|
|
32
|
-
|
|
33
|
-
Args:
|
|
34
|
-
filename: Path to .nas or .bdf file
|
|
35
|
-
verbose: Print progress messages (default: True)
|
|
36
|
-
|
|
37
|
-
Returns:
|
|
38
|
-
dict: Dictionary with mesh data
|
|
39
|
-
- nodes: numpy array (N, 3) with node coordinates [mm]
|
|
40
|
-
- hex_elements: list of hexahedra [n1, n2, n3, n4, n5, n6, n7, n8]
|
|
41
|
-
- penta_elements: list of pentahedra [n1, n2, n3, n4, n5, n6]
|
|
42
|
-
- tetra_elements: list of tetrahedra [n1, n2, n3, n4]
|
|
43
|
-
- tria_groups: dict {material_id: {'faces': [[n1,n2,n3], ...], 'nodes': set(node_ids)}}
|
|
44
|
-
- node_ids: dict mapping node_id to array index
|
|
45
|
-
- node_id_list: list of node IDs in order
|
|
46
|
-
"""
|
|
47
|
-
if verbose:
|
|
48
|
-
print(f"Reading Nastran mesh: {filename}")
|
|
49
|
-
|
|
50
|
-
with open(filename, 'r') as f:
|
|
51
|
-
lines = f.readlines()
|
|
52
|
-
|
|
53
|
-
# Parse GRID entries
|
|
54
|
-
nodes = {} # node_id -> [x, y, z]
|
|
55
|
-
hex_elements = [] # List of [n1, n2, n3, n4, n5, n6, n7, n8]
|
|
56
|
-
penta_elements = [] # List of [n1, n2, n3, n4, n5, n6]
|
|
57
|
-
tetra_elements = [] # List of [n1, n2, n3, n4]
|
|
58
|
-
tria_groups = {} # material_id -> {'faces': [[n1,n2,n3], ...], 'nodes': set(node_ids)}
|
|
59
|
-
|
|
60
|
-
i = 0
|
|
61
|
-
while i < len(lines):
|
|
62
|
-
line = lines[i].rstrip('\n')
|
|
63
|
-
|
|
64
|
-
# Parse GRID* lines (Extended format with continuation)
|
|
65
|
-
if line.startswith('GRID*'):
|
|
66
|
-
try:
|
|
67
|
-
# GRID* ID CP X1 X2
|
|
68
|
-
# * X3
|
|
69
|
-
# Field width: 16 characters
|
|
70
|
-
node_id = int(line[8:24].strip())
|
|
71
|
-
# Skip CP field (line[24:40])
|
|
72
|
-
x = float(line[40:56].strip())
|
|
73
|
-
y = float(line[56:72].strip())
|
|
74
|
-
|
|
75
|
-
# Get continuation line for Z coordinate
|
|
76
|
-
i += 1
|
|
77
|
-
cont_line = lines[i].rstrip('\n')
|
|
78
|
-
z = float(cont_line[8:24].strip())
|
|
79
|
-
|
|
80
|
-
nodes[node_id] = [x, y, z]
|
|
81
|
-
except (ValueError, IndexError) as e:
|
|
82
|
-
if verbose:
|
|
83
|
-
print(f"Warning: Failed to parse GRID* line {i}: {e}")
|
|
84
|
-
|
|
85
|
-
# Parse GRID lines (Fixed format: 8 characters per field)
|
|
86
|
-
elif line.startswith('GRID') and not line.startswith('GRID*'):
|
|
87
|
-
try:
|
|
88
|
-
# GRID ID CP X1 X2 X3
|
|
89
|
-
# 01234567890123456789012345678901234567890123456789
|
|
90
|
-
node_id = int(line[8:16])
|
|
91
|
-
x = float(line[24:32])
|
|
92
|
-
y = float(line[32:40])
|
|
93
|
-
z = float(line[40:48])
|
|
94
|
-
nodes[node_id] = [x, y, z]
|
|
95
|
-
except ValueError as e:
|
|
96
|
-
if verbose:
|
|
97
|
-
print(f"Warning: Failed to parse GRID line {i+1}: {e}")
|
|
98
|
-
|
|
99
|
-
# Parse CHEXA lines (Hexahedron with continuation)
|
|
100
|
-
elif line.startswith('CHEXA'):
|
|
101
|
-
try:
|
|
102
|
-
# CHEXA EID PID G1 G2 G3 G4 G5 G6 +
|
|
103
|
-
# + G7 G8
|
|
104
|
-
# Get nodes from first line (6 nodes)
|
|
105
|
-
n1 = int(line[24:32].strip())
|
|
106
|
-
n2 = int(line[32:40].strip())
|
|
107
|
-
n3 = int(line[40:48].strip())
|
|
108
|
-
n4 = int(line[48:56].strip())
|
|
109
|
-
n5 = int(line[56:64].strip())
|
|
110
|
-
n6 = int(line[64:72].strip())
|
|
111
|
-
|
|
112
|
-
# Get continuation line
|
|
113
|
-
i += 1
|
|
114
|
-
cont_line = lines[i].rstrip('\n')
|
|
115
|
-
# + G7 G8
|
|
116
|
-
n7 = int(cont_line[14:22].strip())
|
|
117
|
-
n8 = int(cont_line[22:30].strip())
|
|
118
|
-
|
|
119
|
-
hex_elements.append([n1, n2, n3, n4, n5, n6, n7, n8])
|
|
120
|
-
except (ValueError, IndexError) as e:
|
|
121
|
-
if verbose:
|
|
122
|
-
print(f"Warning: Failed to parse CHEXA at line {i}: {e}")
|
|
123
|
-
|
|
124
|
-
# Parse CPENTA lines (Pentahedron, single line)
|
|
125
|
-
elif line.startswith('CPENTA'):
|
|
126
|
-
try:
|
|
127
|
-
# CPENTA EID PID G1 G2 G3 G4 G5 G6
|
|
128
|
-
# All 6 nodes on one line
|
|
129
|
-
n1 = int(line[24:32])
|
|
130
|
-
n2 = int(line[32:40])
|
|
131
|
-
n3 = int(line[40:48])
|
|
132
|
-
n4 = int(line[48:56])
|
|
133
|
-
n5 = int(line[56:64])
|
|
134
|
-
n6 = int(line[64:72])
|
|
135
|
-
|
|
136
|
-
penta_elements.append([n1, n2, n3, n4, n5, n6])
|
|
137
|
-
except (ValueError, IndexError) as e:
|
|
138
|
-
if verbose:
|
|
139
|
-
print(f"Warning: Failed to parse CPENTA at line {i}: {e}")
|
|
140
|
-
|
|
141
|
-
# Parse CTETRA lines (Tetrahedron, single line)
|
|
142
|
-
elif line.startswith('CTETRA'):
|
|
143
|
-
try:
|
|
144
|
-
# CTETRA EID PID G1 G2 G3 G4
|
|
145
|
-
# All 4 nodes on one line (10-node tetra has continuation, but we only use first 4)
|
|
146
|
-
n1 = int(line[24:32])
|
|
147
|
-
n2 = int(line[32:40])
|
|
148
|
-
n3 = int(line[40:48])
|
|
149
|
-
n4 = int(line[48:56])
|
|
150
|
-
|
|
151
|
-
tetra_elements.append([n1, n2, n3, n4])
|
|
152
|
-
except (ValueError, IndexError) as e:
|
|
153
|
-
if verbose:
|
|
154
|
-
print(f"Warning: Failed to parse CTETRA at line {i}: {e}")
|
|
155
|
-
|
|
156
|
-
# Parse CTRIA3 lines (Triangle, single line)
|
|
157
|
-
elif line.startswith('CTRIA3'):
|
|
158
|
-
try:
|
|
159
|
-
# CTRIA3 EID PID G1 G2 G3
|
|
160
|
-
# Element ID, Property ID (material), and 3 node IDs
|
|
161
|
-
element_id = int(line[8:16].strip())
|
|
162
|
-
material_id = int(line[16:24].strip())
|
|
163
|
-
n1 = int(line[24:32].strip())
|
|
164
|
-
n2 = int(line[32:40].strip())
|
|
165
|
-
n3 = int(line[40:48].strip())
|
|
166
|
-
|
|
167
|
-
# Group triangles by material ID
|
|
168
|
-
if material_id not in tria_groups:
|
|
169
|
-
tria_groups[material_id] = {'faces': [], 'nodes': set()}
|
|
170
|
-
|
|
171
|
-
tria_groups[material_id]['faces'].append([n1, n2, n3])
|
|
172
|
-
tria_groups[material_id]['nodes'].update([n1, n2, n3])
|
|
173
|
-
except (ValueError, IndexError) as e:
|
|
174
|
-
if verbose:
|
|
175
|
-
print(f"Warning: Failed to parse CTRIA3 at line {i}: {e}")
|
|
176
|
-
|
|
177
|
-
i += 1
|
|
178
|
-
|
|
179
|
-
# Convert to numpy arrays
|
|
180
|
-
node_ids = sorted(nodes.keys())
|
|
181
|
-
node_id_to_idx = {nid: idx for idx, nid in enumerate(node_ids)}
|
|
182
|
-
|
|
183
|
-
nodes_array = np.array([nodes[nid] for nid in node_ids])
|
|
184
|
-
hex_array = np.array(hex_elements, dtype=int) if hex_elements else np.array([])
|
|
185
|
-
penta_array = np.array(penta_elements, dtype=int) if penta_elements else np.array([])
|
|
186
|
-
tetra_array = np.array(tetra_elements, dtype=int) if tetra_elements else np.array([])
|
|
187
|
-
|
|
188
|
-
if verbose:
|
|
189
|
-
print(f" Nodes: {len(nodes_array)}")
|
|
190
|
-
print(f" Elements (CHEXA): {len(hex_elements)}")
|
|
191
|
-
print(f" Elements (CPENTA): {len(penta_elements)}")
|
|
192
|
-
print(f" Elements (CTETRA): {len(tetra_elements)}")
|
|
193
|
-
if tria_groups:
|
|
194
|
-
total_trias = sum(len(group['faces']) for group in tria_groups.values())
|
|
195
|
-
print(f" Elements (CTRIA3): {total_trias} triangles in {len(tria_groups)} material group(s)")
|
|
196
|
-
for mat_id, group in tria_groups.items():
|
|
197
|
-
print(f" Material {mat_id}: {len(group['faces'])} triangles, {len(group['nodes'])} unique nodes")
|
|
198
|
-
total_elements = len(hex_elements) + len(penta_elements) + len(tetra_elements)
|
|
199
|
-
if not tria_groups:
|
|
200
|
-
print(f" Total elements: {total_elements}")
|
|
201
|
-
|
|
202
|
-
return {
|
|
203
|
-
'nodes': nodes_array,
|
|
204
|
-
'hex_elements': hex_array,
|
|
205
|
-
'penta_elements': penta_array,
|
|
206
|
-
'tetra_elements': tetra_array,
|
|
207
|
-
'tria_groups': tria_groups,
|
|
208
|
-
'node_ids': node_id_to_idx,
|
|
209
|
-
'node_id_list': node_ids
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
# Element face connectivity for Radia ObjPolyhdr
|
|
214
|
-
# Node numbering is 1-indexed (as used in connectivity arrays)
|
|
215
|
-
|
|
216
|
-
# Hexahedron face connectivity (1-indexed)
|
|
217
|
-
# Nastran CHEXA node numbering:
|
|
218
|
-
# Nodes: G1, G2, G3, G4 (bottom), G5, G6, G7, G8 (top)
|
|
219
|
-
HEX_FACES = [
|
|
220
|
-
[1, 2, 3, 4], # Bottom face
|
|
221
|
-
[5, 6, 7, 8], # Top face
|
|
222
|
-
[1, 2, 6, 5], # Side face 1
|
|
223
|
-
[2, 3, 7, 6], # Side face 2
|
|
224
|
-
[3, 4, 8, 7], # Side face 3
|
|
225
|
-
[4, 1, 5, 8], # Side face 4
|
|
226
|
-
]
|
|
227
|
-
|
|
228
|
-
# Pentahedron face connectivity (1-indexed)
|
|
229
|
-
# Nastran CPENTA node numbering:
|
|
230
|
-
# Nodes: G1, G2, G3 (bottom triangle), G4, G5, G6 (top triangle)
|
|
231
|
-
PENTA_FACES = [
|
|
232
|
-
[1, 2, 3], # Bottom triangle
|
|
233
|
-
[4, 5, 6], # Top triangle
|
|
234
|
-
[1, 2, 5, 4], # Side face 1 (quad)
|
|
235
|
-
[2, 3, 6, 5], # Side face 2 (quad)
|
|
236
|
-
[3, 1, 4, 6], # Side face 3 (quad)
|
|
237
|
-
]
|
|
238
|
-
|
|
239
|
-
# Tetrahedron face connectivity (1-indexed)
|
|
240
|
-
# Nastran CTETRA node numbering:
|
|
241
|
-
# Nodes: G1, G2, G3, G4
|
|
242
|
-
TETRA_FACES = [
|
|
243
|
-
[1, 2, 3], # Face 1
|
|
244
|
-
[1, 4, 2], # Face 2
|
|
245
|
-
[2, 4, 3], # Face 3
|
|
246
|
-
[3, 4, 1], # Face 4
|
|
247
|
-
]
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
if __name__ == '__main__':
|
|
251
|
-
"""Test the Nastran reader"""
|
|
252
|
-
import os
|
|
253
|
-
import sys
|
|
254
|
-
|
|
255
|
-
# Try to find a test .bdf file
|
|
256
|
-
test_files = [
|
|
257
|
-
'../../examples/electromagnet/York.bdf',
|
|
258
|
-
'../../examples/NGSolve_CoefficientFunction_to_Radia_BackgroundField/sphere.bdf',
|
|
259
|
-
]
|
|
260
|
-
|
|
261
|
-
nas_file = None
|
|
262
|
-
for f in test_files:
|
|
263
|
-
if os.path.exists(f):
|
|
264
|
-
nas_file = f
|
|
265
|
-
break
|
|
266
|
-
|
|
267
|
-
if nas_file:
|
|
268
|
-
mesh = read_nastran_mesh(nas_file)
|
|
269
|
-
|
|
270
|
-
print("\nMesh statistics:")
|
|
271
|
-
print(f" Total nodes: {len(mesh['nodes'])}")
|
|
272
|
-
print(f" Hexahedra (CHEXA): {len(mesh['hex_elements'])}")
|
|
273
|
-
print(f" Pentahedra (CPENTA): {len(mesh['penta_elements'])}")
|
|
274
|
-
print(f" Tetrahedra (CTETRA): {len(mesh['tetra_elements'])}")
|
|
275
|
-
print(f"\nFirst 5 nodes:")
|
|
276
|
-
for i in range(min(5, len(mesh['nodes']))):
|
|
277
|
-
print(f" Node {mesh['node_id_list'][i]}: {mesh['nodes'][i]}")
|
|
278
|
-
|
|
279
|
-
if len(mesh['hex_elements']) > 0:
|
|
280
|
-
print(f"\nFirst 3 hexahedra (node IDs):")
|
|
281
|
-
for i in range(min(3, len(mesh['hex_elements']))):
|
|
282
|
-
print(f" Hex {i+1}: {mesh['hex_elements'][i]}")
|
|
283
|
-
|
|
284
|
-
if len(mesh['penta_elements']) > 0:
|
|
285
|
-
print(f"\nFirst 3 pentahedra (node IDs):")
|
|
286
|
-
for i in range(min(3, len(mesh['penta_elements']))):
|
|
287
|
-
print(f" Penta {i+1}: {mesh['penta_elements'][i]}")
|
|
288
|
-
|
|
289
|
-
if len(mesh['tetra_elements']) > 0:
|
|
290
|
-
print(f"\nFirst 3 tetrahedra (node IDs):")
|
|
291
|
-
for i in range(min(3, len(mesh['tetra_elements']))):
|
|
292
|
-
print(f" Tetra {i+1}: {mesh['tetra_elements'][i]}")
|
|
293
|
-
else:
|
|
294
|
-
print(f"Error: No test .bdf files found")
|
|
295
|
-
print(f"Searched for: {test_files}")
|
python/radia.pyd
DELETED
|
Binary file
|
radia-1.3.3.dist-info/RECORD
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
python/__init__.py,sha256=oUOAjf_vY8DNy5HRU7oArAMic8urvHCR9yHSi4HFkkQ,47
|
|
2
|
-
python/nastran_reader.py,sha256=r4K2LJvHBtvBumbinbiQeyPA42iyvxNyAd6Y05lxeZs,10035
|
|
3
|
-
python/rad_ngsolve.pyd,sha256=s5ZvpTIrjYeV_B3vQv5HrtP4u_RaPhvxuZf5aKv3oC0,566272
|
|
4
|
-
python/rad_ngsolve_fast.py,sha256=GkC7ruKy3MESHsO0iRSWsrgLU4-DPPgctOi6pPpsWg4,5675
|
|
5
|
-
python/radia.pyd,sha256=n9nOJQAzLDaoifMEMvHT160o7RIONFRINa3kdSvbjFE,1811968
|
|
6
|
-
python/radia_coil_builder.py,sha256=nQkiAbfhueNvvxUARHdPD0C68ImidHmUQv_q4RsImeY,11253
|
|
7
|
-
python/radia_field_cached.py,sha256=_9w9ETludvkoCx5Qiy6hXvmR7aJ_fzJXof2aF7JqM2Y,9235
|
|
8
|
-
python/radia_ngsolve_field.py,sha256=suJr4wacfYFKOkyV-5AQuHWnW5rtUMb0gSSjq8VRSXc,10166
|
|
9
|
-
python/radia_pyvista_viewer.py,sha256=JS33Mx4azGI7hUX0bzefc6zJfhv6qfRjM3Kl1bE9Mjs,4275
|
|
10
|
-
python/radia_vtk_export.py,sha256=UbPvo7ftHYLREz6TSpWrpLw7JesFhMA58-22R63HHH4,3997
|
|
11
|
-
radia-1.3.3.dist-info/licenses/LICENSE,sha256=a8e7Y3GCWv0nE5mpUTUbnjCAKgZadruvJSkJrZWIaCA,4281
|
|
12
|
-
radia-1.3.3.dist-info/METADATA,sha256=kVPOR6CHhW7wcGzKdT4R3eUgvP_72xVTrDB-_TNITk0,13329
|
|
13
|
-
radia-1.3.3.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
14
|
-
radia-1.3.3.dist-info/top_level.txt,sha256=J-z0poNcsv31IHB413--iOY8LoHBKiTHeybHX3abokI,7
|
|
15
|
-
radia-1.3.3.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|