本文整理汇总了Python中pyNastran.bdf.bdf_interface.assign_type.double函数的典型用法代码示例。如果您正苦于以下问题:Python double函数的具体用法?Python double怎么用?Python double使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了double函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: add_card
def add_card(self, card, comment=''):
i = self.i
mid = integer(card, 1, 'mid')
if comment:
self.set_comment(mid, comment)
self.material_id[i] = mid
self.e11[i] = double(card, 2, 'E11') #: .. todo:: is this the correct default
self.e22[i] = double(card, 3, 'E22') #: .. todo:: is this the correct default
self.nu12[i] = double_or_blank(card, 4, 'nu12', 0.0)
self.g12[i] = double_or_blank(card, 5, 'g12', 0.0)
self.g1z[i] = double_or_blank(card, 6, 'g1z', 1e8)
self.g2z[i] = double_or_blank(card, 7, 'g2z', 1e8)
self.rho[i] = double_or_blank(card, 8, 'rho', 0.0)
self.a1[i] = double_or_blank(card, 9, 'a1', 0.0)
self.a2[i] = double_or_blank(card, 10, 'a2', 0.0)
self.TRef[i] = double_or_blank(card, 11, 'TRef', 0.0)
self.Xt[i] = double_or_blank(card, 12, 'Xt', 0.0)
self.Xc[i] = double_or_blank(card, 13, 'Xc', self.Xt[i])
self.Yt[i] = double_or_blank(card, 14, 'Yt', 0.0)
self.Yc[i] = double_or_blank(card, 15, 'Yc', self.Yt[i])
self.S[i] = double_or_blank(card, 16, 'S', 0.0)
self.ge[i] = double_or_blank(card, 17, 'ge', 0.0)
self.F12[i] = double_or_blank(card, 18, 'F12', 0.0)
self.strn[i] = double_or_blank(card, 19, 'strn', 0.0)
assert len(card) <= 20, 'len(MAT8 card) = %i\ncard=%s' % (len(card), card)
self.i += 1
示例2: __init__
def __init__(self, card=None, data=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')
#: Coordinates of point in complex plane. (Real)
self.alpha1 = double(card, 2, 'alpha1')
#: Coordinates of point in complex plane. (Real)
self.omega1 = double(card, 3, 'omega1')
#: Multiplicity of complex root at pole defined by point at ALPHAi
#: and OMEGAi
self.m1 = integer(card, 4, 'm1')
#: Coordinates of point in complex plane. (Real)
self.alpha2 = double(card, 5, 'alpha2')
#: Coordinates of point in complex plane. (Real)
self.omega2 = double(card, 6, 'omega2')
#: Multiplicity of complex root at pole defined by point at ALPHAi
#: and OMEGAi
self.m2 = integer(card, 7, 'm2')
assert len(card) == 8, 'len(EIGP card) = %i' % len(card)
else:
raise NotImplementedError('EIGP')
示例3: __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
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.x1 = data[1]
self.x2 = data[2]
xy = data[3:]
is_data = True
self.parse_fields(xy, nrepeated=2, is_data=is_data)
示例4: add_card
def add_card(cls, card, comment=''):
sid = integer(card, 1, 'sid')
f1 = double(card, 2, 'f1') # default=0.0 ?
f2 = double(card, 3, 'f2')
ndf = integer_or_blank(card, 4, 'nf', 1)
assert len(card) <= 5, 'len(FREQ2 card) = %i\ncard=%s' % (len(card), card)
return FREQ2(sid, f1, f2, ndf, comment=comment)
示例5: add_card
def add_card(cls, card, comment=''):
mid = integer(card, 1, 'mid')
tid = integer_or_blank(card, 2, 'tid')
Type = string(card, 3, 'Type')
if Type not in ['NLELAST', 'PLASTIC']:
raise ValueError('MATS1 Type must be [NLELAST, PLASTIC]; Type=%r' % Type)
if Type == 'NLELAST':
# should we even read these?
h = None
hr = None
yf = None
limit1 = None
limit2 = None
#h = blank(card, 4, 'h')
#hr = blank(card, 6, 'hr')
#yf = blank(card, 5, 'yf')
#limit1 = blank(card, 7, 'yf')
#limit2 = blank(card, 8, 'yf')
else:
h = double_or_blank(card, 4, 'H')
yf = integer_or_blank(card, 5, 'yf', 1)
hr = integer_or_blank(card, 6, 'hr', 1)
limit1 = double(card, 7, 'limit1')
if yf in [3, 4]:
limit2 = double(card, 8, 'limit2')
else:
#limit2 = blank(card, 8, 'limit2')
limit2 = None
assert len(card) <= 9, 'len(MATS1 card) = %i\ncard=%s' % (len(card), card)
return MATS1(mid, tid, Type, h, hr, yf, limit1, limit2, comment=comment)
示例6: add_card
def add_card(self, card, comment=''):
assert self.n > 0, self.n
i = self.i
load_id = integer(card, 1, 'load_id')
tbar = double(card, 3, 'Tbar')
tprime = double(card, 4, 'Tprime')
t1 = double_or_blank(card, 5, 'T1')
t2 = double_or_blank(card, 6, 'T2')
self.load_id[i] = load_id
self.element_id[i] = integer(card, 2, 'element_id')
self.tbar[i] = tbar
self.tprime[i] = tprime
self.temp[i, 0] = t1
self.temp[i, 1] = t2
self.i += 1
if len(card) >= 7:
# i must be < self.n
eids = expand_thru(card[9:])
for eid in eids:
self.load_id[i] = load_id
assert isinstance(eid, int), eid
self.element_id[i] = eid
self.tbar[i] = tbar
self.tprime[i] = tprime
self.temp[i, 0] = t1
self.temp[i, 1] = t2
self.i += 1
assert self.i <= self.n
assert len(card) <= 7, '%s; n=%s' % (card, len(card))
#assert len(card) <= 7, len(card)
self.eids = None
示例7: add_card
def add_card(cls, card, comment=''):
sid = integer(card, 1, 'sid')
excite_id = integer(card, 2, 'excite_id') # DAREA, FBALOAD, SLOAD
delay = integer_double_or_blank(card, 3, 'delay', 0) # DELAY, FBADLAY
dphase = integer_double_or_blank(card, 4, 'dphase', 0) # DPHASE, FBAPHAS
power = integer_double_or_blank(card, 5, 'power/tp/rp', 0) # TABLEDi/power
rho = double(card, 6, 'rho')
b = double(card, 7, 'bulk modulus')
assert len(card) <= 8, 'len(ACSRCE card) = %i\n%s' % (len(card), card)
return ACSRCE(sid, excite_id, delay, dphase, power, rho, b, comment=comment)
示例8: add
def add(self, card=None, comment=''):
if comment:
self._comment = comment
i = self.i
#: Identification number of a MAT1, MAT2, or MAT9 entry.
self.material_id[i] = integer(card, 1, 'mid')
#: Identification number of a TABLES1 or TABLEST entry. If H is
#: given, then this field must be blank.
self.table_id[i] = integer_or_blank(card, 2, 'tid', 0)
#: Type of material nonlinearity. ('NLELAST' for nonlinear elastic
#: or 'PLASTIC' for elastoplastic.)
self.Type[i] = string(card, 3, 'Type')
if self.Type[i] == 'NLELAST':
self.h[i] = blank(card, 4, 'h')
self.hr[i] = blank(card, 6, 'hr')
self.yf[i] = blank(card, 5, 'yf')
self.limit1[i] = blank(card, 7, 'yf')
self.limit2[i] = blank(card, 8, 'yf')
else:
#: Work hardening slope (slope of stress versus plastic strain) in
#: units of stress. For elastic-perfectly plastic cases, H=0.0.
#: For more than a single slope in the plastic range, the
#: stress-strain data must be supplied on a TABLES1 entry
#: referenced by TID, and this field must be blank
h = double_or_blank(card, 4, 'H')
self.h[i] = h
if h is None:
self.hflag[i] = False
else:
self.hflag[i] = True
#: Yield function criterion, selected by one of the following
#: values (1) Von Mises (2) Tresca (3) Mohr-Coulomb
#: (4) Drucker-Prager
self.yf[i] = integer_or_blank(card, 5, 'yf', 1)
#: Hardening Rule, selected by one of the following values
#: (Integer): (1) Isotropic (Default) (2) Kinematic
#: (3) Combined isotropic and kinematic hardening
self.hr[i] = integer_or_blank(card, 6, 'hr', 1)
#: Initial yield point
self.limit1[i] = double(card, 7, 'limit1')
if self.yf[i] == 3 or self.yf[i] == 4:
#: Internal friction angle, measured in degrees, for the
#: Mohr-Coulomb and Drucker-Prager yield criteria
self.limit2[i] = double(card, 8, 'limit2')
else:
#self.limit2[i] = blank(card, 8, 'limit2')
#self.limit2[i] = None
pass
assert len(card) <= 9, 'len(MATS1 card) = %i\ncard=%s' % (len(card), card)
self.i += 1
示例9: add_card
def add_card(cls, card, comment=''):
sid = integer(card, 1, 'sid')
alpha1 = double(card, 2, 'alpha1')
omega1 = double(card, 3, 'omega1')
m1 = integer(card, 4, 'm1')
alpha2 = double(card, 5, 'alpha2')
omega2 = double(card, 6, 'omega2')
m2 = integer(card, 7, 'm2')
assert len(card) == 8, 'len(EIGP card) = %i\ncard=%s' % (len(card), card)
return EIGP(sid, alpha1, omega1, m1, alpha2, omega2, m2, comment=comment)
示例10: __init__
def __init__(self, card=None, data=None, comment=''):
if comment:
self._comment = comment
self.sid = integer(card, 1, 'sid')
f1 = double(card, 2, 'f1') # default=0.0 ?
f2 = double(card, 3, 'f2')
nf = integer_or_blank(card, 4, 'nf', 1)
assert len(card) <= 5, 'len(FREQ2 card) = %i' % len(card)
d = 1. / nf * log(f2 / f1)
self.freqs = []
for i in range(nf):
self.freqs.append(f1 * exp(i * d)) # 0 based index
self.clean_freqs()
示例11: add_card
def add_card(cls, card, comment=''):
sid = integer(card, 1, 'sid')
scale = double(card, 2, 'scale')
scale_factors = []
load_ids = []
# alternating of scale factor & load set ID
nloads = len(card) - 3
assert nloads % 2 == 0
for i in range(nloads // 2):
n = 2 * i + 3
scale_factors.append(double(card, n, 'scale_factor'))
load_ids.append(integer(card, n + 1, 'load_id'))
return cls(sid, scale, scale_factors, load_ids, comment=comment)
示例12: __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
示例13: add_card
def add_card(cls, card, comment=''):
conid = integer(card, 1, 'conid')
gids = []
constraints = []
enforced = []
fields = card.fields(0)
nfields = len(fields)
i = 1
for ifield in range(2, nfields, 8):
grid = integer(card, ifield, 'G%i' % i)
component = components_or_blank(card, ifield + 1, 'constraint%i' % i, 0) # scalar point
if i == 1:
enforcedi = double(card, ifield + 2, 'enforced%i' % i)
if enforcedi == 0.0:
raise RuntimeError('enforced1 must be nonzero; enforcedi=%r' % enforcedi)
else:
enforcedi = double_or_blank(card, ifield + 2, 'enforced%i' % i, 0.0)
gids.append(grid)
constraints.append(component)
enforced.append(enforcedi)
i += 1
if ifield + 4 > nfields and i != 2:
# if G2 is empty (it's ifield+4 because nfields is length based and not loop friendly)
break
grid = integer(card, ifield + 3, 'G%i' % i)
component = components_or_blank(card, ifield + 4, 'constraint%i' % i, 0) # scalar point
enforcedi = double_or_blank(card, ifield + 5, 'enforced%i' % i)
gids.append(grid)
constraints.append(component)
enforced.append(enforcedi)
i += 1
return MPC(conid, gids, constraints, enforced, comment=comment)
示例14: add_card
def add_card(cls, card, comment=''):
conid = integer(card, 1, 'conid')
rid = integer(card, 2, 'rid')
hid = integer(card, 3, 'hid')
c = components(card, 4, 'c')
d = double(card, 5, 'd')
return SPCAX(conid, rid, hid, c, d, comment=comment)
示例15: _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