kinnala / adaptmesh

Mesh generation by the adaptive process
Other
35 stars 4 forks source link

AttributeError: 'MeshTri1' object has no attribute 'refine' #5

Closed tsunghan-wu closed 3 years ago

tsunghan-wu commented 3 years ago

Hi,

First of all, thanks for your excellent work. However, I encounter the issue (bug?) when running the example code on README.

After installing the package via pip (adaptmesh==0.1.0), I run the following code:

from adaptmesh import triangulate

m = triangulate([(0., 0.),
                 (1., 0.),
                 (1., 1.),
                 (0., 1.),])

Nonetheless, I got the following error messages:

Traceback (most recent call last):
  File "adap_mesh.py", line 6, in <module>
    (0., 1.),])
  File "/home/master/09/tsunghan/miniconda3/envs/3dtf/lib/python3.6/site-packages/adaptmesh/__init__.py", line 37, in triangulate
    **params,
  File "/home/master/09/tsunghan/miniconda3/envs/3dtf/lib/python3.6/site-packages/adaptmesh/process.py", line 35, in process
    mesh = refine(mesh, elements, **params)
  File "/home/master/09/tsunghan/miniconda3/envs/3dtf/lib/python3.6/site-packages/adaptmesh/refine.py", line 5, in rgb
    m.refine(elems)
AttributeError: 'MeshTri1' object has no attribute 'refine'

Is this a bug or how can I prevent it from happening?

kinnala commented 3 years ago

Thanks for the report. It seems that I've forgotten to enforce a restriction on the version of a dependency. However, this can be easily fixed and I'll release a new version soon.

If you want to try it out in the meanwhile, I think this should be fixed by installing an older version of a dependency, in particular, scikit-fem<3.0.0.

kinnala commented 3 years ago

Now if you run pip install -U adaptmesh, it should install adaptmesh==0.3.0 and the example should work properly.

Thanks again. Waiting for your confirmation before closing the issue.

tsunghan-wu commented 3 years ago

Sorry for the late reply. I have confirmed that the solution you mentioned above can successfully resolve the error. Thanks for your excellent work again.

p.s. I have stared your repo XD