# Path: finat/fiat_elements.py
# class ScalarFiatElement(FiatElement):
#     @property
#     def value_shape(self):
#         return ()
# 
# Path: finat/point_set.py
# class GaussLobattoLegendrePointSet(PointSet):
#     """Gauss-Lobatto-Legendre quadrature points on the interval.
# 
#     This facilitates implementing continuous spectral elements.
#     """
#     def __init__(self, points):
#         super(GaussLobattoLegendrePointSet, self).__init__(points)
#         assert self.points.shape[1] == 1
# 
# class GaussLegendrePointSet(PointSet):
#     """Gauss-Legendre quadrature points on the interval.
# 
#     This facilitates implementing discontinuous spectral elements.
#     """
#     def __init__(self, points):
#         super(GaussLegendrePointSet, self).__init__(points)
#         assert self.points.shape[1] == 1


import FIAT
import gem
from finat.fiat_elements import ScalarFiatElement
from finat.point_set import GaussLobattoLegendrePointSet, GaussLegendrePointSet
    def basis_evaluation(self, order, ps, entity=None, coordinate_mapping=None):
        '''Return code for evaluating the element at known points on the
        reference element.

        :param order: return derivatives up to this order.
        :param ps: the point set.
        :param entity: the cell entity on which to tabulate.
        '''

        result = super(GaussLegendre, self).basis_evaluation(order, ps, entity)
        cell_dimension = self.cell.get_dimension()
        if entity is None or entity == (cell_dimension, 0):  # on cell interior
            space_dim = self.space_dimension()
            if isinstance(ps, GaussLegendrePointSet) and len(ps.points) == space_dim:
                # Bingo: evaluation points match node locations!
                spatial_dim = self.cell.get_spatial_dimension()
                q, = ps.indices
                r, = self.get_indices()
                result[(0,) * spatial_dim] = gem.ComponentTensor(gem.Delta(q, r), (r,))
        return result


class FDMLagrange(ScalarFiatElement):
    """1D CG element with FDM shape functions."""

    def __init__(self, cell, degree):
        fiat_element = FIAT.FDMLagrange(cell, degree)
        super(FDMLagrange, self).__init__(fiat_element)



# Path: finat/fiat_elements.py
# class ScalarFiatElement(FiatElement):
#     @property
#     def value_shape(self):
#         return ()
# 
# Path: finat/point_set.py
# class GaussLobattoLegendrePointSet(PointSet):
#     """Gauss-Lobatto-Legendre quadrature points on the interval.
# 
#     This facilitates implementing continuous spectral elements.
#     """
#     def __init__(self, points):
#         super(GaussLobattoLegendrePointSet, self).__init__(points)
#         assert self.points.shape[1] == 1
# 
# class GaussLegendrePointSet(PointSet):
#     """Gauss-Legendre quadrature points on the interval.
# 
#     This facilitates implementing discontinuous spectral elements.
#     """
#     def __init__(self, points):
#         super(GaussLegendrePointSet, self).__init__(points)
#         assert self.points.shape[1] == 1


# Path: finat/spectral.py
import FIAT
import gem
from finat.fiat_elements import ScalarFiatElement
from finat.point_set import GaussLobattoLegendrePointSet, GaussLegendrePointSet

    def basis_evaluation(self, order, ps, entity=None, coordinate_mapping=None):
        '''Return code for evaluating the element at known points on the
        reference element.

        :param order: return derivatives up to this order.
        :param ps: the point set.
        :param entity: the cell entity on which to tabulate.
        '''

        result = super(GaussLegendre, self).basis_evaluation(order, ps, entity)
        cell_dimension = self.cell.get_dimension()
        if entity is None or entity == (cell_dimension, 0):  # on cell interior
            space_dim = self.space_dimension()
            if isinstance(ps, GaussLegendrePointSet) and len(ps.points) == space_dim:
                # Bingo: evaluation points match node locations!
                spatial_dim = self.cell.get_spatial_dimension()
                q, = ps.indices
                r, = self.get_indices()
                result[(0,) * spatial_dim] = gem.ComponentTensor(gem.Delta(q, r), (r,))
        return result


class FDMLagrange(ScalarFiatElement):
    """1D CG element with FDM shape functions."""

    def __init__(self, cell, degree):
        fiat_element = FIAT.FDMLagrange(cell, degree)
        super(FDMLagrange, self).__init__(fiat_element)



class FDMHermite(ScalarFiatElement):