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) - 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: OP2)[source]

Stores methods that aren’t useful to an end user

property binary_debug

interface to the op2 object

property debug_file

interface to the op2 object

generic_stop_table(data: bytes, ndata: int)[source]

print table data when things get weird

get_marker1(rewind: bool = True, macro_rewind: bool = False) → int[source]
get_marker1_4(rewind: bool = True, macro_rewind: bool = False) → int[source]

Gets 1 marker See get_n_markers(…)

Parameters
rewindbool

should the file be returned to the starting point

macro_rewindbool

???

Returns
markersint

a single marker

get_marker1_8(rewind=True, macro_rewind=False) → int[source]

Gets 1 marker See get_n_markers(…)

Parameters
rewindbool

should the file be returned to the starting point

macro_rewindbool

???

Returns
markersint

a single marker

get_nmarkers(n: int, rewind=True, macro_rewind=False)[source]
get_nmarkers4(n: int, rewind=True, macro_rewind=False)[source]

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

Parameters
nint

number of markers to get

rewindbool

should the file be returned to the starting point

Returns
markersList[int]

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

get_nmarkers8(n: int, rewind=True, macro_rewind=False)[source]

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

Parameters
nint

number of markers to get

rewindbool

should the file be returned to the starting point

Returns
markersList[int]

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

get_skip_read_record_ndata()[source]

selects the read_record or skip_record depending on read_mode

get_subtable_name4(op2, data: bytes, ndata: int) → bytes[source]
get_subtable_name8(op2, data: bytes, ndata: int) → bytes[source]
h5_file = None

the h5 file object used to reduce memory usage

property is_debug_file

interface to the op2 object

is_valid_subcase() → bool[source]

Lets the code check whether or not to read a subcase

Returns
is_validbool

should this subcase defined by self.isubcase be read?

load_as_h5 = None

should an h5_file be created

property log

interface to the op2 object

read_3_blocks4() → bytes[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
databytes

the data in binary

read_3_markers(markers, macro_rewind=True) → None[source]

Micro-optimizes read_markers for 3 markers.

read_3_markers4(markers, macro_rewind=True) → None[source]

Micro-optimizes read_markers for 3 markers.

Parameters
markersList[int, int, int]

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

Raises
FortranMarkerError

if the expected table number is not found

read_aemonpt()[source]

reads the AEMONPT table

read_bgpdt()[source]

reads the BGPDT, BGPDTS, BGPDTOLD tables

tested by TestOP2Matrix.test_gpspc

read_block()[source]
read_block4() → bytes[source]
Reads a block following a pattern of:

[nbytes, data, nbytes]

Returns
databytes

the data in binary

Notes

see read_3_blocks

read_block8() → bytes[source]
Reads a block following a pattern of:

[nbytes, data, nbytes]

Returns
databytes

the data in binary

Notes

see read_3_blocks

read_casecc()[source]

reads the CASECC table

read_cddata()[source]

Cambell diagram summary

read_cstm()[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_dbcopt()[source]

reads the DBCOPT table, which is a design variable history table

read_descyc()[source]

reads the DESCYC table

read_dscmcol()[source]

reads the DSCMCOL table, which defines the columns? for the DSCM2 table

read_eqexin()[source]

isat_random.op2

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

read_fol()[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()[source]

reads the FRL (Frequency Response List) table

tested by TestOP2.test_op2_good_sine_01

read_geom_table()[source]

Reads a geometry table

read_gpdt()[source]

reads the GPDT table

tested by ???

read_gpl()[source]

reads the GPL table (grid point list?)

tested by TestOP2.test_beam_modes

read_gpls()[source]
read_hisadd()[source]

optimization history (SOL200) table

read_ibulk()[source]

tested by TestOP2.test_ibulk

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

read_icase()[source]

tested by ???

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

read_intmod()[source]

reads the INTMOD table

tested by TestNastranGUI.test_femap_rougv1_01

read_long_block(expected_marker: int)[source]
read_markers(markers: List[int], macro_rewind: bool = True) → None[source]
read_markers4(markers: List[int], macro_rewind: bool = True) → None[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
markersList[int]

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

Raises
FortranMarkerError

if the expected table number is not found

read_markers8(markers: List[int], macro_rewind: int = True) → None[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
markersList[int]

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

Raises
FortranMarkerError

if the expected table number is not found

read_matpool_result(code, op2, data, utable_name)[source]
read_matrix(table_name)[source]

General method for reading matrices and MATPOOL matrices

read_meff()[source]

reads the MEFF table

property read_mode

interface to the op2 object

read_monitor()[source]

reads the MONITOR table

read_nastran_version(mode: str)[source]

reads the version header

read_obc1()[source]
read_omm2()[source]

reads the OMM2 table

read_qualinfo()[source]

Reads the QUALINFO table

-100001 (AUXMID=0;AFPMID=0;DESITER=0;HIGHQUAL=0;PVALID=0;DESINC=0;DISCRETE=FALSE;MASSID=0;ARBMID=0;PARTNAME=’ ‘;TRIMID=0;MODULE=0) -100000 (AUXMID=0;AFPMID=0;DESITER=0;HIGHQUAL=0;PVALID=0;DESINC=0;ARBMID=0;PARTNAME=’ ‘;DISCRETE=FALSE;TRIMID=0)

-99999 (AUXMID=0;AFPMID=0;HIGHQUAL=0;PVALID=0;DESINC=0;PRESEQP=TRUE;ARBMID=0;PARTNAME=’ ‘;TRIMID=0;FLXBDYID=0;DFPHASE=’ ‘) -99998 (AUXMID=0;AFPMID=0;DESITER=0;HIGHQUAL=0;DESINC=0;DISCRETE=FALSE;ARBMID=0;MASSID=0;PARTNAME=’ ‘;TRIMID=0)

1431 (HIGHQUAL=0;AUXMID=0;AFPMID=0;DESINC=0;ARBMID=0;PARTNAME=’ ‘;TRIMID=0;FLXBDYID=0) 1459 (PEID=0;DESITER=0;PVALID=0;NL99=0;APRCH=’ ‘;QCPLD=’ ‘;HIGHQUAL=0;AUXMID=0;DESINC=0;DISCRETE=FALSE;MASSID=0;PARTNAME=’ ‘;MODULE=0) 1461 (PEID=0;APRCH=’ ‘;QCPLD=’ ‘;HIGHQUAL=0;AUXMID=0;DESINC=0;PARTNAME=’ ‘;MODULE=0) 1541 (SEID=0;PEID=0;MTEMP=0;DESITER=0;PVALID=0;APRCH=’ ‘;QCPLD=’ ‘;HIGHQUAL=0;P2G=’ ‘;K2GG=’ ‘;M2GG=’ ‘;DELTA=FALSE;AUXMID=0;BNDSHP=FALSE;ADJOINT=FALSE;DESINC=0;DISCRETE=FALSE;CASEF06=’ ‘;ISOLAPP=1;SUBCID=0;OSUBID=1;STEPID=0;RGYRO=0;PARTNAME=’ ‘;SSTEPID=0;MODULE=0)

Word Name Type Description 1 NAME(2) CHAR4 Datablock Name

Word Name Type Description 1 DBKEY I database KEY associated with qualifiers 2 QLEN(C) I length in words of qualifiers string 3 QUALSTR CHAR4 Qualifier information string Word 3 repeats QLEN times

Word Name Type Description 1 FUNIT I Fortran unit op2 file was written to 2 NUMKEYS I Number of keys 3 BIT(5) I ,{

read_r1tabrg()[source]

Reads the R1TABRG design response optimization table

read_results_table()[source]

Reads a results table

read_results_table4() → None[source]

Reads a results table

read_results_table8() → None[source]

Reads a results table

read_sdf()[source]

reads the SDF table

read_stdisp()[source]

reads the STDISP table

read_string_block() → bytes[source]
read_table_name(table_names: List[bytes]) → str[source]
read_table_name4(table_names: List[bytes]) → str[source]
read_table_name8(table_names: List[bytes]) → str[source]
read_tol()[source]

This is probably broken for MSC Nastran

read_xcasecc()[source]

Poorly reads the XCASECC table. It’s somehow aero related…

C:MSC.Softwaresimcenter_nastran_2019.2tpl_post1z402cbush1d_02a.op2 word1 = b’XCASECC ‘ word2 = (

b’ ‘ b’SUBCASE - NONLINEAR IMPLICIT ‘ b’SUBCASE 1 ‘

word3 = b’AEROSG2D’ word4 = b’YES ‘

read_xsop2dir()[source]

Matrix datablocks are named with the matrix name, and they contain only the matrices with no row and column DOF information.

External superelements are written to the OP2 in the XSOP2DIR datablock which contains the directory of matrices, and multiple EXTDB datablocks that contain these matrices. The information in XSOP2DIR can be used to rename the EXTDB datablocks to their corresponding matrix name.

The MATPOOL datablock contains matrices of several different formats. MATPOOL matrices are DMIG-formatted matrices. Matrices from all of these sources can be stored as structured array.

show(n: int, types: str = 'ifs', endian: Optional[str] = None, force: bool = False)[source]

shows the next N bytes

Parameters
nint

the number of bytes to show

typesstr; default=’ifs’

the data types to show

endianstr; default=None -> active endian

the data endian

forcebool; default=False

overwrite the n=2000 limiter

show_data(data: bytes, types: str = 'ifs', endian: Optional[str] = None, force: bool = False)[source]

Shows a data block as various types

Parameters
databytes

the binary string bytes

typesstr; 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)

endianstr; default=None -> auto determined somewhere else in the code

the big/little endian {>, <}

forcebool; default=False

overwrite the n=2000 limiter

.. warning:: ‘s’ is apparently not Python 3 friendly
show_ndata(n: int, types: str = 'ifs', force: bool = False)[source]
unpack_table_name(data: bytes) → bytes[source]
unpack_table_name4(data: bytes) → bytes[source]

table names can apparently be 8 or 32 characters

unpack_table_name8(data: bytes) → bytes[source]

table names can apparently be 8 or 32 characters

exception pyNastran.op2.op2_interface.op2_reader.SubTableReadError[source]
pyNastran.op2.op2_interface.op2_reader.dscmcol_dresp1(responses: Dict[int, Dict[str, Any]], nresponses_dresp1: int, ints, floats) → None[source]

helper for DSCMCOL

pyNastran.op2.op2_interface.op2_reader.dscmcol_dresp2(responses: Dict[int, Dict[str, Any]], nresponses_dresp2: int, ints, floats) → None[source]

helper for DSCMCOL

pyNastran.op2.op2_interface.op2_reader.eqexin_to_nid_dof_doftype(eqexin1, eqexin2) → Tuple[Any, Any, Any][source]

assemble dof table

pyNastran.op2.op2_interface.op2_reader.get_table_size_from_ncolumns(table_name: str, nvalues: int, ncolumns: int) → int[source]
pyNastran.op2.op2_interface.op2_reader.update_op2_datacode(op2, data_code_old)[source]