Exemplo n.º 1
0
    def __init__(self, element):

        nodes = element.dual.nodes
        dim = element.ref_el.get_spatial_dimension()

        if dim == 2:
            ref_el = UFCQuadrilateral()
        elif dim == 3:
            ref_el = UFCHexahedron()
        else:
            raise ValueError("Illegal element dimension %s" % dim)

        entity_ids = element.dual.entity_ids

        flat_entity_ids = flatten_entities(entity_ids)
        dual = DualSet(nodes, ref_el, flat_entity_ids)
        super(FlattenedDimensions, self).__init__(ref_el, dual,
                                                  element.get_order(),
                                                  element.get_formdegree(),
                                                  element._mapping)
        self.element = element

        # Construct unflattening map for passing correct values to tabulate()
        self.unflattening_map = compute_unflattening_map(
            self.element.ref_el.get_topology())
Exemplo n.º 2
0
 def cell(self):
     dim = self.product.cell.get_spatial_dimension()
     if dim == 2:
         return UFCQuadrilateral()
     elif dim == 3:
         return UFCHexahedron()
     else:
         raise NotImplementedError("Cannot guess cell for spatial dimension %s" % dim)
Exemplo n.º 3
0
from FIAT import finite_element, polynomial_set, dual_set, functional
from FIAT.reference_element import (Point, DefaultLine, UFCInterval,
                                    UFCQuadrilateral, UFCHexahedron,
                                    UFCTriangle, UFCTetrahedron,
                                    make_affine_mapping,
                                    flatten_reference_cube)
from FIAT.P0 import P0Dual
import numpy as np

hypercube_simplex_map = {
    Point(): Point(),
    DefaultLine(): DefaultLine(),
    UFCInterval(): UFCInterval(),
    UFCQuadrilateral(): UFCTriangle(),
    UFCHexahedron(): UFCTetrahedron()
}


class DPC0(finite_element.CiarletElement):
    def __init__(self, ref_el):
        flat_el = flatten_reference_cube(ref_el)
        poly_set = polynomial_set.ONPolynomialSet(
            hypercube_simplex_map[flat_el], 0)
        dual = P0Dual(ref_el)
        degree = 0
        formdegree = ref_el.get_spatial_dimension()  # n-form
        super(DPC0, self).__init__(poly_set=poly_set,
                                   dual=dual,
                                   order=degree,
                                   ref_el=ref_el,
Exemplo n.º 4
0
def hexahedron():
    return UFCHexahedron()
Exemplo n.º 5
0
#
# You should have received a copy of the GNU Lesser General Public License
# along with FIAT. If not, see <http://www.gnu.org/licenses/>.

import pytest
import numpy as np
import sys

from FIAT.reference_element import UFCInterval, UFCTriangle, UFCTetrahedron
from FIAT.reference_element import Point, TensorProductCell, UFCQuadrilateral, UFCHexahedron

point = Point()
interval = UFCInterval()
triangle = UFCTriangle()
quadrilateral = UFCQuadrilateral()
hexahedron = UFCHexahedron()
tetrahedron = UFCTetrahedron()
interval_x_interval = TensorProductCell(interval, interval)
triangle_x_interval = TensorProductCell(triangle, interval)
quadrilateral_x_interval = TensorProductCell(quadrilateral, interval)

ufc_tetrahedron_21connectivity = [(0, 1, 2), (0, 3, 4), (1, 3, 5), (2, 4, 5)]
ufc_hexahedron_21connectivity = [(0, 1, 4, 5), (2, 3, 6, 7), (0, 2, 8, 9),
                                 (1, 3, 10, 11), (4, 6, 8, 10), (5, 7, 9, 11)]


@pytest.mark.parametrize(('cell', 'connectivity'),
                         [(tetrahedron, ufc_tetrahedron_21connectivity),
                          (hexahedron, ufc_hexahedron_21connectivity),
                          pytest.param(triangle_x_interval, [], marks=pytest.mark.xfail),
                          pytest.param(quadrilateral_x_interval, [], marks=pytest.mark.xfail)])