Skip to content

Commit

Permalink
repl rectlin with newrectlin if NUTILS_TENSORIAL
Browse files Browse the repository at this point in the history
  • Loading branch information
joostvanzwieten committed Sep 20, 2021
1 parent 1a088c1 commit 1ac3c2b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
3 changes: 3 additions & 0 deletions examples/burgers.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,9 @@ def test_1d_p2(self):
@testing.requires('matplotlib')
def test_2d_p1(self):
lhs = main(ndims=2, nelems=4, timescale=.1, degree=1, endtime=.01, newtontol=1e-5)
import os
if os.environ.get('NUTILS_TENSORIAL'):
lhs = lhs.reshape(4,2,4,2).transpose(0,2,1,3).ravel()
self.assertAlmostEqual64(lhs, '''
eNoNyKENhEAQRuGEQsCv2SEzyQZHDbRACdsDJNsBjqBxSBxBHIgJ9xsqQJ1Drro1L1/eYBZceGz8njrR
yacm8UQLBvPYCw1airpyUVYSJLhKijK4IC01WDnqqxvX8OTl427aU73sctPGr3qqceBnRzOjo0xy9JpJ
Expand Down
5 changes: 5 additions & 0 deletions nutils/mesh.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,11 @@ def newrectilinear(nodes, periodic=None, name='rect', bnames=[['left','right'],[
domains, geoms = zip(*(line(nodesi, i in periodic, bnamesi, name=name, space=spacei) for i, (nodesi, bnamesi, spacei) in enumerate(zip(nodes, tuple(bnames)+(None,)*len(nodes), spaces))))
return util.product(domains), function.stack(geoms)

if os.environ.get('NUTILS_TENSORIAL'):
def rectilinear(richshape, periodic=(), name='rect', space='X'):
spaces = tuple(space+str(i) for i in range(len(richshape)))
return newrectilinear(richshape, periodic, name, spaces=spaces)

@log.withcontext
def multipatch(patches, nelems, patchverts=None, name='multipatch'):
'''multipatch rectilinear mesh generator
Expand Down

0 comments on commit 1ac3c2b

Please sign in to comment.