Skip to content
This repository has been archived by the owner on Feb 21, 2022. It is now read-only.

Commit

Permalink
Merge branch 'mapdes/hdiv-trace-implementation'
Browse files Browse the repository at this point in the history
  • Loading branch information
blechta committed Nov 4, 2016
2 parents ca0bf5e + 5bb92e3 commit 2b9e9fd
Show file tree
Hide file tree
Showing 32 changed files with 550 additions and 622 deletions.
3 changes: 1 addition & 2 deletions FIAT/P0.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,7 @@ def __init__(self, ref_el):
super(P0Dual, self).__init__(nodes, ref_el, entity_ids)


class P0(finite_element.FiniteElement):

class P0(finite_element.CiarletElement):
def __init__(self, ref_el):
poly_set = polynomial_set.ONPolynomialSet(ref_el, 0)
dual = P0Dual(ref_el)
Expand Down
8 changes: 3 additions & 5 deletions FIAT/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,13 @@
from __future__ import absolute_import, print_function, division

# Import finite element classes
from FIAT.finite_element import FiniteElement # noqa: F401
from FIAT.finite_element import FiniteElement, CiarletElement # noqa: F401
from FIAT.argyris import Argyris
from FIAT.argyris import QuinticArgyris
from FIAT.brezzi_douglas_marini import BrezziDouglasMarini
from FIAT.brezzi_douglas_fortin_marini import BrezziDouglasFortinMarini
from FIAT.discontinuous_lagrange import DiscontinuousLagrange
from FIAT.discontinuous_taylor import DiscontinuousTaylor
from FIAT.trace import DiscontinuousLagrangeTrace
from FIAT.discontinuous_raviart_thomas import DiscontinuousRaviartThomas
from FIAT.hermite import CubicHermite
from FIAT.lagrange import Lagrange
Expand All @@ -31,7 +30,7 @@
from FIAT.enriched import EnrichedElement
from FIAT.nodal_enriched import NodalEnrichedElement
from FIAT.discontinuous import DiscontinuousElement
from FIAT.trace_hdiv import HDivTrace
from FIAT.hdiv_trace import HDivTrace
from FIAT.restricted import RestrictedElement # noqa: F401

# Important functionality
Expand All @@ -50,7 +49,6 @@
"Crouzeix-Raviart": CrouzeixRaviart,
"Discontinuous Lagrange": DiscontinuousLagrange,
"Discontinuous Taylor": DiscontinuousTaylor,
"Discontinuous Lagrange Trace": DiscontinuousLagrangeTrace,
"Discontinuous Raviart-Thomas": DiscontinuousRaviartThomas,
"Hermite": CubicHermite,
"Lagrange": Lagrange,
Expand All @@ -65,7 +63,7 @@
"NodalEnrichedElement": NodalEnrichedElement,
"TensorProductElement": TensorProductElement,
"BrokenElement": DiscontinuousElement,
"TraceElement": HDivTrace,
"HDiv Trace": HDivTrace,
"Hellan-Herrmann-Johnson": HellanHerrmannJohnson}

# List of extra elements
Expand Down
4 changes: 2 additions & 2 deletions FIAT/argyris.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ def __init__(self, ref_el):
super(QuinticArgyrisDualSet, self).__init__(nodes, ref_el, entity_ids)


class Argyris(finite_element.FiniteElement):
class Argyris(finite_element.CiarletElement):
"""The Argyris finite element."""

def __init__(self, ref_el, degree):
Expand All @@ -144,7 +144,7 @@ def __init__(self, ref_el, degree):
super(Argyris, self).__init__(poly_set, dual, degree)


class QuinticArgyris(finite_element.FiniteElement):
class QuinticArgyris(finite_element.CiarletElement):
"""The Argyris finite element."""

def __init__(self, ref_el):
Expand Down
2 changes: 1 addition & 1 deletion FIAT/brezzi_douglas_fortin_marini.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ def BDFMSpace(ref_el, order):
return element_set


class BrezziDouglasFortinMarini(finite_element.FiniteElement):
class BrezziDouglasFortinMarini(finite_element.CiarletElement):
"""The BDFM element"""

def __init__(self, ref_el, degree):
Expand Down
2 changes: 1 addition & 1 deletion FIAT/brezzi_douglas_marini.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def __init__(self, ref_el, degree):
super(BDMDualSet, self).__init__(nodes, ref_el, entity_ids)


class BrezziDouglasMarini(finite_element.FiniteElement):
class BrezziDouglasMarini(finite_element.CiarletElement):
"""The BDM element"""

def __init__(self, ref_el, degree):
Expand Down
2 changes: 1 addition & 1 deletion FIAT/bubble.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@ def __init__(self, ref_el, degree):
if len(cell_entity_dofs) == 0:
raise RuntimeError('Bubble element of degree %d has no dofs' % degree)

RestrictedElement.__init__(self, element, indices=cell_entity_dofs)
super(Bubble, self).__init__(element, indices=cell_entity_dofs)
2 changes: 1 addition & 1 deletion FIAT/crouzeix_raviart.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def __init__(self, cell, degree):
super(CrouzeixRaviartDualSet, self).__init__(nodes, cell, entity_ids)


class CrouzeixRaviart(finite_element.FiniteElement):
class CrouzeixRaviart(finite_element.CiarletElement):
"""The Crouzeix-Raviart finite element:
K: Triangle/Tetrahedron
Expand Down
4 changes: 2 additions & 2 deletions FIAT/discontinuous.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@

from __future__ import absolute_import, print_function, division

from FIAT.finite_element import FiniteElement
from FIAT.finite_element import CiarletElement
from FIAT.dual_set import DualSet


class DiscontinuousElement(FiniteElement):
class DiscontinuousElement(CiarletElement):
"""A copy of an existing element where all dofs are associated with the cell"""

def __init__(self, element):
Expand Down
2 changes: 1 addition & 1 deletion FIAT/discontinuous_lagrange.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def __init__(self, ref_el, degree):
super(DiscontinuousLagrangeDualSet, self).__init__(nodes, ref_el, entity_ids)


class HigherOrderDiscontinuousLagrange(finite_element.FiniteElement):
class HigherOrderDiscontinuousLagrange(finite_element.CiarletElement):
"""The discontinuous Lagrange finite element. It is what it is."""

def __init__(self, ref_el, degree):
Expand Down
2 changes: 1 addition & 1 deletion FIAT/discontinuous_raviart_thomas.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def __init__(self, ref_el, degree):
super(DRTDualSet, self).__init__(nodes, ref_el, entity_ids)


class DiscontinuousRaviartThomas(finite_element.FiniteElement):
class DiscontinuousRaviartThomas(finite_element.CiarletElement):
"""The discontinuous Raviart-Thomas finite element"""

def __init__(self, ref_el, q):
Expand Down
2 changes: 1 addition & 1 deletion FIAT/discontinuous_taylor.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def __init__(self, ref_el, degree):
super(DiscontinuousTaylorDualSet, self).__init__(nodes, ref_el, entity_ids)


class HigherOrderDiscontinuousTaylor(finite_element.FiniteElement):
class HigherOrderDiscontinuousTaylor(finite_element.CiarletElement):
"""The discontinuous Taylor finite element. Use a Taylor basis for DG."""

def __init__(self, ref_el, degree):
Expand Down
41 changes: 15 additions & 26 deletions FIAT/enriched.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,26 +49,20 @@ def __init__(self, *elements):
if not A.value_shape() == B.value_shape():
raise ValueError("Elements must have the same value shape")

# Set up constituent elements
self.A = A
self.B = B

# required degree (for quadrature) is definitely max
self.polydegree = max(A.degree(), B.degree())
# order is at least max, possibly more, though getting this
# right isn't important AFAIK
self.order = max(A.get_order(), B.get_order())
order = max(A.get_order(), B.get_order())
# form degree is essentially max (not true for Hdiv/Hcurl,
# but this will raise an error above anyway).
# E.g. an H^1 function enriched with an L^2 is now just L^2.
if A.get_formdegree() is None or B.get_formdegree() is None:
self.formdegree = None
formdegree = None
else:
self.formdegree = max(A.get_formdegree(), B.get_formdegree())
formdegree = max(A.get_formdegree(), B.get_formdegree())

# set up reference element and mapping, following checks above
self.ref_el = A.get_reference_element()
self._mapping = A.mapping()[0]
ref_el = A.get_reference_element()
mapping = A.mapping()[0]

# set up entity_ids - for each geometric entity, just concatenate
# the entities of the constituent elements
Expand All @@ -86,7 +80,16 @@ def __init__(self, *elements):

# set up dual basis - just concatenation
nodes = A.dual_basis() + B.dual_basis()
self.dual = DualSet(nodes, self.ref_el, entity_ids)
dual = DualSet(nodes, ref_el, entity_ids)

super(EnrichedElement, self).__init__(ref_el, dual, order, formdegree, mapping)

# Set up constituent elements
self.A = A
self.B = B

# required degree (for quadrature) is definitely max
self.polydegree = max(A.degree(), B.degree())

# Store subelements
self._elements = elements
Expand All @@ -95,15 +98,6 @@ def elements(self):
"Return reference to original subelements"
return self._elements

@staticmethod
def is_nodal():
"""True if primal and dual bases are orthogonal. If false,
dual basis is not implemented or is undefined.
This implementation returns False!
"""
return False

def degree(self):
"""Return the degree of the (embedding) polynomial space."""
return self.polydegree
Expand All @@ -118,11 +112,6 @@ def get_coeffs(self):
finite element."""
raise NotImplementedError("get_coeffs not implemented")

def space_dimension(self):
"""Return the dimension of the finite element space."""
# number of dofs just adds
return self.A.space_dimension() + self.B.space_dimension()

def tabulate(self, order, points, entity=None):
"""Return tabulated values of derivatives up to given order of
basis functions at given points."""
Expand Down

0 comments on commit 2b9e9fd

Please sign in to comment.