|
17 | 17 | from numbers import Number |
18 | 18 |
|
19 | 19 | from ufl.argument import Argument, Coargument |
20 | | -from ufl.coefficient import BaseCoefficient |
21 | 20 | from ufl.constantvalue import as_ufl |
22 | 21 | from ufl.core.operator import Operator |
23 | 22 | from ufl.core.ufl_type import ufl_type |
@@ -135,21 +134,21 @@ def count(self): |
135 | 134 |
|
136 | 135 | @property |
137 | 136 | def ufl_shape(self): |
138 | | - """Return the UFL shape of the coefficient.produced by the operator.""" |
139 | | - arg, *_ = self.argument_slots() |
140 | | - if not isinstance(arg, BaseCoefficient) and isinstance(arg, (BaseForm, Coargument)): |
141 | | - arg, *_ = arg.arguments() |
| 137 | + """Return the UFL shape of the coefficient produced by the operator.""" |
| 138 | + if len(self.arguments()) == 0: |
| 139 | + return () |
| 140 | + arg, *_ = self.arguments() |
142 | 141 | return arg._ufl_shape |
143 | 142 |
|
144 | 143 | def ufl_function_space(self): |
145 | 144 | """Return the function space associated to the operator. |
146 | 145 |
|
147 | 146 | I.e. return the dual of the base form operator's Coargument space. |
148 | 147 | """ |
149 | | - arg, *_ = self.argument_slots() |
150 | | - if not isinstance(arg, BaseCoefficient) and isinstance(arg, (BaseForm, Coargument)): |
151 | | - arg, *_ = arg.arguments() |
152 | | - return arg.ufl_function_space() |
| 148 | + if len(self.arguments()) == 0: |
| 149 | + return None |
| 150 | + arg, *_ = self.arguments() |
| 151 | + return arg.ufl_function_space().dual() |
153 | 152 |
|
154 | 153 | def _ufl_expr_reconstruct_( |
155 | 154 | self, *operands, function_space=None, derivatives=None, argument_slots=None |
|
0 commit comments