Skip to content

Improved point-cell and cell-point topology methods

Alon Zameret requested to merge primitiveMeshOptimization into develop


The goal of this change is to reduce the runtime of the pointCells() and cellPoints() methods in the primitiveMesh class, which calculate the point-to-cell and cell-to-point addressing, respectively.

Proposed Change

The pointCells() currently calculates the topology using the private method calcPointCells(), which utilizes the method labels() in the cell class. This method introduces significant overhead and reduces performance. The cellPoints() method currently calls the pointCell() method and inverts the result.

The proposed solution implements the cellPoints() method directly using a more efficient algorithm that makes use of the bitset data class to mark points that have already been found. Then, the pointCells() method is implemented by calling cellPoints() and inverting the result. As can be seen below, our implementation improves performance in all cases, even if the user only wants the point-cell topology.


The speedup values were calculated by running both the current version and the new version on structured cube meshes of varying sizes. It can be seen that the speedup remains constant among all the different mesh sizes.
In the testing, the meshes began without either one of the topologies present. Then 3 different cases were tested:

  1. The user wants only point-cell topology
    • Speedup = 1.4x
  2. The user wants only cell-point topology
    • Speedup = 2.4x
  3. The user wants both topologies
    • Speedup = 1.7x


Merge request reports