Skip to content

Commit

Permalink
fix trimming
Browse files Browse the repository at this point in the history
  • Loading branch information
joostvanzwieten committed May 11, 2020
1 parent bdd2818 commit 2c952c8
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions nutils/topology.py
Original file line number Diff line number Diff line change
Expand Up @@ -371,13 +371,14 @@ def _trim(self, levelset, maxrefine, ndivisions=8, leveltopo=None, *, arguments=
arguments = {}

refs = []
levelset = levelset.prepare_eval(subsamples=(function.SubsampleMeta(roots=self.roots, ndimsnormal=sum(root.ndims for root in self.roots)-self.ndims),), transforms=(self.transforms, self.opposites)).simplified
if leveltopo is None:
verts = self.sample('vertex', maxrefine)
levels = verts.eval(levelset)
refs = [ref.trim(levels[verts.getindex(ielem)], maxrefine=maxrefine, ndivisions=ndivisions) for ielem, ref in enumerate(self.references)]
with log.iter.percentage('trimming', self.references, self.transforms, self.opposites) as items:
for ielem, (ref, trans, opp) in enumerate(items):
levels = levelset.eval(function.Subsample(roots=self.roots, transforms=(self.transforms, self.opposites), points=ref.getpoints('vertex', maxrefine), ielem=ielem), **arguments)
refs.append(ref.trim(levels, maxrefine=maxrefine, ndivisions=ndivisions))
else:
log.info('collecting leveltopo elements')
levelset = levelset.prepare_eval(subsamples=(function.SubsampleMeta(roots=self.roots, ndimsnormal=sum(root.ndims for root in self.roots)-self.ndims),), transforms=(self.transforms, self.opposites)).simplified
bins = [dict() for ielem in range(len(self))]
for ielemlevel, trans in enumerate(leveltopo.transforms):
ielem, tail = self.transforms.index_with_tail(trans)
Expand Down

0 comments on commit 2c952c8

Please sign in to comment.