From 332b2dbb65efdd2093f6638fad1da2a514a27ce2 Mon Sep 17 00:00:00 2001 From: Andreas Kloeckner Date: Wed, 21 Aug 2019 12:15:54 -0500 Subject: [PATCH 1/2] Add point attribute test for Triangle --- test/test_meshpy.py | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/test/test_meshpy.py b/test/test_meshpy.py index 6ac566f..5b019f8 100644 --- a/test/test_meshpy.py +++ b/test/test_meshpy.py @@ -61,8 +61,7 @@ def test_triangle_refine(): info.set_holes([(0, 0)]) info.set_facets( round_trip_connect(0, n_outer_points-1) - + - round_trip_connect(n_outer_points, len(points)-1)) + + round_trip_connect(n_outer_points, len(points)-1)) mesh = triangle.build(info, refinement_func=needs_refinement) @@ -77,6 +76,23 @@ def test_triangle_refine(): mesh = triangle.refine(mesh) + +def test_point_attributes(): + import meshpy.triangle as triangle + + points = [(1, 1), (-1, 1), (-1, -1), (1, -1)] + info = triangle.MeshInfo() + info.set_points(points) + + info.number_of_point_attributes = len(points) + + info.point_attributes.setup() + + for i in range(len(points)): + info.point_attributes[i] = [0, 0, 0, 0] + + triangle.build(info) + # }}} -- GitLab From 6431f9214a7936de927a09e367a21092221f4c5c Mon Sep 17 00:00:00 2001 From: Andreas Kloeckner Date: Wed, 21 Aug 2019 12:16:46 -0500 Subject: [PATCH 2/2] Improve point attr test --- test/test_meshpy.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/test_meshpy.py b/test/test_meshpy.py index 5b019f8..7eaf5ff 100644 --- a/test/test_meshpy.py +++ b/test/test_meshpy.py @@ -84,12 +84,12 @@ def test_point_attributes(): info = triangle.MeshInfo() info.set_points(points) - info.number_of_point_attributes = len(points) + info.number_of_point_attributes = 2 info.point_attributes.setup() for i in range(len(points)): - info.point_attributes[i] = [0, 0, 0, 0] + info.point_attributes[i] = [0, 0] triangle.build(info) -- GitLab