Skip to content

Commit

Permalink
let mesh.line return a 0d geometry
Browse files Browse the repository at this point in the history
  • Loading branch information
joostvanzwieten committed Sep 20, 2021
1 parent 25ec6b2 commit 596a39f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
4 changes: 2 additions & 2 deletions nutils/mesh.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def line(nodes, periodic=False, bnames=None, *, space: str = 'X'):
uniform = numpy.equal(nodes, offset + numpy.arange(nelems+1) * scale).all()
root = transform.Identifier(1, 'line')
domain = topology.StructuredLine(space, root, 0, nelems, periodic=periodic, bnames=bnames)
geom = function.rootcoords(space, 1) * scale + offset if uniform else domain.basis('std', degree=1, periodic=[]).dot(nodes)
geom = function.rootcoords(space, 1)[0] * scale + offset if uniform else domain.basis('std', degree=1, periodic=[]).dot(nodes)
return domain, geom

def newrectilinear(nodes, periodic=None, bnames=[['left','right'],['bottom','top'],['front','back']]):
Expand All @@ -100,7 +100,7 @@ def newrectilinear(nodes, periodic=None, bnames=[['left','right'],['bottom','top
domain, geom = dims.pop(0)
for domaini, geomi in dims:
domain = domain * domaini
geom = function.concatenate(function.bifurcate(geom,geomi))
geom = function.concatenate(function.bifurcate(geom,geomi[None]))
return domain, geom

@log.withcontext
Expand Down
1 change: 1 addition & 0 deletions tests/test_basis.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ def setUp(self):
super().setUp()
verts = numpy.linspace(0, 1, self.nelems+1)
self.domain, self.geom = mesh.line(verts, periodic=self.periodic)
self.geom = self.geom[None]
self.basis = self.domain.basis(self.btype, degree=self.degree)

@parametrize.enable_if(lambda btype, **params: btype != 'discont')
Expand Down

0 comments on commit 596a39f

Please sign in to comment.