Skip to content

Commit d5d3cbf

Browse files
authored
Update for v211 (2021R1) (#319)
* updated for v211 * version bump to 0.44.20: * fixed csys record pointers
1 parent 1068f92 commit d5d3cbf

File tree

9 files changed

+213
-127
lines changed

9 files changed

+213
-127
lines changed

pyansys/_rst_keys.py

Lines changed: 109 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,76 @@
1-
"""Various header keys for the result file"""
1+
"""Various header keys for the result file
22
3-
geometry_header_keys = ['__unused', # position not used
4-
'maxety',
5-
'maxrl',
6-
'nnod',
7-
'nelm',
8-
'maxcsy',
9-
'ptrETY',
10-
'ptrREL',
11-
'ptrLOC',
12-
'ptrCSY',
13-
'ptrEID',
14-
'maxsec',
15-
'secsiz',
16-
'nummat',
17-
'matsiz',
18-
'ptrMAS',
19-
'csysiz',
20-
'elmsiz',
21-
'etysiz',
22-
'rlsiz',
23-
'ptrETYl',
24-
'ptrETYh',
25-
'ptrRELl',
26-
'ptrRELh',
27-
'ptrCSYl',
28-
'ptrCSYh',
29-
'ptrLOCl',
30-
'ptrLOCh',
31-
'ptrEIDl',
32-
'ptrEIDh',
33-
'ptrMASl',
34-
'ptrMASh',
35-
'ptrSECl',
36-
'ptrSECh',
37-
'ptrMATl',
38-
'ptrMATh',
39-
'ptrCNTl',
40-
'ptrCNTh',
41-
'ptrNODl',
42-
'ptrNODh',
43-
'ptrELMl',
44-
'ptrELMh',
45-
'Glblenb',
46-
'ptrGNODl',
47-
'ptrGNODh',
48-
'maxn',
49-
'NodesUpd',
50-
'lenbac',
51-
'maxcomp',
52-
'compsiz',
53-
'ptrCOMPl',
54-
'ptrCOMPh']
3+
/usr/ansys_inc/v150/ansys/customize/include/fdresu.inc
4+
5+
"""
6+
7+
geometry_header_keys = ['__unused', # 1
8+
'maxety', # 2
9+
'maxrl', # 3
10+
'nnod', # 4
11+
'nelm', # 5
12+
'maxcsy', # 6
13+
'ptrETY', # 7
14+
'ptrREL', # 8
15+
'ptrLOC', # 9
16+
'ptrCSY', # 10
17+
'ptrEID', # 11
18+
'maxsec', # 12
19+
'secsiz', # 13
20+
'nummat', # 14
21+
'matsiz', # 15
22+
'ptrMAS', # 16
23+
'csysiz', # 17
24+
'elmsiz', # 18
25+
'etysiz', # 19
26+
'rlsiz', # 20
27+
'ptrETYl', # 21
28+
'ptrETYh', # 22
29+
'ptrRELl', # 23
30+
'ptrRELh', # 24
31+
'ptrCSYl', # 25
32+
'ptrCSYh', # 26
33+
'ptrLOCl', # 27
34+
'ptrLOCh', # 28
35+
'ptrEIDl', # 29
36+
'ptrEIDh', # 30
37+
'ptrMASl', # 31
38+
'ptrMASh', # 32
39+
'ptrSECl', # 33
40+
'ptrSECh', # 34
41+
'ptrMATl', # 35
42+
'ptrMATh', # 36
43+
'ptrCNTl', # 37
44+
'ptrCNTh', # 38
45+
'ptrNODl', # 39
46+
'ptrNODh', # 40
47+
'ptrELMl', # 41
48+
'ptrELMh', # 42
49+
'Glblenb', # 43
50+
'ptrGNODl', # 44
51+
'ptrGNODh', # 45
52+
'maxn', # 46
53+
'NodesUpd', # 47
54+
'lenbac', # 48
55+
'maxcomp', # 49
56+
'compsiz', # 50
57+
'ptrCOMPl', # 51
58+
'ptrCOMPh', # 52
59+
'nMatProp', # 53
60+
'nStage', # 54
61+
'maxMSsz', # 55
62+
'ptrMSl', # 56
63+
'ptrMSh', # 57
64+
'nCycP', # 58
65+
'ptrCycPl', # 59
66+
'ptrCycPh', # 60
67+
'numety', # 61
68+
'numrl', # 62
69+
'numcsy', # 63
70+
'numsec', # 64
71+
'mapFlag', # 65
72+
'cysCSID' # 66
73+
]
5574

5675
# FROM fdresu.inc
5776
# maxety - the maximum element type reference number in the model
@@ -72,7 +91,8 @@
7291
# csysiz - the number of items describing a local coordinate system (usually 24)
7392
# elmsiz - the maximum number of nodes that a defined element may have
7493
# etysiz - the number of items describing an element type(=IELCSZ from echprm.inc)
75-
# rlsiz - the maximum number of items defining a real constant (0, if no real constants are defined)
94+
# rlsiz - the maximum number of items defining a real constant (0, if
95+
# no real constants are defined)
7696
# ETYl,h - 64 bit pointer to element type data
7797
# RELl,h - 64 bit pointer to real constant data
7898
# CSYl,h - 64 bit pointer to coordinate system data
@@ -83,9 +103,41 @@
83103
# CNTl,h - 64 bit pointer to element centroids
84104
# NODl,h - 64 bit pointer to nodal equivalence table
85105
# ELMl,h - 64 bit pointer to element equivalence table
86-
# lbnnod - global number of nodes actually used in the solution phase (== nnod unless using Distributed Ansys)
87-
# GNODl,h- 64 bit pointer to the global nodal equivalence table (only used with Distributed ANSYS and when the mesh does not change during solution)
88-
# maxn - maximum node number of the model
106+
# lbnnod - global number of nodes actually used in the solution phase
107+
# (== nnod unless using Distributed Ansys)
108+
# GNODl,h- 64 bit pointer to the global nodal equivalence table (only
109+
# used with Distributed ANSYS and when the mesh does not change during
110+
# solution)
111+
# maxn - maximum node number of the model
112+
# NodesUpd - 1, node coords have been updated
113+
# lenbac - the actual number of nodes used in the solution phase
114+
# numcomp - number of components/assemblies stored (only node/elem
115+
# components/assemblies)
116+
# mxcmpsz - maximum size (in integer words) that any
117+
# component/assembly record may have
118+
# ptrCOMPl,h - 64 bit pointer to component/assembly data
119+
# nMatProp - number of properties stored per material
120+
# nStage - number of stages
121+
# maxMSsz - maximum size (in integer words) that a
122+
# stage record can have
123+
# ptrMSl,h - 64 bit pointer to multistage (MS) cyclic
124+
# analysis data
125+
# nCycP - number of cyclic edge node pair tables (CYCLIC and MS)
126+
# ptrCycPl,h - pointers to cyclic edge node pair tables
127+
# numety - the number of defined element types
128+
# in the model
129+
# numrl - the number of defined real constants in the model
130+
# numcsy - the number of defined coordinate
131+
# systems in the model
132+
# numsec - the number of defined sections in the model
133+
# mapFlag - flag to indicate format of mapping index vectors for
134+
# element types, real constants, coordinate systems, and
135+
# sections.
136+
# = 0, old format with 1 vector of maxDef len
137+
# = 1, new format with 2 vectors each having numDef len
138+
# cycCSID - coordinate system number (CYCLIC and MS)
139+
# = 0 is ignored (must be cylindrical)
140+
89141

90142

91143
element_index_table_info = {

pyansys/_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# major, minor, patch
2-
version_info = 0, 44, 19
2+
version_info = 0, 44, 20
33

44
# Nice string for the version
55
__version__ = '.'.join(map(str, version_info))

pyansys/cython/_binary_reader.pyx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,6 @@ from libc.string cimport memcpy
1414
from libc.stdint cimport int64_t, int32_t
1515
from libc.stdlib cimport malloc, free
1616

17-
# debug
18-
from libc.stdio cimport printf
19-
20-
2117
from cython.parallel import prange
2218
ctypedef unsigned char uint8
2319

pyansys/cython/_reader.pyx

Lines changed: 35 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ def read(filename, read_parameters=False, debug=False):
301301
continue
302302
start_pos = n
303303
if debug:
304-
print('reading NBLOCK')
304+
print('reading NBLOCK due to ', line.decode())
305305

306306
nodes_read = True
307307
# Get size of NBLOCK
@@ -319,40 +319,45 @@ def read(filename, read_parameters=False, debug=False):
319319
nnodes_read = read_nblock(raw, &nnum[0], &nodes[0, 0], nnodes,
320320
&d_size[0], f_size, &n)
321321

322-
# verify at the end of the block
323322
if nnodes_read != nnodes:
324323
nnodes = nnodes_read
325324
nodes = nodes[:nnodes]
326325
nnum = nnum[:nnodes]
327-
else:
328-
if myfgets(line, raw, &n, fsize):
329-
raise RuntimeError('Unable to read nblock format line or '
330-
'at end of file.')
331-
332-
bl_end = line.decode().replace(' ', '')
333-
if 'N,R5.3,LOC' not in bl_end or b'-1' == bl_end[:2]:
334-
if debug:
335-
print('N,R5.3,LOC not at end of block')
336-
# need to reread the number of nodes
337-
n = start_pos
338-
if myfgets(line, raw, &n, fsize): raise Exception(badstr)
339-
nnodes = 0
340-
while True:
341-
if myfgets(line, raw, &n, fsize): raise Exception(badstr)
342-
bl_end = line.decode().replace(' ', '')
343-
if 'N,R5.3,LOC' not in bl_end or b'-1' == bl_end[:2]:
344-
break
345-
nnodes += 1
346-
347-
# reread nodes
348-
n = start_pos
349-
if myfgets(line, raw, &n, fsize): raise Exception(badstr)
350-
d_size, f_size, nfld, nexp = node_block_format(line)
351-
nnum = np.empty(nnodes, dtype=ctypes.c_int)
352-
nodes = np.zeros((nnodes, 6))
353326

354-
n = read_nblock(raw, &nnum[0], &nodes[0, 0], nnodes,
355-
&d_size[0], f_size, &n)
327+
# # verify at the end of the block
328+
# if nnodes_read != nnodes:
329+
# nnodes = nnodes_read
330+
# nodes = nodes[:nnodes]
331+
# nnum = nnum[:nnodes]
332+
# else:
333+
# if myfgets(line, raw, &n, fsize):
334+
# raise RuntimeError('Unable to read nblock format line or '
335+
# 'at end of file.')
336+
337+
# bl_end = line.decode().replace(' ', '')
338+
# if 'LOC' not in bl_end or b'-1' == bl_end[:2]:
339+
# if debug:
340+
# print('Unable to find the end of the NBLOCK')
341+
# # need to reread the number of nodes
342+
# n = start_pos
343+
# if myfgets(line, raw, &n, fsize): raise Exception(badstr)
344+
# nnodes = 0
345+
# while True:
346+
# if myfgets(line, raw, &n, fsize): raise Exception(badstr)
347+
# bl_end = line.decode().replace(' ', '')
348+
# if 'LOC' not in bl_end or b'-1' == bl_end[:2]:
349+
# break
350+
# nnodes += 1
351+
352+
# # reread nodes
353+
# n = start_pos
354+
# if myfgets(line, raw, &n, fsize): raise Exception(badstr)
355+
# d_size, f_size, nfld, nexp = node_block_format(line)
356+
# nnum = np.empty(nnodes, dtype=ctypes.c_int)
357+
# nodes = np.zeros((nnodes, 6))
358+
359+
# n = read_nblock(raw, &nnum[0], &nodes[0, 0], nnodes,
360+
# &d_size[0], f_size, &n)
356361

357362

358363
elif 'C' == line[0] or 'c' == line[0]:

pyansys/parameters.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,11 @@ def __getitem__(self, key):
275275

276276
parm = parameters[key]
277277
if parm['type'] in ['ARRAY', 'TABLE']:
278-
return self._get_parameter_array(key, parm['shape'])
278+
try:
279+
return self._get_parameter_array(key, parm['shape'])
280+
except ValueError:
281+
# allow a second attempt
282+
return self._get_parameter_array(key, parm['shape'])
279283

280284
return parm['value']
281285

0 commit comments

Comments
 (0)