From 8684c143da30ea0696960e901ebfa7f585e457e1 Mon Sep 17 00:00:00 2001 From: Andreas Kloeckner <inform@tiker.net> Date: Mon, 4 Jan 2016 00:12:19 -0600 Subject: [PATCH] make_face_restriction: Only return connection, not also mesh and discr --- meshmode/discretization/connection/face.py | 27 ++++++++++++++++++---- test/test_meshmode.py | 14 +++++++---- 2 files changed, 32 insertions(+), 9 deletions(-) diff --git a/meshmode/discretization/connection/face.py b/meshmode/discretization/connection/face.py index 521dd056..f03b5d8a 100644 --- a/meshmode/discretization/connection/face.py +++ b/meshmode/discretization/connection/face.py @@ -135,9 +135,28 @@ def make_face_restriction(discr, group_factory, boundary_tag): denoted by *boundary_tag*. :arg boundary_tag: The boundary tag for which to create a face - restriction. May be *None* to indicate interior faces. - - :return: a tuple ``(bdry_mesh, bdry_discr, connection)`` + restriction. May be + :class:`meshmode.discretization.connection.INTERIOR_FACES` + to indicate interior faces, or + :class:`meshmode.discretization.connection.ALL_FACES` + to make a discretization consisting of all (interior and + boundary) faces. + + :return: a :class:`meshmode.discretization.connection.DiscretizationConnection` + representing the new connection. The new boundary discretization can be + obtained from the + :attr:`meshmode.discretization.connection.DiscretizationConnection.to_discr` + attribute of the return value, and the corresponding new boundary mesh + from that. + + The resulting discretization is guaranteed to have groups + organized as:: + + (grp0, face0), (grp0, face1), ... (grp0, faceN), + (grp1, face0), (grp1, face1), ... (grp1, faceN), ... + + each with the elements in the same order as the originating + group. """ logger.info("building face restriction: start") @@ -302,7 +321,7 @@ def make_face_restriction(discr, group_factory, boundary_tag): logger.info("building face restriction: done") - return bdry_mesh, bdry_discr, connection + return connection # }}} diff --git a/test/test_meshmode.py b/test/test_meshmode.py index a099fe3c..03a6661d 100644 --- a/test/test_meshmode.py +++ b/test/test_meshmode.py @@ -139,9 +139,10 @@ def test_boundary_interpolation(ctx_getter, group_factory, boundary_tag, x = vol_discr.nodes()[0].with_queue(queue) vol_f = f(x) - bdry_mesh, bdry_discr, bdry_connection = make_face_restriction( + bdry_connection = make_face_restriction( vol_discr, group_factory(order), boundary_tag) + bdry_discr = bdry_connection.to_discr bdry_x = bdry_discr.nodes()[0].with_queue(queue) bdry_f = f(bdry_x) @@ -222,9 +223,10 @@ def test_opposite_face_interpolation(ctx_getter, group_factory, print("h=%s -> %d elements" % ( h, sum(mgrp.nelements for mgrp in mesh.groups))) - bdry_mesh, bdry_discr, bdry_connection = make_face_restriction( + bdry_connection = make_face_restriction( vol_discr, group_factory(order), - None) + FRESTR_INTERIOR_FACES) + bdry_discr = bdry_connection.to_discr opp_face = make_opposite_face_connection(bdry_connection) @@ -365,9 +367,10 @@ def test_sanity_single_element(ctx_getter, dim, order, visualize=False): # {{{ boundary discretization from meshmode.discretization.connection import make_face_restriction - bdry_mesh, bdry_discr, bdry_connection = make_face_restriction( + bdry_connection = make_face_restriction( vol_discr, PolynomialWarpAndBlendGroupFactory(order + 3), BTAG_ALL) + bdry_discr = bdry_connection.to_discr # }}} @@ -441,10 +444,11 @@ def test_sanity_balls(ctx_getter, src_file, dim, mesh_order, InterpolatoryQuadratureSimplexGroupFactory(quad_order)) from meshmode.discretization.connection import make_face_restriction - bdry_mesh, bdry_discr, bdry_connection = make_face_restriction( + bdry_connection = make_face_restriction( vol_discr, InterpolatoryQuadratureSimplexGroupFactory(quad_order), BTAG_ALL) + bdry_discr = bdry_connection.to_discr # }}} -- GitLab