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

Merge branch 'boundary-tag-bit-safer' into 'master'

Boundary tag bit safer

See merge request !77
parents 11826f48 755afb8c
No related branches found
No related tags found
1 merge request!77Boundary tag bit safer
Pipeline #24195 passed
......@@ -22,7 +22,7 @@ jobs:
- name: "Main Script"
run: |
curl -L -O -k https://gitlab.tiker.net/inducer/ci-support/raw/master/prepare-and-run-flake8.sh
. ./prepare-and-run-flake8.sh ./meshmode ./test
. ./prepare-and-run-flake8.sh "$(basename $GITHUB_REPOSITORY)" ./test
pytest2:
name: Pytest Conda Py2
......
......@@ -98,7 +98,7 @@ Documentation:
Flake8:
script:
- curl -L -O -k https://gitlab.tiker.net/inducer/ci-support/raw/master/prepare-and-run-flake8.sh
- ". ./prepare-and-run-flake8.sh meshmode test"
- . ./prepare-and-run-flake8.sh "$CI_PROJECT_NAME" test
tags:
- python3
except:
......
......@@ -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)):
......
......@@ -115,6 +115,9 @@ class BTAG_PARTITION(object): # noqa
def __ne__(self, other):
return not self.__eq__(other)
def __repr__(self):
return "<%s(%s)>" % (type(self).__name__, repr(self.part_nr))
SYSTEM_TAGS = set([BTAG_NONE, BTAG_ALL, BTAG_REALLY_ALL, BTAG_NO_BOUNDARY,
BTAG_PARTITION])
......@@ -632,6 +635,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 +890,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