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 40bbe70 commit 8e0db23
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 18 deletions.
1 change: 1 addition & 0 deletions FIAT/brezzi_douglas_marini.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
polynomial_set, nedelec)
from FIAT.check_format_variant import check_format_variant


class BDMDualSet(dual_set.DualSet):
def __init__(self, ref_el, degree, variant, quad_deg):

Expand Down
15 changes: 8 additions & 7 deletions FIAT/check_format_variant.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
import re
import warnings


def check_format_variant(variant, degree, element):
if variant is None:
variant = "point"
warnings.simplefilter('always', DeprecationWarning)
warnings.warn('Variant of '+ element + ' element will change from point evaluation to integral evaluation.'
' You should project into variant="integral"', DeprecationWarning)
#Replace by the following in a month time
#variant = "integral"
variant = "point"
warnings.simplefilter('always', DeprecationWarning)
warnings.warn('Variant of ' + element + ' element will change from point evaluation to integral evaluation.'
' You should project into variant="integral"', DeprecationWarning)
# Replace by the following in a month time
# variant = "integral"

if not (variant == "point" or "integral" in variant):
raise ValueError('Choose either variant="point" or variant="integral"'
'or variant="integral(Quadrature degree)"')

if variant == "integral":
#quadrature is so high to ensure that the interpolant of curl/divergence-free functions is still curl/divergence-free
# 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):
Expand Down
20 changes: 9 additions & 11 deletions FIAT/functional.py
Original file line number Diff line number Diff line change
Expand Up @@ -410,8 +410,8 @@ def __init__(self, ref_el, Q, P_at_qpts, edge):
pt_dict[pt] = [(wgt*phi*t[i], (i, )) for i in range(sd)]
super().__init__(ref_el, (sd, ), pt_dict, {}, "IntegralMomentOfEdgeTangentEvaluation")

class IntegralMomentOfEdgeTangentEvaluation(Functional):

class IntegralMomentOfEdgeTangentEvaluation(Functional):
r"""
\int_e v\cdot t p ds
Expand All @@ -433,6 +433,7 @@ def __init__(self, ref_el, Q, P_at_qpts, edge):
pt_dict[pt] = [(wgt*phi*t[i], (i, )) for i in range(sd)]
super().__init__(ref_el, (sd, ), pt_dict, {}, "IntegralMomentOfEdgeTangentEvaluation")


class PointFaceTangentEvaluation(Functional):
"""Implements the evaluation of a tangential component of a
vector at a point on a facet of codimension 1."""
Expand Down Expand Up @@ -528,7 +529,6 @@ class IntegralMomentOfFaceTangentEvaluation(Functional):
:arg facet: which facet.
"""
def __init__(self, ref_el, Q, P_at_qpts, facet):
#import ipdb; ipdb.set_trace()
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)
Expand All @@ -538,17 +538,15 @@ def __init__(self, ref_el, Q, P_at_qpts, facet):
weights = Q.get_weights()
pt_dict = OrderedDict()
for pt, wgt, phi in zip(pts, weights, P_at_qpts):
# pt_dict[pt] = [(wgt*(-n[2]*phi[1]+n[1]*phi[2]), (0, )),
# (wgt*(n[2]*phi[0]-n[0]*phi[2]), (1, )),
# (wgt*(-n[1]*phi[0]+n[0]*phi[1]), (2, ))]
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, ))]
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
1 change: 1 addition & 0 deletions FIAT/nedelec.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import numpy
from FIAT.check_format_variant import check_format_variant


def NedelecSpace2D(ref_el, k):
"""Constructs a basis for the 2d H(curl) space of the first kind
which is (P_k)^2 + P_k rot( x )"""
Expand Down
1 change: 1 addition & 0 deletions FIAT/raviart_thomas.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from itertools import chain
from FIAT.check_format_variant import check_format_variant


def RTSpace(ref_el, deg):
"""Constructs a basis for the the Raviart-Thomas space
(P_k)^d + P_k x"""
Expand Down

0 comments on commit 8e0db23

Please sign in to comment.