_NodeData

class _NodeData(dll: SofDll)

Bases: object

This class provides methods and a data structure to:

  • access keys 2/00 of the CDB file;

  • store the retrieved data in a convenient format;

  • provide access to the data after the CDB is closed.

The underlying data structure is a pandas.DataFrame with the following columns:

  • ID node number

  • X0 X-coordinate

  • Y0: Y-coordinate

  • Z0: Z-coordinate

  • KFIX: lateral stiffness

  • IS_:USED: rotational stiffness

The DataFrame uses a MultiIndex with level ID to enable fast lookups via the get method. The index column is not dropped from the DataFrame.

Note

Not all available quantities are retrieved and stored. In particular:

  • internal node id (“INR)

  • additional bit code (“NCOD”)

are currently not included.

This is a deliberate design choice and may be changed in the future without breaking the existing API.

clear() None

Clear all the loaded data.

drop_unused_nodes() None

Remove all the unused nodes.

get(node_id: int, quantity: str, default: bool | float | None = None) float | int | bool

Retrieve the requested nodal quantity.

Parameters:
  • node_id (int) – Node number

  • quantity (str) –

    Quantity to retrieve. Must be one of:

    • "X0"

    • "Y0"

    • "Z0"

    • "KFIX"

    • "IS_USED"

  • default (float or None, default None) – Value to return if the requested quantity is not found

Returns:

value – The requested quantity if found. Otherwise, returns default when it is not None.

Return type:

float

Raises:

LookupError – If the requested quantity is not found and default is None.

get_data(deep: bool = True) DataFrame

Return the pandas.DataFrame containing the loaded key 20/00.

Parameters:

deep (bool, default True) – When deep=True, a new object will be created with a copy of the calling object’s data and indices. Modifications to the data or indices of the copy will not be reflected in the original object (refer to pandas.DataFrame.copy() documentation for details).

is_loaded() bool

Return True if the nodal data have been loaded from the cdb.

load() None

Retrieve all nodal data. If the key does not exist or it is empty, a warning is raised only if echo_level > 0.

number_of_nodes() int

Return the number of nodes.