Exemplo n.º 1
0
 def _read_pload2(self, data, n):
     """
     PLOAD2(6802,68,199) - the marker for Record 18
     """
     ntotal = 12  # 3*4
     nentries = (len(data) - n) // ntotal
     for i in range(nentries):
         edata = data[n:n + 12]
         out = unpack('ifi', edata)
         if self.is_debug_file:
             self.binary_debug.write('  PLOAD2=%s\n' % str(out))
         (sid, p, eid) = out
         load = PLOAD2.add_op2_data(out)
         self._add_load_object(load)
         n += 12
     self.card_count['PLOAD2'] = nentries
     return n
Exemplo n.º 2
0
 def _read_pload2(self, data, n):
     """
     PLOAD2(6802,68,199) - the marker for Record 18
     """
     ntotal = 12  # 3*4
     nentries = (len(data) - n) // ntotal
     for i in range(nentries):
         edata = data[n:n + 12]
         out = unpack('ifi', edata)
         if self.is_debug_file:
             self.binary_debug.write('  PLOAD2=%s\n' % str(out))
         (sid, p, eid) = out
         load = PLOAD2.add_op2_data(out)
         self._add_load_object(load)
         n += 12
     self.card_count['PLOAD2'] = nentries
     return n
Exemplo n.º 3
0
 def _read_pload2(self, data: bytes, n: int) -> int:
     """
     PLOAD2(6802,68,199) - the marker for Record 18
     """
     ntotal = 12  # 3*4
     nentries = (len(data) - n) // ntotal
     struct_ifi = Struct(self._endian + b'ifi')
     for unused_i in range(nentries):
         edata = data[n:n + 12]
         out = struct_ifi.unpack(edata)
         if self.is_debug_file:
             self.binary_debug.write('  PLOAD2=%s\n' % str(out))
         #(sid, p, eid) = out
         load = PLOAD2.add_op2_data(out)
         self._add_load_object(load)
         n += 12
     self.card_count['PLOAD2'] = nentries
     return n
Exemplo n.º 4
0
def _mirror_loads(model: BDF, nid_offset: int = 0, eid_offset: int = 0):
    """
    Mirrors the loads.  A mirrored force acts in the same direction.

    Considers:
     - PLOAD4
        - no coordinate systems (assumes cid=0)
     - FORCE, FORCE1, FORCE2, MOMENT, MOMENT1, MOMENT2
     - PLOAD, PLOAD2
     - TEMP, QVOL, QHBDY, QBDY1, QBDY2, QBDY3

    """
    for unused_load_id, loads in model.loads.items():
        for load in loads:
            loads_new = []
            load_type = load.type
            if load_type == 'PLOAD4':
                g1 = None
                g34 = None
                if load.g1 is not None:
                    g1 = load.g1 + nid_offset
                if load.g34 is not None:
                    g34 = load.g34 + nid_offset

                eids = [eid + eid_offset for eid in load.eids]
                load = PLOAD4(load.sid,
                              eids,
                              load.pressures,
                              g1,
                              g34,
                              cid=load.cid,
                              nvector=load.nvector,
                              surf_or_line=load.surf_or_line,
                              line_load_dir=load.line_load_dir,
                              comment='')
                loads_new.append(load)

            elif load_type == 'FORCE':
                load = FORCE(load.sid,
                             load.node + nid_offset,
                             load.mag,
                             load.xyz,
                             cid=load.cid,
                             comment='')
                loads_new.append(load)
            elif load_type == 'FORCE1':
                load = FORCE1(load.sid,
                              load.node + nid_offset,
                              load.mag,
                              load.g1 + nid_offset,
                              load.g2 + nid_offset,
                              comment='')
                loads_new.append(load)
            elif load_type == 'FORCE2':
                load = FORCE2(load.sid,
                              load.node + nid_offset,
                              load.mag,
                              load.g1 + nid_offset,
                              load.g2 + nid_offset,
                              load.g3 + nid_offset,
                              load.g4 + nid_offset,
                              comment='')
                loads_new.append(load)

            elif load_type == 'MOMENT':
                load = MOMENT(load.sid,
                              load.node + nid_offset,
                              load.mag,
                              load.xyz,
                              cid=load.cid,
                              comment='')
                loads_new.append(load)
            elif load_type == 'MOMENT1':
                load = MOMENT1(load.sid,
                               load.node + nid_offset,
                               load.mag,
                               load.g1 + nid_offset,
                               load.g2 + nid_offset,
                               comment='')
                loads_new.append(load)
            elif load_type == 'MOMENT2':
                load = MOMENT2(load.sid,
                               load.node + nid_offset,
                               load.mag,
                               load.g1 + nid_offset,
                               load.g2 + nid_offset,
                               load.g3 + nid_offset,
                               load.g4 + nid_offset,
                               comment='')
                loads_new.append(load)

            elif load_type == 'PLOAD':
                nodes = [nid + nid_offset for nid in load.nodes]
                load = PLOAD(load.sid, load.pressure, nodes, comment='')
                loads_new.append(load)
            elif load_type == 'PLOAD2':
                eids = [eid + eid_offset for eid in load.eids]
                load = PLOAD2(load.sid, load.pressure, eids, comment='')
                loads_new.append(load)

            elif load_type == 'QVOL':
                elements = [eid + eid_offset for eid in load.elements]
                load = QVOL(load.sid, load.qvol,
                            nid_offset + load.control_point, elements)
                loads_new.append(load)
            elif load_type == 'QHBDY':
                grids = [nid + nid_offset for nid in load.grids]
                load = QHBDY(load.sid, load.flag, load.q0, grids, af=load.af)
                loads_new.append(load)
            elif load_type == 'QBDY1':
                eids = [eid + eid_offset for eid in load.eids]
                load = QBDY1(load.sid, load.qflux, eids)
                loads_new.append(load)
            elif load_type == 'QBDY2':
                load = QBDY2(load.sid,
                             load.eid + eid_offset,
                             load.qfluxs,
                             comment='')
                loads_new.append(load)
            elif load_type == 'QBDY3':
                eids = [eid + eid_offset for eid in load.eids]
                load = QBDY3(load.sid, load.q0, load.cntrlnd + nid_offset,
                             eids)
                loads_new.append(load)

            elif load_type == 'TEMP':
                temperatures = {}
                for nid, temp in load.temperatures.items():
                    temperatures[nid + nid_offset] = temp
                load = TEMP(load.sid, temperatures)
                loads_new.append(load)
            elif load_type == 'GRAV':
                pass
            else:  # pragma: no cover
                model.log.warning('skipping:\n%s' % load.rstrip())
        if loads_new:
            loads += loads_new