本文整理汇总了Python中pyNastran.bdf.field_writer_double.print_card_double函数的典型用法代码示例。如果您正苦于以下问题:Python print_card_double函数的具体用法?Python print_card_double怎么用?Python print_card_double使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了print_card_double函数的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: write_card
def write_card(self, size=8, is_double=False):
msg = '\n$' + '-' * 80
msg += '\n$ %s Matrix %s\n' % ('DMI', self.name)
list_fields = ['DMI', self.name, 0, self.form, self.tin,
self.tout, None, self.nRows, self.nCols]
if size == 8:
msg += print_card_8(list_fields)
#elif is_double:
#msg += print_card_double(list_fields)
else:
msg += print_card_16(list_fields)
#msg += self.print_card(list_fields,size=16,isD=False)
if self.is_complex():
for (gci, gcj, reali, imagi) in zip(self.GCi, self.GCj, self.Real, self.Complex):
list_fields = ['DMI', self.name, gcj, gci, reali, imagi]
if size == 8:
msg += print_card_8(list_fields)
elif is_double:
msg += print_card_double(list_fields)
else:
msg += print_card_16(list_fields)
else:
for (gci, gcj, reali) in zip(self.GCi, self.GCj, self.Real):
list_fields = ['DMI', self.name, gcj, gci, reali]
if size == 8:
msg += print_card_8(list_fields)
elif is_double:
msg += print_card_double(list_fields)
else:
msg += print_card_16(list_fields)
return msg
示例2: write_card
def write_card(self, size=8, is_double=False):
"""
.. todo:: support double precision
"""
msg = '\n$' + '-' * 80
msg += '\n$ %s Matrix %s\n' % (self.type, self.name)
list_fields = [self.type, self.name, 0, self.ifo, self.tin,
self.tout, self.polar, None, self.ncols]
if size == 8:
msg += print_card_8(list_fields)
else:
msg += print_card_16(list_fields)
if self.is_complex():
if self.is_polar():
for (GCi, GCj, reali, complexi) in zip(self.GCi, self.GCj, self.Real, self.Complex):
magi = sqrt(reali**2 + complexi**2)
if reali == 0.0:
phasei = 0.0
else:
phasei = degrees(atan2(complexi, reali))
list_fields = [self.type, self.name, GCj[0], GCj[1],
None, GCi[0], GCi[1], magi, phasei]
if size == 8:
msg += print_card_8(list_fields)
elif is_double:
msg += print_card_double(list_fields)
else:
msg += print_card_16(list_fields)
else:
for (GCi, GCj, reali, complexi) in zip(self.GCi, self.GCj, self.Real, self.Complex):
list_fields = [self.type, self.name, GCj[0], GCj[1],
None, GCi[0], GCi[1], reali, complexi]
if size == 8:
msg += print_card_8(list_fields)
elif is_double:
msg += print_card_double(list_fields)
else:
msg += print_card_16(list_fields)
else:
for (GCi, GCj, reali) in zip(self.GCi, self.GCj, self.Real):
list_fields = [self.type, self.name, GCj[0], GCj[1],
None, GCi[0], GCi[1], reali, None]
if size == 8:
msg += print_card_8(list_fields)
elif is_double:
msg += print_card_double(list_fields)
else:
msg += print_card_16(list_fields)
return msg
示例3: write_card
def write_card(self, size=8, is_double=False):
card = self.raw_fields()
if size == 8:
return self.comment + print_card_8(card)
if is_double:
return self.comment + print_card_double(card)
return self.comment + print_card_16(card)
示例4: write_bdf
def write_bdf(self, f, size, is_double, coord_id=None):
assert size in [8, 16], size
assert is_double in [True, False], is_double
if self.n:
#if coord_id is None:
i = arange(self.n)
#else:
#assert len(unique(coord_id))==len(coord_id), unique(coord_id)
#i = searchsorted(self.coord_id, coord_id)
if size == 8:
for cid, coord in iteritems(self.coords):
if cid > 0:
list_fields = [coord.type, cid, coord.rid] + list(coord.e1) + list(coord.e2) + list(coord.e3)
f.write(print_card_8(list_fields))
else:
if is_double:
for cid, coord in iteritems(self.coords):
if cid > 0:
list_fields = [coord.type, cid, coord.rid] + list(coord.e1) + list(coord.e2) + list(coord.e3)
f.write(print_card_16(list_fields))
else:
for cid, coord in iteritems(self.coords):
if cid > 0:
list_fields = [coord.type, cid, coord.rid] + list(coord.e1) + list(coord.e2) + list(coord.e3)
f.write(print_card_double(list_fields))
示例5: print_card
def print_card(fields, size=8, is_double=False):
"""
Prints a card in 8-character of 16-character Nastran format.
Parameters
----------
fields : List[int/float/str/None]
all the fields in the BDF card (no trailing Nones)
size : int; default=8
the size of the field (8/16)
is_double : bool; default=False
is the card double precision?
Double precision applies to specific cards and turns
1.234E+5 into 1.234D+5. Applies to GRID, CORDx only?
Returns
-------
card : str
string representation of the card
.. note:: be careful of using is_double on cards that aren't
GRID or CORDx
"""
if size == 8:
return print_card_8(fields)
elif is_double:
return print_card_double(fields)
return print_card_16(fields)
示例6: write_bdf
def write_bdf(self, size=8, is_double=False):
card = self.reprFields()
if size == 8:
return self.comment() + print_card_8(card)
elif is_double:
return self.comment() + print_card_double(card)
return self.comment() + print_card_16(card)
示例7: test_card_double
def test_card_double(self):
card = print_card_double(['GRID', 1, None, 120.322,-4.82872,1.13362])
card_expected = 'GRID* 1 1.2032200000D+02-4.828720000D+00\n'
card_expected += '* 1.1336200000D+00\n'
self.assertEqual(card, card_expected)
#card = print_card_double(['CHEXA', 1, 2, 2, 3, 4, 1, 8, 5,
#6, 7])
#card_expected = ''
#card_expected += 'CHEXA* 1 2 2 3\n'
#card_expected +='* 4 1 8 5\n'
#card_expected +='* 6 7\n'
#card_expected += '* 1.1336200000D+00\n'
#card = print_card_double(['CTETRA',6437,1,14533,5598,1577,9976,42364,5599,42365,42363,30022,12904])
#card_expected = ''
#card_expected += 'CTETRA* 6437 1 14533 5598\n'
#card_expected += '* 1577 9976 42364 5599\n'
#card_expected += '* 42365 42363 30022 12904\n'
#card_expected += '* \n'
#card_expected +='CTETRA* 6437 1 14533 5598\n'
#card_expected +='* 1577 9976 42364 5599\n'
#card_expected +='* 42365 42363 30022 12904\n'
#card_expected +='* \n'
#self.assertEqual(card, card_expected)
#=============================
# mid E1 E2 nu12 G12 G1z G2z rho
card = print_card_8(['MAT8', 6, 1.7e+7, 1.7e+7, .98, 340000., 180000., 180000., .0001712,
# a1 a2 TRef
None, 71.33])
card_expected = ''
card_expected += 'MAT8 6 1.7+7 1.7+7 .98 340000. 180000. 180000..0001712\n'
card_expected += ' 71.33\n'
self.assertEqual(card, card_expected)
card = print_card_16(['MAT8', 6, 1.7e+7, 1.7e+7, .98, 340000., 180000., 180000., .0001712,
# a1 a2 TRef
None, 71.33])
card_expected = ''
card_expected += 'MAT8* 6 17000000. 17000000. .98\n'
card_expected += '* 340000. 180000. 180000. .0001712\n'
card_expected += '* 71.33\n'
card_expected += '*\n'
# bad
self.assertEqual(card, card_expected)
示例8: write_card
def write_card(self, size=8, is_double=False):
"""
The writer method used by BDF.write_card
Parameters
----------
size : int
the size of the card (8/16)
"""
card = self.repr_fields()
if size == 8:
return self.comment + print_card_8(card)
if is_double:
return self.comment + print_card_double(card)
return self.comment + print_card_16(card)
示例9: write_card
def write_card(self, size=8, is_double=False):
"""
The writer method used by BDF.write_card
:param self:
the GRID object pointer
:param size:
the size of the card (8/16)
:type size:
int
"""
card = self.repr_fields()
if size == 8:
return self.comment + print_card_8(card)
if is_double:
return self.comment + print_card_double(card)
return self.comment + print_card_16(card)
示例10: print_card
def print_card(fields, size=8, is_double=False):
"""
Prints a card in 8-character of 16-character Nastran format.
:param fields: all the fields in the BDF card (no trailing Nones)
:param size: 8/16
:param is_double: True/False
:returns card: string representation of the card
.. note:: be careful of using is_double on cards that aren't
GRID or COORDx
"""
if size == 8:
return print_card_8(fields)
elif is_double:
return print_card_double(fields)
return print_card_16(fields)
示例11: write_card
def write_card(self, bdf_file, size=True, is_double=False):
if self.n:
if size == 8:
for j, eid, alpha in zip(count(), self.element_id, self.alpha):
salpha = set_blank_if_default(alpha, 0.0)
list_fields = ["RBE2", eid] + [salpha]
bdf_file.write(print_card_8(list_fields))
elif is_double:
for j, eid, gn, cm, alpha in zip(count(), self.element_id, self.gn, self.cm, self.alpha):
gmi = self.gmi[j]
salpha = set_blank_if_default(alpha, 0.0)
list_fields = ["RBE2", eid, gn, cm] + gmi + [salpha]
bdf_file.write(print_card_16(list_fields))
else:
for j, eid, gn, cm, alpha in zip(count(), self.element_id, self.gn, self.cm, self.alpha):
gmi = self.gmi[j]
salpha = set_blank_if_default(alpha, 0.0)
list_fields = ["RBE2", eid, gn, cm] + gmi + [salpha]
bdf_file.write(print_card_double(list_fields))
示例12: write_card
def write_card(self, f, size, is_double):
if self.n == 0:
return
if size == 8:
for j, eid, gn, cm, alpha in zip(count(), self.element_id, self.gn, self.cm, self.alpha):
gmi = self.gmi[j]
salpha = set_blank_if_default(alpha, 0.)
list_fields = ['RBE2', eid, gn, cm] + gmi + [salpha]
f.write(print_card_8(list_fields))
elif is_double:
for j, eid, gn, cm, alpha in zip(count(), self.element_id, self.gn, self.cm, self.alpha):
gmi = self.gmi[j]
salpha = set_blank_if_default(alpha, 0.)
list_fields = ['RBE2', eid, gn, cm] + gmi + [salpha]
f.write(print_card_16(list_fields))
else:
for j, eid, gn, cm, alpha in zip(count(), self.element_id, self.gn, self.cm, self.alpha):
gmi = self.gmi[j]
salpha = set_blank_if_default(alpha, 0.)
list_fields = ['RBE2', eid, gn, cm] + gmi + [salpha]
f.write(print_card_double(list_fields))