Skip to content

Commit

Permalink
revert ProductTopology.basis simplifications
Browse files Browse the repository at this point in the history
  • Loading branch information
joostvanzwieten committed Jun 16, 2020
1 parent 97243a0 commit ba6b3d8
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions nutils/topology.py
Original file line number Diff line number Diff line change
Expand Up @@ -876,6 +876,9 @@ def interfaces(self):
def refined(self):
return self

def basis(self, *args, **kwargs):
return function.PlainBasis(numpy.zeros((0,)*(self.ndims+1)), numpy.zeros((0,)*(self.ndims+1)), 0, self.transforms, self.ndims, function.SelectChain(self.roots))

class Point(Topology):
'point'

Expand Down Expand Up @@ -2401,19 +2404,15 @@ def interfaces(self):
return DisjointUnionTopology(interfaces)

def _productbasis(self, lbasis, rbasis):
if not lbasis:
return rbasis
if not rbasis:
return lbasis
return function.ProductBasis(lbasis, rbasis, function.SelectChain(self.roots))

def basis(self, name, *args, **kwargs):
if name in ('spline', 'h-spline', 'th-spline'):
return self.basis_spline(*args, _variant=name, **kwargs)
elif name == 'std':
return self.basis_std(*args, **kwargs)
lbasis = self._left.basis(name, *args, **kwargs) if self._left.ndims else None
rbasis = self._right.basis(name, *args, **kwargs) if self._right.ndims else None
lbasis = self._left.basis(name, *args, **kwargs)
rbasis = self._right.basis(name, *args, **kwargs)
return self._productbasis(lbasis, rbasis)

def _split_list(self, value, scalar_type):
Expand Down Expand Up @@ -2446,14 +2445,14 @@ def basis_spline(self, degree, removedofs=None, knotvalues=None, knotmultiplicit
lperiodic = [i for i in periodic if i < self._left.ndims]
rperiodic = [i-self._left.ndims for i in periodic if i >= self._left.ndims]

lbasis = self._left.basis(_variant, degree=ldegree, removedofs=lremovedofs, knotvalues=lknotvalues, knotmultiplicities=lknotmultiplicities, continuity=lcontinuity, periodic=lperiodic) if self._left.ndims else None
rbasis = self._right.basis(_variant, degree=rdegree, removedofs=rremovedofs, knotvalues=rknotvalues, knotmultiplicities=rknotmultiplicities, continuity=rcontinuity, periodic=rperiodic) if self._right.ndims else None
lbasis = self._left.basis(_variant, degree=ldegree, removedofs=lremovedofs, knotvalues=lknotvalues, knotmultiplicities=lknotmultiplicities, continuity=lcontinuity, periodic=lperiodic)
rbasis = self._right.basis(_variant, degree=rdegree, removedofs=rremovedofs, knotvalues=rknotvalues, knotmultiplicities=rknotmultiplicities, continuity=rcontinuity, periodic=rperiodic)
return self._productbasis(lbasis, rbasis)

def basis_std(self, degree):
ldegree, rdegree = self._split_scalar(degree, int)
lbasis = self._left.basis('std', degree=ldegree) if self._left.ndims else None
rbasis = self._right.basis('std', degree=rdegree) if self._right.ndims else None
lbasis = self._left.basis('std', degree=ldegree)
rbasis = self._right.basis('std', degree=rdegree)
return self._productbasis(lbasis, rbasis)

@property
Expand Down

0 comments on commit ba6b3d8

Please sign in to comment.