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
5360c823
Commit
5360c823
authored
1 year ago
by
Frederik Hennig
Browse files
Options
Downloads
Patches
Plain Diff
fixed types
parent
1c7da922
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Pipeline
#57466
failed
1 year ago
Stage: pretest
Stage: test
Stage: deploy
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/pystencilssfg/source_concepts/cpp/std_mdspan.py
+5
-5
5 additions, 5 deletions
src/pystencilssfg/source_concepts/cpp/std_mdspan.py
with
5 additions
and
5 deletions
src/pystencilssfg/source_concepts/cpp/std_mdspan.py
+
5
−
5
View file @
5360c823
from
typing
import
Union
from
typing
import
Union
,
cast
import
numpy
as
np
import
numpy
as
np
...
@@ -17,7 +17,7 @@ class StdMdspan(SrcField):
...
@@ -17,7 +17,7 @@ class StdMdspan(SrcField):
def
__init__
(
self
,
identifer
:
str
,
def
__init__
(
self
,
identifer
:
str
,
T
:
PsType
,
T
:
PsType
,
extents
:
tuple
[
int
,
str
],
extents
:
tuple
[
int
|
str
,
...
],
extents_type
:
PsType
=
int
,
extents_type
:
PsType
=
int
,
reference
:
bool
=
False
):
reference
:
bool
=
False
):
cpp_typestr
=
cpp_typename
(
T
)
cpp_typestr
=
cpp_typename
(
T
)
...
@@ -89,16 +89,16 @@ def mdspan_ref(field: Field, extents_type: type = np.uint32):
...
@@ -89,16 +89,16 @@ def mdspan_ref(field: Field, extents_type: type = np.uint32):
if
field
.
layout
!=
layout_string_to_tuple
(
"
soa
"
,
field
.
spatial_dimensions
):
if
field
.
layout
!=
layout_string_to_tuple
(
"
soa
"
,
field
.
spatial_dimensions
):
raise
NotImplementedError
(
"
mdspan mapping is currently only available for structure-of-arrays fields
"
)
raise
NotImplementedError
(
"
mdspan mapping is currently only available for structure-of-arrays fields
"
)
extents
=
[]
extents
:
list
[
str
|
int
]
=
[]
for
s
in
field
.
spatial_shape
:
for
s
in
field
.
spatial_shape
:
extents
+=
StdMdspan
.
dynamic_extent
if
isinstance
(
s
,
FieldShapeSymbol
)
else
s
extents
.
append
(
StdMdspan
.
dynamic_extent
if
isinstance
(
s
,
FieldShapeSymbol
)
else
cast
(
int
,
s
))
if
field
.
index_shape
!=
(
1
,):
if
field
.
index_shape
!=
(
1
,):
for
s
in
field
.
index_shape
:
for
s
in
field
.
index_shape
:
extents
+=
StdMdspan
.
dynamic_extent
if
isinstance
(
s
,
FieldShapeSymbol
)
else
s
extents
+=
StdMdspan
.
dynamic_extent
if
isinstance
(
s
,
FieldShapeSymbol
)
else
s
return
StdMdspan
(
field
.
name
,
field
.
dtype
,
return
StdMdspan
(
field
.
name
,
field
.
dtype
,
(
StdMdspan
.
dynamic_extent
,
StdMdspan
.
dynamic_
extent
),
tuple
(
extent
s
),
extents_type
=
extents_type
,
extents_type
=
extents_type
,
reference
=
True
)
reference
=
True
)
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