meshpro / dmsh

:spider_web: Simple mesh generator inspired by distmesh.
GNU General Public License v3.0
210 stars 25 forks source link

missing attribute 'node_coords' #94

Closed sstaehler closed 1 year ago

sstaehler commented 2 years ago

I created a new anaconda environment on Python 3.9 and installed dmsh using pip. I'm trying to run the examples now, but I get an error at the first line basically.

import dmsh
import meshio
import optimesh

geo = dmsh.Circle([0.0, 0.0], 1.0)
X, cells = dmsh.generate(geo, 0.1)

AttributeError: 'MeshTri' object has no attribute 'node_coords'

mcgeochd commented 2 years ago

I got a partial fix by altering the end of the generate function in main.py (access by ctrl+left click on "generate" in your IDE, at least in VS code that's what it is) and then commented out the call to distmesh_smoothing and replaced the last bit at the end with:

points = pts # mesh.node_coords
# cells = mesh.cells["nodes"]

This produces a nice mesh (once its been cleaned up by optimesh), but it still has the issue of boundary points not lying on the boundary, which I'm trying to fix now: image

mcgeochd commented 2 years ago

Just found this in the changelog for meshplex: image replacing all instances of node_coords with points is a good place to start, apparently signed_cell_areas is no longer a thing too and has been replaced with the generic signed_cell_volumes, while you're at it, also replace all instances of "nodes" with "points". That still leaves some errors that I'm currently working through though.

mcgeochd commented 2 years ago

This contains all the fixes, just copy paste this into main.py and you should be good to go.

ghbrown commented 1 year ago

@mcgeochd Thanks for sharing your work on this, any thoughts on making a PR for your fix? Current contributors to the package seem to be silent on recent issues so perhaps it would be in vain, but this is a pretty show-stopping issue as is so it would be nice to have a real fix.

Your code seems moderately different from the current main.py by eye (even just imports), but I'm not sure where your edits are on the scale of "professional fix in the spirit and style of the original code" to "just make it work now".

mcgeochd commented 1 year ago

Apologies for taking so long to reply, I think this is something @nschloe would have to step in to fix properly. I only managed to address one of the issues I found, others such as the new idx list incompatibility with the old methods I wasn’t able to find enough documentation to fix myself. There is the discord where you could seek help but I was unable to get any responses there myself.

nschloe commented 1 year ago

No idea where node_coords should come from. There must be an old version of something at play, as I've removed node_coords from all of my packages a while ago.