Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
pystencils-sfg
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
pycodegen
pystencils-sfg
Commits
841e40eb
Commit
841e40eb
authored
1 year ago
by
Frederik Hennig
Browse files
Options
Downloads
Patches
Plain Diff
Added vector extraction to composer
parent
87846725
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Pipeline
#57673
passed
1 year ago
Stage: pretest
Stage: test
Stage: deploy
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/pystencilssfg/composer.py
+7
-2
7 additions, 2 deletions
src/pystencilssfg/composer.py
src/pystencilssfg/source_components.py
+1
-1
1 addition, 1 deletion
src/pystencilssfg/source_components.py
with
8 additions
and
3 deletions
src/pystencilssfg/composer.py
+
7
−
2
View file @
841e40eb
from
__future__
import
annotations
from
__future__
import
annotations
from
typing
import
TYPE_CHECKING
,
Optional
from
typing
import
TYPE_CHECKING
,
Optional
,
Sequence
from
abc
import
ABC
,
abstractmethod
from
abc
import
ABC
,
abstractmethod
from
pystencils
import
Field
from
pystencils
import
Field
...
@@ -9,7 +9,7 @@ from .tree import SfgCallTreeNode, SfgKernelCallNode, SfgStatements, SfgSequence
...
@@ -9,7 +9,7 @@ from .tree import SfgCallTreeNode, SfgKernelCallNode, SfgStatements, SfgSequence
from
.tree.deferred_nodes
import
SfgDeferredFieldMapping
from
.tree.deferred_nodes
import
SfgDeferredFieldMapping
from
.tree.conditional
import
SfgCondition
,
SfgCustomCondition
,
SfgBranch
from
.tree.conditional
import
SfgCondition
,
SfgCustomCondition
,
SfgBranch
from
.source_components
import
SfgFunction
,
SfgHeaderInclude
,
SfgKernelNamespace
,
SfgKernelHandle
from
.source_components
import
SfgFunction
,
SfgHeaderInclude
,
SfgKernelNamespace
,
SfgKernelHandle
from
.source_concepts
import
SrcField
,
TypedSymbolOrObject
from
.source_concepts
import
SrcField
,
TypedSymbolOrObject
,
SrcVector
if
TYPE_CHECKING
:
if
TYPE_CHECKING
:
from
.context
import
SfgContext
from
.context
import
SfgContext
...
@@ -92,6 +92,11 @@ class SfgComposer:
...
@@ -92,6 +92,11 @@ class SfgComposer:
def
map_param
(
self
,
lhs
:
TypedSymbolOrObject
,
rhs
:
TypedSymbolOrObject
,
mapping
:
str
):
def
map_param
(
self
,
lhs
:
TypedSymbolOrObject
,
rhs
:
TypedSymbolOrObject
,
mapping
:
str
):
return
SfgStatements
(
mapping
,
(
lhs
,),
(
rhs
,))
return
SfgStatements
(
mapping
,
(
lhs
,),
(
rhs
,))
def
map_vector
(
self
,
lhs_components
:
Sequence
[
TypedSymbolOrObject
],
rhs
:
SrcVector
):
return
make_sequence
(
*
(
rhs
.
extract_component
(
dest
,
coord
)
for
coord
,
dest
in
enumerate
(
lhs_components
)
))
class
SfgNodeBuilder
(
ABC
):
class
SfgNodeBuilder
(
ABC
):
@abstractmethod
@abstractmethod
...
...
This diff is collapsed.
Click to expand it.
src/pystencilssfg/source_components.py
+
1
−
1
View file @
841e40eb
...
@@ -75,7 +75,7 @@ class SfgKernelNamespace:
...
@@ -75,7 +75,7 @@ class SfgKernelNamespace:
def
create
(
self
,
assignments
,
name
:
str
|
None
=
None
,
config
:
CreateKernelConfig
|
None
=
None
):
def
create
(
self
,
assignments
,
name
:
str
|
None
=
None
,
config
:
CreateKernelConfig
|
None
=
None
):
if
config
is
None
:
if
config
is
None
:
config
=
CreateKernelConfig
()
config
=
CreateKernelConfig
()
if
name
is
not
None
:
if
name
is
not
None
:
if
name
in
self
.
_asts
:
if
name
in
self
.
_asts
:
raise
ValueError
(
f
"
Duplicate ASTs: An AST with name
{
name
}
already exists in namespace
{
self
.
_name
}
"
)
raise
ValueError
(
f
"
Duplicate ASTs: An AST with name
{
name
}
already exists in namespace
{
self
.
_name
}
"
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment