Skip to content

Commit

Permalink
Merged in rename_outer_product (pull request #45)
Browse files Browse the repository at this point in the history
Rename_outer_product
  • Loading branch information
miklos1 committed Feb 9, 2016
2 parents ab26b0b + 9434be8 commit aa8d950
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 24 deletions.
4 changes: 2 additions & 2 deletions FIAT/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
from FIAT.crouzeix_raviart import CrouzeixRaviart
from FIAT.regge import Regge
from FIAT.bubble import Bubble
from FIAT.tensor_finite_element import TensorFiniteElement
from FIAT.tensor_product import TensorProductElement
from FIAT.enriched import EnrichedElement
from FIAT.discontinuous import DiscontinuousElement
from FIAT.trace_hdiv import HDivTrace
Expand All @@ -48,7 +48,7 @@
"Raviart-Thomas": RaviartThomas,
"Regge": Regge,
"EnrichedElement": EnrichedElement,
"OuterProductElement": TensorFiniteElement,
"TensorProductElement": TensorProductElement,
"BrokenElement": DiscontinuousElement,
"TraceElement": HDivTrace}

Expand Down
2 changes: 1 addition & 1 deletion FIAT/enriched.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

import numpy
from .finite_element import FiniteElement
from .tensor_finite_element import TensorFiniteElement
from .tensor_product import TensorProductElement
from . import dual_set
from copy import copy

Expand Down
4 changes: 2 additions & 2 deletions FIAT/finite_element.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import numpy
from .polynomial_set import PolynomialSet
from .quadrature import make_quadrature
from .reference_element import two_product_cell, LINE
from .reference_element import TensorProductCell, LINE

class FiniteElement:
"""Class implementing Ciarlet's abstraction of a finite element
Expand Down Expand Up @@ -194,7 +194,7 @@ def facet_support_dofs(elem):
corresponding basis functions take non-zero values."""
if not hasattr(elem, "_facet_support_dofs"):
# Non-extruded cells only
assert not isinstance(elem.ref_el, two_product_cell)
assert not isinstance(elem.ref_el, TensorProductCell)

q = make_quadrature(elem.ref_el.get_facet_element(), max(2*elem.degree(), 1))
ft = lambda f: elem.ref_el.get_facet_transform(f)
Expand Down
10 changes: 5 additions & 5 deletions FIAT/hdivcurl.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@

import numpy
import types
from .tensor_finite_element import TensorFiniteElement
from .tensor_product import TensorProductElement
from . import functional


def Hdiv(element):
if not isinstance(element, TensorFiniteElement):
if not isinstance(element, TensorProductElement):
raise NotImplementedError

if element.A.get_formdegree() is None or element.B.get_formdegree() is None:
Expand All @@ -31,7 +31,7 @@ def Hdiv(element):
if not (formdegree == element.get_reference_element().get_spatial_dimension() - 1):
raise ValueError("Tried to use Hdiv on a non-(n-1)-form element")

newelement = TensorFiniteElement(element.A, element.B) # make a copy to return
newelement = TensorProductElement(element.A, element.B) # make a copy to return

# redefine value_shape()
def value_shape(self):
Expand Down Expand Up @@ -144,7 +144,7 @@ def tabulate(self, order, points):


def Hcurl(element):
if not isinstance(element, TensorFiniteElement):
if not isinstance(element, TensorProductElement):
raise NotImplementedError

if element.A.get_formdegree() is None or element.B.get_formdegree() is None:
Expand All @@ -153,7 +153,7 @@ def Hcurl(element):
if not (formdegree == 1):
raise ValueError("Tried to use Hcurl on a non-1-form element")

newelement = TensorFiniteElement(element.A, element.B) # make a copy to return
newelement = TensorProductElement(element.A, element.B) # make a copy to return

# redefine value_shape()
def value_shape(self):
Expand Down
8 changes: 4 additions & 4 deletions FIAT/reference_element.py
Original file line number Diff line number Diff line change
Expand Up @@ -597,7 +597,7 @@ def contains_point(self, point, epsilon=0):
return result


class two_product_cell( ReferenceElement ):
class TensorProductCell( ReferenceElement ):
"""A cell that is the product of FIAT cells A and B"""
def __init__( self, A, B ):
self.A = A
Expand Down Expand Up @@ -716,9 +716,9 @@ def ufc_cell( cell ):
else:
celltype = cell.cellname()

if celltype == "OuterProductCell":
# cell is a UFL cell
return two_product_cell(ufc_cell(cell._A), ufc_cell(cell._B))
if " * " in celltype:
# Tensor product cell
return TensorProductCell(*map(ufc_cell, celltype.split(" * ")))
elif celltype == "quadrilateral":
return FiredrakeQuadrilateral()
elif celltype == "interval":
Expand Down
16 changes: 8 additions & 8 deletions FIAT/tensor_finite_element.py → FIAT/tensor_product.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@

import numpy
from .finite_element import FiniteElement, _facet_support_dofs
from .reference_element import two_product_cell, LINE
from .reference_element import TensorProductCell, LINE
from .polynomial_set import mis
from .quadrature import make_quadrature
from . import dual_set
from . import functional


class TensorFiniteElement(FiniteElement):
class TensorProductElement(FiniteElement):
"""Class implementing a finite element that is the tensor product
of two existing finite elements."""

Expand All @@ -42,7 +42,7 @@ def __init__(self, A, B):
self.formdegree = A.get_formdegree() + B.get_formdegree()

# set up reference element
self.ref_el = two_product_cell(A.get_reference_element(), B.get_reference_element())
self.ref_el = TensorProductCell(A.get_reference_element(), B.get_reference_element())

if A.mapping()[0] != "affine" and B.mapping()[0] == "affine":
self._mapping = A.mapping()[0]
Expand Down Expand Up @@ -341,7 +341,7 @@ def horiz_facet_support_dofs(elem):
corresponding basis functions take non-zero values."""
if not hasattr(elem, "_horiz_facet_support_dofs"):
# Extruded cells only
assert isinstance(elem.ref_el, two_product_cell)
assert isinstance(elem.ref_el, TensorProductCell)

q = make_quadrature(elem.ref_el.A, max(2*elem.degree(), 1))
ft = lambda f: elem.ref_el.get_horiz_facet_transform(f)
Expand All @@ -357,7 +357,7 @@ def vert_facet_support_dofs(elem):
corresponding basis functions take non-zero values."""
if not hasattr(elem, "_vert_facet_support_dofs"):
# Extruded cells only
assert isinstance(elem.ref_el, two_product_cell)
assert isinstance(elem.ref_el, TensorProductCell)

deg = max(2*elem.degree(), 1)
if elem.ref_el.A.get_shape() == LINE:
Expand All @@ -366,7 +366,7 @@ def vert_facet_support_dofs(elem):
# thus we need special treatment here.
q = make_quadrature(elem.ref_el.B, deg)
else:
vfacet_el = two_product_cell(elem.ref_el.A.get_facet_element(),
vfacet_el = TensorProductCell(elem.ref_el.A.get_facet_element(),
elem.ref_el.B)
q = make_quadrature(vfacet_el, (deg, deg))
ft = lambda f: elem.ref_el.get_vert_facet_transform(f)
Expand All @@ -385,5 +385,5 @@ def vert_facet_support_dofs(elem):
T = reference_element.UFCInterval()
W = raviart_thomas.RaviartThomas(S, 1)
X = lagrange.Lagrange(T, 3)
Y = TensorFiniteElement(W, X)
Z = TensorFiniteElement(Y, X)
Y = TensorProductElement(W, X)
Z = TensorProductElement(Y, X)
4 changes: 2 additions & 2 deletions FIAT/trace_hdiv.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
from .finite_element import FiniteElement
from . import functional
from . import dual_set
from . import TensorFiniteElement
from . import TensorProductElement


class HDivTrace(FiniteElement):
Expand All @@ -33,7 +33,7 @@ def __init__(self, element):
raise ValueError("Can only take trace of Hdiv element")

# TPEs not supported yet
if isinstance(element, TensorFiniteElement):
if isinstance(element, TensorProductElement):
raise NotImplementedError("Trace of TFEs not supported yet")

# Otherwise, let's go...
Expand Down

0 comments on commit aa8d950

Please sign in to comment.