-
-
Notifications
You must be signed in to change notification settings - Fork 120
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
Wrap splits functions - for ParMmg convenience #225
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)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo: "::" -> ":"
src/common/hash.c
Outdated
|
||
return 0; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
MMG5_hashGet_all
has been removed from mmg and replaced by PMMG_hashGet_all
in ParMmg.
src/common/mmgcommon_private.h
Outdated
@@ -676,8 +676,10 @@ typedef struct MMG5_iNode_s { | |||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To clean if we choose to move the function defs into ParMmg
src/common/mmgcommon_private.h
Outdated
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To clean if we choose to move the function defs into ParMmg
src/mmg3d/split_3d.c
Outdated
* \return 0 if fail, 1 otherwise | ||
* | ||
* Split 1 edge of tetra \a k. | ||
* | ||
*/ | ||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, MMG5_split1
has been kept as it was.
src/mmg3d/split_3d.c
Outdated
@@ -991,17 +1013,17 @@ int MMG5_split1b(MMG5_pMesh mesh, MMG5_pSol met,int64_t *list, int ret, MMG5_int | |||
|
|||
/** | |||
* \param flag flag to detect the splitting configuration | |||
* \param v indices of the tetra nodes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* \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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* \param vGlobNum vertices indices of the tetra k (global vertices indices if we come from ParMmg)
src/mmg3d/libmmg3d_private.h
Outdated
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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_configSplit3op
becomesMMG3D_split3op_cfg
).