From 85f05a68cd5033d5a04a4954a9733db25b80d32e Mon Sep 17 00:00:00 2001 From: benSepanski <ben_sepanski@alumni.baylor.edu> Date: Wed, 12 Aug 2020 11:08:03 -0500 Subject: [PATCH] FromBdyFiredrakeConnection -> FromBoundaryFiredrakeConnection --- doc/interop.rst | 2 +- examples/from_firedrake.py | 12 +++++----- meshmode/interop/firedrake/__init__.py | 5 +++-- meshmode/interop/firedrake/connection.py | 10 ++++----- meshmode/interop/firedrake/mesh.py | 2 +- test/test_firedrake_interop.py | 28 +++++++++++++----------- 6 files changed, 31 insertions(+), 28 deletions(-) diff --git a/doc/interop.rst b/doc/interop.rst index 953fe015..0b737a73 100644 --- a/doc/interop.rst +++ b/doc/interop.rst @@ -14,7 +14,7 @@ Function Spaces/Discretizations Users wishing to interact with :mod:`meshmode` from :mod:`firedrake` will primarily interact with the :class:`~meshmode.interop.firedrake.connection.FromFiredrakeConnection` and -:class:`~meshmode.interop.firedrake.connection.FromBdyFiredrakeConnection` +:class:`~meshmode.interop.firedrake.connection.FromBoundaryFiredrakeConnection` classes, while users wishing to interact with :mod:`firedrake` from :mod:`meshmode` will use the :class:`~meshmode.interop.firedrake.connection.ToFiredrakeConnection` class. diff --git a/examples/from_firedrake.py b/examples/from_firedrake.py index ddc6108a..b3f99641 100644 --- a/examples/from_firedrake.py +++ b/examples/from_firedrake.py @@ -25,7 +25,7 @@ import pyopencl as cl # This example provides a brief template for bringing information in # from firedrake and makes some plots to help you better understand -# what a FromBdyFiredrakeConnection does +# what a FromBoundaryFiredrakeConnection does def main(): # If can't import firedrake, do nothing try: @@ -34,7 +34,7 @@ def main(): return 0 from meshmode.interop.firedrake import ( - FromFiredrakeConnection, FromBdyFiredrakeConnection) + FromFiredrakeConnection, FromBoundaryFiredrakeConnection) from firedrake import ( UnitSquareMesh, FunctionSpace, SpatialCoordinate, Function, cos ) @@ -52,7 +52,7 @@ def main(): actx = PyOpenCLArrayContext(queue) fd_connection = FromFiredrakeConnection(actx, fd_fspace) - fd_bdy_connection = FromBdyFiredrakeConnection(actx, + fd_bdy_connection = FromBoundaryFiredrakeConnection(actx, fd_fspace, 'on_boundary') @@ -66,7 +66,7 @@ def main(): draw_vertex_numbers=False, draw_element_numbers=False, set_bounding_box=True) - ax2.set_title("FromBdyFiredrakeConnection") + ax2.set_title("FromBoundaryFiredrakeConnection") plt.sca(ax2) draw_2d_mesh(fd_bdy_connection.discr.mesh, draw_vertex_numbers=False, @@ -85,14 +85,14 @@ def main(): ax1.set_title("cos(x+y) in\nFromFiredrakeConnection") vis.show_scalar_in_matplotlib_3d(field, do_show=False) - # Now repeat using FromBdyFiredrakeConnection + # Now repeat using FromBoundaryFiredrakeConnection bdy_discr = fd_bdy_connection.discr bdy_vis = make_visualizer(actx, bdy_discr, bdy_discr.groups[0].order+3) bdy_field = fd_bdy_connection.from_firedrake(fd_fntn, actx=actx) ax2 = fig.add_subplot(1, 2, 2, projection='3d') plt.sca(ax2) - ax2.set_title("cos(x+y) in\nFromBdyFiredrakeConnection") + ax2.set_title("cos(x+y) in\nFromBoundaryFiredrakeConnection") bdy_vis.show_scalar_in_matplotlib_3d(bdy_field, do_show=False) import matplotlib.cm as cm diff --git a/meshmode/interop/firedrake/__init__.py b/meshmode/interop/firedrake/__init__.py index 19581c84..f86d9de7 100644 --- a/meshmode/interop/firedrake/__init__.py +++ b/meshmode/interop/firedrake/__init__.py @@ -22,11 +22,12 @@ THE SOFTWARE. from meshmode.interop.firedrake.connection import ( - FromBdyFiredrakeConnection, FromFiredrakeConnection, ToFiredrakeConnection) + FromBoundaryFiredrakeConnection, FromFiredrakeConnection, + ToFiredrakeConnection) from meshmode.interop.firedrake.mesh import ( import_firedrake_mesh, export_mesh_to_firedrake) -__all__ = ["FromBdyFiredrakeConnection", "FromFiredrakeConnection", +__all__ = ["FromBoundaryFiredrakeConnection", "FromFiredrakeConnection", "ToFiredrakeConnection", "import_firedrake_mesh", "export_mesh_to_firedrake" ] diff --git a/meshmode/interop/firedrake/connection.py b/meshmode/interop/firedrake/connection.py index 085ef628..8c9b67f6 100644 --- a/meshmode/interop/firedrake/connection.py +++ b/meshmode/interop/firedrake/connection.py @@ -24,7 +24,7 @@ __doc__ = """ .. autoclass:: FiredrakeConnection :members: .. autoclass:: FromFiredrakeConnection -.. autoclass:: FromBdyFiredrakeConnection +.. autoclass:: FromBoundaryFiredrakeConnection .. autoclass:: ToFiredrakeConnection """ @@ -697,7 +697,7 @@ class FromFiredrakeConnection(FiredrakeConnection): except ImportError: grp_factory = InterpolatoryQuadratureSimplexGroupFactory(degree) - # In case this class is really a FromBdyFiredrakeConnection, + # In case this class is really a FromBoundaryFiredrakeConnection, # get *cells_to_use* cells_to_use = self._get_cells_to_use(fdrake_fspace.mesh()) # Create to_discr @@ -753,7 +753,7 @@ class FromFiredrakeConnection(FiredrakeConnection): return None -class FromBdyFiredrakeConnection(FromFiredrakeConnection): +class FromBoundaryFiredrakeConnection(FromFiredrakeConnection): """ A connection created from a :mod:`firedrake` ``"CG"`` or ``"DG"`` function space which creates a @@ -781,8 +781,8 @@ class FromBdyFiredrakeConnection(FromFiredrakeConnection): :class:`~meshmode.interop.firedrake.FromFiredrakeConnection`. """ self.bdy_id = bdy_id - super(FromBdyFiredrakeConnection, self).__init__(actx, fdrake_fspace, - grp_factory=grp_factory) + super(FromBoundaryFiredrakeConnection, self).__init__( + actx, fdrake_fspace, grp_factory=grp_factory) def _get_cells_to_use(self, mesh): """ diff --git a/meshmode/interop/firedrake/mesh.py b/meshmode/interop/firedrake/mesh.py index 6b2e30c2..e2df4dfa 100644 --- a/meshmode/interop/firedrake/mesh.py +++ b/meshmode/interop/firedrake/mesh.py @@ -477,7 +477,7 @@ def import_firedrake_mesh(fdrake_mesh, cells_to_use=None, instead of :class:`BTAG_ALL`. This argument is primarily intended for use by a - :class:`meshmode.interop.firedrake.FromBdyFiredrakeConnection`. + :class:`meshmode.interop.firedrake.FromBoundaryFiredrakeConnection`. :arg normals: **Only** used if *fdrake_mesh* is a 1-surface embedded in 2-space. In this case, diff --git a/test/test_firedrake_interop.py b/test/test_firedrake_interop.py index b50e0b47..552f68c9 100644 --- a/test/test_firedrake_interop.py +++ b/test/test_firedrake_interop.py @@ -39,8 +39,8 @@ from meshmode.dof_array import DOFArray from meshmode.mesh import BTAG_ALL, BTAG_REALLY_ALL, check_bc_coverage from meshmode.interop.firedrake import ( - FromFiredrakeConnection, FromBdyFiredrakeConnection, ToFiredrakeConnection, - import_firedrake_mesh) + FromFiredrakeConnection, FromBoundaryFiredrakeConnection, + ToFiredrakeConnection, import_firedrake_mesh) import pytest @@ -202,15 +202,15 @@ def test_to_fd_consistency(ctx_factory, mm_mesh, fspace_degree): # }}} -# {{{ Now check the FromBdyFiredrakeConnection consistency +# {{{ Now check the FromBoundaryFiredrakeConnection consistency def test_from_bdy_consistency(ctx_factory, fdrake_mesh, fdrake_family, fspace_degree): """ - Make basic checks that FiredrakeFromBdyConnection is not doing something - obviouisly wrong, i.e. that it has proper tagging, that it has + Make basic checks that FiredrakeFromBoundaryConnection is not doing + something obviously wrong, i.e. that it has proper tagging, that it has the right number of cells, etc. """ fdrake_fspace = FunctionSpace(fdrake_mesh, fdrake_family, fspace_degree) @@ -219,9 +219,9 @@ def test_from_bdy_consistency(ctx_factory, queue = cl.CommandQueue(cl_ctx) actx = PyOpenCLArrayContext(queue) - frombdy_conn = FromBdyFiredrakeConnection(actx, - fdrake_fspace, - "on_boundary") + frombdy_conn = FromBoundaryFiredrakeConnection(actx, + fdrake_fspace, + "on_boundary") # Ensure the meshmode mesh has one group and make sure both # meshes agree on some basic properties @@ -303,7 +303,7 @@ def test_bdy_tags(square_or_cube_mesh, bdy_ids, coord_indices, coord_values, cells_to_use = None if only_convert_bdy: # make a dummy connection which just has a bdy_id - class DummyConnection(FromBdyFiredrakeConnection): + class DummyConnection(FromBoundaryFiredrakeConnection): def __init__(self): self.bdy_id = 'on_boundary' cells_to_use = DummyConnection()._get_cells_to_use(square_or_cube_mesh) @@ -431,8 +431,9 @@ def test_from_fd_transfer(ctx_factory, fspace_degree, # make function space and build connection fdrake_fspace = FunctionSpace(fdrake_mesh, fdrake_family, fspace_degree) if only_convert_bdy: - fdrake_connection = FromBdyFiredrakeConnection(actx, fdrake_fspace, - 'on_boundary') + fdrake_connection = FromBoundaryFiredrakeConnection(actx, + fdrake_fspace, + 'on_boundary') else: fdrake_connection = FromFiredrakeConnection(actx, fdrake_fspace) # get this for making functions in firedrake @@ -598,8 +599,9 @@ def test_from_fd_idempotency(ctx_factory, # # Otherwise, just continue as normal if only_convert_bdy: - fdrake_connection = FromBdyFiredrakeConnection(actx, fdrake_fspace, - 'on_boundary') + fdrake_connection = FromBoundaryFiredrakeConnection(actx, + fdrake_fspace, + 'on_boundary') temp = fdrake_connection.from_firedrake(fdrake_unique, actx=actx) fdrake_unique = \ fdrake_connection.from_meshmode(temp, -- GitLab