diff --git a/finat/__init__.py b/finat/__init__.py index bde435a1..4d9f7233 100644 --- a/finat/__init__.py +++ b/finat/__init__.py @@ -28,6 +28,7 @@ from .guzman_neilan import GuzmanNeilanFirstKindH1, GuzmanNeilanSecondKindH1, GuzmanNeilanBubble, GuzmanNeilanH1div # noqa: F401 from .powell_sabin import QuadraticPowellSabin6, QuadraticPowellSabin12 # noqa: F401 from .hermite import Hermite # noqa: F401 +from .bogner_fox_schmit import BognerFoxSchmit # noqa: F401 from .johnson_mercier import JohnsonMercier # noqa: F401 from .mtw import MardalTaiWinther # noqa: F401 from .morley import Morley # noqa: F401 diff --git a/finat/bogner_fox_schmit.py b/finat/bogner_fox_schmit.py new file mode 100644 index 00000000..e776b115 --- /dev/null +++ b/finat/bogner_fox_schmit.py @@ -0,0 +1,28 @@ +from finat.physically_mapped import PhysicallyMappedElement, identity +from finat.tensor_product import TensorProductElement +from finat.hermite import Hermite +from functools import reduce +from gem import Product +import numpy + + +class PhysicallyMappedTensorProductElement(PhysicallyMappedElement, TensorProductElement): + + def __init__(self, factors): + TensorProductElement.__init__(self, factors) + + def basis_transformation(self, coordinate_mapping=None): + M = [] + for f in self.factors: + if isinstance(f, PhysicallyMappedElement): + M.append(f.basis_transformation(coordinate_mapping)) + else: + M.append(identity(f.space_dimension())) + return Product(*M) + + +class BognerFoxSchmit(PhysicallyMappedTensorProductElement): + + def __init__(self, cell, degree=3): + factors = [Hermite(sub_cell, degree) for sub_cell in cell.product.cells] + super().__init__(factors)