The common.py module#

Summary#

elemental_properties

Contains strings to define elemental property fields.

nodal_properties

Contains strings to define nodal property fields.

face_properties

Contains strings to define face property fields.

config_options

Contains strings to define configuration options.

DefinitionLabels

Contains Python definition labels.

TqdmProgressBar

Custom progress bar implementation based on tqdm.

SubClassSmartDict

Return the superclass name for a key if not found initially.

types

The 'types' enum contains the available types passed through operators and workflows to DPF.

natures

The 'natures' enum contains the dimensionality types.

shell_layers

Contains data identifying shell layers.

types_enum_to_types

Return a mapping of enums and corresponding python or dpf types.

type_to_internal_object_keyword

Return dpf types mapped to internal object keywords.

type_to_special_dpf_constructors

Return dpf type mapped to special dpf constructors.

derived_class_name_to_type

Return a mapping of derived class names to their corresponding Python classes.

record_derived_class

Record a new derived class in the mapping of class names to their corresponding Python classes.

create_dpf_instance

Create a server instance of a given type.

Description#

Common.

Module detail#

common.types_enum_to_types()#

Return a mapping of enums and corresponding python or dpf types.

Returns:

Mapping of enum to the corresponding type.

Return type:

dict

common.type_to_internal_object_keyword()#

Return dpf types mapped to internal object keywords.

Returns:

Custom dictionary that returns superclass name for a key if not found initially.

Return type:

SubClassSmartDict

common.type_to_special_dpf_constructors()#

Return dpf type mapped to special dpf constructors.

common.derived_class_name_to_type() Dict[str, type]#

Return a mapping of derived class names to their corresponding Python classes.

Returns:

A dictionary mapping derived class names (str) to their corresponding Python class objects.

Return type:

dict[str, type]

common.record_derived_class(class_name: str, py_class: type, overwrite: bool = False)#

Record a new derived class in the mapping of class names to their corresponding Python classes.

This function updates the global dictionary that maps derived class names (str) to their corresponding Python class objects (type). If the provided class name already exists in the dictionary, it will either overwrite the existing mapping or leave it unchanged based on the overwrite flag.

Parameters:
  • class_name (str) – The name of the derived class to be recorded.

  • py_class (type) – The Python class type corresponding to the derived class.

  • overwrite (bool, optional) – A flag indicating whether to overwrite an existing entry for the class_name. If True, the entry will be overwritten. If False (default), the entry will not be overwritten if it already exists.

common.create_dpf_instance(type, internal_obj, server)#

Create a server instance of a given type.