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

Delete some more unnecessary code in eager interface

parent 3f40665f
No related branches found
No related tags found
1 merge request!63Add eagerly evaluated interface to grudge, plus example
...@@ -23,7 +23,7 @@ THE SOFTWARE. ...@@ -23,7 +23,7 @@ THE SOFTWARE.
""" """
import numpy as np import numpy as np # noqa
from grudge.discretization import DGDiscretizationWithBoundaries from grudge.discretization import DGDiscretizationWithBoundaries
from pytools import memoize_method from pytools import memoize_method
from pytools.obj_array import ( from pytools.obj_array import (
...@@ -55,34 +55,6 @@ class EagerDGDiscretization(DGDiscretizationWithBoundaries): ...@@ -55,34 +55,6 @@ class EagerDGDiscretization(DGDiscretizationWithBoundaries):
def nodes(self): def nodes(self):
return self._volume_discr.nodes() return self._volume_discr.nodes()
@memoize_method
def parametrization_derivative(self):
with cl.CommandQueue(self.cl_context) as queue:
fmat = sym.forward_metric_derivative_mat(
self.ambient_dim, self.dim)
result = bind(self, fmat.reshape(-1))(queue)
return result.reshape(*fmat.shape)
@memoize_method
def vol_jacobian(self):
with cl.CommandQueue(self.cl_context) as queue:
[a, b], [c, d] = with_queue(queue, self.parametrization_derivative())
return (a*d-b*c).with_queue(None)
@memoize_method
def inverse_parametrization_derivative(self):
with cl.CommandQueue(self.cl_context) as queue:
[a, b], [c, d] = with_queue(queue, self.parametrization_derivative())
result = np.zeros((2, 2), dtype=object)
det = a*d-b*c
result[0, 0] = d/det
result[0, 1] = -b/det
result[1, 0] = -c/det
result[1, 1] = a/det
return without_queue(result)
@memoize_method @memoize_method
def _bound_grad(self): def _bound_grad(self):
return bind(self, sym.nabla(self.dim) * sym.Variable("u")) return bind(self, sym.nabla(self.dim) * sym.Variable("u"))
......
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