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
# SPDX-License-Identifier: LGPL-3.0-or-later # # Modified by David A. Ham ([email protected]), 2018 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,