From bf29a3491ba310c40d7e452cbe8474fb731ef1bf Mon Sep 17 00:00:00 2001 From: "[6~" Date: Sun, 17 May 2020 13:43:25 -0500 Subject: [PATCH 1/4] Make Mesh.boundary_tag_bit complain if not called with a known boundary tag --- meshmode/discretization/connection/face.py | 9 +++++---- meshmode/mesh/__init__.py | 11 +++++++++++ 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/meshmode/discretization/connection/face.py b/meshmode/discretization/connection/face.py index a0d4e71e..f45a95c1 100644 --- a/meshmode/discretization/connection/face.py +++ b/meshmode/discretization/connection/face.py @@ -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)): diff --git a/meshmode/mesh/__init__.py b/meshmode/mesh/__init__.py index 95416568..2625515c 100644 --- a/meshmode/mesh/__init__.py +++ b/meshmode/mesh/__init__.py @@ -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: -- GitLab From daebb6c66872a1cfe72bd45d03475d9d315477c1 Mon Sep 17 00:00:00 2001 From: "[6~" Date: Sun, 17 May 2020 14:01:15 -0500 Subject: [PATCH 2/4] Add BTAG_PARTITION.__repr__ --- meshmode/mesh/__init__.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/meshmode/mesh/__init__.py b/meshmode/mesh/__init__.py index 2625515c..19ef8e5d 100644 --- a/meshmode/mesh/__init__.py +++ b/meshmode/mesh/__init__.py @@ -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]) -- GitLab From 66898b28eb408ef7fb1f6c3e2d8acbc3798caa31 Mon Sep 17 00:00:00 2001 From: "[6~" Date: Sun, 17 May 2020 14:16:33 -0500 Subject: [PATCH 3/4] Use CI env var in flake8 invocation in Gitlab CI --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 36093e8a..34ebe33a 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -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: -- GitLab From 755afb8c68264666e5231537a87ca8f818877d62 Mon Sep 17 00:00:00 2001 From: "[6~" Date: Sun, 17 May 2020 14:16:36 -0500 Subject: [PATCH 4/4] Use CI env var in flake8 invocation in Github CI --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bd539266..01e2cbfc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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 -- GitLab