From 2c952c83ed067a656ac3edb3d53ec6e281026c9c Mon Sep 17 00:00:00 2001 From: Joost van Zwieten Date: Mon, 11 May 2020 15:49:51 +0200 Subject: [PATCH] fix trimming --- nutils/topology.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/nutils/topology.py b/nutils/topology.py index 565abfb77d..004436e4ea 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)