Closed lucascbarbosa closed 2 years ago
This has to go:
cells = np.asarray(cells,dtype='object')
optimesh only operates on triangular cells, so you need to extract those first.
Still the same error but now with a warning above.
C:\Users\lucas\Anaconda3\envs\deeplearn37\lib\site-packages\optimesh\main.py:58: VisibleDeprecationWarning: Creating an ndarray from ragged nested sequences (which is a list-or-tuple of lists-or-tuples-or ndarrays with different lengths or shapes) is deprecated. If you meant to do this, you must specify 'dtype=object' when creating the ndarray.
cells = np.asarray(cells)
Traceback (most recent call last):
File "optimize_mesh.py", line 15, in <module>
points, cells, "CVT (block-diagonal)", 1.0e-5, 100
File "C:\Users\lucas\Anaconda3\envs\deeplearn37\lib\site-packages\optimesh\main.py", line 65, in optimize_points_cells
optimize(mesh, method, *args, **kwargs)
File "C:\Users\lucas\Anaconda3\envs\deeplearn37\lib\site-packages\optimesh\main.py", line 54, in optimize
return _optimize(methods[method].get_new_points, mesh, *args, **kwargs)
File "C:\Users\lucas\Anaconda3\envs\deeplearn37\lib\site-packages\optimesh\main.py", line 106, in _optimize
new_points = get_new_points(mesh)
File "C:\Users\lucas\Anaconda3\envs\deeplearn37\lib\site-packages\optimesh\cvt\block_diagonal.py", line 16, in get_new_points
mask = np.any(mesh.ce_ratios < -0.5, axis=0)
File "C:\Users\lucas\Anaconda3\envs\deeplearn37\lib\site-packages\meshplex\_mesh.py", line 290, in ce_ratios
self.cell_partitions[0] / self.ei_dot_ei * 2 * (self.n - 1)
File "C:\Users\lucas\Anaconda3\envs\deeplearn37\lib\site-packages\meshplex\_mesh.py", line 215, in cell_partitions
self._compute_cell_values()
File "C:\Users\lucas\Anaconda3\envs\deeplearn37\lib\site-packages\meshplex\_mesh.py", line 320, in _compute_cell_values
e = self.points[self.idx[-1][..., mask]]
IndexError: arrays used as indices must be of integer (or boolean) type
optimesh only operates on triangular cells, so you need to extract those first.
Understood. I thought the mesh.cells did that, didn't it? How do I extract the cells correctly?
You need to provide a numpy array with the triangle connectivity.
I'm trying to test optimesh in an existent mesh I have but it is returning this error. I alre
The code: