58 int *ilist,int64_t *list,
double crit,int8_t typchk) {
61 double calold,calnew,caltmp;
63 MMG5_int np,na,nb,piv,*adja,adj,pol[
MMG3D_LMAX+2],iel,refdom;
66 pt = &
mesh->tetra[start];
69 pt0 = &
mesh->tetra[0];
77 list[(*ilist)] = 6*(int64_t)start+ia;
79 adja = &
mesh->adja[4*(start-1)+1];
87 if (
mesh->info.opnbdy )
93 if ( adj ==start )
break;
95 pt = &
mesh->tetra[adj];
99 if ( pt->
ref != refdom )
return 0;
100 else if (
mesh->info.opnbdy ) {
101 if ( pt->
xt && (
mesh->xtetra[pt->
xt].ftag[ifac] &
MG_BDY) )
return 0;
109 list[(*ilist)] = 6*(int64_t)adj +i;
115 adja = &
mesh->adja[4*(adj-1)+1];
138 if ( !adj )
return 0;
140 assert(npol == (*ilist));
143 for (k=0; k<npol; k++) {
146 np =
mesh->tetra[iel].v[ip];
150 if (
mesh->info.fem ) {
152 p0 = &
mesh->point[np];
155 for (l=0; l<npol;l++) {
158 if ( l == k || l == k+1 )
continue;
162 if ( l == npol-1 || l == 0 )
continue;
166 pt = &
mesh->tetra[iel];
167 p0 = &
mesh->point[pt->
v[ip]];
175 if ( !
ier )
continue;
179 for (l=0; l<(*ilist); l++) {
183 if ( l == k || l == k+1 )
continue;
187 if ( l == npol-1 || l == 0 )
continue;
191 pt = &
mesh->tetra[iel];
195 adja = &
mesh->adja[4*(iel-1)+1];
198 if ( adj &&
mesh->tetra[adj].v[piv]==np ) {
204 if ( adj &&
mesh->tetra[adj].v[piv]==np ) {
226 if ( typchk==1 && met->
size > 1 && met->
m )
231 calnew =
MG_MIN(calnew,caltmp);
233 ier = (calnew > crit*calold);
240 if ( typchk==1 && met->
size > 1 && met->
m )
245 calnew =
MG_MIN(calnew,caltmp);
247 ier = (calnew > crit*calold);
250 if (
ier )
return pol[k];
276 MMG5_int src,iel,na,nb,np;
284 pt = &
mesh->tetra[iel];
287 p0 = &
mesh->point[na];
288 p1 = &
mesh->point[nb];
291 m[0] = 0.5*(p0->
c[0] + p1->
c[0]);
292 m[1] = 0.5*(p0->
c[1] + p1->
c[1]);
293 m[2] = 0.5*(p0->
c[2] + p1->
c[2]);
296 src =
mesh->point[na].src;
303 fprintf(stderr,
"\n ## Error: %s: unable to allocate"
304 " a new point\n",__func__);
311 if ( typchk == 1 && (met->
size>1) ) {
315 if ( MMG5_intmet(
mesh,met,iel,ia,np,0.5)<=0 )
return 0;
324 fprintf(stderr,
"\n ## Warning: %s: unable to swap internal edge.\n",
337 pt = &
mesh->tetra[start];
338 for (ip=0; ip<4; ip++) {
339 if ( pt->
v[ip] == np )
break;
343 memset(list,0,(
MMG3D_LMAX+2)*
sizeof(MMG5_int));
348 fprintf(stderr,
"\n ## Warning: %s: unable to swap internal edge.\n",
357 assert (
ier &&
"Unable to collapse the point created during the internal swap");
MMG3D_PROctree * MMG3D_pPROctree
int MMG5_boulevolp(MMG5_pMesh mesh, MMG5_int start, int ip, int64_t *list)
Given a vertex and a tetrahedron, find all tetrahedra in the ball of this vertex.
int MMG3D_findEdge(MMG5_pMesh mesh, MMG5_pTetra pt, MMG5_int k, MMG5_int na, MMG5_int nb, int error, int8_t *mmgWarn, int8_t *ia)
MMG5_int MMG5_colver(MMG5_pMesh mesh, MMG5_pSol met, int64_t *list, int ilist, int8_t indq, int8_t typchk)
static double MMG5_orcal(MMG5_pMesh mesh, MMG5_pSol met, MMG5_int iel)
int MMG3D_intmet33_ani(MMG5_pMesh mesh, MMG5_pSol met, MMG5_int k, int8_t i, MMG5_int ip, double s)
API headers and documentation for the mmg3d library, for volumetric meshes in 3D.
int MMG5_split1b(MMG5_pMesh, MMG5_pSol, int64_t *, int, MMG5_int, int, int8_t, int8_t)
void MMG3D_delPt(MMG5_pMesh mesh, MMG5_int ip)
MMG5_int MMG3D_newPt(MMG5_pMesh mesh, double c[3], uint16_t tag, MMG5_int src)
double MMG5_caltet33_ani(MMG5_pMesh mesh, MMG5_pSol met, MMG5_pTetra pt)
static const uint8_t MMG5_iare[6][2]
vertices of extremities of the edges of the tetra
static const uint8_t MMG5_ifar[6][2]
ifar[i][]: faces sharing the ith edge of the tetra
#define MMG3D_POINT_REALLOC(mesh, sol, ip, wantedGap, law, o, tag, src)
#define MMG5_INCREASE_MEM_MESSAGE()
Structure to store tetrahedra of an MMG mesh.
MMG5_int MMG5_chkswpgen(MMG5_pMesh mesh, MMG5_pSol met, MMG5_int start, int ia, int *ilist, int64_t *list, double crit, int8_t typchk)
int MMG5_swpgen(MMG5_pMesh mesh, MMG5_pSol met, MMG5_int nconf, int ilist, int64_t *list, MMG3D_pPROctree PROctree, int8_t typchk)