Beispiel #1
0
    def _read_complex_eigenvalue_4(self, data):
        """parses the Complex Eigenvalues Table 4 Data"""
        if self.read_mode == 1:
            return len(data)

        ntotal = 4 * 6
        nmodes = len(data) // ntotal
        n = 0
        #assert self.isubcase != 0, self.isubcase
        clama = ComplexEigenvalues(11)
        self.eigenvalues[self.Title] = clama
        #self.eigenvalues[self.isubcase] = lama
        s = Struct(b'ii4f')
        for i in range(nmodes):
            edata = data[n:n+ntotal]
            out = s.unpack(edata)
            if self.debug4():
                self.binary_debug.write('  eigenvalue%s - %s\n' % (i, str(out)))
            (imode, order, eigr, eigc, freq, damping) = out # CLAMA
            #print('imode=%s order=%s eigr=%s eigc=%s freq=%s damping=%s' %
                  #(imode, order, eigr, eigc, freq, damping))
            clama.addF06Line(out)
            n += ntotal
        assert n == len(data), 'clama length error'
        return n
Beispiel #2
0
    def _read_complex_eigenvalue_4(self, data, ndata):
        """parses the Complex Eigenvalues Table 4 Data"""
        if self.read_mode == 1:
            return ndata

        ntotal = 4 * 6
        nmodes = ndata // ntotal
        n = 0
        #assert self.isubcase != 0, self.isubcase
        clama = ComplexEigenvalues(11)
        self.eigenvalues[self.title] = clama
        #self.eigenvalues[self.isubcase] = lama
        s = Struct(b(self._endian + 'ii4f'))
        for i in range(nmodes):
            edata = data[n:n + ntotal]
            out = s.unpack(edata)
            if self.is_debug_file:
                self.binary_debug.write('  eigenvalue%s - %s\n' %
                                        (i, str(out)))
            (imode, order, eigr, eigc, freq, damping) = out  # CLAMA
            #print('imode=%s order=%s eigr=%s eigc=%s freq=%s damping=%s' %
            #(imode, order, eigr, eigc, freq, damping))
            clama.add_f06_line(out)
            n += ntotal
        assert n == ndata, 'clama length error'
        return n
Beispiel #3
0
    def _read_complex_eigenvalue_4(self, data: bytes, ndata: int):
        """parses the Complex Eigenvalues Table 4 Data"""
        if self.read_mode == 1:
            return ndata

        ntotal = 24  # 4 * 6
        nmodes = ndata // ntotal
        n = 0
        #assert self.isubcase != 0, self.isubcase
        clama = ComplexEigenvalues(self.title, self.table_name, nmodes)
        #assert self.title not in self.eigenvalues, f'table={self.table_name_str} title={self.title} optimization_count={self._count}'
        self.eigenvalues[self.title] = clama
        #self.eigenvalues[self.isubcase] = clama
        structi = Struct(self._endian + b'ii4f')
        for i in range(nmodes):
            edata = data[n:n + ntotal]
            out = structi.unpack(edata)
            if self.is_debug_file:
                self.binary_debug.write('  eigenvalue%s - %s\n' %
                                        (i, str(out)))
            #(imode, order, eigr, eigc, freq, damping) = out # CLAMA
            #print('imode=%s order=%s eigr=%s eigc=%s freq=%s damping=%s' %
            #(imode, order, eigr, eigc, freq, damping))
            clama.add_op2_line(out, i)
            n += ntotal
        assert n == ndata, 'clama length error'
        return n
Beispiel #4
0
def _load_eigenvalue(h5_result, log):
    """Loads a RealEigenvalue"""
    class_name = _cast(h5_result.get('class_name'))
    title = ''
    nmodes = _cast(h5_result.get('nmodes'))
    if class_name == 'RealEigenvalues':
        obj = RealEigenvalues(title, nmodes=nmodes)
    elif class_name == 'ComplexEigenvalues':
        obj = ComplexEigenvalues(title, nmodes)
    elif class_name == 'BucklingEigenvalues':
        obj = BucklingEigenvalues(title, nmodes=nmodes)
    else:
        log.warning('  %r is not supported...skipping' % class_name)
        return None

    assert obj.class_name == class_name, 'class_name=%r selected; should be %r' % (obj.class_name, class_name)
    keys_to_skip = ['class_name', 'is_complex', 'is_real']
    for key in h5_result.keys():
        if key in keys_to_skip:
            continue
        else:
            datai = _cast(h5_result.get(key))
            assert not isinstance(datai, binary_type), key
            setattr(obj, key, datai)
    return obj
Beispiel #5
0
    def _complex_eigenvalue_summary(self):
        """
        ::

                                 C O M P L E X   E I G E N V A L U E   S U M M A R Y
          ROOT     EXTRACTION                  EIGENVALUE                     FREQUENCY              DAMPING
           NO.        ORDER             (REAL)           (IMAG)                (CYCLES)            COEFFICIENT
               1           6          0.0              6.324555E+01          1.006584E+01          0.0
               2           5          0.0              6.324555E+01          1.006584E+01          0.0
        """
        #(subcaseName,isubcase,transient,dt,analysis_code,is_sort1) = self.readSubcaseNameID()
        isubcase = 1  # .. todo:: fix this...

        headers = self.skip(2)
        data = self._read_f06_table([int, int, float, float, float, float])

        if self.Title in self.eigenvalues:
            self.eigenvalues[self.Title].add_f06_data(data)
        else:
            self.eigenvalues[self.Title] = ComplexEigenvalues(self.Title)
            self.eigenvalues[self.Title].add_f06_data(data)
        self.iSubcases.append(isubcase)
Beispiel #6
0
    def getComplexEigenvalues(self):
        """
        @code
                               C O M P L E X   E I G E N V A L U E   S U M M A R Y
        ROOT     EXTRACTION                  EIGENVALUE                     FREQUENCY              DAMPING
         NO.        ORDER             (REAL)           (IMAG)                (CYCLES)            COEFFICIENT
             1           6          0.0              6.324555E+01          1.006584E+01          0.0
             2           5          0.0              6.324555E+01          1.006584E+01          0.0
        @endcode
        """
        #(subcaseName,iSubcase,transient,dt,analysisCode,isSort1) = self.readSubcaseNameID()
        iSubcase = 1  # @todo fix this...

        headers = self.skip(2)
        data = self.readTable([int, int, float, float, float, float])

        if iSubcase in self.eigenvalues:
            self.eigenvalues[iSubcase].addF06Data(data)
        else:
            isSort1 = True
            self.eigenvalues[iSubcase] = ComplexEigenvalues(iSubcase)
            self.eigenvalues[iSubcase].addF06Data(data)
        self.iSubcases.append(iSubcase)