From 4ce83cb1a1d3d2e9dab1289917721b87dbbe1914 Mon Sep 17 00:00:00 2001 From: Thomas Gibson Date: Thu, 29 Apr 2021 10:13:22 -0500 Subject: [PATCH] Set QTAG_NONE=DISCR_TAG_BASE and call it a day --- grudge/discretization.py | 40 +------------------------- grudge/dof_desc.py | 14 +++++---- grudge/op.py | 16 ----------- grudge/symbolic/dofdesc_inference.py | 21 ++------------ grudge/symbolic/mappers/__init__.py | 8 ------ grudge/symbolic/operators.py | 43 ---------------------------- 6 files changed, 13 insertions(+), 129 deletions(-) diff --git a/grudge/discretization.py b/grudge/discretization.py index 16e3dbb3..02f835b8 100644 --- a/grudge/discretization.py +++ b/grudge/discretization.py @@ -23,9 +23,7 @@ THE SOFTWARE. from pytools import memoize_method from grudge.dof_desc import ( DISCR_TAG_BASE, DISCR_TAG_MODAL, - DTAG_BOUNDARY, DOFDesc, as_dofdesc, - # importing so we can yell at the user for using it - QTAG_NONE + DTAG_BOUNDARY, DOFDesc, as_dofdesc ) import numpy as np # noqa: F401 from meshmode.array_context import ArrayContext @@ -89,14 +87,6 @@ class DiscretizationCollection: quad_tag_to_group_factory[DISCR_TAG_BASE] = \ PolynomialWarpAndBlendGroupFactory(order=order) - # FIXME: QTAG_NONE hunting - if QTAG_NONE in quad_tag_to_group_factory: - warn("`DOFDesc.QTAG_NONE` is deprecated and will be dropped " - "in version 2022.x. Use `DOFDesc.DISCR_TAG_BASE` instead.", - DeprecationWarning, stacklevel=2) - quad_tag_to_group_factory[DISCR_TAG_BASE] = \ - quad_tag_to_group_factory[QTAG_NONE] - # Modal discr should always comes from the base discretization quad_tag_to_group_factory[DISCR_TAG_MODAL] = \ _generate_modal_group_factory( @@ -183,13 +173,6 @@ class DiscretizationCollection: def discr_from_dd(self, dd): dd = as_dofdesc(dd) - # FIXME: QTAG_NONE hunting - if dd.discretization_tag is QTAG_NONE: - warn("`DOFDesc.QTAG_NONE` is deprecated and will be dropped " - "in version 2022.x. Use `DOFDesc.DISCR_TAG_BASE` instead.", - DeprecationWarning, stacklevel=2) - dd = dd.with_discr_tag(DISCR_TAG_BASE) - discr_tag = dd.discretization_tag if discr_tag is DISCR_TAG_MODAL: @@ -225,20 +208,6 @@ class DiscretizationCollection: from_dd = as_dofdesc(from_dd) to_dd = as_dofdesc(to_dd) - # FIXME: QTAG_NONE hunting - if to_dd.discretization_tag is QTAG_NONE: - warn("`DOFDesc.QTAG_NONE` is deprecated and will be dropped " - "in version 2022.x. Use `DOFDesc.DISCR_TAG_BASE` instead.", - DeprecationWarning, stacklevel=2) - to_dd = to_dd.with_discr_tag(DISCR_TAG_BASE) - - # FIXME: QTAG_NONE hunting - if from_dd.discretization_tag is QTAG_NONE: - warn("`DOFDesc.QTAG_NONE` is deprecated and will be dropped " - "in version 2022.x. Use `DOFDesc.DISCR_TAG_BASE` instead.", - DeprecationWarning, stacklevel=2) - from_dd = from_dd.with_discr_tag(DISCR_TAG_BASE) - to_discr_tag = to_dd.discretization_tag from_discr_tag = from_dd.discretization_tag @@ -345,13 +314,6 @@ class DiscretizationCollection: """ OK to override in user code to control mode/node choice. """ - # FIXME: QTAG_NONE hunting - if discretization_tag is QTAG_NONE: - warn("`DOFDesc.QTAG_NONE` is deprecated and will be dropped " - "in version 2022.x. Use `DOFDesc.DISCR_TAG_BASE` instead.", - DeprecationWarning, stacklevel=2) - discretization_tag = DISCR_TAG_BASE - if discretization_tag is None: discretization_tag = DISCR_TAG_BASE diff --git a/grudge/dof_desc.py b/grudge/dof_desc.py index de02eb66..13db8e80 100644 --- a/grudge/dof_desc.py +++ b/grudge/dof_desc.py @@ -108,11 +108,6 @@ class DISCR_TAG_BASE: # noqa: N801 """ -# FIXME: This is deprecated and will be removed -class QTAG_NONE: # noqa: N801 - pass - - class DISCR_TAG_QUAD: # noqa: N801 """A discretization tag indicating the use of a quadrature discretization grid. This tag is used @@ -309,4 +304,13 @@ def as_dofdesc(dd): # }}} +# {{{ Deprecated tags + +# FIXME: These are deprecated and will be removed +QTAG_NONE = DISCR_TAG_BASE +QTAG_MODAL = DISCR_TAG_MODAL + +# }}} + + # vim: foldmethod=marker diff --git a/grudge/op.py b/grudge/op.py index d0b5bc2d..8272459b 100644 --- a/grudge/op.py +++ b/grudge/op.py @@ -62,8 +62,6 @@ from meshmode.dof_array import freeze, flatten, unflatten from grudge.symbolic.primitives import TracePair -from warnings import warn - # def interp(dcoll, src, tgt, vec): # from warnings import warn @@ -85,20 +83,6 @@ def project(dcoll, src, tgt, vec): src = dof_desc.as_dofdesc(src) tgt = dof_desc.as_dofdesc(tgt) - # FIXME: QTAG_NONE hunting - if src.discretization_tag is dof_desc.QTAG_NONE: - warn("`DOFDesc.QTAG_NONE` is deprecated and will be dropped " - "in version 2022.x. Use `DOFDesc.DISCR_TAG_BASE` instead.", - DeprecationWarning, stacklevel=2) - src = src.with_discr_tag(dof_desc.DISCR_TAG_BASE) - - # FIXME: QTAG_NONE hunting - if tgt.discretization_tag is dof_desc.QTAG_NONE: - warn("`DOFDesc.QTAG_NONE` is deprecated and will be dropped " - "in version 2022.x. Use `DOFDesc.DISCR_TAG_BASE` instead.", - DeprecationWarning, stacklevel=2) - tgt = tgt.with_discr_tag(dof_desc.DISCR_TAG_BASE) - if src == tgt: return vec diff --git a/grudge/symbolic/dofdesc_inference.py b/grudge/symbolic/dofdesc_inference.py index c3246d79..894a9bfc 100644 --- a/grudge/symbolic/dofdesc_inference.py +++ b/grudge/symbolic/dofdesc_inference.py @@ -26,8 +26,7 @@ THE SOFTWARE. from pymbolic.mapper import RecursiveMapper, CSECachingMapperMixin -from grudge.dof_desc import DOFDesc, DTAG_SCALAR, QTAG_NONE, DISCR_TAG_BASE -from warnings import warn +from grudge.dof_desc import DOFDesc, DTAG_SCALAR def unify_dofdescs(dd_a, dd_b, expr=None): @@ -48,23 +47,9 @@ def unify_dofdescs(dd_a, dd_b, expr=None): else: raise ValueError("mismatched domain tags " + loc_str) - # FIXME: QTAG_NONE hunting - if dd_a.discretization_tag is QTAG_NONE: - warn("`DOFDesc.QTAG_NONE` is deprecated and will be dropped " - "in version 2022.x. Use `DOFDesc.DISCR_TAG_BASE` instead.", - DeprecationWarning, stacklevel=2) - dd_a = dd_a.with_discr_tag(DISCR_TAG_BASE) - - # FIXME: QTAG_NONE hunting - if dd_b.discretization_tag is QTAG_NONE: - warn("`DOFDesc.QTAG_NONE` is deprecated and will be dropped " - "in version 2022.x. Use `DOFDesc.DISCR_TAG_BASE` instead.", - DeprecationWarning, stacklevel=2) - dd_b = dd_b.with_discr_tag(DISCR_TAG_BASE) - # domain tags match - if dd_a.quadrature_tag != dd_b.quadrature_tag: - raise ValueError("mismatched quadrature tags " + loc_str) + if dd_a.discretization_tag != dd_b.discretization_tag: + raise ValueError("mismatched discretization tags " + loc_str) return dd_a diff --git a/grudge/symbolic/mappers/__init__.py b/grudge/symbolic/mappers/__init__.py index a585a4f6..3ccbaea7 100644 --- a/grudge/symbolic/mappers/__init__.py +++ b/grudge/symbolic/mappers/__init__.py @@ -878,14 +878,6 @@ class QuadratureCheckerAndRemover(CSECachingMapperMixin, IdentityMapper): def _process_dd(self, dd, location_descr): - # FIXME: QTAG_NONE hunting - if dd.discretization_tag is dof_desc.QTAG_NONE: - from warnings import warn - warn("`DOFDesc.QTAG_NONE` is deprecated and will be dropped " - "in version 2022.x. Use `DOFDesc.DISCR_TAG_BASE` instead.", - DeprecationWarning, stacklevel=2) - dd = dd.with_discr_tag(dof_desc.DISCR_TAG_BASE) - if dd.discretization_tag is not dof_desc.DISCR_TAG_BASE: if dd.discretization_tag not in self.quad_tag_to_group_factory: raise ValueError("found unknown quadrature tag '%s' in '%s'" diff --git a/grudge/symbolic/operators.py b/grudge/symbolic/operators.py index 5123d3ff..1ca25c8b 100644 --- a/grudge/symbolic/operators.py +++ b/grudge/symbolic/operators.py @@ -26,7 +26,6 @@ import numpy as np import pymbolic.primitives from typing import Tuple -from warnings import warn __doc__ = """ @@ -108,20 +107,6 @@ class Operator(pymbolic.primitives.Expression): dd_in = dof_desc.as_dofdesc(dd_in) dd_out = dof_desc.as_dofdesc(dd_out) - # FIXME: QTAG_NONE hunting - if dd_in.discretization_tag is dof_desc.QTAG_NONE: - warn("`DOFDesc.QTAG_NONE` is deprecated and will be dropped " - "in version 2022.x. Use `DOFDesc.DISCR_TAG_BASE` instead.", - DeprecationWarning, stacklevel=2) - dd_in = dd_in.with_discr_tag(dof_desc.DISCR_TAG_BASE) - - # FIXME: QTAG_NONE hunting - if dd_out.discretization_tag is dof_desc.QTAG_NONE: - warn("`DOFDesc.QTAG_NONE` is deprecated and will be dropped " - "in version 2022.x. Use `DOFDesc.DISCR_TAG_BASE` instead.", - DeprecationWarning, stacklevel=2) - dd_out = dd_out.with_discr_tag(dof_desc.DISCR_TAG_BASE) - self.dd_in = dd_in self.dd_out = dd_out @@ -785,13 +770,6 @@ def integral(arg, dd=None): dd = dof_desc.DD_VOLUME dd = dof_desc.as_dofdesc(dd) - # FIXME: QTAG_NONE hunting - if dd.discretization_tag is dof_desc.QTAG_NONE: - warn("`DOFDesc.QTAG_NONE` is deprecated and will be dropped " - "in version 2022.x. Use `DOFDesc.DISCR_TAG_BASE` instead.", - DeprecationWarning, stacklevel=2) - dd = dd.with_discr_tag(dof_desc.DISCR_TAG_BASE) - return NodalSum(dd)( arg * prim.cse( MassOperator(dd_in=dd, dd_out=dd)(prim.Ones(dd)), @@ -810,13 +788,6 @@ def norm(p, arg, dd=None): dd = dof_desc.DD_VOLUME dd = dof_desc.as_dofdesc(dd) - # FIXME: QTAG_NONE hunting - if dd.discretization_tag is dof_desc.QTAG_NONE: - warn("`DOFDesc.QTAG_NONE` is deprecated and will be dropped " - "in version 2022.x. Use `DOFDesc.DISCR_TAG_BASE` instead.", - DeprecationWarning, stacklevel=2) - dd = dd.with_discr_tag(dof_desc.DISCR_TAG_BASE) - if p == 2: norm_squared = NodalSum(dd_in=dd)( arg * MassOperator()(arg)) @@ -858,13 +829,6 @@ def h_max_from_volume(ambient_dim, dim=None, dd=None): dd = dof_desc.DD_VOLUME dd = dof_desc.as_dofdesc(dd) - # FIXME: QTAG_NONE hunting - if dd.discretization_tag is dof_desc.QTAG_NONE: - warn("`DOFDesc.QTAG_NONE` is deprecated and will be dropped " - "in version 2022.x. Use `DOFDesc.DISCR_TAG_BASE` instead.", - DeprecationWarning, stacklevel=2) - dd = dd.with_discr_tag(dof_desc.DISCR_TAG_BASE) - if dim is None: dim = ambient_dim @@ -888,13 +852,6 @@ def h_min_from_volume(ambient_dim, dim=None, dd=None): dd = dof_desc.DD_VOLUME dd = dof_desc.as_dofdesc(dd) - # FIXME: QTAG_NONE hunting - if dd.discretization_tag is dof_desc.QTAG_NONE: - warn("`DOFDesc.QTAG_NONE` is deprecated and will be dropped " - "in version 2022.x. Use `DOFDesc.DISCR_TAG_BASE` instead.", - DeprecationWarning, stacklevel=2) - dd = dd.with_discr_tag(dof_desc.DISCR_TAG_BASE) - if dim is None: dim = ambient_dim -- GitLab