本文整理汇总了Python中pyNastran.bdf.bdfInterface.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 self: the CORD3G coordinate system object
: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' % len(card)
# EQN for DEQATN, TABLE for TABLE3D
assert self.form in ['EQN', 'TABLE']
示例2: __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)
示例3: __init__
def __init__(self, card=None, data=None, comment=''):
if comment:
self._comment = comment
if card:
self.nid = integer(card, 1, 'nid')
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:
(sid, ninc, dt, kMethod, kStep, maxIter, conv, intOut, epsU, epsP,
epsW, maxDiv, maxQn, maxLs, fStress, lsTol, maxBisect, maxR,
rTolB) = data
self.nid = sid
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: __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)
示例5: add
def add(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' % len(card)
示例6: __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')
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 = p
self.eids = [self.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.eids = expand_thru([self.eid, 'THRU', eid2])
self.g1 = None
self.g34 = None
else:
#: used for CPENTA, CHEXA
self.eids = [self.eid]
#: used for solid element only
self.g1 = integer_or_blank(card, 7, 'g1')
#: g3/g4 - different depending on CHEXA/CPENTA or CTETRA
self.g34 = integer_or_blank(card, 8, 'g34')
#: Coordinate system identification number. See Remark 2.
#: (Integer >= 0;Default=0)
self.cid = integer_or_blank(card, 9, 'cid', 0)
#print "PLOAD4 cid = ",self.cid
self.NVector = array([double_or_blank(card, 10, 'N1', 0.0),
double_or_blank(card, 11, 'N2', 0.0),
double_or_blank(card, 12, 'N3', 0.0)])
self.sorl = string_or_blank(card, 13, 'sorl', 'SURF')
self.ldir = string_or_blank(card, 14, 'ldir', 'NORM')
assert len(card) <= 15, 'len(PLOAD4 card) = %i' % len(card)
else:
#print "PLOAD4 = ",data
self.sid = data[0]
self.eid = data[1]
self.pressures = data[2]
self.g1 = data[3]
self.g34 = data[4]
self.cid = data[5]
self.NVector = data[6]
self.sorl = data[7]
#self.ldir = data[8]
#assert len(data)==8
self.g1 = self.g1
self.g34 = self.g34
self.eids = [self.eid]
示例7: __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')
optionValues = [interpret_value(field) for field in card[9:] ]
self.options = []
self.values = []
#print "optionValues = ",optionValues
for optionValue in optionValues:
#print "optionValue = ",optionValue
(option, value) = optionValue.split('=')
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')
示例8: __init__
def __init__(self, card=None, data=None, comment=''):
IntegratedLineProperty.__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')
# determine the number of required dimensions on the PBEAM
ndim = self.validTypes[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
示例9: __init__
def __init__(self, card=None, data=None, comment=''):
ShellProperty.__init__(self, card, data)
if comment:
self._comment = comment
if card:
self.pid = integer(card, 1, 'pid')
# z0 will be calculated later
self.nsm = double_or_blank(card, 3, 'nsm', 0.0)
self.sb = double_or_blank(card, 4, 'sb', 0.0)
self.ft = string_or_blank(card, 5, 'ft')
assert self.ft in ['HILL', 'HOFF', 'TSAI', 'STRN', None]
self.TRef = double_or_blank(card, 6, 'TRef', 0.0)
self.ge = double_or_blank(card, 7, 'ge', 0.0)
self.lam = string_or_blank(card, 8, 'lam')
fields = card.fields(9)
T = 0. # thickness
midLast = None
tLast = None
self.plies = []
i = 0
#n = 0
while i < len(fields):
gPlyID = integer(card, 9 + i, 'gPlyID')
mid = integer_or_blank(card, 9 + i + 1, 'mid', midLast)
# can be blank 2nd time thru
thickness = double_or_blank(card, 9 + i + 2, 'thickness', tLast)
theta = double_or_blank(card, 9 + i + 3, 'theta', 0.0)
sout = string_or_blank(card, 9 + i + 4, 'sout', 'NO')
#print('n=%s gPlyID=%s mid=%s thickness=%s len=%s' %(
# n,gPlyID,mid,thickness,len(fields)))
ply = [mid, thickness, theta, sout, gPlyID]
#print("ply = %s" %(ply))
self.plies.append(ply)
#[mid,t,theta,sout] # PCOMP
assert mid is not None
assert thickness is not None
assert isinstance(mid, int), 'mid=%s' % mid
assert isinstance(thickness, float), 'thickness=%s' % thickness
midLast = mid
tLast = thickness
T += thickness
i += 8
#n += 1
self.z0 = double_or_blank(card, 2, 'z0', -0.5 * T)
else:
raise NotImplementedError('PCOMPG data')
示例10: __init__
def __init__(self, card=None, data=None, comment=''):
SolidProperty.__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.cordm = integer_or_blank(card, 3, 'cordm', 0)
self.integ = integer_string_or_blank(card, 4, 'integ')
#validIntegration = ['THREE', 'TWO', 'FULL', 'BUBBLE',
# 2, 3, None, 'REDUCED']
self.stress = integer_string_or_blank(card, 5, 'stress')
self.isop = integer_string_or_blank(card, 6, 'isop')
self.fctn = string_or_blank(card, 7, 'fctn', 'SMECH')
assert len(card) <= 8, 'len(PSOLID card) = %i' % len(card)
else:
self.pid = data[0]
self.mid = data[1]
self.cordm = data[2]
self.integ = data[3]
self.stress = data[4]
self.isop = data[5]
self.fctn = data[6]
if self.fctn == 'SMEC':
self.fctn = 'SMECH'
示例11: __init__
def __init__(self, card=None, data=None, comment=''):
"""
Design Sensitivity Equation Response Quantities
Defines equation responses that are used in the design, either as
constraints or as an objective.
"""
if comment:
self._comment = comment
self.oid = integer(card, 1, 'oid')
self.label = string(card, 2, 'label')
self.eqidFunc = integer_or_string(card, 3, 'eqid_Func')
self.region = integer_or_blank(card, 4, 'region')
self.method = string_or_blank(card, 5, 'method', 'MIN')
self.c1 = double_or_blank(card, 6, 'c1', 100.)
self.c2 = double_or_blank(card, 7, 'c2', 0.005)
self.c3 = double_or_blank(card, 8, 'c3') #: .. todo:: or blank?
i = 0
fields = [interpret_value(field) for field in card[9:] ]
key = '$NULL$' # dummy key
self.params = {key: []}
valueList = []
for (i, field) in enumerate(fields):
if i % 8 == 0 and field is not None:
self.params[key] = valueList
key = field
valueList = []
elif field is not None:
valueList.append(field)
#else:
# pass
self.params[key] = valueList
del self.params['$NULL$']
示例12: 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
示例13: __init__
def __init__(self, card=None, data=None, comment=''):
TabularLoad.__init__(self, card, data)
if comment:
self._comment = comment
if card:
self.sid = integer(card, 1, 'sid')
self.exciteID = integer(card, 2, 'exciteID')
self.delay = integer_double_or_blank(card, 3, 'delay')
self.dphase = integer_double_or_blank(card, 4, 'dphase')
self.tb = integer_or_blank(card, 5, 'tb', 0)
self.tp = integer_or_blank(card, 6, 'tp', 0)
self.Type = string_or_blank(card, 7, 'Type', 'LOAD')
if self.Type in [0, 'L', 'LO', 'LOA', 'LOAD']:
self.Type = 'LOAD'
elif self.Type in [1, 'D', 'DI', 'DIS', 'DISP']:
self.Type = 'DISP'
elif self.Type in [2, 'V', 'VE', 'VEL', 'VELO']:
self.Type = 'VELO'
elif self.Type in [3, 'A', 'AC', 'ACC', 'ACCE']:
self.Type = 'ACCE'
else:
msg = 'invalid RLOAD2 type Type=|%s|' % self.Type
raise RuntimeError(msg)
assert len(card) <= 8, 'len(RLOAD2 card) = %i' % len(card)
else:
raise NotImplementedError(data)
示例14: add
def add(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' % len(card)
self.i += 1
示例15: getShockA
def getShockA(self, card, iStart):
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)
else:
raise RuntimeError('Invalid shockType=|%s| on card\n%s' %(self.shockType, card))
iStart += 8
return iStart