本文整理汇总了Python中pyNastran.bdf.bdfInterface.assign_type.double_or_blank函数的典型用法代码示例。如果您正苦于以下问题:Python double_or_blank函数的具体用法?Python double_or_blank怎么用?Python double_or_blank使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了double_or_blank函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self, card=None, data=None, comment=''):
TriShell.__init__(self, card, data)
if comment:
self._comment = comment
#: Element ID
self.eid = integer(card, 1, 'eid')
#: Property ID
self.pid = integer(card, 2, 'pid')
nids = [integer(card, 3, 'n1'),
integer(card, 4, 'n2'),
integer(card, 5, 'n3')]
self.prepareNodeIDs(nids)
assert len(self.nodes) == 3
self.thetaMcid = integer_double_or_blank(card, 6, 'thetaMcid', 0.0)
self.zOffset = double_or_blank(card, 7, 'zOffset', 0.0)
blank(card, 8, 'blank')
blank(card, 9, 'blank')
blank(card, 10, 'blank')
self.TFlag = integer_or_blank(card, 11, 'TFlag', 0)
self.T1 = double_or_blank(card, 11, 'T1', 1.0)
self.T2 = double_or_blank(card, 12, 'T2', 1.0)
self.T3 = double_or_blank(card, 13, 'T3', 1.0)
assert len(card) <= 14, 'len(CTRIAR card) = %i' % len(card)
示例2: __init__
def __init__(self, card=None, data=None, comment=''):
"""
::
FORCE 3 1 100. 0. 0. 1.
"""
Force.__init__(self, card, data)
if comment:
self._comment = comment
if card:
self.sid = integer(card, 1, 'sid')
self.node = integer(card, 2, 'node')
self.cid = integer_or_blank(card, 3, 'cid', 0)
self.mag = double(card, 4, 'mag')
xyz = array([double_or_blank(card, 5, 'X1', 0.0),
double_or_blank(card, 6, 'X2', 0.0),
double_or_blank(card, 7, 'X3', 0.0)])
assert len(card) <= 8, 'len(FORCE card) = %i' % len(card)
else:
self.sid = data[0]
self.node = data[1]
self.cid = data[2]
self.mag = data[3]
xyz = data[4:7]
assert len(xyz) == 3, 'xyz=%s' % (xyz)
self.xyz = array(xyz)
示例3: add
def add(self, card, comment=''):
cp0 = self.model.grdset.cp
cd0 = self.model.grdset.cd
ps0 = self.model.grdset.ps
seid0 = self.model.grdset.seid
i = self.i
#: Node ID
self.node_id[i] = integer(card, 1, 'nid')
#: Grid point coordinate system
self.cp[i] = integer_or_blank(card, 2, 'cp', cp0)
x = double_or_blank(card, 3, 'x1', 0.)
y = double_or_blank(card, 4, 'x2', 0.)
z = double_or_blank(card, 5, 'x3', 0.)
#: node location in local frame
self.xyz[i] = [x, y, z]
#: Analysis coordinate system
self.cd[i] = integer_or_blank(card, 6, 'cd', cd0)
#: SPC constraint
self.ps[i] = integer_or_blank(card, 7, 'ps', ps0)
#: Superelement ID
self.seid[i] = integer_or_blank(card, 8, 'seid', seid0)
self.i += 1
示例4: __init__
def __init__(self, card=None, data=None, comment=''):
"""
Creates the GRID card
:param self:
the GRID object pointer
:param card:
a BDFCard object
:type card:
BDFCard
:param data:
a list with the GRID fields defined in OP2 format
:type data:
LIST
:param comment:
a comment for the card
:type comment:
string
"""
if comment:
self._comment = comment
Node.__init__(self, card, data)
if card:
#: Node ID
self.nid = integer(card, 1, 'nid')
#: Grid point coordinate system
self.cp = integer_or_blank(card, 2, 'cp', 0)
#: node location in local frame
self.xyz = array([
double_or_blank(card, 3, 'x1', 0.),
double_or_blank(card, 4, 'x2', 0.),
double_or_blank(card, 5, 'x3', 0.)], dtype='float64')
#: Analysis coordinate system
self.cd = integer_or_blank(card, 6, 'cd', 0)
#: SPC constraint
self.ps = str(integer_or_blank(card, 7, 'ps', ''))
#: Superelement ID
self.seid = integer_or_blank(card, 8, 'seid', 0)
assert len(card) <= 9, 'len(GRID card) = %i' % len(card)
else:
self.nid = data[0]
self.cp = data[1]
self.xyz = array(data[2:5])
self.cd = data[5]
self.ps = data[6]
self.seid = data[7]
if self.ps == 0:
self.ps = ''
assert len(self.xyz) == 3
assert self.nid > 0, 'nid=%s' % (self.nid)
assert self.cp >= 0, 'cp=%s' % (self.cp)
assert self.cd >= -1, 'cd=%s' % (self.cd)
assert self.seid >= 0, 'seid=%s' % (self.seid)
示例5: __init__
def __init__(self, card=None, icard=0, data=None, comment=''):
SpringProperty.__init__(self, card, data)
if comment:
self._comment = comment
nOffset = icard * 5
if card:
# 2 PELAS properties can be defined on 1 PELAS card
# these are split into 2 separate cards
#: Property identification number. (Integer > 0)
self.pid = integer(card, 1 + nOffset, 'pid')
#: Ki Elastic property value. (Real)
self.k = double(card, 2 + nOffset, 'k')
#: Damping coefficient, . See Remarks 5. and 6. (Real)
#: To obtain the damping coefficient GE, multiply the
#: critical damping ratio c/c0 by 2.0.
self.ge = double_or_blank(card, 3 + nOffset, 'ge', 0.)
#: Stress coefficient. (Real)
self.s = double_or_blank(card, 4 + nOffset, 's', 0.)
else:
self.pid = data[0]
self.k = data[1]
self.ge = data[2]
self.s = data[3]
示例6: __init__
def __init__(self, card=None, data=None, comment=''):
LineProperty.__init__(self, card, data)
if comment:
self._comment = comment
if card:
self.pid = integer(card, 1, 'pid')
self.mid = integer(card, 2, 'mid')
self.A = double(card, 3, 'A')
self.iz = double(card, 4, 'Iz')
self.iy = double(card, 5, 'Iy')
self.iyz = double_or_blank(card, 6, 'Iyz', 0.0)
self.j = double_or_blank(card, 7, 'J', self.iy + self.iz)
self.nsm = double_or_blank(card, 8, 'nsm', 0.0)
self.cy = double(card, 9, 'cy')
self.cz = double(card, 10, 'cz')
self.dy = double(card, 11, 'dy')
self.dz = double(card, 12, 'dz')
self.ey = double(card, 13, 'ey')
self.dz = double(card, 14, 'ez')
self.fy = double(card, 15, 'fy')
self.fz = double(card, 16, 'fz')
# more...
else:
raise NotImplementedError(data)
示例7: __init__
def __init__(self, card=None, data=None, comment=''):
Constraint.__init__(self, card, data)
if comment:
self._comment = comment
if card:
self.conid = integer(card, 1, 'sid')
self.gids = [integer(card, 2, 'G1'), integer_or_blank(card, 5, 'G2')]
# :0 if scalar point 1-6 if grid
self.constraints = [components_or_blank(card, 3, 'C1', 0),
components_or_blank(card, 6, 'C2', 0)]
self.enforced = [double_or_blank(card, 4, 'D1', 0.0),
double_or_blank(card, 7, 'D2', 0.0)]
# reduce the size if there are duplicate Nones
nConstraints = max(len(self.gids),
len(self.constraints),
len(self.enforced))
self.gids = self.gids[0:nConstraints]
self.constraints = self.constraints[0:nConstraints]
self.enforced = self.enforced[0:nConstraints]
else:
self.conid = data[0]
self.gids = [data[1]]
self.constraints = [data[2]]
self.enforced = [data[3]]
示例8: __init__
def __init__(self, card=None, data=None, comment=''):
"""
Multiple Design Variable Linking
Relates one design variable to one or more other design variables.::
DLINK ID DDVID C0 CMULT IDV1 C1 IDV2 C2
IDV3 C3 -etc.-
"""
if comment:
self._comment = comment
if card:
self.oid = integer(card, 1, 'oid')
self.ddvid = integer(card, 2, 'ddvid')
self.c0 = double_or_blank(card, 3, 'c0', 0.)
self.cmult = double_or_blank(card, 4, 'cmult', 1.)
nfields = len(card) - 4
n = nfields // 2
self.IDv = []
self.Ci = []
for i in range(n):
j = 2 * i + 5
IDv = integer(card, j, 'IDv' + str(i))
Ci = double(card, j + 1, 'Ci' + str(i))
self.IDv.append(IDv)
self.Ci.append(Ci)
else:
raise RuntimeError(data)
示例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 = %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)
示例10: set_E_G_nu
def set_E_G_nu(self, i, card):
r"""
\f[ G = \frac{E}{2 (1+\nu)} \f]
"""
E = double_or_blank(card, 2, 'E')
G = double_or_blank(card, 3, 'G')
nu = double_or_blank(card, 4, 'nu')
if G is None and E is None: # no E,G
raise RuntimeError('G=%s E=%s cannot both be None' % (G, E))
elif E is not None and G is not None and nu is not None:
pass
elif E is not None and nu is not None:
G = E / 2. / (1 + nu)
elif G is not None and nu is not None:
E = 2 * (1 + nu) * G
elif G is not None and E is not None:
nu = E / (2 * G) - 1.
elif G is None and nu is None:
G = 0.0
nu = 0.0
elif E is None and nu is None:
E = 0.0
nu = 0.0
else:
msg = 'G=%s E=%s nu=%s' % (G, E, nu)
raise RuntimeError(msg)
#print 'G =', G
self.E[i] = E
self.G[i] = G
self.nu[i] = nu
示例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: initX_G0
def initX_G0(self, card):
field5 = integer_double_or_blank(card, 5, 'g0_x1', 0.0)
if isinstance(field5, int):
self.g0 = field5
self.x1 = None
self.x2 = None
self.x3 = None
elif isinstance(field5, float):
self.g0 = None
self.x1 = field5
self.x2 = double_or_blank(card, 6, 'x2', 0.0)
self.x3 = double_or_blank(card, 7, 'x3', 0.0)
if norm([self.x1, self.x2, self.x3]) == 0.0:
msg = 'G0 vector defining plane 1 is not defined.\n'
msg += 'G0 = %s\n' % self.g0
msg += 'X1 = %s\n' % self.x1
msg += 'X2 = %s\n' % self.x2
msg += 'X3 = %s\n' % self.x3
raise RuntimeError(msg)
else:
msg = ('field5 on %s (G0/X1) is the wrong type...id=%s field5=%s '
'type=%s' %(self.type, self.eid, field5, type(field5)))
raise RuntimeError(msg)
self.g0 = None
self.x1 = 0.
self.x2 = 0.
self.x3 = 0.
示例13: 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
示例14: __init__
def __init__(self, card=None, data=None, comment=''):
PointMassElement.__init__(self, card, data)
if comment:
self._comment = comment
if card:
self.eid = integer(card, 1, 'eid')
self.nid = integer(card, 2, 'nid')
self.cid = integer_or_blank(card, 3, 'cid', 0)
self.mass = double_or_blank(card, 4, 'mass', 0.)
self.X = array([double_or_blank(card, 5, 'x1', 0.0),
double_or_blank(card, 6, 'x2', 0.0),
double_or_blank(card, 7, 'x3', 0.0)])
self.I = array([double_or_blank(card, 9, 'I11', 0.0),
double_or_blank(card, 10, 'I21', 0.0),
double_or_blank(card, 11, 'I22', 0.0),
double_or_blank(card, 12, 'I31', 0.0),
double_or_blank(card, 13, 'I32', 0.0),
double_or_blank(card, 14, 'I33', 0.0)])
assert len(card) <= 15, 'len(CONM2 card) = %i' % len(card)
else:
self.eid = data[0]
self.nid = data[1]
self.cid = data[2]
self.mass = data[3]
self.X = data[4:7]
self.I = data[7:]
示例15: loadHESS_INV
def loadHESS_INV(self, nRows, card):
alphaOmega_default = None
LJ_default = None
if self.method == 'INV':
alphaOmega_default = 0.0
LJ_default = 1.0
for iRow in xrange(nRows):
NEj = integer(card, 9 + 7 * iRow + 5, 'NE%s' + str(iRow))
NDJ_default = None
if self.method == 'INV':
NDJ_default = 3 * NEj
i = 9 + 8 * iRow
self.alphaAjs.append(
double_or_blank(card, i, 'alphaA' + str(iRow), alphaOmega_default))
self.omegaAjs.append(
double_or_blank(card, i + 1, 'omegaA' + str(iRow), alphaOmega_default))
self.alphaBjs.append(
double_or_blank(card, i + 2, 'alphaB' + str(iRow), alphaOmega_default))
self.omegaBjs.append(
double_or_blank(card, i + 3, 'omegaB' + str(iRow), alphaOmega_default))
self.LJs.append(
double_or_blank(i + 4, LJ_default))
self.NEJs.append(
integer(card, i + 5, 'NEJ' + str(iRow)))
self.NDJs.append(
integer_or_blank(card, i + 6, 'NDJ' + str(iRow), NDJ_default))