-
Notifications
You must be signed in to change notification settings - Fork 108
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
segfault again, meshpy.triangle before and after numpy. #8
Comments
Doesn't crash for me, sorry. My versions are almost exactly the same as yours--Python 2.7.8, numpy 1.9.0rc1. |
(To be clear--I tried both orders.) meshpy is very dependent on the x87 floating point control word, and when something messes with that, it can easily get confused. That would be my first line of investigation... Hope that helps. |
updated, I debug the script with meshpy.triangle placed after numpy, and here are the results,
and using
I found this problem might be related with the refinement_func. I can not go any further here and do not know whether I would help in solving this problem. |
Did you change the script in your original report? |
Yes, I remove all the from __future__ import division
import meshpy.triangle as triangle
import numpy as np
def round_trip_connect(start, end):
return [(i, i+1) for i in range(start, end)] + [(end, start)]
def refinement_func(tri_points, area):
max_area=0.1
return bool(area>max_area);
def main():
points = [(1, 0), (1, 1), (-1, 1), (-1, -1), (1, -1), (1, 0)]
facets = round_trip_connect(0, len(points)-1)
outter_start = len(points)
points.extend([(2, 0), (2, 2), (-2, 2), (-2, -2), (2, -2), (2, 0)])
facets.extend(round_trip_connect(outter_start, len(points)-1))
# build
info = triangle.MeshInfo()
info.set_points(points)
info.set_holes([(0, 0)])
info.set_facets(facets)
#
mesh = triangle.build(info, refinement_func=refinement_func)
#
mesh_points = np.array(mesh.points)
mesh_tris = np.array(mesh.elements)
mesh_attr = np.array(mesh.point_markers)
import matplotlib.pyplot as plt
plt.triplot(mesh_points[:, 0], mesh_points[:, 1], mesh_tris)
plt.xlabel('x')
plt.ylabel('y')
#
fig = plt.gcf()
fig.set_size_inches(4.2, 4.2)
plt.savefig('../../figs/sec5-meshpy-triangle-ex2.pdf')
if __name__ == "__main__":
main() |
Doesn't crash for me, sorry. :/ |
Issues with segfaults in meshpy.triangle related to order of of meshpy vs. numpy imports have emerged again. See this issue on the meshpy repo (inducer/meshpy#8). Look into using TetGen to do the 2d triangulation as the issue seems to be restricted to triangle.
Hi, in the following script, if I put
import meshpy.triangle as triangle
beforeimport numpy as np
, everything goes fine. However, if I put it after numpy, there will be a segfault.the versions are
and using the meshpy-git version.
PS, thanks for the help in the mailing list in generating the facet_markers.
The text was updated successfully, but these errors were encountered: