本文整理汇总了Python中pyNastran.bdf.bdfInterface.assign_type.fields函数的典型用法代码示例。如果您正苦于以下问题:Python fields函数的具体用法?Python fields怎么用?Python fields使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了fields函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self, card=None, data=None, comment=""):
ThermalBC.__init__(self, card, data)
if comment:
self._comment = comment
if card:
#: NODAMB Ambient point for radiation exchange. (Integer > 0)
self.nodamb = integer(card, 1, "nodamb")
assert self.nodamb > 0
#: Radiation view factor between the face and the ambient point.
#: (Real > 0.0)
self.famb = double(card, 2, "famb")
assert self.famb > 0.0
#: Control point for thermal flux load. (Integer > 0; Default = 0)
self.cntrlnd = integer_or_blank(card, 3, "cntrlnd", 0)
assert self.cntrlnd >= 0
nfields = card.nfields
eids = fields(integer_or_string, card, "eid", i=4, j=nfields)
#: CHBDYi element identification number
self.eids = expand_thru_by(eids)
else:
raise NotImplementedError(data)
min_eid = min(self.eids)
if min_eid < 1:
msg = "min(eids)=%i" % min_eid
raise ValueError(msg)
示例2: build
def build(self):
cards = self._cards
ncards = len(cards)
self.n = ncards
if ncards:
float_fmt = self.model.float
self.element_id = zeros(ncards, 'int32')
self.property_id = zeros(ncards, 'int32')
self.node_ids = zeros((ncards, 20), 'int32')
comments = {}
for i, card in enumerate(cards):
comment = self._comments[i]
if comment:
self.comments[eid] = comment
#: Element ID
self.element_id[i] = integer(card, 1, 'element_id')
#: Property ID
self.property_id[i] = integer(card, 2, 'property_id')
#: Node IDs
self.node_ids[i, :] = fields(integer, card, 'node_ids', i=3, j=23)
assert len(card) == 23, 'len(CHEXA20 card) = %i' % len(card)
i = self.element_id.argsort()
self.element_id = self.element_id[i]
self.property_id = self.property_id[i]
self.node_ids = self.node_ids[i, :]
self._cards = []
self._comments = []
示例3: __init__
def __init__(self, card=None, data=None, comment=''):
Property.__init__(self, card, data)
if comment:
self._comment = comment
if card:
#: Property ID
self.pid = integer(card, 1, 'pid')
#: Material ID
self.mid1 = integer_or_blank(card, 2, 'mid1', 0)
self.t1 = double_or_blank(card, 3, 't1')
self.mid2 = integer_or_blank(card, 4, 'mid2', 0)
if self.mid2 > 0:
self.i = double(card, 5, 'i')
assert self.i > 0.0
else:
self.i = blank(card, 5, 'i')
self.mid3 = integer(card, 6, 0)
if self.mid3 > 0:
self.t2 = double(card, 7, 't3')
assert self.t2 > 0.0
else:
self.t2 = blank(card, 7, 't3')
self.nsm = double(card, 8, 'nsm')
self.z1 = double(card, 9, 'z1')
self.z2 = double(card, 10, 'z2')
self.phi = fields(double, card, 'phi', i=11, j=len(card))
else:
raise NotImplementedError(data)
示例4: __init__
def __init__(self, card=None, data=None, comment=''):
ThermalLoad.__init__(self, card, data)
if comment:
self._comment = comment
if card:
#: Load set identification number. (Integer > 0)
self.sid = integer(card, 1, 'eid')
self.flag = string(card, 2, 'flag')
assert self.flag in ['POINT', 'LINE', 'REV', 'AREA3', 'AREA4',
'AREA6', 'AREA8']
#: Magnitude of thermal flux into face. Q0 is positive for heat
#: into the surface. (Real)
self.Q0 = double(card, 3, 'Q0')
#: Area factor depends on type. (Real > 0.0 or blank)
self.af = double_or_blank(card, 4, 'af')
nfields = card.nFields()
#: grids
self.grids = fields(integer, card, 'grid', i=5, j=nfields)
#: Grid point identification of connected grid points.
#: (Integer > 0 or blank)
self.grids = expand_thru_by(self.grids)
else:
self.sid = data[0]
self.flag = data[1]
self.Q0 = data[2]
self.af = data[3]
self.grids = data[4:]
示例5: __init__
def __init__(self, card=None, data=None, comment=''):
if comment:
self._comment = comment
if card:
#: Load set identification number (Integer>0)
self.sid = integer(card, 1, 'sid')
#: Coordinate system identification number. (Integer>0: Default=0)
self.cid = integer_or_blank(card, 2, 'cid', 0)
#: Acceleration vector scale factor. (Real)
self.scale = double(card, 3, 'scale')
#: Components of the acceleration vector measured in coordinate system
#: CID. (Real; at least one Ni != 0)
self.N = array([double_or_blank(card, 4, 'N1', 0.0),
double_or_blank(card, 5, 'N2', 0.0),
double_or_blank(card, 6, 'N3', 0.0)])
assert max(abs(self.N)) > 0.
nodes = fields(integer_or_string, card, 'node', i=9, j=len(card))
else:
raise NotImplementedError(data)
#: nodes to apply the acceleration to
self.nodes = expand_thru_by(nodes)
示例6: getGE
def getGE(self, card, iStart):
# Flag indicating that the next fields, 1 through 6 are structural
# damping constants. See Remark 7. (Character)
#self.ge = string(card, iStart, 'ge')
#: Nominal structural damping constant in directions 1 through 6. See
#: Remarks 2. and 3. (Real; Default = 0.0)
self.GEi = fields(double_or_blank, card, 'GEi', iStart + 1, iStart + 7)
self.vars.append('GE')
示例7: getB
def getB(self, card, iStart):
# Flag indicating that the next 1 to 6 fields are force-per-velocity
# damping.
#self.b = string(card, iStart, 'b')
#: Force per unit velocity (Real)
#: Nominal damping coefficients in direction 1 through 6 in units of
#: force per unit velocity. See Remarks 2, 3, and 9. (Real; Default=0.)
self.Bi = fields(double_or_blank, card, 'Bi', iStart + 1, iStart + 7)
self.vars.append('B')
示例8: getK
def getK(self, card, iStart):
# Flag indicating that the next 1 to 6 fields are stiffness values in
# the element coordinate system.
#self.k = string(card, iStart, 'k')
#: Nominal stiffness values in directions 1 through 6.
#: See Remarks 2 and 3. (Real; Default = 0.0)
self.Ki = fields(double_or_blank, card, 'Ki', iStart + 1, iStart + 7)
#print "Ki = ",self.Ki
self.vars.append('K')
示例9: __init__
def __init__(self, card=None, data=None, comment=''):
Set.__init__(self, card, data)
if comment:
self._comment = comment
#: Identifiers of grids points. (Integer > 0)
self.IDs = []
self.components = components(card, 1, 'components')
IDs = fields(integer_or_string, card, i=2, j=len(card))
self.IDs = expand_thru(IDs)
示例10: __init__
def __init__(self, card=None, data=None, comment=''):
LineProperty.__init__(self, card, data)
if comment:
self._comment = comment
if card:
#: Property ID
self.pid = integer(card, 1, 'pid')
#: Material ID
self.mid = integer(card, 2, 'mid')
self.group = string_or_blank(card, 3, 'group', 'MSCBMLO')
#: Section Type (e.g. 'ROD', 'TUBE', 'I', 'H')
self.Type = string(card, 4, 'Type')
ndim = self.validTypes[self.Type]
j = 9 + ndim + 1
#: dimension list
self.dim = fields(double_or_blank, card, 'dim', i=9, j=j)
#: non-structural mass
self.nsm = double_or_blank(card, 9 + ndim + 1, 'nsm', 0.0)
if ndim > 0:
self.nsm = set_default_if_blank(self.dim.pop(), 0.0)
else:
self.nsm = 0.0
assert isinstance(self.nsm, float), 'nsm=%r' % self.nsm
else:
self.pid = data[0]
self.mid = data[1]
self.group = data[2].strip()
self.Type = data[3].strip()
self.dim = list(data[4:-1])
self.nsm = data[-1]
#print("group = %r" % self.group)
#print("Type = %r" % self.Type)
#print("dim = ",self.dim)
#print(str(self))
#print("*PBARL = ",data)
#raise NotImplementedError('not finished...')
if self.Type not in self.validTypes:
msg = ('Invalid PBARL Type, Type=%s '
'validTypes=%s' % (self.Type, self.validTypes.keys()))
raise RuntimeError(msg)
if len(self.dim) != self.validTypes[self.Type]:
msg = 'dim=%s len(dim)=%s Type=%s len(dimType)=%s' % (
self.dim, len(self.dim), self.Type,
self.validTypes[self.Type])
raise RuntimeError(msg)
assert None not in self.dim
示例11: __init__
def __init__(self, card=None, data=None, comment=''):
"""
::
RBE2 EID GN CM GM1 GM2 GM3 GM4 GM5
GM6 GM7 GM8 -etc.- ALPHA
"""
RigidElement.__init__(self, card, data)
if comment:
self._comment = comment
if card:
#: Element identification number
self.eid = integer(card, 1, 'eid')
#: Identification number of grid point to which all six independent
#: degrees-of-freedom for the element are assigned. (Integer > 0)
self.gn = integer(card, 2, 'gn')
#: Component numbers of the dependent degrees-of-freedom in the
#: global coordinate system at grid points GMi. (Integers 1 through
#: 6 with no embedded blanks.)
self.cm = components_or_blank(card, 3, 'cm')
#: Grid point identification numbers at which dependent
#: degrees-of-freedom are assigned. (Integer > 0)
self.Gmi = fields(integer, card, 'Gm', i=4, j=len(card))
if len(self.Gmi) > 0 and isinstance(self.Gmi[-1], float):
#: Thermal expansion coefficient. See Remark 11.
#: (Real > 0.0 or blank)
self.alpha = self.Gmi.pop() # the last field is not part of
# Gmi
else:
self.alpha = 0.0
else:
self.eid = data[0]
self.gn = data[1]
self.cm = data[2]
self.Gmi = data[3]
self.alpha = data[4]
print("eid=%s gn=%s cm=%s Gmi=%s alpha=%s"
% (self.eid, self.gn, self.cm, self.Gmi, self.alpha))
raise NotImplementedError('RBE2 data...')
assert self.gn is not None, 'gm=%s' % self.gm
assert self.cm is not None, 'cm=%s' % self.cm
self.gn = str(self.gn)
self.cm = str(self.cm)
示例12: __init__
def __init__(self, card=None, data=None, comment=''):
SolidElement.__init__(self, card, data)
if comment:
self._comment = comment
if card:
#: Element ID
self.eid = integer(card, 1, 'eid')
#: Property ID
self.pid = integer(card, 2, 'pid')
nids = fields(integer, card, 'nid', i=3, j=13)
assert len(card) <= 13, 'len(CTETRA10 card) = %i' % len(card)
else:
self.eid = data[0]
self.pid = data[1]
nids = [d if d > 0 else None for d in data[2:]]
assert len(data) == 12, 'len(data)=%s data=%s' % (len(data), data)
self.prepareNodeIDs(nids, allowEmptyNodes=True)
assert len(self.nodes) <= 10
示例13: __init__
def __init__(self, card=None, data=None, comment=''):
CrackElement.__init__(self, card, data)
if comment:
self._comment = comment
if card:
self.eid = integer(card, 1, 'eid')
self.pid = integer(card, 2, 'pid')
# required 1-10, 19-28
# optional 11-18, 29-36, 37-64
# all/none 37-46
nids = fields(integer_or_blank, card, 'nid', 3, 67) # cap at +3 = 67
assert len(card) <= 67, 'len(CRAC3D card) = %i' % len(card)
else:
self.eid = data[0]
self.pid = data[1]
nids = data[2:]
self.prepareNodeIDs(nids, allowEmptyNodes=True)
assert len(self.nodes) == 64
示例14: __init__
def __init__(self, card=None, data=None, comment=''):
Set.__init__(self, card, data)
if comment:
self._comment = comment
#: Unique identification number. (Integer > 0)
self.sid = integer(card, 1, 'sid')
self.IDs = []
IDs = fields(integer_or_string, card, 'ID', i=2, j=len(card))
self.isSkin = False
i = 0
if isinstance(IDs[0], string_types) and IDs[0] == 'SKIN':
self.isSkin = True
i += 1
#: List of structural grid point or element identification numbers.
#: (Integer > 0 or 'THRU'; for the 'THRU' option, ID1 < ID2 or 'SKIN';
#: in field 3)
self.IDs = expand_thru(IDs[i:])
self.clean_ids()
self.xref_type = None
示例15: add
def add(self, card, comment):
i = self.i
self.property_id[i] = integer(card, 1, 'property_id')
self.material_id[i] = integer(card, 2, 'material_id')
self.group[i] = string_or_blank(card, 3, 'group', 'MSCBMLO')
Type = string(card, 4, 'Type')
self.Type[i] = Type
ndim = self.valid_types[Type]
j = 9 + ndim + 1
dim = fields(double_or_blank, card, 'dim', i=9, j=j)
nsm = double_or_blank(card, 9 + ndim + 1, 'nsm', 0.0)
if ndim > 0:
nsm = set_default_if_blank(dim.pop(), 0.0)
#else:
#nsm = 0.0
self.dim[i] = dim
self.nsm[i] = nsm
assert isinstance(nsm, float), 'nsm=%r' % nsm
if Type not in self.valid_types:
msg = ('Invalid PBARL Type, Type=%s '
'validTypes=%s' % (Type, self.valid_types.keys()))
raise RuntimeError(msg)
if len(dim) != self.valid_types[Type]:
msg = 'dim=%s len(dim)=%s Type=%s len(dimType)=%s' % (
dim, len(dim), Type,
self.valid_types[Type])
raise RuntimeError(msg)
assert None not in dim
self.i += 1