Wrap splits functions - for ParMmg convenience#225
Wrap splits functions - for ParMmg convenience#225Algiane merged 20 commits intoMmgTools:developfrom
Conversation
… update communicator
…2) Add 2 new functions to get and update k and s variables at the same time in hash table
…e to use global indices of nodes to determine the split configuration)
Algiane
left a comment
There was a problem hiding this comment.
Hi,
I have few remarks on the factorization choice. It can be discussed tomorrow if needed.
Best
src/common/hash.c
Outdated
| * \return 1 if success, 0 if fail (edge is not found). | ||
| * | ||
| * Update the index of the new point stored along the edge \f$[a;b]\f$ | ||
| * If ls mode in ParMmg:: update the index of the new point in internal edge communicator; |
src/common/hash.c
Outdated
|
|
||
| return 0; | ||
| } | ||
|
|
There was a problem hiding this comment.
Will this function be used in Mmg? If not, I think that we should move it into ParMmg (and rename it PMMG_hashUpdate_all) with the adding of a remark in the MMG5_hashUpdate function saying that an equivalent function that updates both the k and s fields has been added to ParMmg and can be moved into Mmg if we ever need it in Mmg.
There was a problem hiding this comment.
MMG5_hashUpdate_all has been removed from mmg and replaced by PMMG_hashUpdate_all in ParMmg.
src/common/hash.c
Outdated
| /** | ||
| * \param hash pointer toward the hash table of edges. | ||
| * \param a index of the first extremity of the edge. | ||
| * \param b index of the second extremity of the edge. | ||
| * \param k index of new point along the edge [a,b]. | ||
| * \param s If ls mode in ParMmg:: index of new point in internal edge communicator; | ||
| * otherwise, the value stored in variable s. | ||
| * \return 1 if success, 0 if fail (edge is not found). | ||
| * | ||
| * Find the index of the new point stored along the edge \f$[a;b]\f$ | ||
| * If ls mode in ParMmg:: find the index of the new point in internal edge communicator; | ||
| * otherwise, find the value stored in variable s. | ||
| * | ||
| */ | ||
| MMG5_int MMG5_hashGet_all(MMG5_Hash *hash,MMG5_int a,MMG5_int b,MMG5_int *k,MMG5_int *s) { | ||
| MMG5_hedge *ph; | ||
| MMG5_int key; | ||
| MMG5_int ia,ib; | ||
|
|
||
| if ( !hash->item ) return 0; | ||
|
|
||
| ia = MG_MIN(a,b); | ||
| ib = MG_MAX(a,b); | ||
| key = (MMG5_KA*(int64_t)ia + MMG5_KB*(int64_t)ib) % hash->siz; | ||
| ph = &hash->item[key]; | ||
|
|
||
| if ( !ph->a ) return 0; | ||
| if ( ph->a == ia && ph->b == ib ) { | ||
| *k = ph->k; | ||
| *s = ph->s; | ||
| return 1; | ||
| } | ||
| while ( ph->nxt ) { | ||
| ph = &hash->item[ph->nxt]; | ||
| if ( ph->a == ia && ph->b == ib ) { | ||
| *k = ph->k; | ||
| *s = ph->s; | ||
| return 1; | ||
| } | ||
| } | ||
| return 0; | ||
| } | ||
|
|
There was a problem hiding this comment.
Same as previous comment: If not used in Mmg, I think that it is better to move this inside ParMmg.
There was a problem hiding this comment.
MMG5_hashGet_all has been removed from mmg and replaced by PMMG_hashGet_all in ParMmg.
src/common/mmgcommon_private.h
Outdated
| MMG5_int MMG5_hashFace(MMG5_pMesh,MMG5_Hash*,MMG5_int,MMG5_int,MMG5_int,MMG5_int); | ||
| int MMG5_hashEdge(MMG5_pMesh mesh,MMG5_Hash *hash,MMG5_int a,MMG5_int b,MMG5_int k); | ||
| int MMG5_hashUpdate(MMG5_Hash *hash,MMG5_int a,MMG5_int b,MMG5_int k); | ||
| int MMG5_hashUpdate_all(MMG5_Hash *hash,MMG5_int a,MMG5_int b,MMG5_int k,MMG5_int s); |
There was a problem hiding this comment.
To clean if we choose to move the function defs into ParMmg
src/common/mmgcommon_private.h
Outdated
| int MMG5_hashUpdate_all(MMG5_Hash *hash,MMG5_int a,MMG5_int b,MMG5_int k,MMG5_int s); | ||
| int MMG5_hashEdgeTag(MMG5_pMesh mesh,MMG5_Hash *hash,MMG5_int a,MMG5_int b,int16_t k); | ||
| MMG5_int MMG5_hashGet(MMG5_Hash *hash,MMG5_int a,MMG5_int b); | ||
| MMG5_int MMG5_hashGet_all(MMG5_Hash *hash,MMG5_int a,MMG5_int b,MMG5_int *k,MMG5_int *s); |
There was a problem hiding this comment.
To clean if we choose to move the function defs into ParMmg
src/mmg3d/split_3d.c
Outdated
| * | ||
| */ | ||
| int MMG5_split1(MMG5_pMesh mesh,MMG5_pSol met,MMG5_int k,MMG5_int vx[6],int8_t metRidTyp) { | ||
| int MMG5_split1_globNum(MMG5_pMesh mesh,MMG5_pSol met,MMG5_int k,MMG5_int vx[6],MMG5_int vGlobNum[4],int8_t metRidTyp) { |
There was a problem hiding this comment.
If vGlobNum is not used (because there are no ambiguous configs in the face splitting), I think that we can avoid this function redefinition and just let the old MMG5_split1 function unchanged.
There was a problem hiding this comment.
Ok, MMG5_split1 has been kept as it was.
src/mmg3d/split_3d.c
Outdated
|
|
||
| /** | ||
| * \param flag flag to detect the splitting configuration | ||
| * \param v indices of the tetra nodes |
There was a problem hiding this comment.
* \param v indices of the tetra nodes (global node indices if called from ParMmg)
src/mmg3d/split_3d.c
Outdated
| * \param met pointer toward the metric structure. | ||
| * \param k index of element to split. | ||
| * \param vx \f$vx[i]\f$ is the index of the point to add on the edge \a i. | ||
| * \param vGlobNum vertices indices of the tetra k. |
There was a problem hiding this comment.
* \param vGlobNum vertices indices of the tetra k (global vertices indices if we come from ParMmg)
src/mmg3d/libmmg3d_private.h
Outdated
| void MMG3D_split1_cfg(MMG5_int flag,uint8_t *tau,const uint8_t **taued); | ||
| int MMG3D_split1_sim(MMG5_pMesh mesh,MMG5_pSol met,MMG5_int k,MMG5_int vx[6]); | ||
| int MMG5_split1(MMG5_pMesh mesh,MMG5_pSol met,MMG5_int k,MMG5_int vx[6],int8_t metRidTyp); | ||
| int MMG5_split1_globNum(MMG5_pMesh mesh,MMG5_pSol met,MMG5_int k,MMG5_int vx[6],MMG5_int vGlobNum[4],int8_t metRidTyp); |
There was a problem hiding this comment.
If we don't need the global numbering for this function, I think that we can remove the MMG5_split1_globNum function (for sake of readability).
|
Thanks |
MMG3D_configSplit3opbecomesMMG3D_split3op_cfg).