Exemplo n.º 1
0
    def _read_mat10(self, data: bytes, n: int) -> int:
        """
        MAT10(2801,28,365) - record 9

        Word Name Type Description
        1 MID   I Material identification number
        2 BULK RS Bulk modulus
        3 RHO  RS Mass density
        4 C    RS Speed of sound
        5 GE   RS Structural damping coefficient

        """
        ntotal = 20 * self.factor  # 5*4
        s = Struct(mapfmt(self._endian + b'i4f', self.size))
        nmaterials = (len(data) - n) // ntotal
        assert nmaterials > 0, nmaterials
        for unused_i in range(nmaterials):
            edata = data[n:n + ntotal]
            out = s.unpack(edata)
            n += ntotal

            (mid, bulk, rho, c, ge) = out
            if self.is_debug_file:
                self.binary_debug.write('  MAT10=%s\n' % str(out))
            if mid == 0 and bulk == 0. and rho == 0. and c == 0. and ge == 0.:
                self.log.debug('  skipping empty MAT10...')
                continue
            mat = MAT10.add_op2_data(out)
            assert mat.mid > 0, mat
            self.add_op2_material(mat)
        self.card_count['MAT10'] = nmaterials
        return n
Exemplo n.º 2
0
 def readMAT10(self, data):
     """
     MAT10(2801,28,365) - record 9
     """
     #print "reading MAT10"
     while len(data) >= 20:  # 5*4
         out = unpack('iffff', data[:20])
         data = data[20:]
         (mid, bulk, rho, c, ge) = out
         self.addOp2Material(MAT10(None, out))
Exemplo n.º 3
0
 def readMAT10(self, data):
     """
     MAT10(2801,28,365) - record 9
     """
     #print "reading MAT10"
     while len(data) >= 20:  # 5*4
         eData = data[:20]
         data = data[20:]
         out = unpack(b'iffff', eData)
         (mid, bulk, rho, c, ge) = out
         mat = MAT10(None, out)
         self.addOp2Material(mat)
Exemplo n.º 4
0
 def _readMAT10(self, data, n):
     """
     MAT10(2801,28,365) - record 9
     """
     #print "reading MAT10"
     ntotal = 44  # 5*4
     s = Struct(b'i4f')
     nmaterials = (len(data) - n) // ntotal
     for i in xrange(nmaterials):
         edata = data[n:n+20]
         out = s.unpack(edata)
         (mid, bulk, rho, c, ge) = out
         self.addOp2Material(MAT10(None, out))
     self.card_count['MAT10'] = nmaterials
Exemplo n.º 5
0
 def _read_mat10(self, data, n):
     """
     MAT10(2801,28,365) - record 9
     """
     ntotal = 20  # 5*4
     s = Struct(b(self._endian + 'i4f'))
     nmaterials = (len(data) - n) // ntotal
     assert nmaterials > 0, nmaterials
     for i in range(nmaterials):
         edata = data[n:n+20]
         out = s.unpack(edata)
         (mid, bulk, rho, c, ge) = out
         assert mid > 0, out
         mat = MAT10.add_op2_data(out)
         assert mat.mid > 0, mat
         self.add_op2_material(mat)
         n += 20
     self.card_count['MAT10'] = nmaterials
     return n
Exemplo n.º 6
0
 def _read_mat10(self, data, n):
     """
     MAT10(2801,28,365) - record 9
     """
     #self.log.debug("reading MAT10")
     ntotal = 20  # 5*4
     s = Struct(b(self._endian + 'i4f'))
     nmaterials = (len(data) - n) // ntotal
     assert nmaterials > 0, nmaterials
     for i in range(nmaterials):
         edata = data[n:n+20]
         out = s.unpack(edata)
         (mid, bulk, rho, c, ge) = out
         assert mid > 0, out
         mat = MAT10.add_op2_data(out)
         assert mat.mid > 0, mat
         self.add_op2_material(mat)
         n += 20
     self.card_count['MAT10'] = nmaterials
     return n