@@ -126,6 +126,16 @@ def coarsen_bc(bc, self, coefficient_mapping=None):
126
126
return type (bc )(V , val , subdomain )
127
127
128
128
129
+ @coarsen .register (firedrake .EquationBC )
130
+ def coarsen_equation_bc (ebc , self , coefficient_mapping = None ):
131
+ eq = self (ebc ._F .f , self , coefficient_mapping = coefficient_mapping )
132
+ u = self (ebc ._F .u , self , coefficient_mapping = coefficient_mapping )
133
+ sub_domain = ebc ._F .sub_domain
134
+ V = self (ebc ._F .function_space (), self , coefficient_mapping = coefficient_mapping )
135
+
136
+ return type (ebc )(eq == 0 , u , sub_domain , V = V )
137
+
138
+
129
139
@coarsen .register (firedrake .functionspaceimpl .WithGeometryBase )
130
140
def coarsen_function_space (V , self , coefficient_mapping = None ):
131
141
if hasattr (V , "_coarse" ):
@@ -311,7 +321,8 @@ def mult(self, mat, x, y, inc=False):
311
321
x .copy (v )
312
322
self .manager .prolong (self .cprimal , self .fprimal )
313
323
for bc in self .fbcs :
314
- bc .zero (self .fprimal )
324
+ if isinstance (bc , firedrake .DirichletBC ):
325
+ bc .zero (self .fprimal )
315
326
with self .fprimal .dat .vec_ro as v :
316
327
if inc :
317
328
y .axpy (1.0 , v )
@@ -330,7 +341,8 @@ def multTranspose(self, mat, x, y, inc=False):
330
341
x .copy (v )
331
342
self .manager .restrict (self .fdual , self .cdual )
332
343
for bc in self .cbcs :
333
- bc .zero (self .cdual )
344
+ if isinstance (bc , firedrake .DirichletBC ):
345
+ bc .zero (self .cdual )
334
346
with self .cdual .dat .vec_ro as v :
335
347
if inc :
336
348
y .axpy (1.0 , v )
0 commit comments