pyyeti.nastran.op4.OP4.write

OP4.write(filename, names, matrices=None, binary=True, digits=16, endian='=', sparse='auto', forms=None)[source]

Write op4 file.

Parameters:
  • filename (string) – Name of file.

  • names (dictionary/OrderedDict or list or string) – Dictionary indexed by the matrix names with the values being either the matrices or a tuple/list where the first two items are (matrix, form). Alternatively, names can also be a list of matrix names (strings) or a single name (string) if just one matrix is to be saved. If using the list inputs, matrices is required to specify the matrices and, if forms needs to specified, that input would also be required.

  • matrices (array or list; optional) – 2d ndarray or list of 2d ndarrays. Ignored if names is a dictionary. Same length as names.

  • binary (bool; optional) – If true, a double precision binary file is written; otherwise an ascii file is created.

  • digits (integer; optional) – Number of significant digits after the decimal to include in the ascii output. Ignored for binary files.

  • endian (string; optional) – Endian setting for binary output: ‘=’ for native, ‘>’ for big-endian and ‘<’ for little-endian.

  • sparse (string; optional) – Specifies the output format:

    sparse

    Action

    ‘auto’

    Each 2d ndarray will be written in “dense” format and each sparse matrix will be written in “bigmat” sparse format

    ‘bigmat’

    Each matrix (whether sparse or not) is written in “bigmat” sparse format

    ‘dense’

    Each matrix will be written in “dense” format

    ‘nonbigmat’

    Each matrix is written in “nonbigmat” format. Note that if the number of rows is > 65535, then the “bigmat” format is used.

  • forms (integer or list or None; optional) – The matrix form(s). If None, the forms will be determined automatically to be 1, 2, or 6. Ignored if names is a dictionary (which would contain this information). If not None, forms must be the same length as names, but you can use None as the form for one or more matrices (see example in pyyeti.nastran.op4.write()). From Nastran documentation:

    form

    Matrix format

    1

    Square

    2

    Rectangular

    3

    Diagonal

    4

    Lower triangular factor

    5

    Upper triangular factor

    6

    Symmetric

    8

    Identity

    9

    Pseudo identity

    10

    Cholesky factor

    11

    Trapezoidal factor

    13

    Sparse lower triangular factor

    15

    Sparse upper triangular factor

    Warning

    The validity of the values in forms is not checked in any way.

Returns:

None.

Notes

To write multiple matrices that have the same name, names must be a list, not a dictionary. If a list, the order is maintained. If a dictionary, the matrices are written in the order they are retrieved from the dictionary; use a collections.OrderedDict to specify a certain order.

See the examples in pyyeti.nastran.op4.write().