Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
pytato
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Andreas Klöckner
pytato
Commits
61dbaa0e
Commit
61dbaa0e
authored
4 years ago
by
Andreas Klöckner
Browse files
Options
Downloads
Patches
Plain Diff
Enable quotes linting, plus various linter fixes
parent
c43b9dba
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!12
Enable quotes linting, plus various linter fixes
Pipeline
#77899
passed
4 years ago
Stage: test
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
.gitlab-ci.yml
+2
-2
2 additions, 2 deletions
.gitlab-ci.yml
examples/dg_tools.py
+8
-21
8 additions, 21 deletions
examples/dg_tools.py
pytato/visualization.py
+7
-7
7 additions, 7 deletions
pytato/visualization.py
setup.cfg
+4
-0
4 additions, 0 deletions
setup.cfg
with
21 additions
and
30 deletions
.gitlab-ci.yml
+
2
−
2
View file @
61dbaa0e
...
...
@@ -35,7 +35,7 @@ Pylint:
-
export PY_EXE=python3
-
EXTRA_INSTALL="pyopencl"
-
curl -L -O -k https://gitlab.tiker.net/inducer/ci-support/raw/master/prepare-and-run-pylint.sh
-
"
.
./prepare-and-run-pylint.sh
${CI_PROJECT_NAME}
test/test_*.py
"
-
. ./prepare-and-run-pylint.sh ${CI_PROJECT_NAME} test/test_*.py
examples
tags
:
-
python3
except
:
...
...
@@ -45,7 +45,7 @@ Pylint:
Flake8
:
script
:
-
curl -L -O -k https://gitlab.tiker.net/inducer/ci-support/raw/master/prepare-and-run-flake8.sh
-
"
.
./prepare-and-run-flake8.sh
${CI_PROJECT_NAME}
test
"
-
. ./prepare-and-run-flake8.sh ${CI_PROJECT_NAME} test
examples
tags
:
-
python3
except
:
...
...
This diff is collapsed.
Click to expand it.
examples/dg_tools.py
+
8
−
21
View file @
61dbaa0e
...
...
@@ -88,16 +88,16 @@ class DGDiscr1D(object):
Signature: ->()
"""
return
self
.
elements
[
0
,
1
]
-
self
.
elements
[
0
,
0
]
return
self
.
elements
[
0
,
1
]
-
self
.
elements
[
0
,
0
]
def
nodes
(
self
):
"""
Return the vector of node coordinates.
Signature: ->(n*m,)
"""
centers
=
(
self
.
elements
[:,
0
]
+
self
.
elements
[:,
1
])
/
2
radii
=
(
self
.
elements
[:,
1
]
-
self
.
elements
[:,
0
])
/
2
return
((
self
.
ref_nodes
[:,
np
.
newaxis
]
*
radii
)
+
centers
).
T
.
ravel
()
centers
=
(
self
.
elements
[:,
0
]
+
self
.
elements
[:,
1
])
/
2
radii
=
(
self
.
elements
[:,
1
]
-
self
.
elements
[:,
0
])
/
2
return
((
self
.
ref_nodes
[:,
np
.
newaxis
]
*
radii
)
+
centers
).
T
.
ravel
()
@property
@memoized
...
...
@@ -155,11 +155,11 @@ class DGDiscr1D(object):
Signature: ->(n, n)
"""
VrT
=
[]
VrT
=
[]
# noqa: N806
for
row
in
np
.
eye
(
self
.
nnodes
):
deriv
=
ortholegder
(
row
)
VrT
.
append
(
ortholegval
(
self
.
ref_nodes
,
deriv
))
Vr
=
np
.
vstack
(
VrT
).
T
Vr
=
np
.
vstack
(
VrT
).
T
# noqa: N806
return
Vr
@
la
.
inv
(
self
.
vdm
)
@property
...
...
@@ -205,8 +205,8 @@ class DGDiscr1D(object):
Signature: ->(m, 2)
"""
result
=
np
.
zeros
((
self
.
nelements
,
2
))
result
[:,
0
]
=
-
1
result
[:,
1
]
=
1
result
[:,
0
]
=
-
1
result
[:,
1
]
=
1
return
result
...
...
@@ -326,19 +326,6 @@ class AbstractDGOps1D(object):
raise
NotImplementedError
def
elementwise
(
mat
,
vec
):
"""
Apply a matrix to rows of the input representing per-element
degrees of freedom.
Inputs:
mat: Shape (a, b)
vec: Shape (c, b)
Signature: (a, b), (c, b) -> (c, a)
"""
return
np
.
einsum
(
"
ij,kj->ki
"
,
mat
,
vec
)
class
DGOps1DRef
(
AbstractDGOps1D
):
"""
A reference NumPy implementation of the AbstractDGOps1D interface.
"""
...
...
This diff is collapsed.
Click to expand it.
pytato/visualization.py
+
7
−
7
View file @
61dbaa0e
...
...
@@ -151,10 +151,10 @@ class DotEmitter(CodeGeneratorBase):
def
_emit_array
(
emit
:
DotEmitter
,
info
:
DotNodeInfo
,
id
:
str
)
->
None
:
td_attrib
=
"
border=
\
"
0
\"
"
table_attrib
=
"
border=
\
"
0
\
"
cellborder=
\
"
1
\
"
cellspacing=
\
"
0
\"
"
td_attrib
=
'
border=
"
0
"
'
table_attrib
=
'
border=
"
0
"
cellborder=
"
1
"
cellspacing=
"
0
"
'
rows
=
[
"
<tr><td colspan=
\
"
2
\
"
%s>%s</td></tr>
"
rows
=
[
'
<tr><td colspan=
"
2
"
%s>%s</td></tr>
'
%
(
td_attrib
,
dot_escape
(
info
.
title
))]
for
name
,
field
in
info
.
fields
.
items
():
...
...
@@ -173,11 +173,11 @@ def _emit_name_cluster(emit: DotEmitter, names: Mapping[str, Array],
with
emit
.
block
(
"
subgraph cluster_%s
"
%
label
):
emit
(
"
node [shape=ellipse]
"
)
emit
(
"
label=
\
"
%s
\"
"
%
label
)
emit
(
'
label=
"
%s
"
'
%
label
)
for
name
,
array
in
names
.
items
():
name_id
=
id_gen
(
label
)
emit
(
"
%s [label=
\
"
%s
\
"
]
"
%
(
name_id
,
dot_escape
(
name
)))
emit
(
'
%s [label=
"
%s
"
]
'
%
(
name_id
,
dot_escape
(
name
)))
array_id
=
array_to_id
[
array
]
# Edges must be outside the cluster.
edges
.
append
((
name_id
,
array_id
))
...
...
@@ -222,7 +222,7 @@ def get_dot_graph(result: Union[Array, DictOfNamedArrays]) -> str:
# Emit inputs.
with
emit
.
block
(
"
subgraph cluster_Inputs
"
):
emit
(
"
label=
\
"
Inputs
\"
"
)
emit
(
'
label=
"
Inputs
"
'
)
for
array
in
input_arrays
:
_emit_array
(
emit
,
nodes
[
array
],
array_to_id
[
array
])
...
...
@@ -235,7 +235,7 @@ def get_dot_graph(result: Union[Array, DictOfNamedArrays]) -> str:
for
label
,
tail_array
in
node
.
edges
.
items
():
tail
=
array_to_id
[
tail_array
]
head
=
array_to_id
[
array
]
emit
(
"
%s -> %s [label=
\
"
%s
\
"
]
"
%
(
tail
,
head
,
dot_escape
(
label
)))
emit
(
'
%s -> %s [label=
"
%s
"
]
'
%
(
tail
,
head
,
dot_escape
(
label
)))
# Emit output/namespace name mappings.
_emit_name_cluster
(
emit
,
outputs
,
array_to_id
,
id_gen
,
label
=
"
Outputs
"
)
...
...
This diff is collapsed.
Click to expand it.
setup.cfg
+
4
−
0
View file @
61dbaa0e
...
...
@@ -2,6 +2,10 @@
ignore
=
E126,E127,E128,E123,E226,E241,E242,E265,N802,W503,E402,N814,N817,W504
max-line-length
=
85
inline-quotes
=
"
docstring-quotes = """
multiline-quotes
=
"""
[mypy-pytato.transform]
disallow_subclassing_any = False
...
...
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