From 4094cad8a7911fd74115dce2574b8302bbee0c33 Mon Sep 17 00:00:00 2001
From: Andreas Kloeckner <inform@tiker.net>
Date: Sat, 4 Nov 2017 19:15:44 -0500
Subject: [PATCH] Rename FRESTR symbols to something more self-explanatory
 (thanks @eshoag2)

---
 .../discretization/connection/__init__.py     |  8 ++++----
 meshmode/discretization/connection/face.py    | 20 +++++++++++--------
 test/test_meshmode.py                         | 12 +++++------
 3 files changed, 22 insertions(+), 18 deletions(-)

diff --git a/meshmode/discretization/connection/__init__.py b/meshmode/discretization/connection/__init__.py
index 8e217d13..42a2a41b 100644
--- a/meshmode/discretization/connection/__init__.py
+++ b/meshmode/discretization/connection/__init__.py
@@ -32,7 +32,7 @@ from pytools import memoize_method, memoize_in
 from meshmode.discretization.connection.same_mesh import \
         make_same_mesh_connection
 from meshmode.discretization.connection.face import (
-        FRESTR_INTERIOR_FACES, FRESTR_ALL_FACES,
+        FACE_RESTR_INTERIOR, FACE_RESTR_ALL,
         make_face_restriction, make_face_to_all_faces_embedding)
 from meshmode.discretization.connection.opposite_face import \
         make_opposite_face_connection
@@ -47,7 +47,7 @@ logger = logging.getLogger(__name__)
 __all__ = [
         "DiscretizationConnection",
         "make_same_mesh_connection",
-        "FRESTR_INTERIOR_FACES", "FRESTR_ALL_FACES",
+        "FACE_RESTR_INTERIOR", "FACE_RESTR_ALL",
         "make_face_restriction",
         "make_face_to_all_faces_embedding",
         "make_opposite_face_connection",
@@ -60,8 +60,8 @@ __doc__ = """
 
 .. autofunction:: make_same_mesh_connection
 
-.. autofunction:: FRESTR_INTERIOR_FACES
-.. autofunction:: FRESTR_ALL_FACES
+.. autofunction:: FACE_RESTR_INTERIOR
+.. autofunction:: FACE_RESTR_ALL
 .. autofunction:: make_face_restriction
 .. autofunction:: make_face_to_all_faces_embedding
 
diff --git a/meshmode/discretization/connection/face.py b/meshmode/discretization/connection/face.py
index 680d0686..d581c701 100644
--- a/meshmode/discretization/connection/face.py
+++ b/meshmode/discretization/connection/face.py
@@ -36,7 +36,7 @@ import logging
 logger = logging.getLogger(__name__)
 
 
-class FRESTR_INTERIOR_FACES:  # noqa
+class FACE_RESTR_INTERIOR:  # noqa
     """A special value to pass to
     :func:`meshmode.discretization.connection.make_face_restriction`
     to produce a discretization consisting of all interior faces
@@ -44,13 +44,17 @@ class FRESTR_INTERIOR_FACES:  # noqa
     """
 
 
-class FRESTR_ALL_FACES:  # noqa
+class FACE_RESTR_ALL:  # noqa
     """A special value to pass to
     :func:`meshmode.discretization.connection.make_face_restriction`
     to produce a discretization consisting of all faces (interior and boundary)
     faces in a discretization.
     """
 
+# deprecated names for compatibility
+FRESTR_ALL_FACES = FACE_RESTR_ALL
+FRESTR_INTERIOR_FACES = FACE_RESTR_INTERIOR
+
 
 # {{{ boundary connection
 
@@ -118,7 +122,7 @@ def _get_face_vertices(mesh, boundary_tag):
     # a set of volume vertex numbers
     bdry_vertex_vol_nrs = set()
 
-    if boundary_tag not in [FRESTR_INTERIOR_FACES, FRESTR_ALL_FACES]:
+    if boundary_tag not in [FACE_RESTR_INTERIOR, FACE_RESTR_ALL]:
         # {{{ boundary faces
 
         btag_bit = mesh.boundary_tag_bit(boundary_tag)
@@ -191,7 +195,7 @@ def make_face_restriction(discr, group_factory, boundary_tag,
     """
 
     if boundary_tag is None:
-        boundary_tag = FRESTR_INTERIOR_FACES
+        boundary_tag = FACE_RESTR_INTERIOR
         from warnings import warn
         warn("passing *None* for boundary_tag is deprecated--pass "
                 "INTERIOR_FACES instead",
@@ -233,7 +237,7 @@ def make_face_restriction(discr, group_factory, boundary_tag,
 
         group_boundary_faces = []
 
-        if boundary_tag is FRESTR_INTERIOR_FACES:
+        if boundary_tag is FACE_RESTR_INTERIOR:
             for fagrp in six.itervalues(fagrp_map):
                 if fagrp.ineighbor_group is None:
                     # boundary faces -> not looking for those
@@ -242,7 +246,7 @@ def make_face_restriction(discr, group_factory, boundary_tag,
                 group_boundary_faces.extend(
                         zip(fagrp.elements, fagrp.element_faces))
 
-        elif boundary_tag is FRESTR_ALL_FACES:
+        elif boundary_tag is FACE_RESTR_ALL:
             group_boundary_faces.extend(
                     (iel, iface)
                     for iface in range(grp.mesh_el_group.nfaces)
@@ -392,12 +396,12 @@ def make_face_to_all_faces_embedding(faces_connection, all_faces_discr):
     :arg faces_connection: must be the (connection) result of calling
         :func:`meshmode.discretization.connection.make_face_restriction`
         with
-        :class:`meshmode.discretization.connection.FRESTR_INTERIOR_FACES`
+        :class:`meshmode.discretization.connection.FACE_RESTR_INTERIOR`
         or a boundary tag.
     :arg all_faces_discr: must be the (discretization) result of calling
         :func:`meshmode.discretization.connection.make_face_restriction`
         with
-        :class:`meshmode.discretization.connection.FRESTR_ALL_FACES`
+        :class:`meshmode.discretization.connection.FACE_RESTR_ALL`
         for the same volume discretization as the one from which
         *faces_discr* was obtained.
     """
diff --git a/test/test_meshmode.py b/test/test_meshmode.py
index c8e28228..2cb0470a 100644
--- a/test/test_meshmode.py
+++ b/test/test_meshmode.py
@@ -40,7 +40,7 @@ from meshmode.discretization.poly_element import (
         )
 from meshmode.mesh import BTAG_ALL
 from meshmode.discretization.connection import \
-        FRESTR_ALL_FACES, FRESTR_INTERIOR_FACES
+        FACE_RESTR_ALL, FACE_RESTR_INTERIOR
 import meshmode.mesh.generation as mgen
 
 import pytest
@@ -133,8 +133,8 @@ def test_circle_mesh(do_plot=False):
     ])
 @pytest.mark.parametrize("boundary_tag", [
     BTAG_ALL,
-    FRESTR_ALL_FACES,
-    FRESTR_INTERIOR_FACES,
+    FACE_RESTR_ALL,
+    FACE_RESTR_INTERIOR,
     ])
 @pytest.mark.parametrize(("mesh_name", "dim", "mesh_pars"), [
     ("blob", 2, [1e-1, 8e-2, 5e-2]),
@@ -282,7 +282,7 @@ def test_all_faces_interpolation(ctx_getter, mesh_name, dim, mesh_pars,
 
         all_face_bdry_connection = make_face_restriction(
                 vol_discr, PolynomialWarpAndBlendGroupFactory(order),
-                FRESTR_ALL_FACES, per_face_groups=per_face_groups)
+                FACE_RESTR_ALL, per_face_groups=per_face_groups)
         all_face_bdry_discr = all_face_bdry_connection.to_discr
 
         for ito_grp, ceg in enumerate(all_face_bdry_connection.groups):
@@ -303,7 +303,7 @@ def test_all_faces_interpolation(ctx_getter, mesh_name, dim, mesh_pars,
 
         for boundary_tag in [
                 BTAG_ALL,
-                FRESTR_INTERIOR_FACES,
+                FACE_RESTR_INTERIOR,
                 ]:
             bdry_connection = make_face_restriction(
                     vol_discr, PolynomialWarpAndBlendGroupFactory(order),
@@ -396,7 +396,7 @@ def test_opposite_face_interpolation(ctx_getter, group_factory,
 
         bdry_connection = make_face_restriction(
                 vol_discr, group_factory(order),
-                FRESTR_INTERIOR_FACES)
+                FACE_RESTR_INTERIOR)
         bdry_discr = bdry_connection.to_discr
 
         opp_face = make_opposite_face_connection(bdry_connection)
-- 
GitLab