Feature/ls checkmaniball parmmg#208
Conversation
… if on a parallel interface - for parmmg
Algiane
left a comment
There was a problem hiding this comment.
Hi,
Thanks for this PR.
Feedback on Mmg modifications
I think that it is not possible to check the manifoldness of a point along a parallel interface with the knowledge of one partition only so I agree to simply skip this check along points marked as MG_PARBDY for now (it will allow you to not be blocked by this check) and to try to implement a clean parallel check inside ParMmg later (it is not the easiest thing to do so maybe we can postpone this for when you will be more confortable with the ParMmg data structure).
To do that, I think that we may simply ignore MG_PARBDY points in the MMG3D_chkmani function (here).
If MMG3D_chkmaniball is called only on level-set points that are not along the interfaces between the partitions, we should not cross MG_PARBDY entities when travelling the ball so I don't think that it is needed to modify this function.
Ideas for parallel implementation of the check of the implicit domain manifoldness
If we follow the outline of the serial algo, for each point belonging to the level-set, we will have to:
- build the list of the tetrahedra of the ball of the point with the same ref of the starting tetrahedron and reachable by face adjacency without crossing another reference. It has to be done by travelling through partitions and with respect to the order of travel inside the ball;
- complete the ball of the point with the remaining tetrahedra (again, it has to be done through the parallel interfaces end it may imply pultiple MPI processes);
- check that we don't have a tetra with the initial reference in the second part of the list (tetra not reachable without crossing a different reference). Otherwise, it means that we have a domain connected to itself by only an edge or a point.
With our current data structures, It seems pretty hard to do this without a large amount of very small MPI communications. In a first guess, I would propose (but we have to check possible difficulties in the implementation ;-) ):
- to build the layer of the neighbouring tetrahedra of the partition on each MPI process (a tetrahedra is considered as a neighbour if at least one of its vertices belongs to the partition boundary). It can be seen as the building of an overlap for each partition.
- that each process travel the tetra at the interface of its partition (I suppose that we have 1 partition per MPI process), and to check the manifoldness of points that are both along the partitions interfaces and the level-set using the array(s) of the neighbouring tetra.
- The manifoldness of other points will be checked by the serial Mmg function.
Normally we will have MPI communications only during the first step and it will be possible to gather the infos to be sent to have very few comms per pairs of MPI processes. By the way, I think that having the overlap will also be useful to check the level-set snapping/unsnapping.
Best
src/mmg3d/mmg3d2.c
Outdated
| return 0; | ||
| pxt = mesh->xtetra[pt->xt]; | ||
| pmmg_bdy=0; | ||
| /* if an edge is MG_PARBDY: this is not a non-manifold topology */ |
There was a problem hiding this comment.
We cannot know in fact:the topology may be manifold or not. We have to travel the entire ball of the point through the different processors to decide.
src/mmg3d/mmg3d2.c
Outdated
| /* - True for centralized input in parmmg */ | ||
| /* - Wrong for distributed input in parmmg: TODO */ | ||
| for (iedge=0; iedge<6; iedge++) { | ||
| if ( !(pxt.tag[iedge] & MG_PARBDY) ) continue; | ||
| pmmg_bdy=1; | ||
| } | ||
| /* if the starting point is MG_PARBDY: this is not a non-manifold topology */ | ||
| /* - True for centralized input in parmmg */ | ||
| /* - Wrong for distributed input in parmmg: TODO */ | ||
| if ( mesh->point[nump].tag & MG_PARBDY) { | ||
| pmmg_bdy=1; | ||
| } |
There was a problem hiding this comment.
For me, here, you are just skipping the test of manifoldness along entites belonging to boundary faces marked as parallel. It avoid some cases of spurious detection of non-manifold situations but doesn't allow to detect true non-manifold cases on points belonging to parallel interfaces.
In the following picture (2D for sake of simplicity), the left-hand side case has to be detected as manifold while the right-hand side case has to be detected as non-manifold.

Taken separately, the informations of each MPI process are not sufficient to make a decision.
There was a problem hiding this comment.
I agree that's why I wrote Wrong for distributed input in parmmg: TODO in the code. I did that to skip this warning in parmmg for now. But I agree in the distributed input version we need to be able to detect true and false non-manifold situation.
For centralized input as the ls discretisation is done on the centralised mesh, we do not have any issue.
There was a problem hiding this comment.
Yes, I think that what I miss is why you need to test the presence of PARBDY entities inside the ball of point (so in the chkmaniball function)? I think that it is not possible to try to travel through a PARBDY face if the point is not PARBDY. Thus, it seems sufficient for me to check if the point is PARBDY in the chkmani function.
There was a problem hiding this comment.
You are totally right. I have modified the code in accordance. Thanks.
MMG3D_chkmaniball has been modified for ParMmg: