Commit 34b9495c authored by Philipp Arras's avatar Philipp Arras
Browse files

Add type checking to PowerDistributor

parent 28debe14
......@@ -18,6 +18,8 @@
from __future__ import absolute_import, division, print_function
import numpy as np
from ..compat import *
from ..domain_tuple import DomainTuple
from ..domains.power_space import PowerSpace
......@@ -57,3 +59,12 @@ class PowerDistributor(DOFDistributor):
raise ValueError("power_space does not match its partner")
self._init2(power_space.pindex, self._space, power_space)
def apply(self, x, mode):
self._check_input(x, mode)
if x.dtype == np.complex:
if x.imag.sum() == 0:
x = x.real
else:
raise TypeError
return DOFDistributor.apply(self, x, mode)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment