Skip to content

Commit

Permalink
fix Multipatch.refined (#794)
Browse files Browse the repository at this point in the history
This PR fixes two issues with `Multipatch.refined`:

1. In commit 7e29a28 the `apply_annotations` decorators were removed
from the `topology` module, including `Multipatch.__init__`, which wants
a tuple of patches, but `Multipatch.refined`, which passed a generator
of patches, was not changed accordingly.

2. In commit 64d5f6f the `apply_annotations` decorators were removed
from the `transformseq` module, including `PlainTransforms.__init__`,
which wants a tuple of *canonical* transform chains, but
`Multipatch.interfaces`, which passed a tuple of uncanonical transform
chains when refined, was not changed accordingly.

In addition, this PR adds a test for refined multipatch topologies.
  • Loading branch information
joostvanzwieten committed May 16, 2023
2 parents c031199 + 6bfdc10 commit 8d1e969
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 2 additions & 2 deletions nutils/topology.py
Original file line number Diff line number Diff line change
Expand Up @@ -3210,7 +3210,7 @@ def interfaces(self):
transforms = numeric.asobjvector(btopo.transforms).reshape(btopo.shape)
transforms = transforms[tuple(_ if i == boundary.dim else slice(None) for i in range(self.ndims))]
transforms = boundary.apply_transform(transforms)[..., 0]
pairs.append(tuple(transforms.flat))
pairs.append(tuple(map(transform.canonical, transforms.flat)))
# create structured topology of joined element pairs
references = References.from_iter(references, self.ndims-1)
transforms, opposites = pairs
Expand Down Expand Up @@ -3249,6 +3249,6 @@ def connectivity(self):
def refined(self):
'refine'

return MultipatchTopology(Patch(patch.topo.refined, patch.verts, patch.boundaries) for patch in self.patches)
return MultipatchTopology(tuple(Patch(patch.topo.refined, patch.verts, patch.boundaries) for patch in self.patches))

# vim:sw=4:sts=4:et
3 changes: 3 additions & 0 deletions tests/test_topology.py
Original file line number Diff line number Diff line change
Expand Up @@ -1057,6 +1057,8 @@ def setUp(self):
patchverts=tuple(itertools.product(*map(range, npatches+1))),
nelems=4,
)
if getattr(self, 'refined', False):
self.domain = self.domain.refined

def test_spline_basis(self):
basis = self.domain.basis('spline', degree=2)
Expand All @@ -1080,6 +1082,7 @@ def test_interpatch_interfaces(self):

multipatch_hyperrect('3', npatches=(3,))
multipatch_hyperrect('2x2', npatches=(2, 2))
multipatch_hyperrect('2x2-refined', npatches=(2, 2), refined=True)
multipatch_hyperrect('3x3', npatches=(3, 3))
multipatch_hyperrect('2x2x3', npatches=(2, 2, 3))

Expand Down

0 comments on commit 8d1e969

Please sign in to comment.