cytriangle 1.0.0__cp39-cp39-macosx_14_0_arm64.whl → 1.0.2__cp39-cp39-macosx_14_0_arm64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of cytriangle might be problematic. Click here for more details.
- cytriangle/cytriangle.c +1264 -645
- cytriangle/cytriangle.cpython-39-darwin.so +0 -0
- cytriangle/cytriangle.pyx +33 -24
- cytriangle/cytriangleio.c +1460 -1454
- cytriangle/cytriangleio.cpython-39-darwin.so +0 -0
- cytriangle/cytriangleio.pxd +0 -1
- cytriangle/cytriangleio.pyx +38 -24
- {cytriangle-1.0.0.dist-info → cytriangle-1.0.2.dist-info}/METADATA +1 -1
- cytriangle-1.0.2.dist-info/RECORD +13 -0
- cytriangle-1.0.0.dist-info/RECORD +0 -13
- {cytriangle-1.0.0.dist-info → cytriangle-1.0.2.dist-info}/LICENSE +0 -0
- {cytriangle-1.0.0.dist-info → cytriangle-1.0.2.dist-info}/WHEEL +0 -0
|
Binary file
|
cytriangle/cytriangleio.pxd
CHANGED
cytriangle/cytriangleio.pyx
CHANGED
|
@@ -2,6 +2,7 @@ from libc.stdlib cimport free, malloc
|
|
|
2
2
|
import numpy as np
|
|
3
3
|
from cytriangle.ctriangle cimport triangulateio
|
|
4
4
|
|
|
5
|
+
|
|
5
6
|
def validate_input_attributes(attributes):
|
|
6
7
|
num_attr = list(set([len(sublist) for sublist in attributes]))
|
|
7
8
|
if len(num_attr) > 1:
|
|
@@ -14,16 +15,16 @@ def validate_input_attributes(attributes):
|
|
|
14
15
|
def validate_attribute_number(attributes, base_quantity):
|
|
15
16
|
if len(attributes) != base_quantity:
|
|
16
17
|
raise ValueError(
|
|
17
|
-
"Attribute list must have the same number of elements as the
|
|
18
|
+
"""Attribute list must have the same number of elements as the
|
|
19
|
+
input it decorates"""
|
|
18
20
|
)
|
|
19
21
|
|
|
22
|
+
|
|
20
23
|
cdef class TriangleIO:
|
|
21
24
|
|
|
22
25
|
def __cinit__(self):
|
|
23
26
|
# Initialize the triangulateio struct with NULL pointers
|
|
24
27
|
self._io = <triangulateio*> NULL
|
|
25
|
-
# out flag prevents freeing shared in / out struct data twice
|
|
26
|
-
self.out_flag = 0
|
|
27
28
|
|
|
28
29
|
def __dealloc__(self):
|
|
29
30
|
# Free allocated memory when the instance is deallocated
|
|
@@ -47,9 +48,9 @@ cdef class TriangleIO:
|
|
|
47
48
|
free(self._io.segmentlist)
|
|
48
49
|
if self._io.segmentmarkerlist is not NULL:
|
|
49
50
|
free(self._io.segmentmarkerlist)
|
|
50
|
-
if self._io.holelist is not NULL
|
|
51
|
+
if self._io.holelist is not NULL:
|
|
51
52
|
free(self._io.holelist)
|
|
52
|
-
if self._io.regionlist is not NULL
|
|
53
|
+
if self._io.regionlist is not NULL:
|
|
53
54
|
free(self._io.regionlist)
|
|
54
55
|
if self._io.edgelist is not NULL:
|
|
55
56
|
free(self._io.edgelist)
|
|
@@ -59,10 +60,7 @@ cdef class TriangleIO:
|
|
|
59
60
|
free(self._io.normlist)
|
|
60
61
|
free(self._io)
|
|
61
62
|
|
|
62
|
-
def __init__(self, input_dict=None
|
|
63
|
-
# Prevent double deallocation on 'out' triangleio structs
|
|
64
|
-
if kind == 'out':
|
|
65
|
-
self.out_flag = 1
|
|
63
|
+
def __init__(self, input_dict=None):
|
|
66
64
|
# Assemble the triangulateio struct from a Python dictionary (default)
|
|
67
65
|
self._io = <triangulateio*> malloc(sizeof(triangulateio))
|
|
68
66
|
|
|
@@ -125,12 +123,13 @@ cdef class TriangleIO:
|
|
|
125
123
|
if 'regions' in input_dict:
|
|
126
124
|
self.set_regions(input_dict['regions'])
|
|
127
125
|
|
|
128
|
-
def to_dict(self,opt=''):
|
|
126
|
+
def to_dict(self, opt=''):
|
|
129
127
|
"""
|
|
130
128
|
Converts the internal C TriangleIO data structure into a dictionary format.
|
|
131
129
|
|
|
132
130
|
Parameters:
|
|
133
|
-
- opt: A string that indicates the format of the output. If 'np',
|
|
131
|
+
- opt: A string that indicates the format of the output. If 'np',
|
|
132
|
+
numpy arrays are used.
|
|
134
133
|
|
|
135
134
|
Returns:
|
|
136
135
|
- A dictionary containing the triangulation data.
|
|
@@ -147,7 +146,8 @@ cdef class TriangleIO:
|
|
|
147
146
|
if self.triangles:
|
|
148
147
|
output_dict['triangles'] = np.asarray(self.triangles)
|
|
149
148
|
if self.triangle_attributes:
|
|
150
|
-
output_dict['triangle_attributes'] = np.asarray(
|
|
149
|
+
output_dict['triangle_attributes'] = np.asarray(
|
|
150
|
+
self.triangle_attributes)
|
|
151
151
|
else:
|
|
152
152
|
if self.vertices:
|
|
153
153
|
output_dict['vertices'] = self.vertices
|
|
@@ -212,7 +212,9 @@ cdef class TriangleIO:
|
|
|
212
212
|
vertex_attr = []
|
|
213
213
|
for j in range(self._io.numberofpointattributes):
|
|
214
214
|
vertex_attr.append(
|
|
215
|
-
self._io.pointattributelist[
|
|
215
|
+
self._io.pointattributelist[
|
|
216
|
+
i*self._io.numberofpointattributes + j
|
|
217
|
+
]
|
|
216
218
|
)
|
|
217
219
|
vertex_attributes.append(vertex_attr)
|
|
218
220
|
return vertex_attributes
|
|
@@ -239,8 +241,9 @@ cdef class TriangleIO:
|
|
|
239
241
|
@property
|
|
240
242
|
def triangles(self):
|
|
241
243
|
"""
|
|
242
|
-
`triangles`: A list of triangle corners (not necessarily 3).
|
|
243
|
-
in a counterclockwise order,
|
|
244
|
+
`triangles`: A list of triangle corners (not necessarily 3).
|
|
245
|
+
Corners are designated in a counterclockwise order,
|
|
246
|
+
followed by any other nodes if the triangle represents a
|
|
244
247
|
nonlinear element (e.g. num_corners > 3).
|
|
245
248
|
|
|
246
249
|
Returns:
|
|
@@ -251,7 +254,9 @@ cdef class TriangleIO:
|
|
|
251
254
|
for i in range(self._io.numberoftriangles):
|
|
252
255
|
tri_order = []
|
|
253
256
|
for j in range(self._io.numberofcorners):
|
|
254
|
-
tri_order.append(self._io.trianglelist[
|
|
257
|
+
tri_order.append(self._io.trianglelist[
|
|
258
|
+
i * self._io.numberofcorners + j
|
|
259
|
+
])
|
|
255
260
|
triangles.append(tri_order)
|
|
256
261
|
return triangles
|
|
257
262
|
|
|
@@ -274,7 +279,9 @@ cdef class TriangleIO:
|
|
|
274
279
|
triangle_attr = []
|
|
275
280
|
for j in range(self._io.numberoftriangleattributes):
|
|
276
281
|
triangle_attr.append(
|
|
277
|
-
self._io.triangleattributelist[
|
|
282
|
+
self._io.triangleattributelist[
|
|
283
|
+
i*self._io.numberoftriangleattributes + j
|
|
284
|
+
]
|
|
278
285
|
)
|
|
279
286
|
triangle_attributes.append(triangle_attr)
|
|
280
287
|
return triangle_attributes
|
|
@@ -286,7 +293,8 @@ cdef class TriangleIO:
|
|
|
286
293
|
@property
|
|
287
294
|
def triangle_max_area(self):
|
|
288
295
|
"""
|
|
289
|
-
`triangle_max_area`: A list of triangle area constraints;
|
|
296
|
+
`triangle_max_area`: A list of triangle area constraints;
|
|
297
|
+
one per triangle, 0 if not set.
|
|
290
298
|
Input only.
|
|
291
299
|
|
|
292
300
|
Returns:
|
|
@@ -306,7 +314,8 @@ cdef class TriangleIO:
|
|
|
306
314
|
`neighbors`: A list of triangle neighbors; three ints per triangle. Output only.
|
|
307
315
|
|
|
308
316
|
Returns:
|
|
309
|
-
- A list of lists, where each inner list contains indices of neighboring
|
|
317
|
+
- A list of lists, where each inner list contains indices of neighboring
|
|
318
|
+
triangles.
|
|
310
319
|
"""
|
|
311
320
|
max_neighbors = 3
|
|
312
321
|
if self._io.neighborlist is not NULL:
|
|
@@ -391,7 +400,8 @@ cdef class TriangleIO:
|
|
|
391
400
|
regions = []
|
|
392
401
|
for i in range(self._io.numberofregions):
|
|
393
402
|
region = {}
|
|
394
|
-
region['vertex'] = [self._io.regionlist[4*i],
|
|
403
|
+
region['vertex'] = [self._io.regionlist[4*i],
|
|
404
|
+
self._io.regionlist[4*i + 1]]
|
|
395
405
|
region['marker'] = int(self._io.regionlist[4*i + 2])
|
|
396
406
|
region['max_area'] = self._io.regionlist[4*i + 3]
|
|
397
407
|
regions.append(region)
|
|
@@ -465,7 +475,8 @@ cdef class TriangleIO:
|
|
|
465
475
|
num_vertices = self._io.numberofpoints
|
|
466
476
|
validate_attribute_number(vertex_attributes, num_vertices)
|
|
467
477
|
vertex_attributes = np.ascontiguousarray(vertex_attributes)
|
|
468
|
-
self._io.pointattributelist = <double*>malloc(
|
|
478
|
+
self._io.pointattributelist = <double*>malloc(
|
|
479
|
+
num_attr * num_vertices * sizeof(double))
|
|
469
480
|
self._io.numberofpointattributes = num_attr
|
|
470
481
|
for i in range(num_vertices):
|
|
471
482
|
for j in range(num_attr):
|
|
@@ -492,11 +503,13 @@ cdef class TriangleIO:
|
|
|
492
503
|
num_triangles = self._io.numberoftriangles
|
|
493
504
|
validate_attribute_number(triangle_attributes, num_triangles)
|
|
494
505
|
triangle_attributes = np.ascontiguousarray(triangle_attributes)
|
|
495
|
-
self._io.triangleattributelist = <double*>malloc(
|
|
506
|
+
self._io.triangleattributelist = <double*>malloc(
|
|
507
|
+
num_attr * num_triangles * sizeof(double))
|
|
496
508
|
self._io.numberoftriangleattributes = num_attr
|
|
497
509
|
for i in range(num_triangles):
|
|
498
510
|
for j in range(num_attr):
|
|
499
|
-
self._io.triangleattributelist[
|
|
511
|
+
self._io.triangleattributelist[
|
|
512
|
+
i * num_attr + j] = triangle_attributes[i, j]
|
|
500
513
|
|
|
501
514
|
def set_triangle_areas(self, triangle_areas):
|
|
502
515
|
num_triangles = self._io.numberoftriangles
|
|
@@ -518,7 +531,8 @@ cdef class TriangleIO:
|
|
|
518
531
|
def set_segment_markers(self, segment_markers):
|
|
519
532
|
segment_markers = np.ascontiguousarray(segment_markers, dtype=int)
|
|
520
533
|
validate_attribute_number(segment_markers, self._io.numberofsegments)
|
|
521
|
-
self._io.segmentmarkerlist = <int*>malloc(
|
|
534
|
+
self._io.segmentmarkerlist = <int*>malloc(
|
|
535
|
+
self._io.numberofsegments * sizeof(int))
|
|
522
536
|
for i in range(self._io.numberofsegments):
|
|
523
537
|
self._io.segmentmarkerlist[i] = segment_markers[i]
|
|
524
538
|
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
cytriangle/__init__.py,sha256=kEwfRnZoTHQyXpzGRGT2qSmCNuaFBLOSLXbSoSfTc6I,138
|
|
2
|
+
cytriangle/ctriangle.pxd,sha256=YJL_UQqC-O6tccoYEz6uO02V7U3aqtv0B68K43g9Z9o,877
|
|
3
|
+
cytriangle/cytriangle.c,sha256=oRCNJMnsZ6gyOyprv4Wv6OqggY0872NySA-AHegGEuY,567368
|
|
4
|
+
cytriangle/cytriangle.pyx,sha256=gOumyTTJe8z-oMhCuPgDp0V2Yy9MootqnJ-HNvMjTWg,9019
|
|
5
|
+
cytriangle/cytriangleio.c,sha256=YVdzsdqD3EH5Elm5rbDUH2S0MhY3fJISCNbswRX6huI,908054
|
|
6
|
+
cytriangle/cytriangleio.pxd,sha256=0i9ovT56F-4X6p9WnZTOCmtNAD6Jfr3Yw9PnUYbAl_0,100
|
|
7
|
+
cytriangle/cytriangleio.pyx,sha256=mLSi4psbq5fEXjkbVHx6ru3ES3LbQywpu9D-hQ6d01E,22302
|
|
8
|
+
cytriangle/cytriangle.cpython-39-darwin.so,sha256=DK44iZKkh98moh3eRyld_BxuNqGNJ0Uh2rBO7r4Qqcc,584480
|
|
9
|
+
cytriangle/cytriangleio.cpython-39-darwin.so,sha256=iiVheQHUQv9Qqpwd2BYmokaONVodtNMy2QKo8ON6YWg,700528
|
|
10
|
+
cytriangle-1.0.2.dist-info/LICENSE,sha256=46mU2C5kSwOnkqkw9XQAJlhBL2JAf1_uCD8lVcXyMRg,7652
|
|
11
|
+
cytriangle-1.0.2.dist-info/METADATA,sha256=Kr0wjoWUuOkD7gKfhtguJn7uZfCmaj1wuV8y0spNfBo,2000
|
|
12
|
+
cytriangle-1.0.2.dist-info/WHEEL,sha256=G_WFxUbzDt1TgEo0jVMo4tP9Q2ZdlmLbhDg1HCJ0lsY,104
|
|
13
|
+
cytriangle-1.0.2.dist-info/RECORD,,
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
cytriangle/__init__.py,sha256=kEwfRnZoTHQyXpzGRGT2qSmCNuaFBLOSLXbSoSfTc6I,138
|
|
2
|
-
cytriangle/ctriangle.pxd,sha256=YJL_UQqC-O6tccoYEz6uO02V7U3aqtv0B68K43g9Z9o,877
|
|
3
|
-
cytriangle/cytriangle.c,sha256=q_9EXDXaN4frKaRxDepki05yVJcf3GdX7YQ7NVPB8xc,541778
|
|
4
|
-
cytriangle/cytriangle.pyx,sha256=HobcOSGeQnaINMz7n20RpB3rI7guKXkTUt0KtAB7jzA,8703
|
|
5
|
-
cytriangle/cytriangleio.c,sha256=tIpJ7nd1w1yxe6r8u2LwbvmW8lKn9ODsE3TkdUowG3g,910037
|
|
6
|
-
cytriangle/cytriangleio.pxd,sha256=0SAPQZ3BVoYJrLoQG2oYjJVGaScgPGkTH9BaAeCsD68,122
|
|
7
|
-
cytriangle/cytriangleio.pyx,sha256=gz3e2RLf3NGSMZiT5vhnHidyp9sw-mAcBsuyrAEYRm0,22249
|
|
8
|
-
cytriangle/cytriangle.cpython-39-darwin.so,sha256=F3GrfZkCApeL7flN3uGmusvRpeJw4s4czTDD8rKjiyU,550928
|
|
9
|
-
cytriangle/cytriangleio.cpython-39-darwin.so,sha256=r51XY495hoeV4nwzQhzJKF5FR88q8WaOkUtQmchmL5c,700576
|
|
10
|
-
cytriangle-1.0.0.dist-info/LICENSE,sha256=46mU2C5kSwOnkqkw9XQAJlhBL2JAf1_uCD8lVcXyMRg,7652
|
|
11
|
-
cytriangle-1.0.0.dist-info/METADATA,sha256=lzEKAnP-UBy9XIUMnPtyzjOYcM5QJ_SnSIrlcY0i0PI,2000
|
|
12
|
-
cytriangle-1.0.0.dist-info/WHEEL,sha256=G_WFxUbzDt1TgEo0jVMo4tP9Q2ZdlmLbhDg1HCJ0lsY,104
|
|
13
|
-
cytriangle-1.0.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|