Skip to content
Snippets Groups Projects

Refactor collection of header files. Refactor C++ data type modelling. Extend generator script test suite.

Merged Frederik Hennig requested to merge fhennig/header-collection into master
All threads resolved!
Viewing commit 3eaa5dbb
Show latest version
3 files
+ 9
7
Preferences
Compare changes
Files
3
@@ -29,6 +29,7 @@ class StdMdspan(SrcField):
extents: tuple[int | str, ...],
extents_type: PsType = PsUnsignedIntegerType(64),
ref: bool = False,
const: bool = False,
experimental: bool = True,
):
T = create_type(T)
@@ -39,9 +40,9 @@ class StdMdspan(SrcField):
)
if experimental:
dtype = self._template_experimental(T=T, extents=extents_str)
dtype = self._template_experimental(T=T, extents=extents_str, const=const)
else:
dtype = self._template(T=T, extents=extents_str)
dtype = self._template(T=T, extents=extents_str, const=const)
if ref:
dtype = Ref(dtype)
@@ -73,7 +74,7 @@ class StdMdspan(SrcField):
@staticmethod
def from_field(
field: Field, extents_type: PsType = PsUnsignedIntegerType(64), ref: bool = False
field: Field, extents_type: PsType = PsUnsignedIntegerType(64), ref: bool = False, const: bool = False,
):
"""Creates a `std::mdspan` instance for a given pystencils field."""
from pystencils.field import layout_string_to_tuple
@@ -98,6 +99,7 @@ class StdMdspan(SrcField):
tuple(extents),
extents_type=extents_type,
ref=ref,
const=const
).var(field.name)