|
17 | 17 | from FIAT.quadrature_schemes import create_quadrature
|
18 | 18 | from FIAT.restricted import RestrictedElement
|
19 | 19 | from FIAT.nodal_enriched import NodalEnrichedElement
|
20 |
| -from itertools import chain |
21 | 20 |
|
22 | 21 | import numpy
|
23 | 22 | import math
|
@@ -168,21 +167,17 @@ def modified_bubble_subspace(B):
|
168 | 167 | hat = B.take([0])
|
169 | 168 | hat_at_qpts = hat.tabulate(qpts)[(0,)*sd][0, 0]
|
170 | 169 |
|
171 |
| - # tabulate the BDM facet functions |
172 |
| - ref_el = ref_complex.get_parent() |
173 |
| - BDM = BrezziDouglasMarini(ref_el, degree-1) |
174 |
| - entity_dofs = BDM.entity_dofs() |
175 |
| - facet_dofs = list(range(BDM.space_dimension() - len(entity_dofs[sd][0]))) |
176 |
| - BDM_facet = BDM.get_nodal_basis().take(facet_dofs) |
177 |
| - phis = BDM_facet.tabulate(qpts)[(0,)*sd] |
178 |
| - |
179 | 170 | # tabulate the bubbles = hat ** (degree - k) * BDMk_facet
|
| 171 | + ref_el = ref_complex.get_parent() |
180 | 172 | bubbles = [numpy.eye(sd)[:, :, None] * hat_at_qpts[None, None, :] ** degree]
|
181 | 173 | for k in range(1, degree):
|
182 |
| - dimPk = math.comb(k + sd-1, sd-1) |
183 |
| - idsPk = list(chain.from_iterable(entity_dofs[sd-1][f][:dimPk] |
184 |
| - for f in entity_dofs[sd-1])) |
185 |
| - bubbles.append(numpy.multiply(phis[idsPk], hat_at_qpts ** (degree-k))) |
| 174 | + # tabulate the BDM facet functions |
| 175 | + BDM = BrezziDouglasMarini(ref_el, k) |
| 176 | + BDM_facet = BDM.get_nodal_basis().take(BDM.dual.get_indices("facet")) |
| 177 | + phis = BDM_facet.tabulate(qpts)[(0,)*sd] |
| 178 | + |
| 179 | + bubbles.append(numpy.multiply(phis, hat_at_qpts ** (degree-k))) |
| 180 | + |
186 | 181 | bubbles = numpy.concatenate(bubbles, axis=0)
|
187 | 182 |
|
188 | 183 | # store the bubbles into a PolynomialSet via L2 projection
|
|
0 commit comments