Skip to content
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

Is delete_cells_by_point_index parallelisable? #1053

Open
JeffreyWardman opened this issue Feb 16, 2024 · 1 comment
Open

Is delete_cells_by_point_index parallelisable? #1053

JeffreyWardman opened this issue Feb 16, 2024 · 1 comment

Comments

@JeffreyWardman
Copy link
Collaborator

Current code:

  def delete_cells_by_point_index(self, indices):
      """
      Delete a list of vertices identified by any of their vertex index.

      See also `delete_cells()`.

      Examples:
          - [delete_mesh_pts.py](https://github.com/marcomusy/vedo/tree/master/examples/basic/delete_mesh_pts.py)

              ![](https://vedo.embl.es/images/basic/deleteMeshPoints.png)
      """
      cell_ids = vtki.vtkIdList()
      self.dataset.BuildLinks()
      n = 0
      for i in np.unique(indices):
          self.dataset.GetPointCells(i, cell_ids)
          for j in range(cell_ids.GetNumberOfIds()):
              self.dataset.DeleteCell(cell_ids.GetId(j))  # flag cell
              n += 1

      self.dataset.RemoveDeletedCells()
      self.dataset.Modified()
      self.pipeline = OperationNode("delete_cells_by_point_index", parents=[self])
      return self

Are there any issues with parallelising these two for loops? Even if it's via setting the number of jobs with joblib? It doesn't scale well (e.g. deleting half of a 150,000 point mesh). I'm not sure how VTK datasets work under the hood.

@marcomusy
Copy link
Owner

I think that should be possible: the DeleteCell() call only flags a cell for deletion and the actual work is done by RemoveDeletedCells(). But I dont know which one is the bottleneck.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants