diff --git a/nutils/topology.py b/nutils/topology.py index 565abfb77..004436e4e 100644 --- a/nutils/topology.py +++ b/nutils/topology.py @@ -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)