Skip to content
Snippets Groups Projects
Commit 66aea308 authored by Andreas Klöckner's avatar Andreas Klöckner
Browse files

Implement PointsDiscretization abomination

parent 4d6b563e
No related branches found
No related tags found
No related merge requests found
......@@ -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
......@@ -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()'
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment