# Path: finat/fiat_elements.py
# class ScalarFiatElement(FiatElement):
#     @property
#     def value_shape(self):
#         return ()
# 
# Path: finat/physically_mapped.py
# class NeedsCoordinateMappingElement(metaclass=ABCMeta):
# class PhysicallyMappedElement(NeedsCoordinateMappingElement):
# class DirectlyDefinedElement(NeedsCoordinateMappingElement):
# class PhysicalGeometry(metaclass=ABCMeta):
#     def __init__(self, *args, **kwargs):
#     def basis_transformation(self, coordinate_mapping):
#     def basis_evaluation(self, order, ps, entity=None, coordinate_mapping=None):
#         def matvec(table):
#     def point_evaluation(self, order, refcoords, entity=None):
#     def cell_size(self):
#     def jacobian_at(self, point):
#     def detJ_at(self, point):
#     def reference_normals(self):
#     def physical_normals(self):
#     def physical_tangents(self):
#     def physical_edge_lengths(self):
#     def physical_points(self, point_set, entity=None):
#     def physical_vertices(self):
#         M = self.basis_transformation(coordinate_mapping)


import numpy
import FIAT
from gem import Literal, ListTensor
from finat.fiat_elements import ScalarFiatElement
from finat.physically_mapped import PhysicallyMappedElement, Citations
            # second derivatives
            tau = [pts[e, 0]*pts[e, 0],
                   2*pts[e, 0]*pts[e, 1],
                   pts[e, 1]*pts[e, 1]]

            for i in (0, 1, 2):
                V[18+e, 6*v0id+3+i] = -1/252 * (pel[e]*foo*tau[i])
                V[18+e, 6*v1id+3+i] = 1/252 * (pel[e]*foo*tau[i])

        h = coordinate_mapping.cell_size()

        for v in range(3):
            for k in range(2):
                for i in range(21):
                    V[i, 6*v+1+k] = V[i, 6*v+1+k] / h[v]
            for k in range(3):
                for i in range(21):
                    V[i, 6*v+3+k] = V[i, 6*v+3+k] / (h[v]*h[v])

        return ListTensor(V.T)

    # This wipes out the edge dofs.  FIAT gives a 21 DOF element
    # because we need some extra functions to help with transforming
    # under the edge constraint.  However, we only have an 18 DOF
    # element.
    def entity_dofs(self):
        return {0: {0: list(range(6)),
                    1: list(range(6, 12)),
                    2: list(range(12, 18))},
                1: {0: [], 1: [], 2: []},

# Path: finat/fiat_elements.py
# class ScalarFiatElement(FiatElement):
#     @property
#     def value_shape(self):
#         return ()
# 
# Path: finat/physically_mapped.py
# class NeedsCoordinateMappingElement(metaclass=ABCMeta):
# class PhysicallyMappedElement(NeedsCoordinateMappingElement):
# class DirectlyDefinedElement(NeedsCoordinateMappingElement):
# class PhysicalGeometry(metaclass=ABCMeta):
#     def __init__(self, *args, **kwargs):
#     def basis_transformation(self, coordinate_mapping):
#     def basis_evaluation(self, order, ps, entity=None, coordinate_mapping=None):
#         def matvec(table):
#     def point_evaluation(self, order, refcoords, entity=None):
#     def cell_size(self):
#     def jacobian_at(self, point):
#     def detJ_at(self, point):
#     def reference_normals(self):
#     def physical_normals(self):
#     def physical_tangents(self):
#     def physical_edge_lengths(self):
#     def physical_points(self, point_set, entity=None):
#     def physical_vertices(self):
#         M = self.basis_transformation(coordinate_mapping)


# Path: finat/bell.py
import numpy
import FIAT
from gem import Literal, ListTensor
from finat.fiat_elements import ScalarFiatElement
from finat.physically_mapped import PhysicallyMappedElement, Citations

            # second derivatives
            tau = [pts[e, 0]*pts[e, 0],
                   2*pts[e, 0]*pts[e, 1],
                   pts[e, 1]*pts[e, 1]]

            for i in (0, 1, 2):
                V[18+e, 6*v0id+3+i] = -1/252 * (pel[e]*foo*tau[i])
                V[18+e, 6*v1id+3+i] = 1/252 * (pel[e]*foo*tau[i])

        h = coordinate_mapping.cell_size()

        for v in range(3):
            for k in range(2):
                for i in range(21):
                    V[i, 6*v+1+k] = V[i, 6*v+1+k] / h[v]
            for k in range(3):
                for i in range(21):
                    V[i, 6*v+3+k] = V[i, 6*v+3+k] / (h[v]*h[v])

        return ListTensor(V.T)

    # This wipes out the edge dofs.  FIAT gives a 21 DOF element
    # because we need some extra functions to help with transforming
    # under the edge constraint.  However, we only have an 18 DOF
    # element.
    def entity_dofs(self):
        return {0: {0: list(range(6)),
                    1: list(range(6, 12)),
                    2: list(range(12, 18))},
                1: {0: [], 1: [], 2: []},

                2: {0: []}}