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

Make Mesh.boundary_tag_bit complain if not called with a known boundary tag

parent 11826f48
No related branches found
No related tags found
No related merge requests found
......@@ -168,9 +168,9 @@ def make_face_restriction(discr, group_factory, boundary_tag,
:arg boundary_tag: The boundary tag for which to create a face
restriction. May be
:class:`meshmode.discretization.connection.FRESTR_INTERIOR_FACES`
:class:`FACE_RESTR_INTERIOR`
to indicate interior faces, or
:class:`meshmode.discretization.connection.FRESTR_ALL_FACES`
:class:`FACE_RESTR_ALL`
to make a discretization consisting of all (interior and
boundary) faces.
......@@ -199,7 +199,7 @@ def make_face_restriction(discr, group_factory, boundary_tag,
boundary_tag = FACE_RESTR_INTERIOR
from warnings import warn
warn("passing *None* for boundary_tag is deprecated--pass "
"FRESTR_INTERIOR_FACES instead",
"FACE_RESTR_INTERIOR instead",
DeprecationWarning, stacklevel=2)
logger.info("building face restriction: start")
......@@ -223,7 +223,8 @@ def make_face_restriction(discr, group_factory, boundary_tag,
bdry_mesh_groups = []
connection_data = {}
btag_bit = discr.mesh.boundary_tag_bit(boundary_tag)
if boundary_tag not in [FACE_RESTR_ALL, FACE_RESTR_INTERIOR]:
btag_bit = discr.mesh.boundary_tag_bit(boundary_tag)
for igrp, (grp, fagrp_map) in enumerate(
zip(discr.groups, discr.mesh.facial_adjacency_groups)):
......
......@@ -632,6 +632,11 @@ class Mesh(Record):
A mapping that maps boundary tag identifiers to their
corresponding index.
.. note::
Elements of :attr:`boundary_tags` that do not cover any
part of the boundary will not be keys in this dictionary.
.. attribute:: vertex_id_dtype
.. attribute:: element_id_dtype
......@@ -882,6 +887,12 @@ class Mesh(Record):
return self._facial_adjacency_groups
def boundary_tag_bit(self, boundary_tag):
if boundary_tag is BTAG_NONE:
return 0
if boundary_tag not in self.boundary_tags:
raise ValueError("boundary tag '%s' is not known" % boundary_tag)
try:
return 1 << self.btag_to_index[boundary_tag]
except KeyError:
......
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