Skip to content
Snippets Groups Projects
Commit 7a4ff746 authored by Frederik Hennig's avatar Frederik Hennig
Browse files

Add CustomGenerator to docs. Fix bug in postprocessing.

parent 2edd363e
Branches
No related merge requests found
......@@ -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:
......@@ -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: ...
......@@ -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
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment