Newer
Older
from pystencilssfg import SourceFileGenerator, SfgConfiguration, SfgComposer
from pystencilssfg.configuration import SfgCodeStyle
from pystencils.types import PsCustomType
from pystencilssfg.ir.source_components import SfgClass, SfgMemberVariable, SfgConstructor, SfgMethod
from pystencils import fields, kernel
sfg_config = SfgConfiguration(
output_directory="out/test_classes",
outer_namespace="gen_code",
codestyle=SfgCodeStyle(
code_style="Mozilla",
force_clang_format=True
)
with SourceFileGenerator(sfg_config) as ctx:
sfg = SfgComposer(ctx)
@kernel
def assignments():
f[0,0] @= 3 * g[0,0]
khandle = sfg.kernels.create(assignments)
cls = SfgClass("MyClass")
"inlineConst",
sfg.seq(
"return -1.0;"
),
"awesomeMethod",
sfg.seq(
"return 2.0f;"
),
[sfg.var("stuff", PsCustomType("std::vector< int > &"))],