Groups

class Groups(dll: SofDll)

Bases: object

This class provides methods and a data structure to:

  • access keys 11/0 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:

  • GROUP" group number

  • GROUP_NAME" group nmae

  • BEAM_MIN_ID" beam minimum id

  • BEAM_MAX_ID" beam maximum id

  • NUMBER_OF_BEAMS" number of beams

  • TRUSS_MIN_ID" truss minimum id

  • TRUSS_MAX_ID" truss maximum id

  • NUMBER_OF_TRUSSES" number of trusses

  • CABLE_MIN_ID" cable minimum id

  • CABLE_MAX_ID" cable maximum id

  • NUMBER_OF_CABLES" number of cables

  • SPRING_MIN_ID" spring minimum id

  • SPRING_MAX_ID" spring maximum id

  • NUMBER_OF_SPRINGS" number of springs

  • QUAD_MIN_ID" quad minimum id

  • QUAD_MAX_ID" quad maximum id

  • NUMBER_OF_QUADS number of quads

The DataFrame uses a MultiIndex with level GROUP to enable fast lookups via the get_id_range, get_name and get_number methods. The index columns are not dropped from the DataFrame.

Note

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

  • INF: bit-code of the group

  • MNR: material number of the group

  • MBW: material reinforcement number of the group

  • IBB and IBD: construction stage numbers

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.

get_data(deep: bool = True) DataFrame

Return the pandas.DataFrame containing the loaded key 11/0.

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).

get_groups() list[int]

Return a list of groups.

get_id_range(quantity: str, group_number: int) range

Return a range starting from the minimum element ID to the maximum ID + 1, so that a check like max_id in get_id_range("BEAM", group_number) returns True.

If no elements of the requested type are present in the given group_number returns range(0).

Parameters:
  • quantity (str) –

    The type of finite element for which the range is requested. Must be one of:

    • "BEAM"

    • "CABLE"

    • "TRUSS"

    • "SPRING"

    • "QUAD"

  • group_number (int) – The group number

get_name(group_number: int) str

Return a string containing the group name, given its number.

Parameters:

group_number (int) – The group number

Raises:

LookupError – If the given group_number is not found.

get_number(group_name: str) int

Return the group number, given its name.

Parameters:

group_name (str) – The group name

Raises:

LookupError – If the given group_name is not found.

iterator(quantity: str) Generator[tuple[int, range], None, None]

Yield a tuple containing the group number and the quantity ID range for each group defined in the CDB.

Parameters:

quantity (str) –

The type of finite element for which the range is requested. Must be one of:

  • "BEAM"

  • "CABLE"

  • "TRUSS"

  • "SPRING"

  • "QUAD"

See also

get_id_range()

load() None

Load group data (key 11/0) from the CDB.