Skip to content

Commit

Permalink
Merge pull request #242 from laetitia-m/feature/wrap-interpol-metric
Browse files Browse the repository at this point in the history
Do the metric interpolation using directly the global nodes index of the edge instead of the tetra index
  • Loading branch information
Algiane authored Feb 8, 2024
2 parents 3647b34 + 0c4c326 commit 9fa75b0
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 3 deletions.
41 changes: 38 additions & 3 deletions src/mmg3d/intmet_3d.c
Original file line number Diff line number Diff line change
Expand Up @@ -101,13 +101,31 @@ int MMG5_intmet_ani(MMG5_pMesh mesh,MMG5_pSol met,MMG5_int k,int8_t i,MMG5_int i
int MMG3D_intmet33_ani(MMG5_pMesh mesh,MMG5_pSol met,MMG5_int k,int8_t i,MMG5_int ip,
double s) {
MMG5_pTetra pt;
double *m,*n,*mr;
MMG5_int ip1,ip2;

pt = &mesh->tetra[k];
ip1 = pt->v[MMG5_iare[i][0]];
ip2 = pt->v[MMG5_iare[i][1]];

return MMG3D_intmet33_ani_edge(met,ip1,ip2,ip,s);
}

/**
* \param met pointer toward the metric structure.
* \param ip1 first global index of edge extremities.
* \param ip2 second global index of edge extremities.
* \param ip global index of the new point in which we want to compute the metric.
* \param s interpolation parameter (between 0 and 1).
* \return 0 if fail, 1 otherwise.
*
* Interpolation of anisotropic sizemap at parameter \a s along edge [ip1,ip2]
* for a classic storage of ridges metrics (before defsiz call).
*
*/
int MMG3D_intmet33_ani_edge(MMG5_pSol met,MMG5_int ip1,MMG5_int ip2,MMG5_int ip,
double s) {
double *m,*n,*mr;

m = &met->m[6*ip1];
n = &met->m[6*ip2];
mr = &met->m[6*ip];
Expand All @@ -124,20 +142,37 @@ int MMG3D_intmet33_ani(MMG5_pMesh mesh,MMG5_pSol met,MMG5_int k,int8_t i,MMG5_in
* \param s interpolation parameter (between 0 and 1).
* \return 0 if fail, 1 otherwise.
*
* Interpolation of anisotropic sizemap at parameter \a s along edge \a i of elt
* Interpolation of isotropic sizemap at parameter \a s along edge \a i of elt
* \a k.
*
*/
int MMG5_intmet_iso(MMG5_pMesh mesh,MMG5_pSol met,MMG5_int k,int8_t i,MMG5_int ip,
double s) {
MMG5_pTetra pt;
MMG5_int ip1, ip2;
double *m1,*m2,*mm;

pt = &mesh->tetra[k];
ip1 = pt->v[MMG5_iare[i][0]];
ip2 = pt->v[MMG5_iare[i][1]];

return MMG5_intmet_iso_edge(met,ip1,ip2,ip,s);
}

/**
* \param met pointer toward the metric structure.
* \param ip1 first global index of edge extremities.
* \param ip2 second global index of edge extremities.
* \param ip global index of the new point in which we want to compute the metric.
* \param s interpolation parameter (between 0 and 1).
* \return 0 if fail, 1 otherwise.
*
* Interpolation of isotropic sizemap at parameter \a s along edge [ip1,ip2].
*
*/
int MMG5_intmet_iso_edge(MMG5_pSol met,MMG5_int ip1,MMG5_int ip2,MMG5_int ip,
double s) {
double *m1,*m2,*mm;

m1 = &met->m[met->size*ip1];
m2 = &met->m[met->size*ip2];
mm = &met->m[met->size*ip];
Expand Down
2 changes: 2 additions & 0 deletions src/mmg3d/libmmg3d_private.h
Original file line number Diff line number Diff line change
Expand Up @@ -521,8 +521,10 @@ extern double MMG5_lenedgCoor_iso(double*, double*, double*, double*);
int MMG3D_doSol_iso(MMG5_pMesh,MMG5_pSol);
int MMG3D_doSol_ani(MMG5_pMesh,MMG5_pSol);
int MMG5_intmet_iso(MMG5_pMesh,MMG5_pSol,MMG5_int,int8_t,MMG5_int, double);
int MMG5_intmet_iso_edge(MMG5_pSol,MMG5_int,MMG5_int,MMG5_int, double);
int MMG5_intmet_ani(MMG5_pMesh,MMG5_pSol,MMG5_int,int8_t,MMG5_int, double);
int MMG3D_intmet33_ani(MMG5_pMesh,MMG5_pSol,MMG5_int,int8_t,MMG5_int, double);
int MMG3D_intmet33_ani_edge(MMG5_pSol,MMG5_int,MMG5_int,MMG5_int, double);
int MMG5_interp4bar_ani(MMG5_pMesh,MMG5_pSol,MMG5_int,MMG5_int,double *);
int MMG5_interp4bar33_ani(MMG5_pMesh,MMG5_pSol,MMG5_int,MMG5_int,double *);
int MMG5_interp4bar_iso(MMG5_pMesh,MMG5_pSol,MMG5_int,MMG5_int,double *);
Expand Down

0 comments on commit 9fa75b0

Please sign in to comment.