Compute_tri_areas fails with new meshplex commit
Eslsamu opened this issue · comments
Let's take this geo (but it happens for every other shape I tried as well):
These are the boundary coords:
boundary_e=[[124.0, 18.0], [75.0, 33.0], [51.0, 54.0], [31.0, 86.0], [19.0, 124.0], [14.0, 183.0], [18.0, 221.0], [33.0, 269.0], [64.0, 310.0], [93.0, 326.0], [122.0, 332.0], [185.0, 327.0], [220.0, 311.0], [254.0, 285.0], [254.0, 156.0], [145.0, 156.0], [145.0, 215.0], [193.0, 215.0], [194.0, 248.0], [155.0, 269.0], [130.0, 269.0], [111.0, 260.0], [92.0, 234.0], [84.0, 190.0], [84.0, 159.0], [94.0, 112.0], [110.0, 91.0], [131.0, 81.0], [159.0, 84.0], [184.0, 116.0], [250.0, 101.0], [242.0, 72.0], [216.0, 36.0], [197.0, 25.0], [162.0, 18.0], [125.0, 19.0]]
dmsh.Polygon(boundary_e)
Then "dmsh.generate(geo, edge_size=20, verbose = False)" leads to:
.../python3.6/site-packages/meshplex/base.py", line 17, in compute_tri_areas
assert numpy.all(vol2 > -1.0e-14)
AssertionError
Fatal Python error: Aborted
This didn't happen when I had a previos version of meshplex. Maybe the last update caused it.
Interesting. Could you provide a full MWE that I can just copy/paste please? This makes it easier for me. (You can also make use of GitHub code fences for clarity.)
Can you also try to produce the easiest shape possible that produces the error? This helps with testing then.
For my usecase I am using segments I take from images. So they are on a larger scale. Haven't tried to downscale them.
Very simple cases like geo = dmsh.Polygon([[0,0],[0,1],[2,1],[1,0.5],[2,0]]) with edge size of 0.1 work.
This one causes the same error (first iteration btw)
points: [[43.0, 7.0], [43.0, 191.0], [154.0, 192.0], [156.0, 190.0], [155.0, 7.0]]
I tried to guess what you did. This
import dmsh
geo = dmsh.Polygon([[0, 0], [0, 1], [2, 1], [1, 0.5], [2, 0]])
dmsh.generate(geo, edge_size=20, verbose=False)
works without error. This was a waste of my time.
Lesson: Always provide a full MWE!
As I said, the example you mention works. The other example I provided does not.
Sorry If I was not clear.
Always provide a full MWE!
Ouch, well I mean this is the MWNE I could get:
[[43.0, 7.0], [43.0, 191.0], [154.0, 192.0], [156.0, 190.0], [155.0, 7.0]]
The complete code. I just want to copy-and-paste the whole thing to make sure I'm running the same as you are.
def main():
X, cells = dmsh.generate(dmsh.Polygon([[43.0, 7.0],
[43.0, 191.0], [154.0, 192.0],
[156.0, 190.0], [155.0, 7.0]]), edge_size=20, verbose=False)
if name == 'main':
main()
output:
Traceback (most recent call last):
File "meshing.py", line 100, in
main()
File "meshing.py", line 97, in main
[156.0, 190.0], [155.0, 7.0]]), edge_size=20, verbose=False)
File "/home/samuel/MEGAsync/Thesis_Celtic/FreeformCelticKnotwork/distmesh.py", line 143, in generate
f_scale=1.2,
File "/home/samuel/MEGAsync/Thesis_Celtic/FreeformCelticKnotwork/distmesh.py", line 182, in distmesh_smoothing
mesh = meshplex.MeshTri(mesh.node_coords, cells)
File "/home/samuel/MEGAsync/Thesis_Celtic/FreeformCelticKnotwork/venv/lib/python3.6/site-packages/meshplex/mesh_tri.py", line 114, in init
self.cell_volumes = compute_tri_areas(self.ei_dot_ej)
File "/home/samuel/MEGAsync/Thesis_Celtic/FreeformCelticKnotwork/venv/lib/python3.6/site-packages/meshplex/base.py", line 17, in compute_tri_areas
assert numpy.all(vol2 > -1.0e-14)
AssertionError
File "/tmp/j.py", line 2
X, cells = dmsh.generate(dmsh.Polygon([[43.0, 7.0],
^
IndentationError: expected an indented block
Always use code fences.
File "/tmp/j.py", line 2 X, cells = dmsh.generate(dmsh.Polygon([[43.0, 7.0], ^ IndentationError: expected an indented block
Always use code fences.
Okay, sorry I didn't know how to do this on a comment here
Should be fixed now. If the issue persists for you, feel free to reopen with an MWE.