本文整理汇总了Python中pyNastran.bdf.bdf_interface.assign_type.string_or_blank函数的典型用法代码示例。如果您正苦于以下问题:Python string_or_blank函数的具体用法?Python string_or_blank怎么用?Python string_or_blank使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了string_or_blank函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self, card=None, data=None, comment=''):
"""
Intilizes the CORD3G
:param card: a list version of the fields
"""
if comment:
self.comment = comment
Coord.__init__(self, card, data)
self.cid = integer(card, 1, 'cid')
method = string_or_blank(card, 2, 'E313')
self.methodES = method[0]
self.methodInt = int(method[1:])
assert self.methodES in ['E', 'S'] # Euler / Space-Fixed
assert 0 < self.methodInt < 1000
self.form = string_or_blank(card, 3, 'form', 'EQN')
self.thetas = [integer(card, 4, 'theta1'),
integer(card, 5, 'theta2'),
integer(card, 6, 'theta3')]
assert len(self.thetas) == 3, 'thetas=%s' % (self.thetas)
self.rid = integer_or_blank(card, 7, 'cidRef')
assert len(card) <= 8, 'len(CORD3G card) = %i\ncard=%s' % (len(card), card)
# EQN for DEQATN, TABLE for TABLE3D
assert self.form in ['EQN', 'TABLE']
示例2: add_card
def add_card(cls, card, comment=''):
nlparm_id = integer(card, 1, 'nlparm_id')
ninc = integer_or_blank(card, 2, 'ninc', 10)
dt = double_or_blank(card, 3, 'dt', 0.0)
kmethod = string_or_blank(card, 4, 'kMethod', 'AUTO')
kStep = integer_or_blank(card, 5, 'kStep', 5)
maxIter = integer_or_blank(card, 6, 'maxIter', 25)
conv = string_or_blank(card, 7, 'conv', 'PW')
int_out = string_or_blank(card, 8, 'intOut', 'NO')
# line 2
epsU = double_or_blank(card, 9, 'epsU', 0.01)
epsP = double_or_blank(card, 10, 'epsP', 0.01)
epsW = double_or_blank(card, 11, 'epsW', 0.01)
maxDiv = integer_or_blank(card, 12, 'maxDiv', 3)
if kmethod == 'PFNT':
maxQn = integer_or_blank(card, 13, 'maxQn', 0)
else:
maxQn = integer_or_blank(card, 13, 'maxQn', maxIter)
maxLs = integer_or_blank(card, 14, 'maxLs', 4)
fStress = double_or_blank(card, 15, 'fStress', 0.2)
lsTol = double_or_blank(card, 16, 'lsTol', 0.5)
# line 3
maxBisect = integer_or_blank(card, 17, '', 5)
maxR = double_or_blank(card, 21, 'maxR', 20.)
rTolB = double_or_blank(card, 23, 'rTolB', 20.)
assert len(card) <= 24, 'len(NLPARM card) = %i\ncard=%s' % (len(card), card)
return NLPARM(nlparm_id, ninc, dt, kmethod, kStep, maxIter, conv,
int_out, epsU, epsP, epsW, maxDiv,
maxQn, maxLs, fStress,
lsTol, maxBisect, maxR,
rTolB, comment=comment)
示例3: __init__
def __init__(self, card=None, data=None, comment=''):
if comment:
self._comment = comment
if card:
self.nlparm_id = integer(card, 1, 'nlparm_id')
self.ninc = integer_or_blank(card, 2, 'ninc', 10)
self.dt = double_or_blank(card, 3, 'dt', 0.0)
self.kMethod = string_or_blank(card, 4, 'kMethod', 'AUTO')
self.kStep = integer_or_blank(card, 5, 'kStep', 5)
self.maxIter = integer_or_blank(card, 6, 'maxIter', 25)
self.conv = string_or_blank(card, 7, 'conv', 'PW')
self.intOut = string_or_blank(card, 8, 'intOut', 'NO')
# line 2
self.epsU = double_or_blank(card, 9, 'epsU', 0.01)
self.epsP = double_or_blank(card, 10, 'epsP', 0.01)
self.epsW = double_or_blank(card, 11, 'epsW', 0.01)
self.maxDiv = integer_or_blank(card, 12, 'maxDiv', 3)
if self.kMethod == 'PFNT':
self.maxQn = integer_or_blank(card, 13, 'maxQn', 0)
else:
self.maxQn = integer_or_blank(card, 13, 'maxQn', self.maxIter)
self.maxLs = integer_or_blank(card, 14, 'maxLs', 4)
self.fStress = double_or_blank(card, 15, 'fStress', 0.2)
self.lsTol = double_or_blank(card, 16, 'lsTol', 0.5)
# line 3
self.maxBisect = integer_or_blank(card, 17, '', 5)
self.maxR = double_or_blank(card, 21, 'maxR', 20.)
self.rTolB = double_or_blank(card, 23, 'rTolB', 20.)
assert len(card) <= 24, 'len(NLPARM card) = %i' % len(card)
else:
(nlparm_id, ninc, dt, kMethod, kStep, maxIter, conv, intOut, epsU, epsP,
epsW, maxDiv, maxQn, maxLs, fStress, lsTol, maxBisect, maxR,
rTolB) = data
self.nlparm_id = nlparm_id
self.ninc = ninc
self.dt = dt
self.kMethod = kMethod
self.kStep = kStep
self.maxIter = maxIter
self.conv = conv
self.intOut = intOut
# line 2
self.epsU = epsU
self.epsP = epsP
self.epsW = epsW
self.maxDiv = maxDiv
self.maxQn = maxQn
self.maxLs = maxLs
self.fStress = fStress
self.lsTol = lsTol
# line 3
self.maxBisect = maxBisect
self.maxR = maxR
self.rTolB = rTolB
示例4: add_card
def add_card(cls, card, comment=''):
crid = integer(card, 1, 'crid')
surf = string_or_blank(card, 2, 'surf', 'TOP')
offset = double_or_blank(card, 3, 'offset')
Type = string_or_blank(card, 4, 'type', 'FLEX')
mgp = integer_or_blank(card, 5, 'mpg', 0)
return BCRPARA(crid, surf, offset, Type=Type, mgp=mgp, comment=comment)
示例5: add_card
def add_card(cls, card, comment=''):
sid = integer(card, 1, 'sid')
method = string_or_blank(card, 2, 'method', 'LAN')
f1 = double_or_blank(card, 3, 'f1')
f2 = double_or_blank(card, 4, 'f2')
ne = integer_or_blank(card, 5, 'ne')
if method not in cls.allowed_methods:
msg = 'method=%s; allowed_methods=[%s]' % (
method, ', '.join(cls.allowed_methods))
raise ValueError(msg)
if method == 'SINV':
nd = integer_or_blank(card, 6, 'nd', 600)
if method == 'INV':
nd = integer_or_blank(card, 6, 'nd', 3 * ne)
elif method in ['GIV', 'MGIV', 'HOU', 'MHOU']:
nd = integer_or_blank(card, 6, 'nd', 0)
else:
nd = integer(card, 6, 'nd')
norm = string_or_blank(card, 9, 'norm', 'MASS')
if method == 'POINT':
G = integer(card, 10, 'G')
C = components(card, 11, 'C')
else:
G = blank(card, 10, 'G')
C = blank(card, 11, 'C')
assert len(card) <= 12, 'len(EIGR card) = %i\ncard=%s' % (len(card), card)
return EIGR(sid, method, f1, f2, ne, nd, norm, G, C, comment=comment)
示例6: __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_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')
is_data = False
else:
self.tid = data[0]
self.xaxis = self.map_axis(data[1])
self.yaxis = self.map_axis(data[2])
xy = data[3:]
is_data = True
assert self.xaxis in ['LINEAR', 'LOG'], 'xaxis=%r' % (self.xaxis)
assert self.yaxis in ['LINEAR', 'LOG'], 'yaxis=%r' % (self.yaxis)
self.parse_fields(xy, nrepeated=2, is_data=is_data)
示例7: add_card
def add_card(self, card=None, comment=''):
if comment:
self.comment = comment
self.nlparm_id = integer(card, 1, 'nlparm_id')
self.ninc = integer_or_blank(card, 2, 'ninc', 10)
self.dt = double_or_blank(card, 3, 'dt', 0.0)
self.kMethod = string_or_blank(card, 4, 'kMethod', 'AUTO')
self.kStep = integer_or_blank(card, 5, 'kStep', 5)
self.maxIter = integer_or_blank(card, 6, 'maxIter', 25)
self.conv = string_or_blank(card, 7, 'conv', 'PW')
self.intOut = string_or_blank(card, 8, 'intOut', 'NO')
# line 2
self.epsU = double_or_blank(card, 9, 'epsU', 0.01)
self.epsP = double_or_blank(card, 10, 'epsP', 0.01)
self.epsW = double_or_blank(card, 11, 'epsW', 0.01)
self.maxDiv = integer_or_blank(card, 12, 'maxDiv', 3)
if self.kMethod == 'PFNT':
self.maxQn = integer_or_blank(card, 13, 'maxQn', 0)
else:
self.maxQn = integer_or_blank(card, 13, 'maxQn', self.maxIter)
self.maxLs = integer_or_blank(card, 14, 'maxLs', 4)
self.fStress = double_or_blank(card, 15, 'fStress', 0.2)
self.lsTol = double_or_blank(card, 16, 'lsTol', 0.5)
# line 3
self.maxBisect = integer_or_blank(card, 17, '', 5)
self.maxR = double_or_blank(card, 21, 'maxR', 20.)
self.rTolB = double_or_blank(card, 23, 'rTolB', 20.)
assert len(card) <= 24, 'len(NLPARM card) = %i\ncard=%s' % (len(card), card)
示例8: __init__
def __init__(self, card=None, data=None, comment=''):
if comment:
self._comment = comment
if card:
#: CRID Contact region ID. (Integer > 0)
self.crid = integer(card, 1, 'crid')
#: SURF Indicates the contact side. See Remark 1. (Character = "TOP" or
#: "BOT"; Default = "TOP")
self.surf = string_or_blank(card, 2, 'surf', 'TOP')
#: Offset distance for the contact region. See Remark 2. (Real > 0.0,
#: Default =OFFSET value in BCTPARA entry)
self.offset = double_or_blank(card, 3, 'offset')
#: Indicates whether a contact region is a rigid surface if it is used as a
#: target region. See Remarks 3 and 4. (Character = "RIGID" or "FLEX",
#: Default = "FLEX"). This is not supported for SOL 101.
self.Type = string_or_blank(card, 4, 'type', 'FLEX')
#: Master grid point for a target contact region with TYPE=RIGID or
#: when the rigid-target algorithm is used. The master grid point may be
#: used to control the motion of a rigid surface. (Integer > 0,; Default = 0)
#: This is not supported for SOL 101.
self.mgp = integer_or_blank(card, 5, 'mpg', 0)
else:
msg = '%s has not implemented data parsing' % self.type
raise NotImplementedError(msg)
示例9: __init__
def __init__(self, card=None, data=None, sol=None, comment=''):
Method.__init__(self, card, data)
if comment:
self._comment = comment
if card:
#: Set identification number. (Unique Integer > 0)
self.sid = integer(card, 1, 'sid')
#: For vibration analysis: frequency range of interest. For
#: buckling analysis: eigenvalue range of interest. See Remark 4.
#: (Real or blank, -5 10e16 <= V1 < V2 <= 5.10e16)
self.v1 = double_or_blank(card, 2, 'v1')
self.v2 = double_or_blank(card, 3, 'v2')
#: Number of roots desired
self.nd = integer_or_blank(card, 4, 'nd')
#: Diagnostic level. (0 < Integer < 4; Default = 0)
self.msglvl = integer_or_blank(card, 5, 'msglvl', 0)
#: Number of vectors in block or set. Default is machine dependent
self.maxset = integer_or_blank(card, 6, 'maxset')
#: Estimate of the first flexible mode natural frequency
#: (Real or blank)
self.shfscl = double_or_blank(card, 7, 'shfscl')
#: Method for normalizing eigenvectors (Character: 'MASS' or 'MAX')
self.norm = string_or_blank(card, 8, 'norm')
option_values = [interpret_value(field) for field in card[9:]]
self.options = []
self.values = []
for option_value in option_values:
try:
(option, value) = option_value.split('=')
except AttributeError:
msg = 'parsing EIGRL card incorrectly; option_values=%s\ncard=%s' % (
option_values, card)
raise RuntimeError(msg)
self.options.append(option)
self.values.append(value)
#: Method for normalizing eigenvectors
if sol in [103, 115, 146]:
# normal modes,cyclic normal modes, flutter
self.norm = string_or_blank(card, 8, 'norm', 'MASS')
elif sol in [105, 110, 111, 116]:
# buckling, modal complex eigenvalues,
# modal frequency response,cyclic buckling
self.norm = string_or_blank(card, 8, 'norm', 'MAX')
else:
self.norm = string_or_blank(card, 8, 'norm')
#assert len(card) <= 9, 'len(EIGRL card) = %i' % len(card)
assert len(card) <= 10, 'len(EIGRL card) = %i' % len(card)
#msg = 'norm=%s sol=%s' % (self.norm, sol)
#assert self.norm in ['MASS', 'MAX'],msg
#assert card.nFields()<9,'card = %s' %(card.fields(0))
else:
raise NotImplementedError('EIGRL')
示例10: add_card
def add_card(cls, card, comment=''):
pid = integer(card, 1, 'pid')
# z0 will be calculated later
nsm = double_or_blank(card, 3, 'nsm', 0.0)
sb = double_or_blank(card, 4, 'sb', 0.0)
ft = string_or_blank(card, 5, 'ft')
TRef = double_or_blank(card, 6, 'TRef', 0.0)
ge = double_or_blank(card, 7, 'ge', 0.0)
lam = string_or_blank(card, 8, 'lam')
fields = card.fields(9)
#T = 0. # thickness
mid_last = None
thick_last = None
i = 0
#n = 0
mids = []
thicknesses = []
thetas = []
souts = []
global_ply_ids = []
while i < len(fields):
global_ply_id = integer(card, 9 + i, 'global_ply_id')
mid = integer_or_blank(card, 9 + i + 1, 'mid', mid_last)
# can be blank 2nd time thru
thickness = double_or_blank(card, 9 + i + 2, 'thickness', thick_last)
theta = double_or_blank(card, 9 + i + 3, 'theta', 0.0)
sout = string_or_blank(card, 9 + i + 4, 'sout', 'NO')
#print('n=%s global_ply_id=%s mid=%s thickness=%s len=%s' %(
# n,global_ply_id,mid,thickness,len(fields)))
mids.append(mid)
thicknesses.append(thickness)
thetas.append(theta)
souts.append(sout)
global_ply_ids.append(global_ply_id)
assert mid is not None
assert thickness is not None
assert isinstance(mid, int), 'mid=%s' % mid
assert isinstance(thickness, float), 'thickness=%s' % thickness
mid_last = mid
thick_last = thickness
#T += thickness
i += 8
#n += 1
z0 = double_or_blank(card, 2, 'z0')
return PCOMPG(pid,
global_ply_ids, mids, thicknesses, thetas, souts,
nsm, sb, ft, TRef, ge, lam, z0, comment=comment)
示例11: add_card
def add_card(self, card, comment=''):
if comment:
self._comment = comment
#: 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')
# determine the number of required dimensions on the PBEAM
ndim = self.valid_types[self.Type]
#nAll = ndim + 1
#: dimension list
self.dim = []
Dim = []
#: Section position
self.xxb = [0.]
#: Output flag
self.so = ['YES']
#: non-structural mass :math:`nsm`
self.nsm = []
i = 9
n = 0
while i < len(card):
if n > 0:
so = string_or_blank(card, i, 'so_n=%i' % n, 'YES')
xxb = double_or_blank(card, i + 1, 'xxb_n=%i' % n, 1.0)
self.so.append(so)
self.xxb.append(xxb)
i += 2
Dim = []
for ii in range(ndim):
dim = double(card, i, 'dim_n=%i_ii=%i' % (n, ii))
Dim.append(dim)
i += 1
self.dim.append(Dim)
nsm = double_or_blank(card, i, 'nsm_n=%i' % n, 0.0)
self.nsm.append(nsm)
n += 1
i += 1
示例12: _read_shock
def _read_shock(self, card, istart):
"""
F(u, v) = Cv * S(u) * sign(v) * |v|^ev
"""
self.shockType = string_or_blank(card, istart + 1, 'shockType')
self.shockCVT = double(card, istart + 2, 'shockCVT')
self.shockCVC = double_or_blank(card, istart + 3, 'shockCVC')
self.shockExpVT = double_or_blank(card, istart + 4, 'shockExpVT', 1.0)
self.shockExpVC = double_or_blank(card, istart + 5,
'shockExpVC', self.shockExpVT)
if self.shockType == 'TABLE':
pass
# self.shockIDTS = integer(card, istart + 6, 'shockIDTS')
# self.shockIDETS = blank(card, istart + 9, 'shockIDETS')
# self.shockIDECS = blank(card, istart + 10, 'shockIDECS')
# self.shockIDETSD = blank(card, istart + 11, 'shockIDETSD')
# self.shockIDECSD = blank(card, istart + 12, 'shockIDECSD')
elif self.shockType == 'EQUAT':
self.shockIDTS = blank(card, istart + 6, 'shockIDTS')
self.shockIDETS = integer(card, istart + 9, 'shockIDETS')
self.shockIDECS = integer_or_blank(card, istart + 10,
'shockIDECS', self.shockIDETS)
self.shockIDETSD = integer(card, istart + 11, 'shockIDETSD')
self.shockIDECSD = integer_or_blank(card, istart + 11,
'shockIDECSD', self.shockIDETSD)
#def DEquation(self):
#if isinstance(self.dequation, int):
#return self.dequation
#return self.dequation.equation_id
else:
raise RuntimeError('Invalid shockType=%r on card\n%s' %(self.shockType, card))
istart += 8
return istart
示例13: add
def add(self, card, comment=''):
i = self.i
self.element_id[i] = integer(card, 1, 'element_id')
self.caero[i] = integer(card, 2, 'caero')
self.box1[i] = integer(card, 3, 'box1')
self.box2[i] = integer(card, 4, 'box2')
self.setg[i] = integer(card, 5, 'setg')
self.dz[i] = double_or_blank(card, 6, 'dz', 0.0)
self.method[i] = string_or_blank(card, 7, 'method', 'IPS')
self.usage[i] = string_or_blank(card, 8, 'usage', 'BOTH')
self.nelements[i] = integer_or_blank(card, 9, 'nelements', 10)
self.melements[i] = integer_or_blank(card, 10, 'melements', 10)
assert self.nelements[i] > 0, 'nelements = %s' % self.nelements[i]
assert self.melements[i] > 0, 'melements = %s' % self.melements[i]
assert len(card) <= 11, 'len(SPLINE1 card) = %i' % len(card)
self.i += 1
示例14: add_card
def add_card(self, card, comment=''):
i = self.i
self.property_id[i] = integer(card, 1, 'pid')
self.material_id[i] = integer(card, 2, 'mid')
self.cordm[i] = integer_or_blank(card, 3, 'cordm', 0)
self.integ[i] = integer_string_or_blank(card, 4, 'integ', '')
#validIntegration = ['THREE', 'TWO', 'FULL', 'BUBBLE',
# 2, 3, None, 'REDUCED']
# ISOP
# ------
# 1. FULL
# 2.
# 3.
# REDUCED
# IN
# ------
# 1.
# 2. TWO
# 3. THREE
# BUBBLE - 2 for CTETRA, 3 for CHEXA/CPENTA
# STRESS
# ------
# 1. GAUSS (no midside nodes on CPENTA/CHEXA; ok on CTETRA)
# 2.
self.stress[i] = integer_string_or_blank(card, 5, 'stress', '')
self.isop[i] = integer_string_or_blank(card, 6, 'isop', '')
self.fctn[i] = string_or_blank(card, 7, 'fctn', 'SMECH')
assert len(card) <= 8, 'len(PSOLID card) = %i\ncard=%s' % (len(card), card)
self.i += 1
示例15: add_card
def add_card(self, card, comment=None):
i = self.i
self._comments.append(comment)
#element_ids = {}
#for i in range(ncards):
#element_ids[i] = []
self.load_id[i] = integer(card, 1, 'load_id')
eid = integer(card, 2, 'element_id')
self.element_ids[i] = eid
p1 = double_or_blank(card, 3, 'p1', 0.0)
p = [p1,
double_or_blank(card, 4, 'p2', p1),
double_or_blank(card, 5, 'p3', p1),
double_or_blank(card, 6, 'p4', p1)]
self.pressures[i, :] = p
self.element_ids[i] = [eid]
if(integer_string_or_blank(card, 7, 'g1/THRU') == 'THRU' and
integer_or_blank(card, 8, 'eid2')): # plates
eid2 = integer(card, 8, 'eid2')
if eid2:
self.element_ids[i] = list(unique(expand_thru([eid, 'THRU', eid2],
set_fields=False, sort_fields=False)))
#self.g1 = None
#self.g34 = None
else:
#: used for CPENTA, CHEXA
self.element_ids[i] = [eid]
#: used for solid element only
self.g1[i] = integer_or_blank(card, 7, 'g1', -1)
#: g3/g4 - different depending on CHEXA/CPENTA or CTETRA
self.g34[i] = integer_or_blank(card, 8, 'g34', -1)
#: Coordinate system identification number. See Remark 2.
#: (Integer >= 0;Default=0)
self.cid[i] = integer_or_blank(card, 9, 'cid', 0)
self.nvector[i, :] = [
double_or_blank(card, 10, 'N1'),
double_or_blank(card, 11, 'N2'),
double_or_blank(card, 12, 'N3'), ]
self.sorl[i] = string_or_blank(card, 13, 'sorl', 'SURF')
self.ldir[i] = string_or_blank(card, 14, 'ldir', 'NORM')
assert len(card) <= 15, 'len(PLOAD4 card) = %i\ncard=%s' % (len(card), card)
self.i += 1