diff --git a/docs/source/api/composer.rst b/docs/source/api/composer.rst index 75acd8abedc7ebe0c9c9024575f3bffe99f7c6bf..fb63d6811bac4935a15a8edcf7298423ea767ca1 100644 --- a/docs/source/api/composer.rst +++ b/docs/source/api/composer.rst @@ -14,4 +14,13 @@ Composer API (`pystencilssfg.composer`) .. autoclass:: pystencilssfg.composer.SfgClassComposer :members: +Helper Methods +============== + .. autofunction:: pystencilssfg.composer.make_sequence + +Custom Generators +================= + +.. autoclass:: pystencilssfg.composer.custom.CustomGenerator + :members: diff --git a/src/pystencilssfg/composer/custom.py b/src/pystencilssfg/composer/custom.py index 26e9b933456904576202837b763fa09a8ae6b141..fa53d6af033fa52743d2f1c066e41950f9394a0e 100644 --- a/src/pystencilssfg/composer/custom.py +++ b/src/pystencilssfg/composer/custom.py @@ -4,7 +4,7 @@ from ..context import SfgContext class CustomGenerator(ABC): """Abstract base class for custom code generators that may be passed to - [SfgComposer.generate][pystencilssfg.SfgComposer.generate].""" + `SfgComposer.generate`.""" @abstractmethod def generate(self, ctx: SfgContext) -> None: ... diff --git a/src/pystencilssfg/ir/postprocessing.py b/src/pystencilssfg/ir/postprocessing.py index e796a69cd856abfd2cadabd6b28ea5292d310d7b..c037c522324771b455bd5796de45af8bac0164df 100644 --- a/src/pystencilssfg/ir/postprocessing.py +++ b/src/pystencilssfg/ir/postprocessing.py @@ -106,23 +106,24 @@ class PostProcessingContext: if var.name in self._live_variables: live_var = self._live_variables[var.name] - if var.dtype == live_var.dtype: - # This can only happen if the variables are SymbolLike, - # i.e. wrap a field-associated kernel parameter - # TODO: Once symbol properties are a thing, check and combine them here - warnings.warn( - "Encountered two non-identical variables with same name and data type:\n" - f" {var.name_and_type()}\n" - "and\n" - f" {live_var.name_and_type()}\n" - ) - else: - raise SfgException( - "Encountered two variables with same name but different data types:\n" - f" {var.name_and_type()}\n" - "and\n" - f" {live_var.name_and_type()}" - ) + if var != live_var: + if var.dtype == live_var.dtype: + # This can only happen if the variables are SymbolLike, + # i.e. wrap a field-associated kernel parameter + # TODO: Once symbol properties are a thing, check and combine them here + warnings.warn( + "Encountered two non-identical variables with same name and data type:\n" + f" {var.name_and_type()}\n" + "and\n" + f" {live_var.name_and_type()}\n" + ) + else: + raise SfgException( + "Encountered two variables with same name but different data types:\n" + f" {var.name_and_type()}\n" + "and\n" + f" {live_var.name_and_type()}" + ) else: self._live_variables[var.name] = var