Skip to content

Commit

Permalink
hdf5 work
Browse files Browse the repository at this point in the history
  • Loading branch information
SteveDoyle2 committed Dec 1, 2018
1 parent d4f4865 commit 499a687
Show file tree
Hide file tree
Showing 21 changed files with 507 additions and 82 deletions.
284 changes: 234 additions & 50 deletions pyNastran/bdf/bdf_interface/hdf5_loader.py

Large diffs are not rendered by default.

25 changes: 23 additions & 2 deletions pyNastran/bdf/cards/aero/aero.py
Original file line number Diff line number Diff line change
Expand Up @@ -3577,8 +3577,6 @@ class MONPNT1(BaseCard):

@classmethod
def _init_from_empty(cls):
aeparm_id = 1
label = 'name'
name = 'WING'
label = 'Wing Integrated Load to Butline'
axes = '6'
Expand Down Expand Up @@ -3720,6 +3718,17 @@ def __repr__(self):
class MONPNT2(BaseCard):
"""MSC Nastran specific card"""
type = 'MONPNT2'

@classmethod
def _init_from_empty(cls):
name = 'WING'
label = 'Wing Integrated Load to Butline'
table = 'MYTABLE'
Type = 'CAT'
nddl_item = 42
eid = 2
return MONPNT2(name, label, table, Type, nddl_item, eid, comment='')

def __init__(self, name, label, table, Type, nddl_item, eid, comment=''):
BaseCard.__init__(self)
if comment:
Expand Down Expand Up @@ -3778,6 +3787,18 @@ def __repr__(self):
class MONPNT3(BaseCard):
"""MSC Nastran specific card"""
type = 'MONPNT3'

@classmethod
def _init_from_empty(cls):
name = 'WING'
label = 'Wing Integrated Load to Butline'
axes = '6'
grid_set = 10
elem_set = 11
xyz = [0., 1., 2.]
return MONPNT3(name, label, axes, grid_set, elem_set, xyz,
cp=0, cd=None, xflag=None, comment='')

def __init__(self, name, label, axes, grid_set, elem_set, xyz,
cp=0, cd=None, xflag=None, comment=''):
BaseCard.__init__(self)
Expand Down
129 changes: 128 additions & 1 deletion pyNastran/bdf/cards/bdf_sets.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,13 @@ class ASET(ABCQSet):
+------+-----+----+-----+------+-----+----+-----+----+
"""
type = 'ASET'
_properties = ['node_ids']

@classmethod
def _init_from_empty(cls):
ids = [1, 2]
components = ['123', '456']
return ASET(ids, components, comment='')

def __init__(self, ids, components, comment=''):
"""
Expand Down Expand Up @@ -313,6 +320,13 @@ class BSET(ABCQSet):
+------+-----+----+-----+------+-----+----+-----+----+
"""
type = 'BSET'
_properties = ['node_ids']

@classmethod
def _init_from_empty(cls):
ids = [1, 2]
components = ['123', '456']
return BSET(ids, components, comment='')

def __init__(self, ids, components, comment=''):
"""
Expand Down Expand Up @@ -350,6 +364,13 @@ class CSET(ABCQSet):
+------+-----+----+-----+------+-----+----+-----+----+
"""
type = 'CSET'
_properties = ['node_ids']

@classmethod
def _init_from_empty(cls):
ids = [1, 2]
components = ['123', '456']
return CSET(ids, components, comment='')

def __init__(self, ids, components, comment=''):
"""
Expand Down Expand Up @@ -386,6 +407,13 @@ class QSET(ABCQSet):
+------+-----+----+-----+------+-----+----+-----+----+
"""
type = 'QSET'
_properties = ['node_ids']

@classmethod
def _init_from_empty(cls):
ids = [1, 2]
components = ['123', '456']
return QSET(ids, components, comment='')

def __init__(self, ids, components, comment=''):
"""
Expand Down Expand Up @@ -623,6 +651,13 @@ class ASET1(ABQSet1):
+-------+-----+-----+------+-----+-----+-----+-----+-----+
"""
type = 'ASET1'
_properties = ['node_ids']

@classmethod
def _init_from_empty(cls):
ids = [1, 2]
components = '123'
return ASET1(ids, components, comment='')

def __init__(self, ids, components, comment=''):
"""
Expand Down Expand Up @@ -658,6 +693,12 @@ class OMIT1(ABQSet1):
"""
type = 'OMIT1'

@classmethod
def _init_from_empty(cls):
ids = [1, 2]
components = '123'
return OMIT1(ids, components, comment='')

def __init__(self, ids, components, comment=''):
"""
Creates an OMIT1 card, which defines the degree of freedoms that
Expand Down Expand Up @@ -693,6 +734,13 @@ class BSET1(ABQSet1):
+-------+-----+-----+------+-----+-----+-----+-----+-----+
"""
type = 'BSET1'
_properties = ['node_ids']

@classmethod
def _init_from_empty(cls):
ids = [1, 2]
components = '123'
return BSET1(ids, components, comment='')

def __init__(self, ids, components, comment=''):
"""
Expand Down Expand Up @@ -732,6 +780,13 @@ class CSET1(Set):
+-------+-----+-----+------+-----+-----+-----+-----+-----+
"""
type = 'CSET1'
_properties = ['node_ids']

@classmethod
def _init_from_empty(cls):
ids = [1, 2]
components = '123'
return CSET1(ids, components, comment='')

def __init__(self, ids, components, comment=''):
"""
Expand Down Expand Up @@ -823,6 +878,13 @@ class QSET1(ABQSet1):
dynamic reduction or component mode synthesis.
"""
type = 'QSET1'
_properties = ['node_ids']

@classmethod
def _init_from_empty(cls):
ids = [1, 2]
components = '123'
return QSET1(ids, components, comment='')

def __init__(self, ids, components, comment=''):
"""
Expand Down Expand Up @@ -1352,6 +1414,14 @@ class SEBSET(SuperABCQSet):
+--------+------+-----+------+-----+----+-----+----+
"""
type = 'SEBSET'
_properties = ['node_ids']

@classmethod
def _init_from_empty(cls):
seid = 1
ids = [1, 2]
components = ['123', '456']
return SEBSET(seid, ids, components, comment='')

def __init__(self, seid, ids, components, comment=''):
SuperABCQSet.__init__(self, seid, ids, components, comment)
Expand All @@ -1373,13 +1443,29 @@ class SEBSET1(SuperABQSet1):
+----------+------+-----+------+------+-----+-----+-----+-----+
"""
type = 'SEBSET1'
_properties = ['node_ids']

@classmethod
def _init_from_empty(cls):
seid = 1
ids = [1, 2]
components = '123'
return SEBSET1(seid, ids, components, comment='')

def __init__(self, seid, ids, components, comment=''):
SuperABQSet1.__init__(self, seid, ids, components, comment)


class SECSET(SuperABCQSet):
type = 'SECSET'
_properties = ['node_ids']

@classmethod
def _init_from_empty(cls):
seid = 1
ids = [1, 2]
components = ['123', '456']
return SECSET(seid, ids, components, comment='')

def __init__(self, seid, ids, components, comment=''):
SuperABCQSet.__init__(self, seid, ids, components, comment)
Expand All @@ -1399,19 +1485,43 @@ class SECSET1(SuperABQSet1):
+----------+------+-----+------+------+-----+-----+-----+-----+
"""
type = 'SECSET1'
_properties = ['node_ids']

@classmethod
def _init_from_empty(cls):
seid = 1
ids = [1, 2]
components = '123'
return SECSET1(seid, ids, components, comment='')

def __init__(self, seid, ids, components, comment=''):
SuperABQSet1.__init__(self, seid, ids, components, comment)


class SEQSET(SuperABCQSet):
type = 'SEQSET'
_properties = ['node_ids']

@classmethod
def _init_from_empty(cls):
seid = 1
ids = [1, 2]
components = ['123', '456']
return SEQSET(seid, ids, components, comment='')

def __init__(self, seid, ids, components, comment=''):
SuperABCQSet.__init__(self, seid, ids, components, comment)

class SEQSET1(SuperABQSet1):
type = 'SEQSET1'
_properties = ['node_ids']

@classmethod
def _init_from_empty(cls):
seid = 1
ids = [1, 2]
components = '123'
return SEQSET1(seid, ids, components, comment='')

def __init__(self, seid, ids, components, comment=''):
SuperABQSet1.__init__(self, seid, ids, components, comment)
Expand Down Expand Up @@ -1567,6 +1677,15 @@ class USET(Set):
+------+-------+-----+------+-----+----+-----+----+
"""
type = 'USET'
_properties = ['node_ids']

@classmethod
def _init_from_empty(cls):
name = 'SNAME'
ids = [1, 2]
components = ['123', '456']
return QSET(ids, components, comment='')

def __init__(self, name, ids, components, comment=''):
"""
Creates a USET card, which defines a degrees-of-freedom set.
Expand Down Expand Up @@ -1692,6 +1811,14 @@ class USET1(ABQSet1):
+-------+-------+-----+------+------+-----+-----+-----+-----+
"""
type = 'USET1'
_properties = ['node_ids']

@classmethod
def _init_from_empty(cls):
name = 'SNAME'
ids = [1, 2]
components = '123'
return USET1(name, ids, components, comment='')

def __init__(self, name, ids, components, comment=''):
"""
Expand All @@ -1704,7 +1831,7 @@ def __init__(self, name, ids, components, comment=''):
followed by the set name.)
ids : List[int]
the GRID/SPOINT ids
components : List[str]
components : str
the degree of freedoms (e.g., '1', '123')
comment : str; default=''
a comment for the card
Expand Down
16 changes: 16 additions & 0 deletions pyNastran/bdf/cards/constraints.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,13 @@ class SUPORT(Constraint):
+---------+-----+-----+-----+-----+-----+-----+-----+----+
"""
type = 'SUPORT'
_properties = ['node_ids']

@classmethod
def _init_from_empty(cls):
nodes = [1, 2]
components = ['123', '456']
return SUPORT(nodes, components, comment='')

def __init__(self, nodes, Cs, comment=''):
"""
Expand Down Expand Up @@ -948,6 +955,15 @@ class SPCAX(Constraint):
"""
type = 'SPCAX'

@classmethod
def _init_from_empty(cls):
conid = 1
ringax = 2
hid = 3
component = 4
enforced = 0.
return SPCAX(conid, ringax, hid, component, enforced, comment='')

def __init__(self, conid, ringax, hid, component, enforced, comment=''):
"""
Creates an SPCAX card
Expand Down
9 changes: 5 additions & 4 deletions pyNastran/bdf/cards/elements/axisymmetric_shells.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from __future__ import (nested_scopes, generators, division, absolute_import,
print_function, unicode_literals)

from numpy import cross
import numpy as np
from numpy.linalg import norm # type: ignore

from pyNastran.utils.numpy_utils import integer_types
Expand Down Expand Up @@ -678,14 +678,15 @@ class CTRIAX6(TriShell):
def export_to_hdf5(cls, h5_file, model, eids):
"""exports the elements in a vectorized way"""
#comments = []
neids = len(eids)
mids = []
nodes = []
nodes = np.zeros((neids, 6), dtype='int32')
thetas = []
for eid in eids:
for i, eid in enumerate(eids):
element = model.elements[eid]
#comments.append(element.comment)
mids.append(element.mid)
nodes.append(element.nodes)
nodes[i, :] = [eid if eid is not None else 0 for eid in element.nodes]
thetas.append(element.theta)
#h5_file.create_dataset('_comment', data=comments)
h5_file.create_dataset('eid', data=eids)
Expand Down
2 changes: 1 addition & 1 deletion pyNastran/bdf/cards/elements/bush.py
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@ def export_to_hdf5(cls, h5_file, model, eids):
element = model.elements[eid]
#comments.append(element.comment)
pids.append(element.pid)
nodes.append(element.nodes)
nodes.append([nid if nid is not None else 0 for nid in element.nodes])
cid.append(element.cid if element.cid is not None else -1)
#h5_file.create_dataset('_comment', data=comments)
#print('cid =', cid)
Expand Down
8 changes: 6 additions & 2 deletions pyNastran/bdf/cards/elements/elements.py
Original file line number Diff line number Diff line change
Expand Up @@ -323,8 +323,12 @@ def export_to_hdf5(cls, h5_file, model, eids):
x.append(nan)
g0.append(g0i)
else:
assert element.x[0] is not None, element.get_stats()
x.append(element.x)
if element.x[0] is None:
x.append(nan)
else:
x.append(element.x)
#assert element.x[0] is not None, element.get_stats()
#x.append(element.x)
g0.append(-1)
else:
cid.append(element.cid)
Expand Down
2 changes: 1 addition & 1 deletion pyNastran/bdf/cards/elements/mass.py
Original file line number Diff line number Diff line change
Expand Up @@ -647,7 +647,7 @@ class CMASS4(PointMassElement):
@classmethod
def _init_from_empty(cls):
eid = 1
mass = 1.
pid = 1
nids = [1, 2]
return CMASS4(eid, pid, nids, comment='')

Expand Down
Loading

0 comments on commit 499a687

Please sign in to comment.