本文整理汇总了Python中pyNastran.bdf.bdfInterface.assign_type.string函数的典型用法代码示例。如果您正苦于以下问题:Python string函数的具体用法?Python string怎么用?Python string使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了string函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self, card=None, data=None, comment=''):
Table.__init__(self, card, data)
if comment:
self._comment = comment
if card:
self.tid = integer(card, 1, 'tid')
self.Type = integer_or_blank(card, 2, 'Type', 1)
assert self.Type in [1, 2], 'TABLES1 Type=%s' % self.Type
nfields = len(card) - 1
nterms = (nfields - 9) // 2
if nterms < 0:
raise SyntaxError('%r card is too short' % self.type)
xy = []
for i in range(nterms):
n = 9 + i * 2
if card.field(n) == 'ENDT':
break
x = double_or_string(card, n, 'x' + str(i + 1))
y = double_or_string(card, n + 1, 'y' + str(i + 1))
if x == 'SKIP' or y == 'SKIP':
continue
xy += [x, y]
string(card, nfields, 'ENDT')
isData = False
else:
self.tid = data[0]
xy = data[1:]
isData = True
self.parse_fields(xy, nrepeated=2, isData=isData)
示例2: __init__
def __init__(self, card=None, data=None, comment=''):
"""
+--------+-----------+------------+-------+------+--------+-------+-----+-------+
| DRESP1 | 1S1 | CSTRAIN | PCOMP | | | 1 | 1 | 10000 |
+--------+-----------+------------+-------+------+--------+-------+-----+-------+
"""
if comment:
self._comment = comment
if card:
self.oid = integer(card, 1, 'oid')
self.label = string(card, 2, 'label')
self.rtype = string(card, 3, 'rtype')
# elem, pbar, pshell, etc. (ELEM flag or Prop Name)
self.ptype = integer_string_or_blank(card, 4, 'ptype')
#if 1:
## incomplete
#assert self.ptype in ['ELEM', 'PSHELL', 'PBAR', 'PROD', 'PCOMP',
#'PSOLID', 'PELAS', 'PBARL', 'PBEAM',
#'PBEAML', 'PSHEAR', 'PTUBE',
#'PKNL',
#None], 'DRESP1 ptype=%s' % self.ptype
self.region = integer_or_blank(card, 5, 'region')
self.atta = integer_double_string_or_blank(card, 6, 'atta')
self.attb = integer_double_string_or_blank(card, 7, 'attb')
self.atti = []
for i in range(8, len(card)):
atti = integer_double_string_or_blank(card, i, 'atti_%i' % (i + 1))
self.atti.append(atti)
else:
raise RuntimeError(data)
示例3: __init__
def __init__(self, card=None, data=None, comment=''):
RandomTable.__init__(self, card, data)
if comment:
self._comment = comment
if card:
self.tid = integer(card, 1, 'tid')
self.xaxis = string_or_blank(card, 2, 'xaxis', 'LINEAR')
self.yaxis = string_or_blank(card, 3, 'yaxis', 'LINEAR')
nfields = len(card) - 1
nterms = (nfields - 9) // 2
if nterms < 0:
raise SyntaxError('%r card is too short' % self.type)
xy = []
for i in range(nterms):
n = 9 + i * 2
if card.field(n) == 'ENDT':
break
x = double(card, n, 'x' + str(i + 1))
y = double(card, n + 1, 'y' + str(i + 1))
xy += [x, y]
string(card, nfields, 'ENDT')
isData = False
else:
self.tid = data[0]
self.xaxis = self.map_axis(data[1])
self.yaxis = self.map_axis(data[2])
xy = data[3:]
isData = True
assert self.xaxis in ['LINEAR', 'LOG'], 'xaxis=|%s|' % (self.xaxis)
assert self.yaxis in ['LINEAR', 'LOG'], 'yaxis=|%s|' % (self.yaxis)
self.parse_fields(xy, nrepeated=2, isData=isData)
示例4: __init__
def __init__(self, card=None, data=None, comment=''):
"""
::
DRESP1 1S1 CSTRAIN PCOMP 1 1 10000
"""
if comment:
self._comment = comment
self.oid = integer(card, 1, 'oid')
self.label = string(card, 2, 'label')
self.rtype = string(card, 3, 'rtype')
# elem, pbar, pshell, etc. (ELEM flag or Prop Name)
self.ptype = integer_string_or_blank(card, 4, 'ptype')
if 0:
assert self.ptype in ['ELEM', 'PSHELL', 'PBAR', 'PROD', 'PCOMP',
'PSOLID', 'PELAS', 'PBARL', 'PBEAM',
'PBEAML', 'PSHEAR', 'PTUBE',
'PKNL', #: .. todo:: is this correct?
None], 'DRESP1 ptype=%s' % self.ptype
self.region = integer_or_blank(card, 5, 'region')
self.atta = integer_double_string_or_blank(card, 6, 'atta')
self.attb = integer_double_string_or_blank(card, 7, 'attb')
self.atti = integer_double_string_or_blank(card, 8, 'atti')
self.others = [interpret_value(field) for field in card[9:] ]
示例5: __init__
def __init__(self, card=None, data=None, comment=''):
if comment:
self._comment = comment
if card:
self.sid = integer(card, 1, 'sid')
self.eid = integer(card, 2, 'eid')
self.Type = string(card, 3, 'Type')
self.scale = string(card, 4, 'scale')
self.x1 = double(card, 5, 'x1')
self.p1 = double(card, 6, 'p1')
self.x2 = double_or_blank(card, 7, 'x2', self.x1)
self.p2 = double_or_blank(card, 8, 'p2', self.p1)
assert 0 <= self.x1 <= self.x2
assert len(card) <= 9, 'len(PLOAD1 card) = %i' % len(card)
else:
self.sid = data[0]
self.eid = data[1]
self.Type = data[2]
self.scale = data[3]
self.x1 = data[4]
self.p1 = data[5]
self.x2 = data[6]
self.p2 = data[7]
if self.Type not in self.validTypes:
msg = '%s is an invalid type on the PLOAD1 card' % self.Type
raise RuntimeError(msg)
assert self.scale in self.validScales, '%s is an invalid scale on the PLOAD1 card' % (self.scale)
示例6: __init__
def __init__(self, card=None, data=None, comment=''):
if comment:
self._comment = comment
if card:
self.name = string(card, 1, 'name')
#zero
#: 4-Lower Triangular; 5=Upper Triangular; 6=Symmetric; 8=Identity (m=nRows, n=m)
self.ifo = integer(card, 3, 'ifo')
#: 1-Real, Single Precision; 2=Real,Double Precision; 3=Complex, Single; 4=Complex, Double
self.tin = integer(card, 4, 'tin')
#: 0-Set by cell precision
self.tout = integer_or_blank(card, 5, 'tout', 0)
self.polar = integer_or_blank(card, 6, 'polar')
if self.ifo == 9:
self.ncol = integer(card, 8, 'ncol')
else:
self.ncol = blank(card, 8, 'ncol')
else:
raise NotImplementedError(data)
self.GCj = []
self.GCi = []
self.Real = []
if self.isComplex():
self.Complex = []
示例7: __init__
def __init__(self, card=None, data=None, comment=""):
ThermalElement.__init__(self, card, data)
if comment:
self._comment = comment
if card:
#: Surface element ID
self.eid = integer(card, 1, "eid")
#: PHBDY property entry identification numbers. (Integer > 0)
self.pid = integer(card, 2, "pid")
assert self.pid > 0
self.Type = string(card, 3, "Type")
# print("self.Type = %s" % self.Type)
# msg = 'CHBDYP Type=%r' % self.Type
# assert self.Type in ['POINT','LINE','ELCYL','FTUBE','TUBE'], msg
#: A VIEW entry identification number for the front face.
self.iViewFront = integer_or_blank(card, 4, "iViewFront", 0)
#: A VIEW entry identification number for the back face.
self.iViewBack = integer_or_blank(card, 5, "iViewBack", 0)
#: Grid point identification numbers of grids bounding the surface.
#: (Integer > 0)
self.g1 = integer(card, 6, "g1")
#: Grid point identification numbers of grids bounding the surface.
#: (Integer > 0)
if self.Type != "POINT":
self.g2 = integer(card, 7, "g2")
else:
self.g2 = blank(card, 7, "g2")
#: Orientation grid point. (Integer > 0; Default = 0)
self.g0 = integer_or_blank(card, 8, "g0", 0)
#: RADM identification number for front face of surface element.
#: (Integer > 0)
self.radMidFront = integer_or_blank(card, 9, "radMidFront", 0)
#: RADM identification number for back face of surface element.
#: (Integer > 0)
self.radMidBack = integer_or_blank(card, 10, "radMidBack", 0)
#: Grid point identification number of a midside node if it is used
#: with the line type surface element.
self.gmid = integer_or_blank(card, 11, "gmid")
#: Coordinate system for defining orientation vector.
#: (Integer > 0; Default = 0
self.ce = integer_or_blank(card, 12, "ce", 0)
#: Components of the orientation vector in coordinate system CE.
#: The origin of the orientation vector is grid point G1.
#: (Real or blank)
self.e1 = double_or_blank(card, 13, "e3")
self.e2 = double_or_blank(card, 14, "e3")
self.e3 = double_or_blank(card, 15, "e3")
assert len(card) <= 16, "len(CHBDYP card) = %i" % len(card)
else:
raise NotImplementedError(data)
示例8: __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
nnodes = self.flag_to_nnodes[self.flag]
#: Grid point identification of connected grid points.
#: (Integer > 0 or blank)
self.grids = []
for i in range(nnodes):
grid = integer(card, 5 + i, 'grid%i' % (i + 1))
self.grids.append(grid)
else:
self.sid = data[0]
self.flag = data[1]
self.Q0 = data[2]
self.af = data[3]
self.grids = data[4:]
示例9: __init__
def __init__(self, card=None, data=None, comment=''):
ThermalElement.__init__(self, card, data)
if comment:
self._comment = comment
if card:
#: Surface element ID
self.eid = integer(card, 1, 'eid')
#: PHBDY property entry identification numbers. (Integer > 0)
self.pid = integer(card, 2, 'pid')
assert self.pid > 0
self.Type = string(card, 3, 'Type')
#print "self.Type = ",self.Type
# msg = 'CHBDYP Type=|%s|' (self.Type)
#assert self.Type in ['POINT','LINE','ELCYL','FTUBE','TUBE'], msg
#: A VIEW entry identification number for the front face.
self.iViewFront = integer_or_blank(card, 4, 'iViewFront', 0)
#: A VIEW entry identification number for the back face.
self.iViewBack = integer_or_blank(card, 5, 'iViewBack', 0)
#: Grid point identification numbers of grids bounding the surface.
#: (Integer > 0)
self.g1 = integer(card, 6, 'g1')
#: Grid point identification numbers of grids bounding the surface.
#: (Integer > 0)
if self.Type != 'POINT':
self.g2 = integer(card, 7, 'g2')
else:
self.g2 = blank(card, 7, 'g2')
#: Orientation grid point. (Integer > 0; Default = 0)
self.g0 = integer_or_blank(card, 8, 'g0', 0)
#: RADM identification number for front face of surface element.
#: (Integer > 0)
self.radMidFront = integer_or_blank(card, 9, 'radMidFront', 0)
#: RADM identification number for back face of surface element.
#: (Integer > 0)
self.radMidBack = integer_or_blank(card, 10, 'radMidBack', 0)
#: Grid point identification number of a midside node if it is used
#: with the line type surface element.
self.gmid = integer_or_blank(card, 11, 'gmid')
#: Coordinate system for defining orientation vector.
#: (Integer > 0; Default = 0
self.ce = integer_or_blank(card, 12, 'ce', 0)
#: Components of the orientation vector in coordinate system CE.
#: The origin of the orientation vector is grid point G1.
#: (Real or blank)
self.e1 = double_or_blank(card, 13, 'e3')
self.e2 = double_or_blank(card, 14, 'e3')
self.e3 = double_or_blank(card, 15, 'e3')
assert len(card) <= 16, 'len(CHBDYP card) = %i' % len(card)
else:
raise NotImplementedError(data)
示例10: __init__
def __init__(self, card=None, data=None, comment=''):
Table.__init__(self, card, data)
if comment:
self._comment = comment
if card:
self.tid = integer(card, 1, 'tid')
self.x1 = double(card, 2, 'x1')
self.x2 = double(card, 3, 'x2')
assert self.x2 != 0.0
self.x3 = double(card, 4, 'x3')
self.x4 = double(card, 5, 'x4')
assert self.x3 < self.x4
nfields = len(card) - 1
nterms = (nfields - 9) // 2
xy = []
for i in range(nterms):
n = 9 + i * 2
if card.field(n) == 'ENDT':
break
x = double(card, n, 'x' + str(i + 1))
y = double(card, n + 1, 'y' + str(i + 1))
xy += [x, y]
ENDT = string(card, nfields, 'ENDT')
isData = False
else:
self.tid = data[0]
self.x1 = data[1]
self.x2 = data[2]
self.x3 = data[3]
self.x4 = data[4]
xy = data[3:]
isData = True
self.parse_fields(xy, nrepeated=1, isData=isData)
示例11: __init__
def __init__(self, card=None, data=None, comment=''):
if comment:
self._comment = comment
if card:
self.name = string(card, 1, 'name')
#zero
#: 4-Lower Triangular; 5=Upper Triangular; 6=Symmetric; 8=Identity (m=nRows, n=m)
self.ifo = integer(card, 3, 'ifo')
#: 1-Real, Single Precision; 2=Real,Double Precision; 3=Complex, Single; 4=Complex, Double
self.tin = integer(card, 4, 'tin')
#: 0-Set by cell precision
self.tout = integer_or_blank(card, 5, 'tout', 0)
#: Input format of Ai, Bi. (Integer=blank or 0 indicates real, imaginary format;
#: Integer > 0 indicates amplitude, phase format.)
self.polar = integer_or_blank(card, 6, 'polar', 0)
if self.ifo in [6, 9]:
self.ncol = integer(card, 8, 'ncol')
else: # technically right, but nulling this will fix bad decks
self.ncol = None
#self.ncol = blank(card, 8, 'ncol')
else:
raise NotImplementedError(data)
self.GCj = []
self.GCi = []
self.Real = []
if self.is_complex():
self.Complex = []
示例12: __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:]
示例13: __init__
def __init__(self, card=None, data=None, comment=''):
BushingProperty.__init__(self, card, data)
if comment:
self._comment = comment
if card:
self.pid = integer(card, 1, 'pid')
nfields = len(card) - 1
nrows = nfields // 8
if nfields % 8 != 0:
nrows += 1
self.k_tables = []
self.b_tables = []
self.ge_tables = []
self.kn_tables = []
for irow in range(nrows):
ifield = 1 + irow * 8
param = string(card, ifield + 1, 'param_type')
table = []
for j in range(6):
table_value = integer_or_blank(card, ifield + j + 2, param + '%i' % (j+1))
table.append(table_value)
if param == 'K':
self.k_tables = table
elif param == 'B':
self.b_tables = table
elif param == 'GE':
self.ge_tables = table
elif param == 'KN':
self.kn_tables = table
else:
raise ValueError(param)
else:
raise NotImplementedError()
示例14: __init__
def __init__(self, card=None, data=None, comment=''):
Table.__init__(self, card, data)
if comment:
self._comment = comment
if card:
self.tid = integer(card, 1, 'tid')
self.Type = string_or_blank(card, 2, 'Type', 'G')
assert self.Type in ['G', 'CRIT', 'Q'], 'Type=%r' % self.Type
nfields = len(card) - 1
nterms = (nfields - 9) // 2
if nterms < 0:
raise SyntaxError('%r card is too short' % self.type)
xy = []
for i in range(nterms):
n = 9 + i * 2
if card.field(n) == 'ENDT':
break
x = double(card, n, 'x' + str(i + 1))
y = double(card, n + 1, 'y' + str(i + 1))
xy += [x, y]
ENDT = string(card, nfields, 'ENDT')
isData = False
else:
self.tid = data[0]
self.x1 = data[1]
self.Type = data[2]
xy = data[5:]
isData = True
self.parse_fields(xy, nrepeated=2, isData=isData)
示例15: __init__
def __init__(self, card, comment=''):
self.pid = integer(card, 1, 'property_id')
self.sets = []
self.Types = []
self.gammas = []
self._cps = []
#self.set = integer(card, 2, 'set_id')
#self.Type = string(card, 3, 'Type')
#if self.Type not in ['NEWTON','PRANDTL-MEYER', 'CP']:
# raise RuntimeError('Type=%r' % Type)
#self.gamma = double_or_blank(card, 4, 'gamma', 1.4)
i = 2
while i < len(card):
self.sets.append(integer(card, i, 'set_id'))
Type = string(card, i+1, 'Type')
self.Types.append(Type)
#if self.Type not in ['NEWTON','PRANDTL-MEYER', 'CP']:
#raise RuntimeError('Type=%r' % Type)
self.gammas.append(double_or_blank(card, i+2, 'gamma', 1.4))
_cp = None
if Type == 'CP':
_cp = double(card, i+3, 'Cp')
elif Type == 'NEWTON':
_cp = double_or_blank(card, i+3, 'Cp_nominal', 2.0)
self._cps.append(_cp)
i += 7