From 57e21cc8ebdb044c1d8423b48f3dbf70975d5548 Mon Sep 17 00:00:00 2001 From: ksagiyam <46749170+ksagiyam@users.noreply.github.com> Date: Wed, 7 Aug 2024 17:00:17 +0100 Subject: [PATCH] bc: postpone raising exception for zany elements (#3726) --- firedrake/bcs.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/firedrake/bcs.py b/firedrake/bcs.py index 61369a4083..9f340e4181 100644 --- a/firedrake/bcs.py +++ b/firedrake/bcs.py @@ -40,10 +40,6 @@ class BCBase(object): @PETSc.Log.EventDecorator() def __init__(self, V, sub_domain): - # First, we bail out on zany elements. We don't know how to do BC's for them. - if isinstance(V.finat_element, (finat.Argyris, finat.Morley, finat.Bell)) or \ - (isinstance(V.finat_element, finat.Hermite) and V.mesh().topological_dimension() > 1): - raise NotImplementedError("Strong BCs not implemented for element %r, use Nitsche-type methods until we figure this out" % V.finat_element) self._function_space = V self.sub_domain = sub_domain # If this BC is defined on a subspace (IndexedFunctionSpace or @@ -131,6 +127,12 @@ def domain_args(self): def nodes(self): '''The list of nodes at which this boundary condition applies.''' + # First, we bail out on zany elements. We don't know how to do BC's for them. + V = self._function_space + if isinstance(V.finat_element, (finat.Argyris, finat.Morley, finat.Bell)) or \ + (isinstance(V.finat_element, finat.Hermite) and V.mesh().topological_dimension() > 1): + raise NotImplementedError("Strong BCs not implemented for element %r, use Nitsche-type methods until we figure this out" % V.finat_element) + def hermite_stride(bcnodes): if isinstance(self._function_space.finat_element, finat.Hermite) and \ self._function_space.mesh().topological_dimension() == 1: