Beispiel #1
0
 def check_float_8p4f(self, val, expected):
     actual = write_floats_8p4f([val])
     actuali = actual[0]
     self.assertEqual(
         actuali,
         expected,
         msg='\nactual  =%r len(actual)=%i\nexpected=%r len(expected)=%i' %
         (actuali, len(actuali), expected, len(expected)))
    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 = []
        if self.nonlinear_factor is not None:
            return self._write_f06_transient(
                header,
                page_stamp,
                page_num,
                f,
                is_mag_phase=is_mag_phase,
                is_sort1=is_sort1)

        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 ekey, nxs in sorted(iteritems(self.nx)):
            ekey2 = ekey
            zero = '0'
            for iLoad, nx in enumerate(nxs):
                ny = self.ny[ekey][iLoad]
                txy = self.txy[ekey][iLoad]
                angle = self.angle[ekey][iLoad]
                majorP = self.majorP[ekey][iLoad]
                minorP = self.minorP[ekey][iLoad]
                tmax = self.tmax[ekey][iLoad]
                ovm = self.ovm[ekey][iLoad]

                (elemName) = self.elemName[ekey][iLoad]
                eid = self.eids[ekey][iLoad]
                vals = [nx, ny, txy, majorP, minorP, tmax, ovm]
                vals2 = write_floats_10e(vals)
                [nx, ny, txy, majorP, minorP, tmax, ovm] = vals2
                if eid == 0:
                    eid = zero
                angle = write_floats_8p4f([angle])
                anglei = angle[0]
                msg.append(
                    '%s%8s  %8s   %4s    %s %s %s   %8s %10s %10s %10s  %s\n' %
                    (zero, ekey2, eid, elemName, nx, ny, txy, anglei, majorP,
                     minorP, tmax, ovm))
                zero = ' '
                ekey2 = ' '
        msg.append(page_stamp % page_num)
        f.write(''.join(msg))
        return page_num
    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 = []
        if self.nonlinear_factor is not None:
            return self._write_f06_transient(header,
                                             page_stamp,
                                             page_num,
                                             f,
                                             is_mag_phase=is_mag_phase,
                                             is_sort1=is_sort1)

        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 ekey, nxs in sorted(iteritems(self.nx)):
            ekey2 = ekey
            zero = '0'
            for iLoad, nx in enumerate(nxs):
                ny = self.ny[ekey][iLoad]
                txy = self.txy[ekey][iLoad]
                angle = self.angle[ekey][iLoad]
                majorP = self.majorP[ekey][iLoad]
                minorP = self.minorP[ekey][iLoad]
                tmax = self.tmax[ekey][iLoad]
                ovm = self.ovm[ekey][iLoad]

                (elemName) = self.elemName[ekey][iLoad]
                eid = self.eids[ekey][iLoad]
                vals = [nx, ny, txy, majorP, minorP, tmax, ovm]
                vals2 = write_floats_10e(vals)
                [nx, ny, txy, majorP, minorP, tmax, ovm] = vals2
                if eid == 0:
                    eid = zero
                angle = write_floats_8p4f([angle])
                anglei = angle[0]
                msg.append(
                    '%s%8s  %8s   %4s    %s %s %s   %8s %10s %10s %10s  %s\n' %
                    (zero, ekey2, eid, elemName, nx, ny, txy, anglei, majorP,
                     minorP, tmax, ovm))
                zero = ' '
                ekey2 = ' '
        msg.append(page_stamp % page_num)
        f.write(''.join(msg))
        return page_num
 def check_float_8p4f(self, val, expected):
     actual = write_floats_8p4f([val])
     actuali = actual[0]
     self.assertEqual(actuali, expected, msg='\nactual  =%r len(actual)=%i\nexpected=%r len(expected)=%i' % (
         actuali, len(actuali), expected, len(expected)))