Skip to content

Commit

Permalink
new quad function + tests_26
Browse files Browse the repository at this point in the history
  • Loading branch information
felicio93 committed Jun 28, 2024
1 parent 647352e commit fc67bfe
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 21 deletions.
10 changes: 3 additions & 7 deletions .github/workflows/functional_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,6 @@ jobs:
path: /tmp/test_dem.tif
retention-days: 7

- name: Run Python API tests
shell: bash -el {0}
run: python -m unittest discover tests/api -p "utils.py"

- name: Run geom build test
if: runner.os != 'Windows'
shell: bash -l {0}
Expand Down Expand Up @@ -117,6 +113,6 @@ jobs:
path: remeshed.2dm
retention-days: 7

# - name: Run Python API tests
# shell: bash -el {0}
# run: python -m unittest discover tests/api -p "*.py"
- name: Run Python API tests
shell: bash -el {0}
run: python -m unittest discover tests/api -p "*.py"
2 changes: 1 addition & 1 deletion ocsmesh/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -3116,7 +3116,7 @@ def order_nodes(verts):
if len(el) > 0:
ordered_idx = np.array([order_nodes(coord_verts[i]) for i in el])
ordered_el = np.zeros(el.shape,dtype="int")
for i,e in enumerate(ordered_el):
for i,e in enumerate(ordered_idx):
ordered_el[i] = el[i][e]
if etype == 'tria3':
tri.append(ordered_el)
Expand Down
26 changes: 13 additions & 13 deletions tests/api/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,23 +103,23 @@ def test_order_mesh(self):
np.all(utils.order_mesh(out_msht).quad4['index'] == np.array([[ 0, 4, 8, 7],[ 7, 8, 10, 9]]))
)

# def test_quads_from_tri(self):
# out_msht = utils.msht_from_numpy(
# coordinates=self.in_verts,
# triangles=self.in_tria,
# quadrilaterals=self.in_quad
# )
def test_quads_from_tri(self):
out_msht = utils.msht_from_numpy(
coordinates=self.in_verts,
triangles=self.in_tria,
quadrilaterals=self.in_quad
)

# self.assertIsInstance(out_msht, jigsaw_msh_t)
self.assertIsInstance(out_msht, jigsaw_msh_t)

# out_msht_ord = utils.order_mesh(out_msht)
# self.assertIsInstance(out_msht_ord, jigsaw_msh_t)
out_msht_ord = utils.order_mesh(out_msht)
self.assertIsInstance(out_msht_ord, jigsaw_msh_t)

# out_msht_ord_q = utils.quads_from_tri(out_msht_ord)
# self.assertIsInstance(out_msht_ord_q, jigsaw_msh_t)
out_msht_ord_q = utils.quads_from_tri(out_msht_ord)
self.assertIsInstance(out_msht_ord_q, jigsaw_msh_t)

# self.assertEqual(len(out_msht_ord_q.tria3), 2)
# self.assertEqual(len(out_msht_ord_q.quad4), 4)
self.assertEqual(len(out_msht_ord_q.tria3), 2)
self.assertEqual(len(out_msht_ord_q.quad4), 4)


class SmallAreaElements(unittest.TestCase):
Expand Down

0 comments on commit fc67bfe

Please sign in to comment.