forked from FEniCS/fiat
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement DG variants, remove topological DOF ordering in DG
- Loading branch information
Showing
3 changed files
with
32 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,54 +6,12 @@ | |
# | ||
# Written by David A. Ham ([email protected]), 2015 | ||
# | ||
# Modified by Pablo D. Brubeck ([email protected]), 2021 | ||
# Modified by Pablo D. Brubeck ([email protected]), 2023 | ||
|
||
from FIAT import finite_element, polynomial_set, dual_set, functional | ||
from FIAT.reference_element import POINT, LINE, TRIANGLE, TETRAHEDRON | ||
from FIAT.orientation_utils import make_entity_permutations_simplex | ||
from FIAT.barycentric_interpolation import LagrangePolynomialSet | ||
from FIAT.reference_element import make_lattice | ||
from FIAT import discontinuous_lagrange | ||
|
||
|
||
class GaussLegendreDualSet(dual_set.DualSet): | ||
"""The dual basis for discontinuous elements with nodes at the | ||
(recursive) Gauss-Legendre points.""" | ||
|
||
def __init__(self, ref_el, degree): | ||
entity_ids = {} | ||
entity_permutations = {} | ||
top = ref_el.get_topology() | ||
for dim in sorted(top): | ||
entity_ids[dim] = {} | ||
entity_permutations[dim] = {} | ||
perms = make_entity_permutations_simplex(dim, degree + 1 if dim == len(top)-1 else -1) | ||
for entity in sorted(top[dim]): | ||
entity_ids[dim][entity] = [] | ||
entity_permutations[dim][entity] = perms | ||
|
||
# make nodes by getting points | ||
pts = make_lattice(ref_el.get_vertices(), degree, variant="gl") | ||
nodes = [functional.PointEvaluation(ref_el, x) for x in pts] | ||
entity_ids[dim][0] = list(range(len(nodes))) | ||
super(GaussLegendreDualSet, self).__init__(nodes, ref_el, entity_ids, entity_permutations) | ||
|
||
|
||
class GaussLegendre(finite_element.CiarletElement): | ||
class GaussLegendre(discontinuous_lagrange.HigherOrderDiscontinuousLagrange): | ||
"""Simplicial discontinuous element with nodes at the (recursive) Gauss-Legendre points.""" | ||
def __init__(self, ref_el, degree): | ||
if ref_el.shape not in {POINT, LINE, TRIANGLE, TETRAHEDRON}: | ||
raise ValueError("Gauss-Legendre elements are only defined on simplices.") | ||
dual = GaussLegendreDualSet(ref_el, degree) | ||
if ref_el.shape == LINE: | ||
# In 1D we can use the primal basis as the expansion set, | ||
# avoiding any round-off coming from a basis transformation | ||
points = [] | ||
for node in dual.nodes: | ||
# Assert singleton point for each node. | ||
pt, = node.get_point_dict().keys() | ||
points.append(pt) | ||
poly_set = LagrangePolynomialSet(ref_el, points) | ||
else: | ||
poly_set = polynomial_set.ONPolynomialSet(ref_el, degree) | ||
formdegree = ref_el.get_spatial_dimension() # n-form | ||
super(GaussLegendre, self).__init__(poly_set, dual, degree, formdegree) | ||
super(GaussLegendre, self).__init__(ref_el, degree, variant="gl") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters