Source code for pyNastran.op2.tables.oug.oug_Objects

from six import  iteritems
from struct import pack
from pyNastran.op2.resultObjects.op2_Objects import ScalarObject


#class staticFlux(scalarObject): # approach_code=1, table_code=3 - whatever the static version of this is...


[docs]class Flux(ScalarObject): # approach_code=1, table_code=3, thermal=1 def __init__(self, data_code, isubcase, dt): ScalarObject.__init__(self, data_code, isubcase) self.dt = dt self.fluxes = {} if dt is not None: self.fluxes = {} self.isTransient = True raise NotImplementedError('transient fluxObject is supported...')
[docs] def delete_transient(self, dt): del self.fluxes[dt]
[docs] def get_transients(self): k = self.fluxes.keys() k.sort() return k
[docs] def add(self, nodeID, gridType, v1, v2, v3, v4=None, v5=None, v6=None): assert 0 < nodeID < 1000000000, 'nodeID=%s' % (nodeID) assert nodeID not in self.fluxes self.fluxes[nodeID] = array([v1, v2, v3])
[docs] def write_op2(self, block3, device_code=1): """ Creates the binary data for writing the table .. warning:: hasnt been tested... """ msg = block3 for nodeID, flux in sorted(iteritems(self.fluxes)): grid = nodeID * 10 + device_code msg += pack('i6f', grid, flux[0], flux[1], flux[2], 0, 0, 0) return msg