Skip to content
This repository has been archived by the owner on Feb 21, 2022. It is now read-only.

Commit

Permalink
Added entity_block_sizes for Nedelec and RT elements and default to […
Browse files Browse the repository at this point in the history
…1,1,1,1] for all other elements
  • Loading branch information
mscroggs committed Nov 6, 2019
1 parent ae587ff commit 87a3e5c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
7 changes: 5 additions & 2 deletions FIAT/dual_set.py
Expand Up @@ -8,11 +8,11 @@


class DualSet(object):
def __init__(self, nodes, ref_el, entity_ids):
def __init__(self, nodes, ref_el, entity_ids, entity_block_sizes=[1, 1, 1, 1]):
self.nodes = nodes
self.ref_el = ref_el
self.entity_ids = entity_ids

self.entity_block_sizes = entity_block_sizes
# Compute the nodes on the closure of each sub_entity.
self.entity_closure_ids = {}
for dim, entities in ref_el.sub_entities.items():
Expand Down Expand Up @@ -54,6 +54,9 @@ def to_riesz(self, poly_set):

return self.mat

def get_entity_block_sizes(self):
return self.entity_block_sizes


def make_entity_closure_ids(ref_el, entity_ids):
entity_closure_ids = {}
Expand Down
4 changes: 2 additions & 2 deletions FIAT/nedelec.py
Expand Up @@ -198,7 +198,7 @@ def __init__(self, ref_el, degree):
num_internal_dof = sd * Pkm1_at_qpts.shape[0]
entity_ids[2][0] = list(range(cur, cur + num_internal_dof))

super(NedelecDual2D, self).__init__(nodes, ref_el, entity_ids)
super(NedelecDual2D, self).__init__(nodes, ref_el, entity_ids, [1, 1, 2, -1])


class NedelecDual3D(dual_set.DualSet):
Expand Down Expand Up @@ -273,7 +273,7 @@ def __init__(self, ref_el, degree):
num_internal_dof = Pkm2_at_qpts.shape[0] * sd
entity_ids[3][0] = list(range(cur, cur + num_internal_dof))

super(NedelecDual3D, self).__init__(nodes, ref_el, entity_ids)
super(NedelecDual3D, self).__init__(nodes, ref_el, entity_ids, [1, 1, 2, 3])


class Nedelec(finite_element.CiarletElement):
Expand Down
7 changes: 6 additions & 1 deletion FIAT/raviart_thomas.py
Expand Up @@ -124,7 +124,12 @@ def __init__(self, ref_el, degree):
degree - 1)
entity_ids[sd][0] = list(range(cur, cur + num_internal_nodes * sd))

super(RTDualSet, self).__init__(nodes, ref_el, entity_ids)
if sd == 2:
entity_block_sizes = [1, 1, 2, -1]
else:
entity_block_sizes = [1, 1, 1, 3]

super(RTDualSet, self).__init__(nodes, ref_el, entity_ids, entity_block_sizes)


class RaviartThomas(finite_element.CiarletElement):
Expand Down

0 comments on commit 87a3e5c

Please sign in to comment.