本文整理汇总了Python中pyNastran.f06.f06_formatting.write_floats_13e函数的典型用法代码示例。如果您正苦于以下问题:Python write_floats_13e函数的具体用法?Python write_floats_13e怎么用?Python write_floats_13e使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了write_floats_13e函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _write_f06_springs_transient
def _write_f06_springs_transient(f, stress, header, words, name):
raise RuntimeError('is this used?')
for dt, datai in sorted(iteritems(data)):
header[1] = ' %s = %10.4E\n' % (name, dt)
msg += header + words
f.write(''.join(msg))
eids = []
stresses = []
for eid, stress in sorted(iteritems(datai)):
eids.append(eid)
stresses.append(stress)
if len(stresses) == 4:
stresses = write_floats_13e(stresses)
f.write(' %10i %13s %10i %13s %10i %13s %10i %13s\n' % (
eids[0], stresses[0],
eids[1], stresses[1],
eids[2], stresses[2],
eids[3], stresses[3]))
eids = []
stresses = []
if stresses:
line = ' '
stresses = write_floats_13e(stresses)
for eid, stress in zip(eids, stresses):
line += '%10i %13s ' % (eid, stress)
f.write(line.rstrip() + '\n')
msg.append(page_stamp % page_num)
f.write(''.join(msg))
msg = ['']
page_num += 1
return page_num - 1
示例2: _write_sort2_as_sort2
def _write_sort2_as_sort2(self, f, page_num, page_stamp, header, words):
nodes = self.node_gridtype[:, 0]
gridtypes = self.node_gridtype[:, 1]
times = self._times
for inode, (node_id, gridtypei) in enumerate(zip(nodes, gridtypes)):
t1 = self.data[inode, :, 0]
t2 = self.data[inode, :, 1]
t3 = self.data[inode, :, 2]
r1 = self.data[inode, :, 3]
r2 = self.data[inode, :, 4]
r3 = self.data[inode, :, 5]
header[1] = ' POINT-ID = %10i\n' % node_id
f.write(''.join(header + words))
for dt, t1i, t2i, t3i, r1i, r2i, r3i in zip(times, t1, t2, t3, r1, r2, r3):
sgridtype = self.recast_gridtype_as_string(gridtypei)
vals = [t1i, t2i, t3i, r1i, r2i, r3i]
vals2 = write_floats_13e(vals)
(dx, dy, dz, rx, ry, rz) = vals2
if sgridtype == 'G':
f.write('%14s %6s %-13s %-13s %-13s %-13s %-13s %s\n' % (
write_float_12e(dt), sgridtype, dx, dy, dz, rx, ry, rz))
elif sgridtype == 'S':
f.write('%14s %6s %s\n' % (node_id, sgridtype, dx))
elif sgridtype == 'H':
f.write('%14s %6s %-13s %-13s %-13s %-13s %-13s %s\n' % (
write_float_12e(dt), sgridtype, dx, dy, dz, rx, ry, rz))
elif sgridtype == 'L':
f.write('%14s %6s %-13s %-13s %-13s %-13s %-13s %s\n' % (
write_float_12e(dt), sgridtype, dx, dy, dz, rx, ry, rz))
else:
raise NotImplementedError(sgridtype)
f.write(page_stamp % page_num)
page_num += 1
return page_num
示例3: write_f06
def write_f06(self, f, header=None, page_stamp='PAGE %s', page_num=1, is_mag_phase=False, is_sort1=True):
if header is None:
header = []
words = [' APPLIED LOADS VECTOR\n',
'\n',
' EID SOURCE FX FY FZ MX MY MZ\n']
ntimes, ntotal, size = self.data.shape
for itime, dt in enumerate(self._times):
if self.nonlinear_factor is not None:
if isinstance(dt, float):
header[1] = ' %s = %10.4E\n' % (self.data_code['name'], dt)
else:
header[1] = ' %s = %10i\n' % (self.data_code['name'], dt)
f.write(''.join(header + words))
f1 = self.data[itime, :, 0]
f2 = self.data[itime, :, 1]
f3 = self.data[itime, :, 2]
m1 = self.data[itime, :, 3]
m2 = self.data[itime, :, 4]
m3 = self.data[itime, :, 5]
for f1i, f2i, f3i, m1i, m2i, m3i in zip(f1, f2, f3, m1, m2, m3):
vals = [f1i, f2i, f3i, m1i, m2i, m3i]
vals2 = write_floats_13e(vals)
(dx, dy, dz, rx, ry, rz) = vals2
f.write('%14i %6s %-13s %-13s %-13s %-13s %-13s %s\n' % (
node_id, eid, source, dx, dy, dz, rx, ry, rz))
f.write(page_stamp % page_num)
page_num += 1
return page_num-1
示例4: write_f06
def write_f06(self, f, header=None, page_stamp='PAGE %s', page_num=1, is_mag_phase=False, is_sort1=True):
if header is None:
header = []
msg = self._get_msgs()
(ntimes, ntotal) = self.data.shape[:2]
eids = self.element
for itime in range(ntimes):
dt = self._times[itime]
header = _eigenvalue_header(self, header, itime, ntimes, dt)
f.write(''.join(header + msg))
compX, shearY, shearZ, axialU, shearV, shearW, slipV, slipW
compX = self.data[itime, :, 0]
shearY = self.data[itime, :, 1]
shearZ = self.data[itime, :, 2]
axialU = self.data[itime, :, 3]
shearV = self.data[itime, :, 4]
shearW = self.data[itime, :, 5]
slipV = self.data[itime, :, 6]
slipW = self.data[itime, :, 7]
for (i, eid, compXi, shearYi, shearZi, axialUi, shearVi, shearWi, slipVi, slipWi) in zip(
count(), eids, compX, shearY, shearZ, axialU, shearV, shearW, slipV, slipW):
vals = [compXi, shearYi, shearZi, axialUi, shearVi, shearWi, slipVi, slipWi]
vals2 = write_floats_13e(vals)
[compXi, shearYi, shearZi, axialUi, shearVi, shearWi, slipVi, slipWi] = vals2
f.write('0%8i %-13s %-13s %-13s %-13s %-13s %-13s %-13s %s\n'
% (eid, compXi, shearYi, shearZi, axialUi, shearVi, shearWi, slipVi, slipWi))
f.write(page_stamp % page_num)
page_num += 1
if self.nonlinear_factor is None:
page_num -= 1
return page_num
示例5: _write_sort2_as_sort2
def _write_sort2_as_sort2(self, f, page_num, page_stamp, header, words):
nodes = self.node_gridtype[:, 0]
gridtypes = self.node_gridtype[:, 1]
times = self._times
for inode, (node_id, gridtypei) in enumerate(zip(nodes, gridtypes)):
t1 = self.data[inode, :, 0]
header[1] = ' POINT-ID = %10i\n' % node_id
f.write(''.join(header + words))
for dt, t1i in zip(times, t1):
sgridtype = self.recast_gridtype_as_string(gridtypei)
vals = [t1i]
vals2 = write_floats_13e(vals)
dx = vals2[0]
if sgridtype == 'G':
f.write('%14s %6s %s\n' % (write_float_12e(dt), sgridtype, dx))
elif sgridtype == 'S':
f.write('%14s %6s %s\n' % (node_id, sgridtype, dx))
elif sgridtype == 'H':
f.write('%14s %6s %s\n' % (write_float_12e(dt), sgridtype, dx))
elif sgridtype == 'L':
f.write('%14s %6s %s\n' % (write_float_12e(dt), sgridtype, dx))
else:
raise NotImplementedError(sgridtype)
f.write(page_stamp % page_num)
page_num += 1
return page_num
示例6: write_f06
def write_f06(self, f, header=None, page_stamp='PAGE %s', page_num=1, is_mag_phase=False, is_sort1=True):
if header is None:
header = []
msg = self._get_msgs()
(ntimes, ntotal) = self.data.shape[:2]
eids = self.element
for itime in range(ntimes):
dt = self._times[itime]
header = _eigenvalue_header(self, header, itime, ntimes, dt)
f.write(''.join(header + msg))
#[tx, ty, tz, rx, ry, rz]
tx = self.data[itime, :, 0]
ty = self.data[itime, :, 1]
tz = self.data[itime, :, 2]
rx = self.data[itime, :, 3]
ry = self.data[itime, :, 4]
rz = self.data[itime, :, 5]
for eid, txi, tyi, tzi, rxi, ryi, rzi in zip(
eids, tx, ty, tz, rx, ry, rz):
vals = [txi, tyi, tzi, rxi, ryi, rzi]
vals2 = write_floats_13e(vals)
[txi, tyi, tzi, rxi, ryi, rzi] = vals2
f.write('0 %8i %-13s %-13s %-13s %-13s %-13s %s\n' % (
eid, txi, tyi, tzi, rxi, ryi, rzi))
f.write(page_stamp % page_num)
page_num += 1
if self.nonlinear_factor is None:
page_num -= 1
return page_num
示例7: _write_sort1_as_sort2
def _write_sort1_as_sort2(self, f, page_num, page_stamp, header, words):
element = self.element
element_type = self.element_data_type
times = self._times
node_id = 0 ## TODO: fix the node id
for inode, (eid, etypei) in enumerate(zip(element, element_type)):
t1 = self.data[:, inode, 0].ravel()
t2 = self.data[:, inode, 1].ravel()
t3 = self.data[:, inode, 2].ravel()
r1 = self.data[:, inode, 3].ravel()
r2 = self.data[:, inode, 4].ravel()
r3 = self.data[:, inode, 5].ravel()
header[1] = ' POINT-ID = %10i\n' % node_id
f.write(''.join(header + words))
for dt, t1i, t2i, t3i, r1i, r2i, r3i in zip(times, t1, t2, t3, r1, r2, r3):
vals = [t1i, t2i, t3i, r1i, r2i, r3i]
vals2 = write_floats_13e(vals)
(dx, dy, dz, rx, ry, rz) = vals2
f.write('%14s %6s %-13s %-13s %-13s %-13s %-13s %s\n' % (
write_float_12E(dt), etypei, dx, dy, dz, rx, ry, rz))
f.write(page_stamp % page_num)
page_num += 1
return page_num
示例8: _write_sort1_as_sort1
def _write_sort1_as_sort1(self, f, page_num, page_stamp, header, words):
element = self.element
element_type = self.element_data_type
times = self._times
for itime in range(self.ntimes):
dt = self._times[itime]
t1 = self.data[itime, :, 0]
t2 = self.data[itime, :, 1]
t3 = self.data[itime, :, 2]
r1 = self.data[itime, :, 3]
r2 = self.data[itime, :, 4]
r3 = self.data[itime, :, 5]
if isinstance(dt, (float, float32)):
header[1] = ' %s = %10.4E\n' % (self.data_code['name'], dt)
else:
header[1] = ' %s = %10i\n' % (self.data_code['name'], dt)
f.write(''.join(header + words))
for element_id, etypei, t1i, t2i, t3i, r1i, r2i, r3i in zip(element, element_type, t1, t2, t3, r1, r2, r3):
vals = [t1i, t2i, t3i, r1i, r2i, r3i]
vals2 = write_floats_13e(vals)
(dx, dy, dz, rx, ry, rz) = vals2
f.write('%14i %6s %-13s %-13s %-13s %-13s %-13s %s\n' % (element_id, etypei, dx, dy, dz, rx, ry, rz))
f.write(page_stamp % page_num)
page_num += 1
return page_num
示例9: write_f06
def write_f06(self, f, header=None, page_stamp='PAGE %s', page_num=1, is_mag_phase=False, is_sort1=True):
if header is None:
header = []
msg = self._get_msgs()
(ntimes, ntotal) = self.data.shape[:2]
eids = self.element
for itime in range(ntimes):
dt = self._times[itime]
header = _eigenvalue_header(self, header, itime, ntimes, dt)
f.write(''.join(header + msg))
#[element_force, axial_displacement, axial_velocity, axial_stress, axial_strain, plastic_strain, is_failed]
element_force = self.data[itime, :, 0]
axial_displacement = self.data[itime, :, 1]
axial_velocity = self.data[itime, :, 2]
axial_stress = self.data[itime, :, 3]
axial_strain = self.data[itime, :, 4]
plastic_strain = self.data[itime, :, 5]
is_failed = self.is_failed[itime, :, 0]
for (i, eid, element_forcei, axial_displacementi, axial_velocityi, axial_stressi, axial_straini, plastic_straini, is_failedi) in zip(
count(), eids, element_force, axial_displacement, axial_velocity, axial_stress, axial_strain, plastic_strain, is_failed):
vals = [element_forcei, axial_displacementi, axial_velocityi, axial_stressi, axial_straini, plastic_straini, is_failedi]
vals2 = write_floats_13e(vals)
[element_forcei, axial_displacementi, axial_velocityi, axial_stressi, axial_straini, plastic_straini, is_failedi] = vals2
f.write('0%8i %-13s %-13s %-13s %-13s %-13s %-13s %s\n'
% (eid, element_forcei, axial_displacementi, axial_velocityi, axial_stressi, axial_straini, plastic_straini, is_failedi))
f.write(page_stamp % page_num)
page_num += 1
if self.nonlinear_factor is None:
page_num -= 1
return page_num
示例10: _write_f06_transient
def _write_f06_transient(self, header, page_stamp, page_num=1, f=None, is_mag_phase=False, is_sort1=True):
f.write('GridPointStressesVolume _write_f06_transient is not implemented...\n')
return page_num
#raise NotImplementedError()
msg = header + [' S T R E S S E S A T G R I D P O I N T S - - S U R F A C E 5\n',
'0 SURFACE X-AXIS X NORMAL(Z-AXIS) Z REFERENCE COORDINATE SYSTEM FOR SURFACE DEFINITION CID 0\n',
' GRID ELEMENT STRESSES IN SURFACE SYSTEM PRINCIPAL STRESSES MAX \n',
' ID ID FIBRE NORMAL-X NORMAL-Y SHEAR-XY ANGLE MAJOR MINOR SHEAR VON MISES\n']
#'0 13683 3736 TRIAX6 4.996584E+00 0.0 1.203093E+02 0.0 0.0 0.0'
#' 13683 3737 TRIAX6 -4.996584E+00 0.0 -1.203093E+02 0.0 0.0 0.0'
#' 13683 *TOTALS* 6.366463E-12 0.0 -1.364242E-12 0.0 0.0 0.0'
for dt, Forces in sorted(iteritems(self.forces)):
for ekey, force in sorted(iteritems(Forces)):
zero = '0'
for iLoad, f in enumerate(force):
(f1, f2, f3) = f
(m1, m2, m3) = self.moments[dt][ekey][iLoad]
(elemName) = self.elemName[ekey][iLoad]
eid = self.eids[ekey][iLoad]
vals = [f1, f2, f3, m1, m2, m3]
vals2 = write_floats_13e(vals)
[f1, f2, f3, m1, m2, m3] = vals2
if eid == 0:
eid = ''
msg.append('%s %8s %10s %8s %s %s %s %s %s %-s\n' % (zero, ekey, eid, elemName, f1, f2, f3, m1, m2, m3))
zero = ' '
msg.append(page_stamp % page_num)
f.write(''.join(msg))
msg = ['']
page_num += 1
return page_num - 1
示例11: _write_sort1_as_sort1
def _write_sort1_as_sort1(self, f06_file, header, page_stamp, msg, page_num):
(ntimes, ntotal) = self.data.shape[:2]
eids = self.element
for itime in range(ntimes):
dt = self._times[itime]
header = _eigenvalue_header(self, header, itime, ntimes, dt)
f06_file.write(''.join(header + msg))
sd = self.data[itime, :, 0]
sxc = self.data[itime, :, 1]
sxd = self.data[itime, :, 2]
sxe = self.data[itime, :, 3]
sxf = self.data[itime, :, 4]
axial = self.data[itime, :, 5]
smax = self.data[itime, :, 6]
smin = self.data[itime, :, 7]
MS = self.data[itime, :, 8]
for (i, eid, sdi, sxci, sxdi, sxei, sxfi, axiali, smaxi, smini, MSi) in zip(
count(), eids, sd, sxc, sxd, sxe, sxf, axial, smax, smin, MS):
vals = [sdi, sxci, sxdi, sxei, sxfi, axiali, smaxi, smini, MSi]
vals2 = write_floats_13e(vals)
[sdi, sxci, sxdi, sxei, sxfi, axiali, smaxi, smini, MSi] = vals2
f06_file.write('0%8i %-13s %-13s %-13s %-13s %-13s %-13s %-13s %s %s\n'
% (eid, sdi, sxci, sxdi, sxei, sxfi, axiali, smaxi, smini, MSi))
f06_file.write(page_stamp % page_num)
page_num += 1
if self.nonlinear_factor is None:
page_num -= 1
return page_num
示例12: _write_sort1_as_sort1
def _write_sort1_as_sort1(self, header, page_stamp, page_num, f, msg_temp):
ntimes = self.data.shape[0]
eids = self.element
is_odd = False
nwrite = len(eids)
if len(eids) % 2 == 1:
nwrite -= 1
is_odd = True
for itime in range(ntimes):
dt = self._times[itime]
header = _eigenvalue_header(self, header, itime, ntimes, dt)
f.write(''.join(header + msg_temp))
#print("self.data.shape=%s itime=%s ieids=%s" % (str(self.data.shape), itime, str(ieids)))
axial = self.data[itime, :, 0]
SMa = self.data[itime, :, 1]
torsion = self.data[itime, :, 2]
SMt = self.data[itime, :, 3]
out = []
for eid, axiali, SMai, torsioni, SMti in zip(eids, axial, SMa, torsion, SMt):
[axiali, torsioni, SMai, SMti] = write_floats_13e([axiali, torsioni, SMai, SMti])
out.append([eid, axiali, SMai, torsioni, SMti])
for i in range(0, nwrite, 2):
out_line = ' %8i %-13s %-13s %-13s %-13s %-8i %-13s %-13s %-13s %-s\n' % (tuple(out[i] + out[i + 1]))
f.write(out_line)
if is_odd:
out_line = ' %8i %-13s %-13s %-13s %13s\n' % (tuple(out[-1]))
f.write(out_line)
f.write(page_stamp % page_num)
page_num += 1
return page_num - 1
示例13: _write_sort1_as_sort1
def _write_sort1_as_sort1(self, header, page_stamp, page_num, f, msg_temp):
ntimes = self.data.shape[0]
eids = self.element
is_odd = False
nwrite = len(eids)
for itime in range(ntimes):
dt = self._times[itime]
header = _eigenvalue_header(self, header, itime, ntimes, dt)
f.write(''.join(header + msg_temp))
#print("self.data.shape=%s itime=%s ieids=%s" % (str(self.data.shape), itime, str(ieids)))
axial = self.data[itime, :, 0]
eqs = self.data[itime, :, 1]
total = self.data[itime, :, 2]
epcs = self.data[itime, :, 3]
ecs = self.data[itime, :, 4]
lts = self.data[itime, :, 5]
#print "dt=%s axials=%s eqs=%s ts=%s epcs=%s ecs=%s lts=%s" %(dt,axial,eqs,ts,epcs,ecs,lts)
#msgE[eid] = ' ELEMENT-ID = %8i\n' % (eid)
#if eid not in msgT:
#msgT[eid] = []
#msgT[eid].append(' %9.3E %13.6E %13.6E %13.6E %13.6E %13.6E %13.6E\n' % (dt, axial, eqs, ts, epcs, ecs, lts))
for eid, axiali, eqsi, totali, epcsi, ecsi, ltsi in zip(eids, axial, eqs, total, epcs, ecs, lts):
([saxial, seqs, stotal, sepcs, secs, slts]) = write_floats_13e(
[axiali, eqsi, totali, epcsi, ecsi, ltsi])
f.write(' %8i %-13s %-13s %-13s %-13s %-13s %s\n' % (
eid, saxial, seqs, stotal, sepcs, secs, slts))
f.write(page_stamp % page_num)
page_num += 1
return page_num - 1
示例14: write_f06
def write_f06(self, f, header=None, page_stamp='PAGE %s', page_num=1, is_mag_phase=False, is_sort1=True):
if header is None:
header = []
msg = self._get_msgs()
(ntimes, ntotal) = self.data.shape[:2]
eids = self.element_node[:, 0]
nids = self.element_node[:, 1]
for itime in range(ntimes):
dt = self._times[itime]
header = _eigenvalue_header(self, header, itime, ntimes, dt)
f.write(''.join(header + msg))
#[radial, azimuthal, axial, shear, omax, oms, ovm]
radial = self.data[itime, :, 0]
azimuthal = self.data[itime, :, 1]
axial = self.data[itime, :, 2]
shear = self.data[itime, :, 3]
omax = self.data[itime, :, 4]
oms = self.data[itime, :, 5]
ovm = self.data[itime, :, 6]
for (i, eid, nid, radiali, azimuthali, axiali, sheari, omaxi, omsi, ovmi) in zip(
count(), eids, nids, radial, azimuthal, axial, shear, omax, oms, ovm):
vals = [radiali, azimuthali, axiali, sheari, omaxi, omsi, ovmi]
vals2 = write_floats_13e(vals)
[radiali, azimuthali, axiali, sheari, omaxi, omsi, ovmi] = vals2
f.write('0%8i %-13s %-13s %-13s %-13s %-13s %-13s %-13s %s\n'
% (eid, nid, radiali, azimuthali, axiali, sheari, omaxi, omsi, ovmi))
f.write(page_stamp % page_num)
page_num += 1
if self.nonlinear_factor is None:
page_num -= 1
return page_num
示例15: _write_sort1_as_sort1
def _write_sort1_as_sort1(self, f, page_num, page_stamp, header, words):
nodes = self.node_gridtype[:, 0]
gridtypes = self.node_gridtype[:, 1]
#times = self._times
for itime in range(self.ntimes):
dt = self._times[itime]
t1 = self.data[itime, :, 0]
if isinstance(dt, (float, float32)):
header[1] = ' %s = %10.4E\n' % (self.data_code['name'], dt)
else:
header[1] = ' %s = %10i\n' % (self.data_code['name'], dt)
f.write(''.join(header + words))
for node_id, gridtypei, t1i in zip(nodes, gridtypes, t1):
sgridtype = self.recast_gridtype_as_string(gridtypei)
vals = [t1i]
vals2 = write_floats_13e(vals)
dx = vals2[0]
if sgridtype == 'G':
f.write('%14i %6s %s\n' % (node_id, sgridtype, dx))
elif sgridtype == 'S':
f.write('%14i %6s %s\n' % (node_id, sgridtype, dx))
elif sgridtype == 'H':
f.write('%14i %6s %s\n' % (node_id, sgridtype, dx))
elif sgridtype == 'L':
f.write('%14i %6s %s\n' % (node_id, sgridtype, dx))
else:
raise NotImplementedError(sgridtype)
f.write(page_stamp % page_num)
page_num += 1
return page_num