Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
grudge
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
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
Matt Wala
grudge
Commits
66aea308
Commit
66aea308
authored
7 years ago
by
Andreas Klöckner
Browse files
Options
Downloads
Patches
Plain Diff
Implement PointsDiscretization abomination
parent
4d6b563e
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
grudge/discretization.py
+32
-1
32 additions, 1 deletion
grudge/discretization.py
test/test_grudge.py
+16
-0
16 additions, 0 deletions
test/test_grudge.py
with
48 additions
and
1 deletion
grudge/discretization.py
+
32
−
1
View file @
66aea308
...
...
@@ -27,7 +27,11 @@ from pytools import memoize_method
from
grudge
import
sym
class
Discretization
(
object
):
class
DiscretizationBase
(
object
):
pass
class
Discretization
(
DiscretizationBase
):
"""
.. attribute :: volume_discr
...
...
@@ -220,4 +224,31 @@ class Discretization(object):
or
where
==
sym
.
VTAG_ALL
)
class
PointsDiscretization
(
DiscretizationBase
):
"""
Implements just enough of the discretization interface to be
able to smuggle some points into :func:`bind`.
"""
def
__init__
(
self
,
nodes
):
self
.
_nodes
=
nodes
def
ambient_dim
(
self
):
return
self
.
_nodes
.
shape
[
0
]
@property
def
mesh
(
self
):
return
self
@property
def
nnodes
(
self
):
return
self
.
_nodes
.
shape
[
-
1
]
def
nodes
(
self
):
return
self
.
_nodes
@property
def
volume_discr
(
self
):
return
self
# vim: foldmethod=marker
This diff is collapsed.
Click to expand it.
test/test_grudge.py
+
16
−
0
View file @
66aea308
...
...
@@ -333,6 +333,22 @@ def test_convergence_advec(ctx_factory, mesh_name, mesh_pars, op_type, flux_type
assert
eoc_rec
.
order_estimate
()
>
order
def
test_foreign_points
(
ctx_factory
):
pytest
.
importorskip
(
"
sumpy
"
)
import
sumpy.point_calculus
as
pc
cl_ctx
=
cl
.
create_some_context
()
queue
=
cl
.
CommandQueue
(
cl_ctx
)
dim
=
2
cp
=
pc
.
CalculusPatch
(
np
.
zeros
(
dim
))
from
grudge.discretization
import
PointsDiscretization
pdiscr
=
PointsDiscretization
(
cl
.
array
.
to_device
(
queue
,
cp
.
points
))
bind
(
pdiscr
,
sym
.
nodes
(
dim
)
**
2
)(
queue
)
# You can test individual routines by typing
# $ python test_grudge.py 'test_routine()'
...
...
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