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
Clustering cells by similarity. #16274
Comments
In practice, many meshes will about as many clusters as there are cells, if they are totally unstructured. In cases like this, it may be useful to see whether we can identify -- say -- 20 or 50 clusters. If a cell is not part of those, then it is simply "unclustered" and no caching can happen on such cells. Of course, on structured meshes all or nearly all cells are parts of a very small number of clusters. |
That's right. I'll add a couple things on here. It doesn't have to be just clustering. Really any sort of structure/similarity measuring or detection works, even AI/ML-based approaches 🙂 You just have to look at the reference to physical mapping's Jacobian. It looks like you use Clustering (depending on which clustering algorithm you choose) doesn't necessarily guarantee you'll have perfect translations. The greedy approach we've also followed constructively builds a list based on an upfront tolerance The patch preconditioner version (this computes an There are plenty of other little optimizations to be made in there, but I want to switch away from those Also, as a final note, I think deal.ii also has some support for generating extruded meshes. I don't know if you do this already, but it crossed my mind that every time you generate an extruded mesh, you'll get |
@GrahamBenHarper gave a talk in our seminar today that made me think about how we can do our cell similarity things better.
What he is doing is this, in essence: Up front, all cells are classified as "similar" (to a certain tolerance) to other cells by clustering cells based on the difference in the Jacobian matrices of their mappings. So translated cells have a small distance and consequently end up in the same cluster. Then, instead of re-computing mappings, shape values, shape gradients, etc., on every cell, he only looks up the corresponding values for each cluster. In his examples, the number of clusters on many meshes is not very large, a small fraction of the total number of cells, so the fact that he doesn't have to recompute a bunch of things really pays off.
This whole thing made me think of our scheme in
FEValues
: We also consider cell similarity, but only to the last cell we visited. And we don't do it at all when we run in multithreaded mode because then the order in which we visit cells is no longer predictable. But if we clustered all cells up front, then we could switch the cell similarity test back on, and only compute theFEValues
information once for each cluster, using a deterministically chosen "representative cell" for each cluster.The text was updated successfully, but these errors were encountered: