pyfem.util package
Submodules
pyfem.util.BaseModule module
- class BaseModule(props)[source]
Bases:
object
- type
- def get_nested_attr(obj, attr_path, default=None):
“”” Access a nested attribute in an object hierarchy.
Parameters: - obj: The base object - attr_path: A string of dot-separated attribute names (e.g., “bar.foo.y”) - default: The value to return if any attribute in the chain doesn’t exist
Returns: - The value of the nested attribute, or the default if any attribute is missing “”” try:
- for attr in attr_path.split(‘.’):
obj = getattr(obj, attr)
return obj
- except AttributeError:
return default
# Example usage: # Assuming x.bar.foo.y exists value = get_nested_attr(x, “bar.foo.y”, default=”Attribute not found”) print(value)
pyfem.util.BezierShapeFunctions module
pyfem.util.dataStructures module
- class GlobalData(nodes, elements, dofs)[source]
Bases:
Properties
pyfem.util.fileParser module
pyfem.util.itemList module
- class itemList[source]
Bases:
dict
Class to construct a list of items that have a coninuous local number, and a global ID.
- add(ID: int, item)[source]
Adds an item with an ID to the list. This item will be stored in the list.
- Parameters:
ID (int) – the ID of the item to be stored.
item – the value(s) of the item to be stored.
- get(IDs)[source]
Returns the index / indices of an ID or list of IDs of items in the list.
- Parameters:
IDs (list[int]|int,optional) – the ID/IDs. If ommited, a list with all indces
returned. (will be)
- Returns:
a list with the indices. In the case of a single ID, this list has length 1.
- Return type:
list[int]
- getIndices(IDs: list[int] | int = -1) list[int] [source]
Returns the index / indices of an ID or list of IDs of items in the list.
- Parameters:
IDs (list[int]|int,optional) – the ID/IDs. If ommited, a list with all indces
returned. (will be)
- Returns:
a list with the indices. In the case of a single ID, this list has length 1.
- Return type:
list[int]
pyfem.util.kinematics module
pyfem.util.logger module
pyfem.util.plotUtils module
pyfem.util.shapeFunctions module
pyfem.util.transformations module
pyfem.util.utilFunctions module
- macauley(x: float) float [source]
Function that performs the macaulay operation to a variable. The macaulay operation returns the exact same value when that value is positive and returns zero when the values is negative.
- Parameters:
x (float) – The input to the function
- Returns:
The macauley value.
- Return type:
float