Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dune-codegen
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
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
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
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Christian Heinigk
dune-codegen
Commits
a231da12
Commit
a231da12
authored
8 years ago
by
Dominic Kempf
Browse files
Options
Downloads
Patches
Plain Diff
Fix all of renes complaints
parent
c2bb160c
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
python/dune/perftool/sumfact/basis.py
+14
-8
14 additions, 8 deletions
python/dune/perftool/sumfact/basis.py
python/dune/perftool/tools.py
+5
-5
5 additions, 5 deletions
python/dune/perftool/tools.py
with
19 additions
and
13 deletions
python/dune/perftool/sumfact/basis.py
+
14
−
8
View file @
a231da12
"""
Generator functions to evaluate trial and test functions
NB: Basis evaluation is only needed for the trial function argument in jacobians, as the
multiplication withthe test function is part of the sum factorization kernel.
multiplication with
the test function is part of the sum factorization kernel.
"""
from
dune.perftool.generation
import
(
backend
,
cached
,
...
...
@@ -28,7 +28,7 @@ from dune.perftool.pdelab.restriction import restricted_name
from
pytools
import
product
import
pymbolic.primitives
as
p
import
pymbolic.primitives
as
p
rim
@cached
...
...
@@ -37,6 +37,7 @@ def pymbolic_trialfunction(element, restriction, component):
rows
=
quadrature_points_per_direction
()
cols
=
basis_functions_per_direction
()
a_matrix
=
AMatrix
(
theta
,
rows
,
cols
)
# TODO: this is 2D only
a_matrices
=
(
a_matrix
,
a_matrix
)
# Do stage 1
...
...
@@ -51,7 +52,9 @@ def pymbolic_trialfunction(element, restriction, component):
insn_dep
=
frozenset
({
insn_dep
}),
)
return
p
.
Subscript
(
p
.
Variable
(
var
),
tuple
(
p
.
Variable
(
i
)
for
i
in
quadrature_inames
()))
return
prim
.
Subscript
(
prim
.
Variable
(
var
),
tuple
(
prim
.
Variable
(
i
)
for
i
in
quadrature_inames
())
)
@iname
...
...
@@ -78,10 +81,13 @@ def evaluate_basis(element, name, restriction):
inames
=
lfs_inames
(
element
,
restriction
)
assert
(
len
(
quad_inames
)
==
len
(
inames
))
instruction
(
expression
=
p
.
Product
(
tuple
(
p
.
Call
(
ColMajorAccess
(
theta
),
(
p
.
Variable
(
i
),
p
.
Variable
(
j
)))
for
(
i
,
j
)
in
zip
(
quad_inames
,
inames
))
),
assignee
=
p
.
Variable
(
name
),
instruction
(
expression
=
prim
.
Product
(
tuple
(
prim
.
Call
(
ColMajorAccess
(
theta
),
(
prim
.
Variable
(
i
),
prim
.
Variable
(
j
))
)
for
(
i
,
j
)
in
zip
(
quad_inames
,
inames
)
)
),
assignee
=
prim
.
Variable
(
name
),
forced_iname_deps
=
frozenset
(
quad_inames
+
inames
),
forced_iname_deps_is_final
=
True
,
)
...
...
@@ -95,4 +101,4 @@ def pymbolic_basis(element, restriction, number):
name
=
restricted_name
(
name
,
restriction
)
evaluate_basis
(
element
,
name
,
restriction
)
return
p
.
Variable
(
name
)
return
p
rim
.
Variable
(
name
)
This diff is collapsed.
Click to expand it.
python/dune/perftool/tools.py
+
5
−
5
View file @
a231da12
"""
Some grabbag tools
"""
import
pymbolic.primitives
as
p
import
pymbolic.primitives
as
p
rim
def
get_pymbolic_basename
(
expr
):
assert
isinstance
(
expr
,
p
.
Expression
),
"
Type: {}, expr: {}
"
.
format
(
type
(
expr
),
expr
)
assert
isinstance
(
expr
,
p
rim
.
Expression
),
"
Type: {}, expr: {}
"
.
format
(
type
(
expr
),
expr
)
if
isinstance
(
expr
,
p
.
Variable
):
if
isinstance
(
expr
,
p
rim
.
Variable
):
return
expr
.
name
if
isinstance
(
expr
,
p
.
Subscript
):
if
isinstance
(
expr
,
p
rim
.
Subscript
):
return
get_pymbolic_basename
(
expr
.
aggregate
)
raise
NotImplementedError
(
"
Cannot determine basename of {}
"
.
format
(
expr
))
def
get_pymbolic_indices
(
expr
):
if
not
isinstance
(
expr
,
p
.
Subscript
):
if
not
isinstance
(
expr
,
p
rim
.
Subscript
):
return
()
def
ind
(
i
):
...
...
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