예제 #1
0
def get_line_nodes(V):
    # Return the Line nodes for Q, DQ, RTCF/E, NCF/E
    from FIAT.reference_element import UFCInterval
    from FIAT import quadrature
    use_tensorproduct, N, ndim, sub_families, variant = tensor_product_space_query(
        V)
    assert use_tensorproduct
    cell = UFCInterval()
    if variant == "equispaced" and sub_families <= {
            "Q", "DQ", "Lagrange", "Discontinuous Lagrange"
    }:
        return [cell.make_points(1, 0, N + 1)] * ndim
    elif sub_families <= {"Q", "Lagrange"}:
        rule = quadrature.GaussLobattoLegendreQuadratureLineRule(cell, N + 1)
        return [rule.get_points()] * ndim
    elif sub_families <= {"DQ", "Discontinuous Lagrange"}:
        rule = quadrature.GaussLegendreQuadratureLineRule(cell, N + 1)
        return [rule.get_points()] * ndim
    elif sub_families < {"RTCF", "NCF"}:
        cg = quadrature.GaussLobattoLegendreQuadratureLineRule(cell, N + 1)
        dg = quadrature.GaussLegendreQuadratureLineRule(cell, N)
        return [cg.get_points()] + [dg.get_points()] * (ndim - 1)
    elif sub_families < {"RTCE", "NCE"}:
        cg = quadrature.GaussLobattoLegendreQuadratureLineRule(cell, N + 1)
        dg = quadrature.GaussLegendreQuadratureLineRule(cell, N)
        return [dg.get_points()] + [cg.get_points()] * (ndim - 1)
    else:
        raise ValueError("Don't know how to get line nodes for %s" %
                         V.ufl_element())
예제 #2
0
    def __init__(self, ref_el, degree):
        entity_ids = {0: {0: [0], 1: [degree]}, 1: {0: list(range(1, degree))}}
        lr = quadrature.GaussLobattoLegendreQuadratureLineRule(
            ref_el, degree + 1)
        nodes = [functional.PointEvaluation(ref_el, x) for x in lr.pts]

        super().__init__(nodes, ref_el, entity_ids)
    def __init__(self, ref_el, degree):
        entity_ids = {0: {0: [0], 1: [degree]}, 1: {0: list(range(1, degree))}}
        lr = quadrature.GaussLobattoLegendreQuadratureLineRule(
            ref_el, degree + 1)
        nodes = [functional.PointEvaluation(ref_el, x) for x in lr.pts]
        entity_permutations = {}
        entity_permutations[0] = {0: {0: [0]}, 1: {0: [0]}}
        entity_permutations[1] = {0: make_entity_permutations(1, degree - 1)}

        super(GaussLobattoLegendreDualSet,
              self).__init__(nodes, ref_el, entity_ids, entity_permutations)
예제 #4
0
def get_line_nodes(V):
    # Return the corresponding nodes in the Line for CG / DG
    from FIAT.reference_element import UFCInterval
    from FIAT import quadrature
    use_tensorproduct, N, family, variant = tensor_product_space_query(V)
    assert use_tensorproduct
    cell = UFCInterval()
    if variant == "equispaced":
        return cell.make_points(1, 0, N + 1)
    elif family <= {"Q", "Lagrange"}:
        rule = quadrature.GaussLobattoLegendreQuadratureLineRule(cell, N + 1)
        return rule.get_points()
    elif family <= {"DQ", "Discontinuous Lagrange"}:
        rule = quadrature.GaussLegendreQuadratureLineRule(cell, N + 1)
        return rule.get_points()
    else:
        raise ValueError("Don't know how to get line nodes for %r" % family)
예제 #5
0
    def get_nodes_1d(V):
        # Return GLL nodes if V==CG or GL nodes if V==DG
        from FIAT import quadrature
        from FIAT.reference_element import DefaultLine
        use_tensorproduct, N, family, variant = tensor_product_space_query(V)
        assert use_tensorproduct
        if family <= {"Q", "Lagrange"}:
            if variant == "equispaced":
                nodes = np.linspace(-1.0E0, 1.0E0, N+1)
            else:
                rule = quadrature.GaussLobattoLegendreQuadratureLineRule(DefaultLine(), N+1)
                nodes = np.asarray(rule.get_points()).flatten()
        elif family <= {"DQ", "Discontinuous Lagrange"}:
            if variant == "equispaced":
                nodes = np.arange(1, N+2)*(2.0E0/(N+2))-1.0E0
            else:
                rule = quadrature.GaussLegendreQuadratureLineRule(DefaultLine(), N+1)
                nodes = np.asarray(rule.get_points()).flatten()
        else:
            raise ValueError("Don't know how to get nodes for %r" % family)

        return nodes