op2_interface Package

op2_codes Module

digraph inheritancec88becc3be { bgcolor=transparent; rankdir=LR; size=""; "pyNastran.op2.op2_interface.op2_codes.Op2Codes" [fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled"]; }
pyNastran.op2.op2_interface.op2_codes.determine_sort_bits_meaning(table_code: int, sort_code: int, sort_bits: tuple[int, int, int]) tuple[int, bool, bool][source]

Value Sort type Data format Random ===== ========= =========== ====== 0 SORT1 Real No 1 SORT1 Complex No 2 SORT2 Real No 3 SORT2 Complex No 4 SORT1 Real Yes 5 SORT2 ??? Yes 6 SORT2 Real Yes

table_code%1000 = function3()

SPCForce = table_code % 1000 (function 3)

pyNastran.op2.op2_interface.op2_codes.get_format_word(format_code: int) str[source]
pyNastran.op2.op2_interface.op2_codes.get_result_word(result_type: int) str[source]
pyNastran.op2.op2_interface.op2_codes.get_scode_word(s_code: int, stress_bits: list[int]) str[source]
pyNastran.op2.op2_interface.op2_codes.get_scode_word_assert(s_code: int, stress_bits: list[int]) str[source]
pyNastran.op2.op2_interface.op2_codes.get_sort_method_from_table_name(table_name: bytes) int[source]

helper method

pyNastran.op2.op2_interface.op2_codes.get_table_from_table_code(table_code: int, table_name: str, is_msc: bool = True) str[source]

translates that a key of say 1 is the ‘OUG - Displacement vector’ table

op2_f06_common Module

digraph inheritance7399eee4e6 { bgcolor=transparent; rankdir=LR; size=""; "pyNastran.op2.op2_interface.op2_f06_common.OP2_F06_Common" [URL="#pyNastran.op2.op2_interface.op2_f06_common.OP2_F06_Common",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top"]; "pyNastran.op2.op2_interface.op2_f06_common.Op2F06Attributes" [URL="#pyNastran.op2.op2_interface.op2_f06_common.Op2F06Attributes",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top"]; "pyNastran.op2.op2_interface.op2_f06_common.OP2_F06_Common" -> "pyNastran.op2.op2_interface.op2_f06_common.Op2F06Attributes" [arrowsize=0.5,style="setlinewidth(0.5)"]; }
class pyNastran.op2.op2_interface.op2_f06_common.OP2_F06_Common[source]

Bases: object

del_result(result_name: str) None[source]

delattr, but considers sub-objects

get_op2_stats(short: bool = False) str[source]

Gets info about the contents of the different attributes of the OP2 class.

Examples

*Detailed OP2 Stats* >>> self.get_op2_stats()

displacements[1]

isubcase = 1 type=RealDisplacementArray nnodes=72 data: [t1, t2, t3, r1, r2, r3] shape=[1, 72, 6] dtype=float32 gridTypes sort1 lsdvmns = [1]

spc_forces[1]

isubcase = 1 type=RealSPCForcesArray nnodes=72 data: [t1, t2, t3, r1, r2, r3] shape=[1, 72, 6] dtype=float32 gridTypes sort1 lsdvmns = [1]

ctetra_stress[1]

type=RealSolidStressArray nelements=186 nnodes=930 nodes_per_element=5 (including centroid) eType, cid data: [1, nnodes, 10] where 10=[oxx, oyy, ozz, txy, tyz, txz, o1, o2, o3, von_mises] data.shape = (1, 930, 10) element name: CTETRA sort1 lsdvmns = [1]

*Appreviated OP2 Stats* >>> self.get_op2_stats(short=True) displacements[1]; RealDisplacementArray; [1, 72, 6]; [t1, t2, t3, r1, r2, r3]

get_result(result_name: str) dict[source]

Getattr, but considers sub-objects

Examples

Example 1 >>> self.eigenvectors = self.get_result(‘eigenvectors’)

Example 2 >>> self.ato.displacements = self.get_result(‘ato.displacements’)

get_table_types()[source]

Gets the names of the results.

has_result(result_name: str) bool[source]

checks to see if a result exists

isubcase_name_map

a dictionary that maps an integer of the subcaseName to the subcase_id

remove_empty_results() None[source]
title

BDF Title

class pyNastran.op2.op2_interface.op2_f06_common.Op2F06Attributes[source]

Bases: OP2_F06_Common

result_set Module

digraph inheritance6f7a17e2ea { bgcolor=transparent; rankdir=LR; size=""; "pyNastran.op2.op2_interface.result_set.ResultSet" [URL="#pyNastran.op2.op2_interface.result_set.ResultSet",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="This class is private storage interface class."]; }
Defines:
  • ResultSet(allowed_results)

    • allowed

    • found

    • saved

    • is_saved(result)

    • is_not_saved(result)

    • clear()

    • add(result)

    • remove(results)

    • _found_result(result)

    • update(self, results)

class pyNastran.op2.op2_interface.result_set.ResultSet(allowed_results: list[str], results_map: dict[str, Any], log: SimpleLogger)[source]

Bases: object

This class is private storage interface class.

It’s an interface tool between the code and the results the user requests.

we’ll set the allowed results

Parameters:
allowed_resultslist[str]

all results that are allowed

results_mapdict[str, Any]

combined objects (e.g., ato, psd, stress, force, …)

logSimpleLogger

the logging object

add(results: str | list[str]) list[str][source]

adds a list/str of results

clear() None[source]

clears all the results

is_not_saved(result: str) bool[source]

checks to see if a result is saved

is_saved(result: str) bool[source]

checks to see if a result is saved

remove(results: str | list[str]) list[str][source]

removes a list/str of results

update(results: list[str]) None[source]
pyNastran.op2.op2_interface.result_set.add_results_of_exact_type(all_results: list[str], result_word: str) list[str][source]
Parameters:
all_resultslist[str]

all the results to check against

result_wordstr

‘stress’, ‘strain’, … ‘stress’ lets in stress.cquad4_stress, but not psd.cquad4_stress or grid_point_stress.discontinuities

Returns:
results_to_addlist[str]

the results to add

write_utils Module

Defines methods for the op2 & hdf5 writer

pyNastran.op2.op2_interface.write_utils.export_to_hdf5(self, group, log)[source]

exports the object to HDF5 format

pyNastran.op2.op2_interface.write_utils.get_complex_fdtype(dtype)[source]

complex64 -> float32; complex128 -> float64

pyNastran.op2.op2_interface.write_utils.get_title_subtitle_label(title: str, subtitle: str, label: str, superelement_adaptivity_index: str = '') tuple[bytes, bytes, bytes][source]
TODO: subtitle is missing

superelement_adaptivity_index

pyNastran.op2.op2_interface.write_utils.set_table3_field(str_fields, ifield: int, value)[source]

ifield is 1 based

pyNastran.op2.op2_interface.write_utils.to_column_bytes(data_list: list[ndarray], dtype_out: str, debug: bool = False) ndarray[source]

Takes an stackable numpy array of mixed types (e.g., ints/strings) and casts them to the appropriate output datatype (typically float32/float64).

An array is stackable if it’s the same shape (e.g., ints/floats). This requirement is a bit looser for strings (4 characters per 32-bit float)

pyNastran.op2.op2_interface.write_utils.view_dtype(array_obj: ndarray, dtype) ndarray[source]

handles downcasting data

pyNastran.op2.op2_interface.write_utils.view_idtype_as_fdtype(int_array: ndarray, fdtype: str) ndarray[source]

If we’re downcasting from int64 to float32, we can’t directly go to float32. We need to first go to int32, then to float32.

pyNastran.op2.op2_interface.write_utils.write_table_header(op2_file: BinaryIO, fascii: TextIO, table_name: str)[source]

Writes the beginning of an op2 table

Parameters:
op2_filefile

the op2 file object

table_namestr

the table name to write

Submodules