op2_reader_helper

This is the pyNastran.op2_interface.op2_reader.rst file.

op2_reader Module

Defines various tables that don’t fit in other sections:
  • OP2Reader - read_cmodeext(self) - read_cmodeext_helper(self) - read_aemonpt(self) - read_monitor(self) - read_r1tabrg(self, data, ndata) - read_hisadd(self)

    • read_cstm(self)
    • read_dit(self)
    • read_extdb(self)
    • read_fol(self)
    • read_frl(self)
    • read_gpl(self)
    • read_ibulk(self)
    • read_intmod(self)
    • read_meff(self)
    • read_omm2(self)
    • read_sdf(self)
    • read_tol(self)
    • _skip_pcompts(self)
    • _read_pcompts(self)
  • Matrix - _get_matrix_row_fmt_nterms_nfloats(self, nvalues, tout) - _skip_matrix_mat(self) - read_matrix(self, table_name) - _read_matpool_matrix(self) - _read_matrix_mat(self) - grids_comp_array_to_index(grids1, comps1, grids2, comps2,

    make_matrix_symmetric)

  • Others - _get_marker_n(self, nmarkers) - read_markers(self) - _skip_subtables(self) - _skip_table_helper(self) - _print_month(self, month, day, year, zero, one) - read_results_table(self)

class pyNastran.op2.op2_interface.op2_reader.OP2Reader(op2)[source]

Stores methods that aren’t useful to an end user

binary_debug

interface to the op2 object

debug_file

interface to the op2 object

generic_stop_table(self, data, ndata)[source]

print table data when things get weird

get_marker1(self, rewind=True, macro_rewind=False)[source]

Gets 1 marker See get_n_markers(…)

Parameters:
rewind : bool

should the file be returned to the starting point

macro_rewind : bool

???

Returns:
markers : int

a single marker

get_nmarkers(self, n, rewind=True, macro_rewind=False)[source]

Gets n markers, so if n=2, it will get 2 markers.

Parameters:
n : int

number of markers to get

rewind : bool

should the file be returned to the starting point

Returns:
markers : List[int]

list of [1, 2, 3, …] markers

h5_file = None

the h5 file object used to reduce memory usage

is_debug_file

interface to the op2 object

is_valid_subcase(self)[source]

Lets the code check whether or not to read a subcase

Returns:
is_valid : bool

should this subcase defined by self.isubcase be read?

load_as_h5 = None

should an h5_file be created

log

interface to the op2 object

read_3_blocks(self)[source]
Reads a block following a pattern of:
[nbytes, data, nbytes] [nbytes, data, nbytes] [nbytes, data, nbytes]

This is intended to be used for reading marker triples

Returns:
data : bytes

the data in binary

read_3_markers(self, markers, macro_rewind=True)[source]

Micro-optimizes read_markers for 3 markers.

Parameters:
markers : List[int, int, int]

markers to get; markers = [-10, 1, 0]

Raises:
FortranMarkerError

if the expected table number is not found

read_aemonpt(self)[source]

reads the AEMONPT table

read_bgpdt(self)[source]

reads the BGPDT, BGPDTS, BGPDTOLD tables

tested by TestOP2Matrix.test_gpspc

read_block(self)[source]
Reads a block following a pattern of:
[nbytes, data, nbytes]
Returns:
data : bytes

the data in binary

Notes

see read_3_blocks

read_cstm(self)[source]

Reads the CSTM table, which defines the transform from global to basic.

Returns 14-column matrix 2-d array of the CSTM data:

[
 [ id1 type xo yo zo T(1,1:3) T(2,1:3) T(3,1:3) ]
 [ id2 type xo yo zo T(1,1:3) T(2,1:3) T(3,1:3) ]
 ...
]

T is transformation from local to basic for the coordinate system.

read_eqexin(self)[source]

isat_random.op2

read_extdb(self)[source]
fails if a streaming block:
  • nx_spikeextse04c_0.op2
read_fol(self)[source]

Reads the FOL table Frequency response frequency output list

tested by TestOP2.test_monpnt3

Word Name Type Description
1 NAME(2) CHAR4 Data block name
3 FREQ RS Frequency
Word 3 repeats until End of Record
Word Name Type Description
1 WORD1 I Number of frequencies
2 WORD2 I Frequency set record number
3 WORD3 I Number of loads
4 UNDEF(3) None Not used
read_frl(self)[source]

reads the FRL (Frequency Response List) table

tested by TestOP2.test_op2_good_sine_01

read_geom_table(self)[source]

Reads a geometry table

read_gpdt(self)[source]

reads the GPDT table

tested by ???

read_gpl(self)[source]

reads the GPL table (grid point list?)

tested by TestOP2.test_beam_modes

read_hisadd(self)[source]

optimization history (SOL200) table

read_ibulk(self)[source]

tested by TestOP2.test_ibulk

read_mode = 1 (array sizing) read_mode = 1 (reading)

read_intmod(self)[source]

reads the INTMOD table

tested by TestNastranGUI.test_femap_rougv1_01

read_markers(self, markers, macro_rewind=True)[source]

Gets specified markers, where a marker has the form of [4, value, 4]. The “marker” corresponds to the value, so 3 markers takes up 9 integers. These are used to indicate position in the file as well as the number of bytes to read.

Because we’re checking the markers vs. what we expect, we just throw the data away.

Parameters:
markers : List[int]

markers to get; markers = [-10, 1]

Raises:
FortranMarkerError

if the expected table number is not found

read_matrix(self, table_name)[source]

General method for reading matrices and MATPOOL matrices

read_meff(self)[source]

reads the MEFF table

read_mode

interface to the op2 object

read_monitor(self)[source]

reads the MONITOR table

read_nastran_version(self, mode)[source]

reads the version header

read_omm2(self)[source]

reads the OMM2 table

read_r1tabrg(self, data, ndata)[source]
Design Responses:
  • Weight
  • Flutter Speed
  • Stress
  • Strain
  • Displacement
read_results_table(self)[source]

Reads a results table

read_sdf(self)[source]

reads the SDF table

read_table_name(self, table_names)[source]
read_tol(self)[source]

This is probably broken for MSC Nastran

show(self, n, types='ifs', endian=None)[source]

shows the next N bytes

Parameters:
n : int

the number of bytes to show

types : str; default=’ifs’

the data types to show

endian : str; default=None -> active endian

the data endian

show_data(self, data, types='ifs', endian=None)[source]

Shows a data block as various types

Parameters:
data : bytes

the binary string bytes

types : str; default=’ifs’

i - int f - float s - string d - double (float64; 8 bytes) q - long long (int64; 8 bytes)

l - long (int; 4 bytes) I - unsigned int (int; 4 bytes) L - unsigned long (int; 4 bytes) Q - unsigned long long (int; 8 bytes)

endian : str; default=None -> auto determined somewhere else in the code

the big/little endian {>, <}

.. warning:: ‘s’ is apparently not Python 3 friendly
show_ndata(self, n, types='ifs')[source]
exception pyNastran.op2.op2_interface.op2_reader.SubTableReadError[source]
pyNastran.op2.op2_interface.op2_reader.eqexin_to_nid_dof_doftype(eqexin1, eqexin2)[source]

assemble dof table

pyNastran.op2.op2_interface.op2_reader.get_table_size_from_ncolumns(table_name, nvalues, ncolumns)[source]
pyNastran.op2.op2_interface.op2_reader.grids_comp_array_to_index(grids1, comps1, grids2, comps2, make_matrix_symmetric)[source]

maps the dofs