From 4cfcd034fb223f3be017bf6541573b7e56516d21 Mon Sep 17 00:00:00 2001 From: FabianL1908 Date: Thu, 11 Jun 2020 00:21:10 +0100 Subject: [PATCH] Lint fixes --- FIAT/check_format_variant.py | 2 +- FIAT/functional.py | 91 ------------------------------------ FIAT/nedelec_second_kind.py | 3 -- 3 files changed, 1 insertion(+), 95 deletions(-) diff --git a/FIAT/check_format_variant.py b/FIAT/check_format_variant.py index 7fd0a99f..5aeb40e6 100644 --- a/FIAT/check_format_variant.py +++ b/FIAT/check_format_variant.py @@ -19,7 +19,7 @@ def check_format_variant(variant, degree, element): # quadrature is so high to ensure that the interpolant of curl/divergence-free functions is still curl/divergence-free quad_deg = 5 * (degree + 1) variant = "integral" - elif re.match('^integral\(\d+\)$', variant): + elif re.match(r'^integral\(\d+\)$', variant): quad_deg = int(''.join(filter(str.isdigit, variant))) if quad_deg < degree + 1: raise ValueError("Warning, quadrature degree should be at least %s" % (degree + 1)) diff --git a/FIAT/functional.py b/FIAT/functional.py index fcdbcb9f..3a54b5eb 100644 --- a/FIAT/functional.py +++ b/FIAT/functional.py @@ -388,29 +388,6 @@ def tostr(self): return "(u.t)(%s)" % (','.join(x),) -class IntegralMomentOfEdgeTangentEvaluation(Functional): - r""" - \int_e v\cdot t ds - - p \in Polynomials - - :arg ref_el: reference element for which e is a dim-1 entity - :arg Q: quadrature rule on the face - :arg P_at_qpts: polynomials evaluated at quad points - :arg edge: which edge. - """ - def __init__(self, ref_el, Q, P_at_qpts, edge): - t = ref_el.compute_edge_tangent(edge) - sd = ref_el.get_spatial_dimension() - transform = ref_el.get_entity_transform(1, edge) - pts = tuple(map(lambda p: tuple(transform(p)), Q.get_points())) - weights = Q.get_weights() - pt_dict = OrderedDict() - for pt, wgt, phi in zip(pts, weights, P_at_qpts): - pt_dict[pt] = [(wgt*phi*t[i], (i, )) for i in range(sd)] - super().__init__(ref_el, (sd, ), pt_dict, {}, "IntegralMomentOfEdgeTangentEvaluation") - - class IntegralMomentOfEdgeTangentEvaluation(Functional): r""" \int_e v\cdot t p ds @@ -452,18 +429,6 @@ def tostr(self): return "(u.t%d)(%s)" % (self.tno, ','.join(x),) -class MonkIntegralMoment(Functional): - def __init__(self, ref_el, Q, P_at_qpts, facet): - sd = ref_el.get_spatial_dimension() - weights = Q.get_weights() - pt_dict = OrderedDict() - transform = ref_el.get_entity_transform(sd-1, facet) - pts = tuple(map(lambda p: tuple(transform(p)), Q.get_points())) - for pt, wgt, phi in zip(pts, weights, P_at_qpts): - pt_dict[pt] = [(wgt*phi[i], (i, )) for i in range(sd)] - super().__init__(ref_el, (sd, ), pt_dict, {}, "MonkIntegralMoment") - - class IntegralMomentOfFaceTangentEvaluation(Functional): r""" \int_F v \times n \cdot p ds @@ -506,7 +471,6 @@ class MonkIntegralMoment(Functional): def __init__(self, ref_el, Q, P_at_qpts, facet): sd = ref_el.get_spatial_dimension() - area = ref_el.volume_of_subcomplex(sd - 1, facet) weights = Q.get_weights() pt_dict = OrderedDict() transform = ref_el.get_entity_transform(sd-1, facet) @@ -516,37 +480,6 @@ def __init__(self, ref_el, Q, P_at_qpts, facet): super().__init__(ref_el, (sd, ), pt_dict, {}, "MonkIntegralMoment") -class IntegralMomentOfFaceTangentEvaluation(Functional): - - r""" - \int_F v \times n \cdot p ds - - p \in Polynomials - - :arg ref_el: reference element for which F is a codim-1 entity - :arg Q: quadrature rule on the face - :arg P_at_qpts: polynomials evaluated at quad points - :arg facet: which facet. - """ - def __init__(self, ref_el, Q, P_at_qpts, facet): - P_at_qpts = [[P_at_qpts[0][i], P_at_qpts[1][i], P_at_qpts[2][i]] - for i in range(P_at_qpts.shape[1])] - n = ref_el.compute_scaled_normal(facet) - sd = ref_el.get_spatial_dimension() - transform = ref_el.get_entity_transform(sd-1, facet) - pts = tuple(map(lambda p: tuple(transform(p)), Q.get_points())) - weights = Q.get_weights() - pt_dict = OrderedDict() - for pt, wgt, phi in zip(pts, weights, P_at_qpts): - phixn = [phi[1]*n[2] - phi[2]*n[1], - phi[2]*n[0] - phi[0]*n[2], - phi[0]*n[1] - phi[1]*n[0]] - pt_dict[pt] = [(wgt*(-n[2]*phixn[1]+n[1]*phixn[2]), (0, )), - (wgt*(n[2]*phixn[0]-n[0]*phixn[2]), (1, )), - (wgt*(-n[1]*phixn[0]+n[0]*phixn[1]), (2, ))] - super().__init__(ref_el, (sd, ), pt_dict, {}, "IntegralMomentOfFaceTangentEvaluation") - - class PointScaledNormalEvaluation(Functional): """Implements the evaluation of the normal component of a vector at a point on a facet of codimension 1, where the normal is scaled by @@ -588,30 +521,6 @@ def __init__(self, ref_el, Q, P_at_qpts, facet): super().__init__(ref_el, (sd, ), pt_dict, {}, "IntegralMomentOfScaledNormalEvaluation") -class IntegralMomentOfScaledNormalEvaluation(Functional): - - r""" - \int_F v\cdot n p ds - - p \in Polynomials - - :arg ref_el: reference element for which F is a codim-1 entity - :arg Q: quadrature rule on the face - :arg P_at_qpts: polynomials evaluated at quad points - :arg facet: which facet. - """ - def __init__(self, ref_el, Q, P_at_qpts, facet): - n = ref_el.compute_scaled_normal(facet) - sd = ref_el.get_spatial_dimension() - transform = ref_el.get_entity_transform(sd - 1, facet) - pts = tuple(map(lambda p: tuple(transform(p)), Q.get_points())) - weights = Q.get_weights() - pt_dict = OrderedDict() - for pt, wgt, phi in zip(pts, weights, P_at_qpts): - pt_dict[pt] = [(wgt*phi*n[i], (i, )) for i in range(sd)] - super().__init__(ref_el, (sd, ), pt_dict, {}, "IntegralMomentOfScaledNormalEvaluation") - - class PointwiseInnerProductEvaluation(Functional): """ This is a functional on symmetric 2-tensor fields. Let u be such a diff --git a/FIAT/nedelec_second_kind.py b/FIAT/nedelec_second_kind.py index 0d5d3ceb..e0aaf99f 100644 --- a/FIAT/nedelec_second_kind.py +++ b/FIAT/nedelec_second_kind.py @@ -17,9 +17,6 @@ from FIAT.reference_element import UFCTetrahedron from FIAT.check_format_variant import check_format_variant -from FIAT import (polynomial_set, expansions, quadrature, dual_set, - finite_element, functional) - from FIAT import polynomial_set, quadrature, functional