Skip to content

Allow the 3d swapper to create tetrahedra with 4 boundary vertices when not in FEM mode #301

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

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

mpotse
Copy link
Contributor

@mpotse mpotse commented Mar 21, 2025

MMG5_chkswpgen() does not allow the creation of tetrahedra with 4 boundary vertices. I think this restriction should only be made in FEM mode, just like the restriction on creating edges between boundary points is only made in FEM mode (further up in the same function) and anatet4() is only called in FEM mode.
I made this modification because we need it for the meshes we create for the MICROCARD project. These meshes have lots of internal boundaries, often with only one layer of tetrahedra between them, and we don't want to have more layers because the space is very thin. Thus it is perfectly normal to have tetrahedra with all of their vertices on either of two boundaries. The refusal of these swaps costs me a factor 5 in quality for the worst 10% of tetrahedra.
I wrote the change such that it makes minimal changes to the blame.

@mpotse
Copy link
Contributor Author

mpotse commented Mar 26, 2025

Following up on the discussion I had with Corentin last week, I confirm that the test for FEM mode in this MR is not strong enough. It behaves differently when I use if(0). There may also be an issue with the test for mesh->info.fem on line 150 in the same function, which I had used as example.

@mpotse
Copy link
Contributor Author

mpotse commented Mar 28, 2025

Further update: either by replacing both of the mesh->info.fem by 0 here or by checking (mesh->info.fem == typchk) instead I get the desired behaviour when I don't want a FEM mesh. Evidence:

  • The median worst-element quality over 27 test meshes improved by a factor 16.
  • The Delaunay kernel now gives a better worst-element quality than the Pattern kernel. It has been the other way around since release 2.7.1 while in 2.7.0 they performed about equally in this respect.
  • Average element quality improved by 2 percentage points for both Delaunay and Pattern, to 0.75 and 0.77, respectively.

Doing this only with the second of the two mesh->info.fem flags produced intermediate results.

The test for (mesh->info.fem==typchk) changes the behaviour in FEM mode too but I cannot tell if the result is more or less "FEM". In any case the difference was minor.

Bottom line: don't merge this as is; I trust that the idea will be integrated in the reorganization of the fem flag.

@mpotse
Copy link
Contributor Author

mpotse commented Apr 12, 2025

As discussed with Corentin this week, I'm pushing the commit that allows to completely enable/disable FEM mode in the 3d swapper. I believe that this can be merged before the proposed changes to the (no)fem option.

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

Successfully merging this pull request may close these issues.

1 participant