Skip to content

Commit e352af0

Browse files
committed
[ci] add test cgals2m
1 parent 644a909 commit e352af0

File tree

3 files changed

+14
-5
lines changed

3 files changed

+14
-5
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ tracked in https://github.com/NeuroJSON/pyiso2mesh/issues/1
199199
| > Iso2mesh main function backend| | |`readasc.m` | ⭕️ tested |
200200
|`binsurface.m` | ✅ tested | | ⭕️ `readinr.m` | ⭕️ tested |
201201
|`cgalv2m.m` | ✅ tested | |`readmedit.m` | ⭕️ tested |
202-
|`cgals2m.m` | ⭕️ tested | |`readoff.m` | ✅ tested |
202+
|`cgals2m.m` | tested | |`readoff.m` | ✅ tested |
203203
|`vol2restrictedtri.m` | ✅ tested | | ⭕️ `readsmf.m` | ⭕️ tested |
204204
|`surf2volz.m` | ✅ tested | |`readtetgen.m` | ✅ tested |
205205
|`mesh2mask.m` | ⭕️ tested | |`deletemeshfile.m` | ✅ tested |

iso2mesh/core.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -897,7 +897,7 @@ def cgals2m(v, f, opt, maxvol, **kwargs):
897897
If it's a scalar, it only specifies radbound.
898898
maxvol : float
899899
Target maximum tetrahedral element volume.
900-
*args : Additional arguments
900+
kwargs : Additional arguments
901901
902902
Returns:
903903
node : ndarray
@@ -920,7 +920,7 @@ def cgals2m(v, f, opt, maxvol, **kwargs):
920920
if not isinstance(opt, dict):
921921
ssize = opt
922922

923-
if isinstance(opt, dict) and len(opt) == 1:
923+
if isinstance(opt, dict):
924924
ssize = opt.get("radbound", ssize)
925925
ang = opt.get("angbound", ang)
926926
approx = opt.get("distbound", approx)

test/run_test.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1180,6 +1180,15 @@ def test_cgalv2m(self):
11801180
self.assertEqual(removedupelem(fc[:, :3]).shape[0], 0)
11811181
self.assertAlmostEqual(sum(elemvolume(no[:, :3], el[:, :4])), 0.7455, 3)
11821182

1183+
def test_cgals2m(self):
1184+
node, elem, face = cgals2m(self.no[:, :3], self.fc[:, :3], 3, 50)
1185+
self.assertAlmostEqual(
1186+
sum(elemvolume(node[:, :3], face[:, :3])) * 0.001, 2.393432610273361, 3
1187+
)
1188+
self.assertAlmostEqual(
1189+
sum(elemvolume(node[:, :3], elem[:, :4])) * 0.001, 3.817319008857012, 3
1190+
)
1191+
11831192
def test_v2s_label(self):
11841193
no, fc, _, _ = v2s(self.mask, 0.5, 0.5)
11851194
self.assertAlmostEqual(
@@ -1265,8 +1274,8 @@ def test_surf2vol_fill(self):
12651274
self.assertAlmostEqual(np.sum(vol.astype(np.float32)) * 0.0001, 3.5536, 2)
12661275

12671276
def test_s2v(self):
1268-
vol = s2v(self.no, self.fc, 80, fill=1)
1269-
self.assertAlmostEqual(np.sum(vol.astype(np.float32)) * 0.0001, 31.4066, 2)
1277+
vol = s2v(self.no, self.fc, 100, fill=1)
1278+
self.assertAlmostEqual(np.sum(vol.astype(np.float32)) * 0.0001, 60.827, 2)
12701279

12711280

12721281
@unittest.skipIf(

0 commit comments

Comments
 (0)