libICEpost ========== .. py:module:: libICEpost .. autoapi-nested-parse:: @author: F. Ramognino Last update: 9/03/2023 Package with useful classes and executables and function for pre/post processing of data in the context of internal combustion engines and CFD simulations" -> Processing of experimental measurements on ICEs -> Processing of results of CFD simulations -> Computation of mixture compositions (external/internal EGR, thermophysical properties) -> Processing of laminar flame speed correlations and OpenFOAM tabulations -> Handling, reading/writing, and assessment of OpenFOAM tabulations Content of the package: TODO: Add description Submodules ---------- .. toctree:: :maxdepth: 1 /autoapi/libICEpost/Database/index /autoapi/libICEpost/GLOBALS/index /autoapi/libICEpost/scripts/index /autoapi/libICEpost/src/index Attributes ---------- .. autoapisummary:: libICEpost.database Classes ------- .. autoapisummary:: libICEpost.BaseClass libICEpost.Dictionary Package Contents ---------------- .. py:data:: database .. py:class:: BaseClass Bases: :py:obj:`libICEpost.src.base.Utilities.Utilities` Class wrapping useful methods for base virtual classes (e.g. run-time selector) .. py:method:: selectionTable() -> SelectionTable :classmethod: The run-time selection table associated to this class. .. py:method:: selector(typeName: str, dictionary: dict) -> BaseClassType :classmethod: Construct an instance of a subclass of this that was added to the selection table. :param typeName: Name of the subclass to instantiate :type typeName: str :param dictionary: Dictionary containing the data to construct the class. :type dictionary: dict :returns: Instance of the specific class. :rtype: BaseClassType .. py:method:: hasSelectionTable() -> bool :classmethod: Check if selection table was defined for this class. .. py:method:: fromDictionary(dictionary: dict) -> BaseClassType :classmethod: :abstractmethod: Construct an instance of this class from a dictionary. To be overwritten by derived class. :param dictionary: Dictionary containing the data to construct the class. :type dictionary: dict :returns: Instance of the specific class. :rtype: BaseClassType .. py:method:: addToRuntimeSelectionTable(childClass: BaseClassType, *, overwrite: bool = True) -> None :classmethod: Add the subclass to the database of available subclasses for runtime selection. :param childClass: Subclass to add to the selection table :type childClass: BaseClassType :param overwrite: Overwrite if present? Defaults to True. :type overwrite: bool, optional .. py:method:: createRuntimeSelectionTable() -> None :classmethod: Create the runtime selection table, initializing the property 'selectionTable' of the class. .. py:method:: showRuntimeSelectionTable() -> None :classmethod: Prints a list of the available classes in the selection table and if they are instantiable. .. rubric:: Example Available classes in selection table: ClassA (Abstract class) ClassB ClassC .. py:class:: Dictionary(*args, _fileName: str = None, **argv) Bases: :py:obj:`collections.OrderedDict`, :py:obj:`libICEpost.src.base.Utilities.Utilities` Ordered dictionary embedding some useful OpenFOAM-like methods. .. py:attribute:: path :type: str | None .. py:attribute:: file :type: str | None .. py:method:: fromFile(fileName: str) :classmethod: fileName: str Path of the file Read the variables stored in a python file (Runs the code in the file and retrieves the local variables) NOTE: local variable 'this' for this file. You can access the local folder as 'this.path' within the dictionary. .. py:method:: lookup(entryName: str, *, varType: T | Iterable[type] = None) -> T | Any Same as __getitem__ but embeds error handling and type checking. :param entryName: Name of the entry to look for :type entryName: str :param varType: Type of the variable to lookup for. Performes type-checking if it is given. Defaults to None. :type varType: type|Iterable[type], optional :raises KeyError: If the entry is not found :raises TypeError: If the type is not consistent with varType :returns: self[entryName] :rtype: varType|Any .. py:method:: pop(entryName: str) entryName: str Name of the entry to look for Same as dictionary.pop but custom error message .. py:method:: lookupOrDefault(entryName: str, default: T, fatal: bool = True) -> T Lookup of give a default value if not found :param entryName: Name of the entry to look for :type entryName: str :param default: Instance to return in case the value is not found. It is also used for typeChecking :type default: T :param fatal: If the type is not consistent rise a TypeError. Defaults to True. :type fatal: bool, optional :returns: self[entryName] if entryName is found, else default :rtype: T .. py:method:: _correctSubdicts() Convert recursively every subdictionary into Dictionary classes. .. py:method:: __setitem__(*args, **argv) Set self[key] to value. .. py:method:: update(/, dictionary=None, **kwargs) Performs like dict.update() method but recursively updates sub-dictionaries. Accepts both a dictionary and keyword arguments. :param dictionary: Dictionary to update with. Defaults to None. :type dictionary: dict, optional