pyyeti.nastran.n2p.expanddof

pyyeti.nastran.n2p.expanddof(dof, grids_only=True)[source]

Expands degree of freedom (DOF) specification

Parameters:
  • dof (1d or 2d array_like) –

    dof can be input in 2 different ways:

    1. 1d array. Each element is assumed to be an ID. If grids_only is True (the default), this routine assumes the DOFs are 1-6, so the IDs are only of GRIDs. If grids_only is False, then the DOFs will be 0-6, which enables the routine mkdofpv() to find both GRIDs and SPOINTs.

    2. 2d 2-column DOF array. Each row is: [ID, DOF]. Here, DOF specifies which degrees-of-freedom of the ID to find. The DOF can be input in the same way as Nastran accepts it: 0 or any combo of digits 1-6; eg, 123456 for all 6.

  • grids_only (bool; optional) – Ignored if dof has two columns. Otherwise, see option 1 of the dof description above and the examples below.

Returns:

outdof (2d ndarray) – The expanded version of the dof input.

Raises:

ValueError – When DOF > 6 are found.

Examples

>>> from pyyeti import nastran
>>> nastran.expanddof([1, 2])
array([[1, 1],
       [1, 2],
       [1, 3],
       [1, 4],
       [1, 5],
       [1, 6],
       [2, 1],
       [2, 2],
       [2, 3],
       [2, 4],
       [2, 5],
       [2, 6]]...)
>>> nastran.expanddof([1, 2], grids_only=False)
array([[1, 0],
       [1, 1],
       [1, 2],
       [1, 3],
       [1, 4],
       [1, 5],
       [1, 6],
       [2, 0],
       [2, 1],
       [2, 2],
       [2, 3],
       [2, 4],
       [2, 5],
       [2, 6]]...)
>>> nastran.expanddof([[1, 34], [2, 156]])
array([[1, 3],
       [1, 4],
       [2, 1],
       [2, 5],
       [2, 6]]...)
>>> nastran.expanddof([])
array([], shape=(0, 2), dtype=int64)