Commit 76de9882 authored by theos's avatar theos
Browse files

Removed dof_split

parent a13e0bdb
......@@ -461,16 +461,6 @@ class Field(object):
except TypeError:
return ()
@property
def dof_split(self):
dof_tuple = ()
dof_tuple += tuple(sp.dof_split for sp in self.domain)
dof_tuple += tuple(ft.dof_split for ft in self.field_type)
try:
return reduce(lambda x, y: x + y, dof_tuple)
except TypeError:
return ()
def cast(self, x=None, dtype=None):
if dtype is None:
dtype = self.dtype
......
......@@ -13,6 +13,8 @@ class FieldType(object):
self._dtype = np.dtype(dtype)
self._dof = self._get_dof()
@property
def shape(self):
return self._shape
......@@ -25,21 +27,13 @@ class FieldType(object):
def dof(self):
return self._dof
@property
def dof_split(self):
return self._dof_split
def _get_dof(self, split=False):
def _get_dof(self):
if issubclass(self.dtype.type, np.complexfloating):
multiplicator = 2
else:
multiplicator = 1
if split:
dof = tuple(multiplicator*np.array(self.shape))
else:
dof = multiplicator*reduce(lambda x, y: x*y, self.shape)
dof = multiplicator*reduce(lambda x, y: x*y, self.shape)
return dof
def process(self, method_name, array, inplace=True, **kwargs):
......
......@@ -199,10 +199,6 @@ class LMSpace(Space):
dof = np.int((lmax + 1) * (2 * mmax + 1) - (mmax + 1) * mmax)
return dof
@property
def dof_split(self):
return (self.dof,)
@property
def meta_volume(self):
"""
......
......@@ -320,23 +320,6 @@ class Space(object):
dof = dof * 2
return dof
@property
def dof_split(self):
"""
Computes the number of degrees of freedom of the space, i.e./ the
number of points for real-valued fields and twice that number for
complex-valued fields.
Returns
-------
dof : int
Number of degrees of freedom of the space.
"""
dof = self.shape
if issubclass(self.dtype.type, np.complexfloating):
dof = tuple(np.array(dof)*2)
return dof
@property
def vol(self):
collapsed_distances = [np.sum(x) for x in self.distances]
......
......@@ -304,11 +304,8 @@ class Test_Common_Point_Like_Space_Interface(unittest.TestCase):
assert(isinstance(s.dim, np.int))
assert(isinstance(s.dof, np.int))
assert(isinstance(s.dof_split, tuple))
assert_equal(s.dof, np.prod(s.dof_split))
assert(isinstance(s.get_vol(), np.float))
assert(isinstance(s.dof_split, tuple))
assert(isinstance(s.meta_volume, np.float))
print(s.meta_volume_split, type(s.cast(1)))
......@@ -421,10 +418,8 @@ class Test_Point_Space(unittest.TestCase):
if issubclass(dtype.type, np.complexfloating):
assert_equal(s.dof, 2 * num)
assert_equal(s.dof_split, (2 * num,))
else:
assert_equal(s.dof, num)
assert_equal(s.dof_split, (num,))
###############################################################################
......@@ -1015,7 +1010,6 @@ class Test_Lm_Space(unittest.TestCase):
assert_equal(l.shape, (156,))
assert_equal(l.dof, 294)
assert_equal(l.dof_split, (294,))
assert_equal(l.meta_volume, 294.)
assert_equal(l.meta_volume_split,
l.cast(np.concatenate([np.ones(18), np.ones(138)*2])))
......
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