From fc67bfec31356538addd52ce78148e2ec2d454d7 Mon Sep 17 00:00:00 2001 From: felicio93 Date: Fri, 28 Jun 2024 18:34:48 -0400 Subject: [PATCH] new quad function + tests_26 --- .github/workflows/functional_test.yml | 10 +++------- ocsmesh/utils.py | 2 +- tests/api/utils.py | 26 +++++++++++++------------- 3 files changed, 17 insertions(+), 21 deletions(-) diff --git a/.github/workflows/functional_test.yml b/.github/workflows/functional_test.yml index 0944818..36a001b 100644 --- a/.github/workflows/functional_test.yml +++ b/.github/workflows/functional_test.yml @@ -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} @@ -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" diff --git a/ocsmesh/utils.py b/ocsmesh/utils.py index 8a64ea8..39ed29b 100644 --- a/ocsmesh/utils.py +++ b/ocsmesh/utils.py @@ -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) diff --git a/tests/api/utils.py b/tests/api/utils.py index 36b8bc9..0ad8197 100644 --- a/tests/api/utils.py +++ b/tests/api/utils.py @@ -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):