Additional option to remesh only the elements of bad quality#321
Additional option to remesh only the elements of bad quality#321fsalmon001 wants to merge 4 commits intoMmgTools:developfrom
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #321 +/- ##
===========================================
- Coverage 50.31% 50.20% -0.11%
===========================================
Files 177 177
Lines 47845 47971 +126
Branches 10355 10388 +33
===========================================
+ Hits 24071 24082 +11
- Misses 16043 16156 +113
- Partials 7731 7733 +2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
The corrections have been made and some comments have been added in the new commit |
src/common/scalem.c
Outdated
| mesh->info.min[0]= 0.; | ||
| mesh->info.min[1]= 0.; | ||
| mesh->info.min[2]= 0.; | ||
| if (mesh->dim == 3) mesh->info.min[2]= 0.; |
There was a problem hiding this comment.
And otherwise? I think this field should always be initialized.
There was a problem hiding this comment.
mesh->info.min[2] is not used in 2D. In addition, this is not an initialisation, but a reset of the values (see comment just above these lines). So, without the if condition, it would reset the value of min[2] while it must remain during all the adaptation
src/mmg2d/API_functions_2d.c
Outdated
| /* [0/1] ,avoid/enforce isotropic smoothing even with anisotropic metric */ | ||
| mesh->info.isotropic_pt_relocation = MMG5_OFF; | ||
| /* limit angle to avoid remeshing some good triangles */ | ||
| mesh->info.limit_angle = 5.*atan(1.); |
There was a problem hiding this comment.
Why not a simpler value?
There was a problem hiding this comment.
Yes, we can. The value is just here to be high enough to avoid triggering the localized adaptation. I replaced it by 10.
| /* Ridge detection */ | ||
| mesh->info.dhd = MMG5_ANGEDG; | ||
| /* to adapt more thoroughly close to boundaries */ | ||
| mesh->info.bdy_adaptation = MMG5_OFF; |
There was a problem hiding this comment.
Was that variable already there? Is the name really explicit?
There was a problem hiding this comment.
No it wasn't. Regarding the name, I don't know, this option is to extend the mesh adaptation to boundaries using less tolerant criteria about the triangle angle and size.
src/common/libmmgtypes.h
Outdated
| \f$k^th\f$ quadrilaterals are adjacent and share their | ||
| edges \a j and \a l (resp.) */ | ||
| int *ipar; /*!< Store indices of the local parameters */ | ||
| double *velocity; /*!< Velocity of the vertices when Lagrangian resolution */ |
There was a problem hiding this comment.
lagrangian_velocity?
src/mmg2d/mmg2d1.c
Outdated
| // #warning Luca: check consistency with 3D | ||
| } | ||
| if ( !mesh->info.noinsert ) { | ||
| if ( !mesh->info.noinsert && mesh->info.limit_angle >= 4.*atan(1.)) { |
There was a problem hiding this comment.
why this value ? (it was 5 above ...)
There was a problem hiding this comment.
The value is just here to trigger the reduced mesh adaptation. If the user doesn't modify the limit_angle, this condition is always false. I will replace this value by M_PI to make cleaner
| mesh->base++; | ||
|
|
||
| if (mesh->info.limit_angle <= 4*atan(1.)) mesh->info.fem = 0; | ||
|
|
There was a problem hiding this comment.
this function is tricky as is. Can you please comment extra ifs ?
|
|
||
| mesh->mark = mesh->np; | ||
| for (int i = 1; i <= mesh->np; i++) mesh->point[i].tmp = -1; | ||
|
|
There was a problem hiding this comment.
why is this needed ?
There was a problem hiding this comment.
The criterion on the minimal angle is applied during all the process, but the mesh is modified, and so we don't have the velocity on the new nodes during the process. We use mesh->mark and mesh->point.tmp to spot the vertices that exist since the beginning and where we have the velocity.
It changes nothing in the calculation even when the reduced adaptation is not used, so I didn't put these lines inside an if condition
Same functionalities as the nextsim branch, but the velocity field is incorporated within the mesh structure to avoid heavy modifications in some function variables.