Skip to content

Commit

Permalink
Lint fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
FabianL1908 committed Jun 10, 2020
1 parent 8e0db23 commit 4cfcd03
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 95 deletions.
2 changes: 1 addition & 1 deletion FIAT/check_format_variant.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
91 changes: 0 additions & 91 deletions FIAT/functional.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
3 changes: 0 additions & 3 deletions FIAT/nedelec_second_kind.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down

0 comments on commit 4cfcd03

Please sign in to comment.