Mmg
Simplicial remeshers (mesh adaptation, isovalue discretization, lagrangian movement)
API_functions_s.c
Go to the documentation of this file.
1/* =============================================================================
2** This file is part of the mmg software package for the triangular
3** mesh modification.
4** Copyright (c) Bx INP/CNRS/Inria/UBordeaux/UPMC, 2004-
5**
6** mmg is free software: you can redistribute it and/or modify it
7** under the terms of the GNU Lesser General Public License as published
8** by the Free Software Foundation, either version 3 of the License, or
9** (at your option) any later version.
10**
11** mmg is distributed in the hope that it will be useful, but WITHOUT
12** ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13** FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
14** License for more details.
15**
16** You should have received a copy of the GNU Lesser General Public
17** License and of the GNU General Public License along with mmg (in
18** files COPYING.LESSER and COPYING). If not, see
19** <http://www.gnu.org/licenses/>. Please read their terms carefully and
20** use this copy of the mmg distribution only if you accept them.
21** =============================================================================
22*/
23
40#include "libmmgs_private.h"
41#include "libmmgs.h"
42
43int MMGS_Init_mesh(const int starter,...) {
44 va_list argptr;
45 int ier;
46
48
50
52
53 return ier;
54}
55
57 ) {
58
60 return;
61}
62
64
66}
67
69 return MMG5_Set_inputSolName(mesh,sol,solin);
70}
71
72int MMGS_Set_inputParamName(MMG5_pMesh mesh, const char* fparamin) {
73 return MMG5_Set_inputParamName(mesh,fparamin);
74}
75
76int MMGS_Set_outputMeshName(MMG5_pMesh mesh, const char* meshout) {
77
78 return MMG5_Set_outputMeshName(mesh,meshout);
79}
80
82 return MMG5_Set_outputSolName(mesh,sol,solout);
83}
85
86 /* Init common parameters for mmgs and mmgs. */
88 /* [0/1], Turn off/on the renumbering using SCOTCH; */
89 mesh->info.renum = 0;
90
91}
92
93int MMGS_Set_solSize(MMG5_pMesh mesh, MMG5_pSol sol, int typEntity, MMG5_int np, int typSol) {
94
95 if ( ( (mesh->info.imprim > 5) || mesh->info.ddebug ) && sol->m )
96 fprintf(stderr,"\n ## Warning: %s: old solution deletion.\n",__func__);
97
98 if ( typEntity != MMG5_Vertex ) {
99 fprintf(stderr,"\n ## Error: %s: mmgs need a solution imposed on vertices.\n",
100 __func__);
101 return 0;
102 }
103
104 sol->type = typSol;
105
106 if ( typSol == MMG5_Scalar ) {
107 sol->size = 1;
108 }
109 else if ( typSol == MMG5_Vector ) {
110 sol->size = 3;
111 }
112 else if ( typSol == MMG5_Tensor ) {
113 sol->size = 6;
114 /* User will provide its own metric: classical storage at ridges */
115 mesh->info.metRidTyp = 0;
116 }
117 else {
118 fprintf(stderr,"\n ## Error: %s: type of solution not yet implemented.\n",
119 __func__);
120 return 0;
121 }
122
123 sol->dim = 3;
124
125 if ( np ) {
126 sol->np = np;
127 sol->npi = np;
128 if ( sol->m )
130
131 sol->npmax = mesh->npmax;
132 MMG5_ADD_MEM(mesh,(sol->size*(sol->npmax+1))*sizeof(double),"initial solution",
133 fprintf(stderr," Exit program.\n");
134 return 0);
135 MMG5_SAFE_CALLOC(sol->m,(sol->size*(sol->npmax+1)),double,return 0);
136 }
137 return 1;
138}
139
141 MMG5_int nentities, int *typSol) {
142 MMG5_pSol psl;
143 char data[18];
144 int j;
145
146 if ( ( (mesh->info.imprim > 5) || mesh->info.ddebug ) && mesh->nsols ) {
147 if ( *sol ) {
148 fprintf(stderr,"\n ## Warning: %s: old solutions array deletion.\n",
149 __func__);
151 }
152 }
153
155 mesh->nsols = nsols;
156
157 MMG5_ADD_MEM(mesh,nsols*sizeof(MMG5_Sol),"solutions array",
158 return 0);
159 MMG5_SAFE_CALLOC(*sol,nsols,MMG5_Sol,return 0);
160
161 for ( j=0; j<nsols; ++j ) {
162 psl = *sol + j;
163 psl->ver = 2;
164
165 /* Give an arbitrary name to the solution */
166 sprintf(data,"sol_%d",j);
167 if ( !MMGS_Set_inputSolName(mesh,psl,data) ) {
168 return 0;
169 }
170 /* Give an arbitrary name to the solution */
171 sprintf(data,"sol_%d.o",j);
172 if ( !MMGS_Set_outputSolName(mesh,psl,data) ) {
173 return 0;
174 }
175
176 if ( !MMGS_Set_solSize(mesh,psl,MMG5_Vertex,mesh->np,typSol[j]) ) {
177 fprintf(stderr,"\n ## Error: %s: unable to set the size of the"
178 " solution num %d.\n",__func__,j);
179 return 0;
180 }
181 }
182 return 1;
183}
184
185int MMGS_Set_meshSize(MMG5_pMesh mesh, MMG5_int np, MMG5_int nt, MMG5_int na) {
186
187 if ( ( (mesh->info.imprim > 5) || mesh->info.ddebug ) &&
188 ( mesh->point || mesh->tria || mesh->edge) )
189 fprintf(stderr,"\n ## Warning: %s: old mesh deletion.\n",__func__);
190
191 mesh->np = np;
192 mesh->nt = nt;
193 mesh->na = na;
194 mesh->npi = mesh->np;
195 mesh->nti = mesh->nt;
196 mesh->nai = mesh->na;
197
198 if ( !np || !nt ) {
199 fprintf(stderr," ** MISSING DATA:\n");
200 fprintf(stderr," Your mesh must contains at least points and triangles.\n");
201 return 0;
202 }
203
204 if ( mesh->point )
206 if ( mesh->tria )
208 if ( mesh->edge )
210
211 /*tester si -m defini : renvoie 0 si pas ok et met la taille min dans info.mem */
212 if( mesh->info.mem > 0) {
213 if ( mesh->npmax < mesh->np || mesh->ntmax < mesh->nt) {
214 if ( !MMGS_memOption(mesh) ) return 0;
215 } else if(mesh->info.mem < 39) {
216 fprintf(stderr,"\n ## Error: %s: not enough memory %d\n",
217 __func__,mesh->info.mem);
218 return 0;
219 }
220 } else {
221 if ( !MMGS_memOption(mesh) ) return 0;
222 }
223
224 /* Mesh allocation and linkage */
225 if ( !MMGS_setMeshSize_alloc( mesh ) ) return 0;
226
227 return 1;
228}
229
230int MMGS_Get_solSize(MMG5_pMesh mesh, MMG5_pSol sol, int* typEntity, MMG5_int* np, int* typSol) {
231
232 if ( typEntity != NULL )
233 *typEntity = MMG5_Vertex;
234
235 if ( typSol != NULL ) {
236 if ( sol->size == 1 )
237 *typSol = MMG5_Scalar;
238 else if ( sol->size == 3 )
239 *typSol = MMG5_Vector;
240 else if ( sol->size == 6 )
241 *typSol = MMG5_Tensor;
242 else
243 *typSol = MMG5_Notype;
244 }
245
246 assert( (!sol->np) || (sol->np == mesh->np));
247
248 if ( np != NULL )
249 *np = sol->np;
250
251 sol->npi = 0;
252
253 return 1;
254}
255
257 MMG5_int* np, int* typSol) {
258 MMG5_pSol psl;
259 int j;
260
261 if ( !mesh ) {
262 fprintf(stderr,"\n ## Error: %s: your mesh structure must be allocated"
263 " and filled\n",__func__);
264 return 0;
265 }
266
267 if ( nsols != NULL )
268 *nsols = mesh->nsols;
269
270 for ( j=0; j<mesh->nsols; ++j ) {
271 psl = *sol + j;
272
273 if ( typSol != NULL ) {
274 typSol[j] = psl->type;
275 }
276
277 assert( (!psl->np) || (psl->np == mesh->np));
278 }
279 if ( np != NULL )
280 *np = mesh->np;
281
282 return 1;
283}
284
285int MMGS_Get_meshSize(MMG5_pMesh mesh, MMG5_int* np, MMG5_int* nt, MMG5_int* na) {
286
287 if ( np != NULL )
288 *np = mesh->np;
289 if ( nt != NULL )
290 *nt = mesh->nt;
291 if ( na != NULL )
292 *na = mesh->na;
293
294 return 1;
295}
296
297int MMGS_Set_vertex(MMG5_pMesh mesh, double c0, double c1, double c2, MMG5_int ref, MMG5_int pos) {
298
299 if ( !mesh->np ) {
300 fprintf(stderr,"\n ## Error: %s: you must set the number of points with the",
301 __func__);
302 fprintf(stderr," MMGS_Set_meshSize function before setting vertices in mesh.\n");
303 return 0;
304 }
305
306 if ( pos > mesh->npmax ) {
307 fprintf(stderr,"\n ## Error: %s: unable to allocate a new point.\n",__func__);
308 fprintf(stderr," max number of points: %" MMG5_PRId "\n",mesh->npmax);
310 return 0;
311 }
312
313 if ( pos > mesh->np ) {
314 fprintf(stderr,"\n ## Error: %s: attempt to set new vertex at position %" MMG5_PRId ".",
315 __func__,pos);
316 fprintf(stderr," Overflow of the given number of vertices: %" MMG5_PRId "\n",mesh->np);
317 fprintf(stderr,"\n ## Check the mesh size, its compactness or the position");
318 fprintf(stderr," of the vertex.\n");
319 return 0;
320 }
321
322 mesh->point[pos].c[0] = c0;
323 mesh->point[pos].c[1] = c1;
324 mesh->point[pos].c[2] = c2;
325 mesh->point[pos].ref = ref;
326 mesh->point[pos].tag = MG_NUL;
327 mesh->point[pos].flag = 0;
328 mesh->point[pos].tmp = 0;
329
330 return 1;
331}
332
333int MMGS_Set_vertices(MMG5_pMesh mesh, double *vertices,MMG5_int *refs) {
334
335 MMG5_pPoint ppt;
336 MMG5_int i,j;
337
338 /*coordinates vertices*/
339 for (i=1;i<=mesh->np;i++)
340 {
341 ppt = &mesh->point[i];
342
343 j = (i-1)*3;
344 ppt->c[0] = vertices[j];
345 ppt->c[1] = vertices[j+1];
346 ppt->c[2] = vertices[j+2];
347
348 ppt->tag = MG_NUL;
349 ppt->flag = 0;
350 ppt->tmp = 0;
351
352 if ( refs != NULL )
353 ppt->ref = refs[i-1];
354 }
355
356 return 1;
357}
358
359
360int MMGS_Get_vertex(MMG5_pMesh mesh, double* c0, double* c1, double* c2, MMG5_int* ref,
361 int* isCorner, int* isRequired) {
362
363 if ( mesh->npi == mesh->np ) {
364 mesh->npi = 0;
365 if ( mesh->info.ddebug ) {
366 fprintf(stderr,"\n ## Warning: %s: reset the internal counter of points.\n",
367 __func__);
368 fprintf(stderr," You must pass here exactly one time (the first time ");
369 fprintf(stderr,"you call the MMGS_Get_vertex function).\n");
370 fprintf(stderr," If not, the number of call of this function");
371 fprintf(stderr," exceed the number of points: %" MMG5_PRId "\n ",mesh->np);
372 }
373 }
374
375 mesh->npi++;
376
377 if ( mesh->npi > mesh->np ) {
378 fprintf(stderr,"\n ## Error: %s: unable to get point.\n",__func__);
379 fprintf(stderr," The number of call of MMGS_Get_vertex function");
380 fprintf(stderr," can not exceed the number of points: %" MMG5_PRId "\n ",mesh->np);
381 return 0;
382 }
383
384 return MMGS_GetByIdx_vertex( mesh,c0,c1,c2,ref,isCorner,isRequired,mesh->npi);
385}
386
387int MMGS_GetByIdx_vertex(MMG5_pMesh mesh, double* c0, double* c1, double* c2, MMG5_int* ref,
388 int* isCorner, int* isRequired, MMG5_int idx) {
389
390 if ( idx < 1 || idx > mesh->np ) {
391 fprintf(stderr,"\n ## Error: %s: unable to get point at position %" MMG5_PRId ".\n",
392 __func__,idx);
393 fprintf(stderr," Your vertices numbering goes from 1 to %" MMG5_PRId "\n",mesh->np);
394 return 0;
395 }
396
397 *c0 = mesh->point[idx].c[0];
398 *c1 = mesh->point[idx].c[1];
399 *c2 = mesh->point[idx].c[2];
400 if ( ref != NULL )
401 *ref = mesh->point[idx].ref;
402
403 if ( isCorner != NULL ) {
404 if ( mesh->point[idx].tag & MG_CRN )
405 *isCorner = 1;
406 else
407 *isCorner = 0;
408 }
409
410 if ( isRequired != NULL ) {
411 if ( mesh->point[idx].tag & MG_REQ )
412 *isRequired = 1;
413 else
414 *isRequired = 0;
415 }
416
417 return 1;
418}
419
420int MMGS_Get_vertices(MMG5_pMesh mesh, double* vertices, MMG5_int* refs,
421 int* areCorners, int* areRequired) {
422 MMG5_pPoint ppt;
423 MMG5_int i,j;
424
425 for (i=1;i<=mesh->np;i++)
426 {
427 ppt = &mesh->point[i];
428
429 j = (i-1)*3;
430 vertices[j] = ppt->c[0];
431 vertices[j+1] = ppt->c[1];
432 vertices[j+2] = ppt->c[2];
433
434 j = i-1;
435 if ( refs != NULL )
436 refs[j] = ppt->ref;
437
438 if ( areCorners !=NULL ) {
439 if ( ppt->tag & MG_CRN )
440 areCorners[j] = 1;
441 else
442 areCorners[j] = 0;
443 }
444
445 if ( areRequired != NULL ) {
446 if ( ppt->tag & MG_REQ )
447 areRequired[j] = 1;
448 else
449 areRequired[j] = 0;
450 }
451 }
452
453 return 1;
454}
455
456int MMGS_Set_triangle(MMG5_pMesh mesh, MMG5_int v0, MMG5_int v1, MMG5_int v2, MMG5_int ref,MMG5_int pos) {
457
458 if ( !mesh->nt ) {
459 fprintf(stderr,"\n ## Error: %s: You must set the number of triangles"
460 " with the",__func__);
461 fprintf(stderr," MMGS_Set_meshSize function before setting triangles in mesh\n");
462 return 0;
463 }
464
465 if ( pos > mesh->ntmax ) {
466 fprintf(stderr,"\n ## Error: %s: unable to allocate a new triangle.\n",
467 __func__);
468 fprintf(stderr," max number of triangle: %" MMG5_PRId "\n",mesh->ntmax);
470 return 0;
471 }
472
473 if ( pos > mesh->nt ) {
474 fprintf(stderr,"\n ## Error: %s: attempt to set new triangle at position %" MMG5_PRId ".",
475 __func__,pos);
476 fprintf(stderr," Overflow of the given number of triangles: %" MMG5_PRId "\n",mesh->nt);
477 fprintf(stderr,"\n ## Check the mesh size, its compactness or the position");
478 fprintf(stderr," of the triangle.\n");
479 return 0;
480 }
481
482 mesh->tria[pos].v[0] = v0;
483 mesh->tria[pos].v[1] = v1;
484 mesh->tria[pos].v[2] = v2;
485 mesh->tria[pos].ref = ref;
486
487 mesh->point[v0].tag &= ~MG_NUL;
488 mesh->point[v1].tag &= ~MG_NUL;
489 mesh->point[v2].tag &= ~MG_NUL;
490
491 return 1;
492}
493
494int MMGS_Get_triangle(MMG5_pMesh mesh, MMG5_int* v0, MMG5_int* v1, MMG5_int* v2, MMG5_int* ref
495 ,int* isRequired) {
496 MMG5_pTria ptt;
497
498 if ( mesh->nti == mesh->nt ) {
499 mesh->nti = 0;
500 if ( mesh->info.ddebug ) {
501 fprintf(stderr,"\n ## Warning: %s: reset the internal counter of triangles.\n",
502 __func__);
503 fprintf(stderr," You must pass here exactly one time (the first time ");
504 fprintf(stderr,"you call the MMGS_Get_triangle function).\n");
505 fprintf(stderr," If not, the number of call of this function");
506 fprintf(stderr," exceed the number of triangles: %" MMG5_PRId "\n ",mesh->nt);
507 }
508 }
509
510 mesh->nti++;
511
512 if ( mesh->nti > mesh->nt ) {
513 fprintf(stderr,"\n ## Error: %s: unable to get triangle.\n",__func__);
514 fprintf(stderr," The number of call of MMGS_Get_triangle function");
515 fprintf(stderr," can not exceed the number of triangles: %" MMG5_PRId "\n ",mesh->nt);
516 return 0;
517 }
518
519 ptt = &mesh->tria[mesh->nti];
520 *v0 = ptt->v[0];
521 *v1 = ptt->v[1];
522 *v2 = ptt->v[2];
523 if ( ref != NULL )
524 *ref = ptt->ref;
525
526 if ( isRequired != NULL ) {
527 if ( (ptt->tag[0] & MG_REQ) && (ptt->tag[1] & MG_REQ) &&
528 (ptt->tag[2] & MG_REQ) )
529 *isRequired = 1;
530 else
531 *isRequired = 0;
532 }
533
534 return 1;
535}
536
537int MMGS_Set_triangles(MMG5_pMesh mesh, MMG5_int *tria, MMG5_int *refs) {
538 MMG5_pTria ptt;
539 MMG5_int i, j;
540
541 for (i=1;i<=mesh->nt;i++)
542 {
543 j = (i-1)*3;
544 ptt = &mesh->tria[i];
545 ptt->v[0] = tria[j] ;
546 ptt->v[1] = tria[j+1];
547 ptt->v[2] = tria[j+2];
548
549 mesh->point[ptt->v[0]].tag &= ~MG_NUL;
550 mesh->point[ptt->v[1]].tag &= ~MG_NUL;
551 mesh->point[ptt->v[2]].tag &= ~MG_NUL;
552
553 if ( refs != NULL )
554 ptt->ref = refs[i-1];
555 }
556 return 1;
557}
558
559int MMGS_Get_triangles(MMG5_pMesh mesh, MMG5_int *tria, MMG5_int *refs, int *areRequired) {
560 MMG5_pTria ptt;
561 MMG5_int i, j;
562
563 for (i=1;i<=mesh->nt;i++)
564 {
565 j = (i-1)*3;
566 ptt = &mesh->tria[i];
567 tria[j] = ptt->v[0];
568 tria[j+1] = ptt->v[1];
569 tria[j+2] = ptt->v[2];
570
571 if ( refs!=NULL )
572 refs[i-1] = ptt->ref ;
573 if ( areRequired != NULL ) {
574 if ( (ptt->tag[0] & MG_REQ) && (ptt->tag[1] & MG_REQ) &&
575 (ptt->tag[2] & MG_REQ) )
576 areRequired[i-1] = 1;
577 else
578 areRequired[i-1] = 0;
579 }
580 }
581 return 1;
582}
583
584
585int MMGS_Set_edge(MMG5_pMesh mesh, MMG5_int v0, MMG5_int v1, MMG5_int ref, MMG5_int pos) {
586
587 if ( !mesh->na ) {
588 fprintf(stderr,"\n ## Error: %s: You must set the number of edges with the",
589 __func__);
590 fprintf(stderr," MMGS_Set_meshSize function before setting edges in mesh\n");
591 return 0;
592 }
593 if ( pos > mesh->namax ) {
594 fprintf(stderr,"\n ## Error: %s: unable to allocate a new edge.\n",
595 __func__);
596 fprintf(stderr," max number of edge: %" MMG5_PRId "\n",mesh->namax);
598 return 0;
599 }
600 if ( pos > mesh->na ) {
601 fprintf(stderr,"\n ## Error: %s: attempt to set new edge at position %" MMG5_PRId ".",
602 __func__,pos);
603 fprintf(stderr," Overflow of the given number of edges: %" MMG5_PRId "\n",mesh->na);
604 fprintf(stderr,"\n ## Check the mesh size, its compactness or the position");
605 fprintf(stderr," of the edge.\n");
606 return 0;
607 }
608
609 mesh->edge[pos].a = v0;
610 mesh->edge[pos].b = v1;
611 mesh->edge[pos].ref = ref;
612 mesh->edge[pos].tag |= MG_REF;
613
614 return 1;
615}
616
617int MMGS_Get_edge(MMG5_pMesh mesh, MMG5_int* e0, MMG5_int* e1, MMG5_int* ref
618 ,int* isRidge, int* isRequired) {
619
620 if ( mesh->nai == mesh->na ) {
621 mesh->nai = 0;
622 if ( mesh->info.ddebug ) {
623 fprintf(stderr,"\n ## Warning: %s: reset the internal counter of edges.\n",
624 __func__);
625 fprintf(stderr," You must pass here exactly one time (the first time ");
626 fprintf(stderr,"you call the MMGS_Get_edge function).\n");
627 fprintf(stderr," If not, the number of call of this function");
628 fprintf(stderr," exceed the number of edges: %" MMG5_PRId "\n ",mesh->na);
629 }
630 }
631
632 mesh->nai++;
633
634 if ( mesh->nai > mesh->na ) {
635 fprintf(stderr,"\n ## Error: %s: unable to get edge.\n",__func__);
636 fprintf(stderr," The number of call of MMGS_Get_edge function");
637 fprintf(stderr," can not exceed the number of edges: %" MMG5_PRId "\n ",mesh->na);
638 return 0;
639 }
640
641 *e0 = mesh->edge[mesh->nai].a;
642 *e1 = mesh->edge[mesh->nai].b;
643 if ( ref!=NULL )
644 *ref = mesh->edge[mesh->nai].ref;
645
646 if ( isRidge != NULL ) {
647 if ( mesh->edge[mesh->nai].tag & MG_GEO )
648 *isRidge = 1;
649 else
650 *isRidge = 0;
651 }
652
653 if ( isRequired != NULL ) {
654 if ( mesh->edge[mesh->nai].tag & MG_REQ )
655 *isRequired = 1;
656 else
657 *isRequired = 0;
658 }
659
660 return 1;
661}
662
663int MMGS_Set_edges(MMG5_pMesh mesh, MMG5_int *edges, MMG5_int *refs) {
664 MMG5_int i,j;
665
666 for (i=1;i<=mesh->na;i++)
667 {
668 j = (i-1)*2;
669
670 mesh->edge[i].a = edges[j];
671 mesh->edge[i].b = edges[j+1];
672 if ( refs != NULL )
673 mesh->edge[i].ref = refs[i];
674 mesh->edge[i].tag |= MG_REF;
675 }
676
677 return 1;
678}
679
680int MMGS_Get_edges(MMG5_pMesh mesh, MMG5_int* edges,MMG5_int *refs,int* areRidges,int* areRequired) {
681 MMG5_int i,j;
682
683 for (i=1;i<=mesh->na;i++)
684 {
685 j = (i-1)*2;
686 edges[j] = mesh->edge[i].a;
687 edges[j+1] = mesh->edge[i].b;
688
689 if ( refs!=NULL )
690 refs[i-1] = mesh->edge[i].ref;
691
692 if ( areRidges != NULL ) {
693 if ( mesh->edge[i].tag & MG_GEO )
694 areRidges[i-1] = 1;
695 else
696 areRidges[i-1] = 0;
697 }
698
699 if ( areRequired != NULL ) {
700 if ( mesh->edge[i].tag & MG_REQ )
701 areRequired[i-1] = 1;
702 else
703 areRequired[i-1] = 0;
704 }
705 }
706
707 return 1;
708}
709
711 assert ( k <= mesh->np );
712 mesh->point[k].tag |= MG_CRN;
713 return 1;
714}
715
717 assert ( k <= mesh->np );
718 mesh->point[k].tag &= ~MG_CRN;
719 return 1;
720}
721
723 assert ( k <= mesh->np );
724 mesh->point[k].tag |= MG_REQ;
725 mesh->point[k].tag &= ~MG_NUL;
726 return 1;
727}
728
730 assert ( k <= mesh->np );
731 mesh->point[k].tag &= ~MG_REQ;
732 return 1;
733}
734
736 assert ( k <= mesh->nt );
737 mesh->tria[k].tag[0] |= MG_REQ;
738 mesh->tria[k].tag[1] |= MG_REQ;
739 mesh->tria[k].tag[2] |= MG_REQ;
740 return 1;
741}
742
744 assert ( k <= mesh->nt );
745 mesh->tria[k].tag[0] &= ~MG_REQ;
746 mesh->tria[k].tag[1] &= ~MG_REQ;
747 mesh->tria[k].tag[2] &= ~MG_REQ;
748 return 1;
749}
750
752 assert ( k <= mesh->na );
753 mesh->edge[k].tag |= MG_GEO;
754 return 1;
755}
757 assert ( k <= mesh->na );
758 mesh->edge[k].tag &= ~MG_GEO;
759 return 1;
760}
761
763 assert ( k <= mesh->na );
764 mesh->edge[k].tag |= MG_REQ;
765 return 1;
766}
767
769 assert ( k <= mesh->na );
770 mesh->edge[k].tag &= ~MG_REQ;
771 return 1;
772}
773
774int MMGS_Set_normalAtVertex(MMG5_pMesh mesh, MMG5_int k, double n0, double n1, double n2) {
775
776 assert ( k <= mesh->np );
777 mesh->point[k].n[0] = n0;
778 mesh->point[k].n[1] = n1;
779 mesh->point[k].n[2] = n2;
780
781 ++mesh->nc1;
782
783 return 1;
784}
785
786int MMGS_Get_normalAtVertex(MMG5_pMesh mesh, MMG5_int k, double *n0, double *n1, double *n2) {
787
788 assert ( k <= mesh->np );
789 (*n0) = mesh->point[k].n[0];
790 (*n1) = mesh->point[k].n[1];
791 (*n2) = mesh->point[k].n[2];
792
793 return 1;
794}
795
797 double qual = 0.;
798 MMG5_pTria pt;
799
800 if ( k < 1 || k > mesh->nt ) {
801 fprintf(stderr,"\n ## Error: %s: unable to access to triangle %" MMG5_PRId ".\n",
802 __func__,k);
803 fprintf(stderr," Tria numbering goes from 1 to %" MMG5_PRId "\n",mesh->nt);
804 return 0.;
805 }
806 pt = &mesh->tria[k];
807 assert ( MG_EOK(pt) );
808
809 if ( (!met) || (!met->m) || met->size==1 ) {
810 /* iso quality */
811 qual = MMGS_ALPHAD * MMG5_caltri_iso(mesh,met,pt);
812 }
813 else if ( !mesh->info.metRidTyp ) {
814 qual = MMGS_ALPHAD * MMG5_caltri33_ani(mesh,met,pt);
815 }
816 else {
817 qual = MMGS_ALPHAD * MMG5_caltri_ani(mesh,met,pt);
818 }
819
820 return qual;
821}
822
823int MMGS_Set_scalarSol(MMG5_pSol met, double s, MMG5_int pos) {
824
825 if ( !met->np ) {
826 fprintf(stderr,"\n ## Error: %s: You must set the number of solution"
827 " with the",__func__);
828 fprintf(stderr," MMGS_Set_solSize function before setting values");
829 fprintf(stderr," in solution structure \n");
830 return 0;
831 }
832 if ( pos < 1 ) {
833 fprintf(stderr,"\n ## Error: %s: unable to set a new solution.\n",
834 __func__);
835 fprintf(stderr," Minimal index of the solution position must be 1.\n");
836 return 0;
837 }
838 if ( pos >= met->npmax ) {
839 fprintf(stderr,"\n ## Error: %s: unable to set a new solution.\n",
840 __func__);
841 fprintf(stderr," max number of solutions: %" MMG5_PRId "\n",met->npmax);
842 return 0;
843 }
844
845 if ( pos > met->np ) {
846 fprintf(stderr,"\n ## Error: %s: attempt to set new solution at"
847 " position %" MMG5_PRId ".",__func__,pos);
848 fprintf(stderr," Overflow of the given number of solutions: %" MMG5_PRId "\n",met->np);
849 fprintf(stderr,"\n ## Check the solution size, its compactness or the position");
850 fprintf(stderr," of the solution.\n");
851 return 0;
852 }
853
854 met->m[pos] = s;
855 return 1;
856}
857
858int MMGS_Get_scalarSol(MMG5_pSol met, double* s) {
859 int ddebug = 0;
860
861 if ( met->npi == met->np ) {
862 met->npi = 0;
863 if ( ddebug ) {
864 fprintf(stderr,"\n ## Warning: %s: reset the internal counter of points.\n",
865 __func__);
866 fprintf(stderr," You must pass here exactly one time (the first time ");
867 fprintf(stderr,"you call the MMGS_Get_scalarSol function).\n");
868 fprintf(stderr," If not, the number of call of this function");
869 fprintf(stderr," exceed the number of points: %" MMG5_PRId "\n ",met->np);
870 }
871 }
872
873 met->npi++;
874
875 if ( met->npi > met->np ) {
876 fprintf(stderr,"\n ## Error: %s: unable to get solution.\n",__func__);
877 fprintf(stderr," The number of call of MMGS_Get_scalarSol function");
878 fprintf(stderr," can not exceed the number of points: %" MMG5_PRId "\n ",met->np);
879 return 0;
880 }
881
882 *s = met->m[met->npi];
883
884 return 1;
885}
886
887int MMGS_Set_scalarSols(MMG5_pSol met, double *s ) {
888 MMG5_int k;
889
890 if ( !met->np ) {
891 fprintf(stderr,"\n ## Error: %s: You must set the number of solution"
892 " with the",__func__);
893 fprintf(stderr," MMGS_Set_solSize function before setting values");
894 fprintf(stderr," in solution structure \n");
895 return 0;
896 }
897
898 for ( k=0; k<met->np; ++k )
899 met->m[k+1] = s[k];
900
901 return 1;
902}
903
904int MMGS_Get_scalarSols(MMG5_pSol met, double* s) {
905 MMG5_int k;
906
907 for ( k=0; k<met->np; ++k )
908 s[k] = met->m[k+1];
909
910 return 1;
911}
912
913
914int MMGS_Set_vectorSol(MMG5_pSol met, double vx,double vy, double vz, MMG5_int pos) {
915
916 if ( !met->np ) {
917 fprintf(stderr,"\n ## Error: %s: You must set the number of"
918 " solution with the",__func__);
919 fprintf(stderr," MMGS_Set_solSize function before setting values");
920 fprintf(stderr," in solution structure \n");
921 return 0;
922 }
923 if ( pos < 1 ) {
924 fprintf(stderr,"\n ## Error: %s: unable to set a new solution.\n",
925 __func__);
926 fprintf(stderr," Minimal index of the solution position must be 1.\n");
927 return 0;
928 }
929 if ( pos >= met->npmax ) {
930 fprintf(stderr,"\n ## Error: %s: unable to set a new solution.\n",
931 __func__);
932 fprintf(stderr," max number of solutions: %" MMG5_PRId "\n",met->npmax);
933 return 0;
934 }
935
936 if ( pos > met->np ) {
937 fprintf(stderr,"\n ## Error: %s: attempt to set new solution at position %" MMG5_PRId ".",
938 __func__,pos);
939 fprintf(stderr," Overflow of the given number of solutions: %" MMG5_PRId "\n",met->np);
940 fprintf(stderr,"\n ## Check the solution size, its compactness or the position");
941 fprintf(stderr," of the solution.\n");
942 return 0;
943 }
944
945 met->m[3*pos] = vx;
946 met->m[3*pos+1] = vy;
947 met->m[3*pos+2] = vz;
948
949 return 1;
950}
951
952int MMGS_Get_vectorSol(MMG5_pSol met, double* vx, double* vy, double* vz) {
953 int ddebug = 0;
954
955 if ( met->npi == met->np ) {
956 met->npi = 0;
957 if ( ddebug ) {
958 fprintf(stderr,"\n ## Warning: %s: reset the internal counter of points.\n",
959 __func__);
960 fprintf(stderr," You must pass here exactly one time (the first time ");
961 fprintf(stderr,"you call the MMGS_Get_vectorSol function).\n");
962 fprintf(stderr," If not, the number of call of this function");
963 fprintf(stderr," exceed the number of points: %" MMG5_PRId "\n ",met->np);
964 }
965 }
966
967 met->npi++;
968
969 if ( met->npi > met->np ) {
970 fprintf(stderr,"\n ## Error: %s: unable to get solution.\n",__func__);
971 fprintf(stderr," The number of call of MMGS_Get_vectorSol function");
972 fprintf(stderr," can not exceed the number of points: %" MMG5_PRId "\n ",met->np);
973 return 0;
974 }
975
976 *vx = met->m[3*met->npi];
977 *vy = met->m[3*met->npi+1];
978 *vz = met->m[3*met->npi+2];
979
980 return 1;
981}
982
983
984int MMGS_Set_vectorSols(MMG5_pSol met, double *sols) {
985 double *m;
986 MMG5_int k,j;
987
988 if ( !met->np ) {
989 fprintf(stderr,"\n ## Error: %s: You must set the number of"
990 " solution with the",__func__);
991 fprintf(stderr," MMGS_Set_solSize function before setting values");
992 fprintf(stderr," in solution structure \n");
993 return 0;
994 }
995
996 for ( k=0; k<met->np; ++k ) {
997 j = 3*k;
998 m = &met->m[j+3];
999 m[0] = sols[j];
1000 m[1] = sols[j+1];
1001 m[2] = sols[j+2];
1002 }
1003
1004 return 1;
1005}
1006
1007int MMGS_Get_vectorSols(MMG5_pSol met, double* sols) {
1008 double *m;
1009 MMG5_int k, j;
1010
1011 for ( k=0; k<met->np; ++k ) {
1012 j = 3*k;
1013 m = &met->m[j+3];
1014 sols[j] = m[0];
1015 sols[j+1] = m[1];
1016 sols[j+2] = m[2];
1017 }
1018
1019 return 1;
1020}
1021
1022int MMGS_Set_tensorSol(MMG5_pSol met, double m11,double m12, double m13,
1023 double m22,double m23, double m33, MMG5_int pos) {
1024
1025 if ( !met->np ) {
1026 fprintf(stderr,"\n ## Error: %s: You must set the number of"
1027 " solution with the",__func__);
1028 fprintf(stderr," MMGS_Set_solSize function before setting values");
1029 fprintf(stderr," in solution structure \n");
1030 return 0;
1031 }
1032 if ( pos < 1 ) {
1033 fprintf(stderr,"\n ## Error: %s: unable to set a new solution.\n",
1034 __func__);
1035 fprintf(stderr," Minimal index of the solution position must be 1.\n");
1036 return 0;
1037 }
1038 if ( pos >= met->npmax ) {
1039 fprintf(stderr,"\n ## Error: %s: unable to set a new solution.\n",
1040 __func__);
1041 fprintf(stderr," max number of solutions: %" MMG5_PRId "\n",met->npmax);
1042 return 0;
1043 }
1044
1045 if ( pos > met->np ) {
1046 fprintf(stderr,"\n ## Error: %s: attempt to set new solution"
1047 " at position %" MMG5_PRId ".",__func__,pos);
1048 fprintf(stderr," Overflow of the given number of solutions: %" MMG5_PRId "\n",met->np);
1049 fprintf(stderr,"\n ## Check the solution size, its compactness or the position");
1050 fprintf(stderr," of the solution.\n");
1051 return 0;
1052 }
1053
1054 met->m[6*pos] = m11;
1055 met->m[6*pos+1] = m12;
1056 met->m[6*pos+2] = m13;
1057 met->m[6*pos+3] = m22;
1058 met->m[6*pos+4] = m23;
1059 met->m[6*pos+5] = m33;
1060
1061 return 1;
1062}
1063
1064int MMGS_Get_tensorSol(MMG5_pSol met, double *m11,double *m12, double *m13,
1065 double *m22,double *m23, double *m33) {
1066
1067 int ddebug = 0;
1068
1069 if ( met->npi == met->np ) {
1070 met->npi = 0;
1071 if ( ddebug ) {
1072 fprintf(stderr,"\n ## Warning: %s: reset the internal counter of"
1073 " points.\n",__func__);
1074 fprintf(stderr," You must pass here exactly one time (the first time ");
1075 fprintf(stderr,"you call the MMGS_Get_tensorSol function).\n");
1076 fprintf(stderr," If not, the number of call of this function");
1077 fprintf(stderr," exceed the number of points: %" MMG5_PRId "\n ",met->np);
1078 }
1079 }
1080
1081 met->npi++;
1082
1083 if ( met->npi > met->np ) {
1084 fprintf(stderr,"\n ## Error: %s: unable to get solution.\n",__func__);
1085 fprintf(stderr," The number of call of MMGS_Get_tensorSol function");
1086 fprintf(stderr," can not exceed the number of points: %" MMG5_PRId "\n ",met->np);
1087 return 0;
1088 }
1089
1090 *m11 = met->m[6*met->npi];
1091 *m12 = met->m[6*met->npi+1];
1092 *m13 = met->m[6*met->npi+2];
1093 *m22 = met->m[6*met->npi+3];
1094 *m23 = met->m[6*met->npi+4];
1095 *m33 = met->m[6*met->npi+5];
1096
1097 return 1;
1098}
1099
1100
1101int MMGS_Set_tensorSols(MMG5_pSol met, double *sols) {
1102 double *m;
1103 MMG5_int k,j;
1104
1105 if ( !met->np ) {
1106 fprintf(stderr,"\n ## Error: %s: You must set the number"
1107 " of solution with the",__func__);
1108 fprintf(stderr," MMGS_Set_solSize function before setting values");
1109 fprintf(stderr," in solution structure \n");
1110 return 0;
1111 }
1112
1113 for ( k=0; k<met->np; ++k ) {
1114 j = 6*k;
1115 m = &met->m[j+6];
1116
1117 m[0] = sols[j];
1118 m[1] = sols[j+1];
1119 m[2] = sols[j+2];
1120 m[3] = sols[j+3];
1121 m[4] = sols[j+4];
1122 m[5] = sols[j+5];
1123 }
1124 return 1;
1125}
1126
1127int MMGS_Get_tensorSols(MMG5_pSol met, double *sols) {
1128 double *m;
1129 MMG5_int k,j;
1130
1131 for ( k=0; k<met->np; ++k ) {
1132 j = 6*k;
1133 m = &met->m[j+6];
1134
1135 sols[j] = m[0];
1136 sols[j+1] = m[1];
1137 sols[j+2] = m[2];
1138 sols[j+3] = m[3];
1139 sols[j+4] = m[4];
1140 sols[j+5] = m[5];
1141 }
1142
1143 return 1;
1144}
1145
1146int MMGS_Set_ithSol_inSolsAtVertices(MMG5_pSol sol,int i, double* s,MMG5_int pos) {
1147 MMG5_pSol psl;
1148
1149 /* Warning: users give indices from 1 to nsols */
1150 psl = sol + (i-1);
1151
1152 switch ( psl->type ) {
1153 case MMG5_Scalar:
1154 return MMGS_Set_scalarSol(psl,s[0],pos);
1155 break;
1156
1157 case MMG5_Vector:
1158 MMGS_Set_vectorSol(psl,s[0],s[1],s[2],pos);
1159 break;
1160
1161 case MMG5_Tensor:
1162 MMGS_Set_tensorSol(psl,s[0],s[1],s[2],s[3],s[4],s[5],pos);
1163 break;
1164
1165 default:
1166 fprintf(stderr,"\n ## Error: %s: unexpected type of solution: %s.\n",
1167 __func__,MMG5_Get_typeName(psl->type));
1168 return 0;
1169 }
1170 return 1;
1171}
1172
1173int MMGS_Get_ithSol_inSolsAtVertices(MMG5_pSol sol,int i, double *s,MMG5_int pos) {
1174 MMG5_pSol psl;
1175
1176 /* Warning: users give indices from 1 to nsols */
1177 psl = sol + (i-1);
1178
1179 psl->npi = pos-1;
1180
1181 switch ( psl->type ) {
1182 case MMG5_Scalar:
1183 return MMGS_Get_scalarSol(psl,&s[0]);
1184 break;
1185
1186 case MMG5_Vector:
1187 MMGS_Get_vectorSol(psl,&s[0],&s[1],&s[2]);
1188 break;
1189
1190 case MMG5_Tensor:
1191 MMGS_Get_tensorSol(psl,&s[0],&s[1],&s[2],&s[3],&s[4],&s[5]);
1192 break;
1193
1194 default:
1195 fprintf(stderr,"\n ## Error: %s: unexpected type of solution: %s\n",
1196 __func__,MMG5_Get_typeName(psl->type));
1197 return 0;
1198 }
1199
1200 return 1;
1201}
1202
1204 MMG5_pSol psl;
1205
1206 /* Warning: users give indices from 1 to nsols */
1207 psl = sol + (i-1);
1208
1209 switch ( psl->type ) {
1210 case MMG5_Scalar:
1211 return MMGS_Set_scalarSols(psl,s);
1212 break;
1213
1214 case MMG5_Vector:
1215 MMGS_Set_vectorSols(psl,s);
1216 break;
1217
1218 case MMG5_Tensor:
1219 MMGS_Set_tensorSols(psl,s);
1220 break;
1221
1222 default:
1223 fprintf(stderr,"\n ## Error: %s: unexpected type of solution: %s.\n",
1224 __func__,MMG5_Get_typeName(psl->type));
1225 return 0;
1226 }
1227
1228 return 1;
1229}
1230
1232 MMG5_pSol psl;
1233
1234 /* Warning: users give indices from 1 to nsols */
1235 psl = sol + (i-1);
1236
1237 switch ( psl->type ) {
1238 case MMG5_Scalar:
1239 return MMGS_Get_scalarSols(psl,s);
1240 break;
1241
1242 case MMG5_Vector:
1243 MMGS_Get_vectorSols(psl,s);
1244 break;
1245
1246 case MMG5_Tensor:
1247 MMGS_Get_tensorSols(psl,s);
1248 break;
1249
1250 default:
1251 fprintf(stderr,"\n ## Error: %s: unexpected type of solution: %s\n",
1252 __func__,MMG5_Get_typeName(psl->type));
1253 return 0;
1254 }
1255
1256 return 1;
1257}
1258
1259
1261
1262 if ( (mesh->npi != mesh->np) || (mesh->nti != mesh->nt) ) {
1263 fprintf(stderr,"\n ## Error: %s: if you don't use the MMGS_loadMesh"
1264 " function,",__func__);
1265 fprintf(stderr," you must call the MMGS_Set_meshSize function to have a");
1266 fprintf(stderr," valid mesh.\n");
1267 fprintf(stderr," Missing datas.\n");
1268 return 0;
1269 }
1270
1271 if ( met->npi != met->np ) {
1272 fprintf(stderr,"\n ## Error: %s: if you don't use the MMGS_loadSol"
1273 " function,",__func__);
1274 fprintf(stderr," you must call the MMGS_Set_solSize function to have a");
1275 fprintf(stderr," valid solution.\n");
1276 fprintf(stderr," Missing datas.\n");
1277 return 0;
1278 }
1279
1280 /* Check mesh data */
1281 if ( mesh->info.ddebug ) {
1282 if ( (!mesh->np) || (!mesh->point) ||
1283 (!mesh->nt) || (!mesh->tria) ) {
1284 fprintf(stderr," ** MISSING DATA.\n");
1285 fprintf(stderr," Check that your mesh contains points and triangles.\n");
1286 fprintf(stderr," Exit program.\n");
1287 return 0;
1288 }
1289 }
1290
1291 if ( mesh->dim != 3 ) {
1292 fprintf(stderr," ** 3 DIMENSIONAL MESH NEEDED. Exit program.\n");
1293 return 0;
1294 }
1295 if ( met->dim != 3 ) {
1296 fprintf(stderr," ** WRONG DIMENSION FOR METRIC. Exit program.\n");
1297 return 0;
1298 }
1299 if ( !mesh->ver ) mesh->ver = 2;
1300 if ( !met ->ver ) met ->ver = 2;
1301
1302 return 1;
1303}
1304
1305int MMGS_Set_iparameter(MMG5_pMesh mesh, MMG5_pSol sol, int iparam, MMG5_int val){
1306 MMG5_int k;
1307
1308 switch ( iparam ) {
1309 /* Integer parameters */
1310 case MMGS_IPARAM_verbose :
1311 mesh->info.imprim = val;
1312 break;
1313 case MMGS_IPARAM_mem :
1314 if ( val <= 0 ) {
1315 fprintf(stderr,"\n ## Warning: %s: maximal memory authorized must be"
1316 " strictly positive.\n",__func__);
1317 fprintf(stderr," Reset to default value.\n");
1318 }
1319 else
1320 mesh->info.mem = val;
1321 if ( !MMGS_memOption(mesh) ) return 0;
1322 break;
1323 case MMGS_IPARAM_debug :
1324 mesh->info.ddebug = val;
1325 break;
1326 case MMGS_IPARAM_angle :
1327 if ( mesh->xpoint )
1329 if ( !val )
1330 mesh->info.dhd = -1.;
1331 else {
1332 if ( (mesh->info.imprim > 5) || mesh->info.ddebug )
1333 fprintf(stderr,"\n ## Warning: %s: angle detection parameter set"
1334 " to default value\n",__func__);
1336 }
1337 break;
1338 case MMGS_IPARAM_iso :
1339 if ( !mesh->info.iso )
1340 mesh->info.iso = val;
1341 break;
1342 case MMGS_IPARAM_isoref :
1343 mesh->info.isoref = val;
1344 break;
1345 case MMGS_IPARAM_isosurf :
1346 mesh->info.isosurf = val;
1347 break;
1348 case MMGS_IPARAM_keepRef :
1349 if ( mesh->info.nmat ) {
1350 fprintf(stderr,"\n ## Warning: %s: multi material mode not compatible with"
1351 " references preservation. Refs preservation disabled.\n",__func__);
1352 }
1353 else if ( val ) {
1354 mesh->info.iso = 2;
1355 }
1356 break;
1358 mesh->info.nsd = val;
1359 break;
1360 case MMGS_IPARAM_optim :
1361 mesh->info.optim = val;
1362 break;
1364 mesh->info.noinsert = val;
1365 break;
1366 case MMGS_IPARAM_noswap :
1367 mesh->info.noswap = val;
1368 break;
1369 case MMGS_IPARAM_nomove :
1370 mesh->info.nomove = val;
1371 break;
1372 case MMGS_IPARAM_nreg :
1373 mesh->info.nreg = val;
1374 break;
1375 case MMGS_IPARAM_xreg :
1376 mesh->info.xreg = val;
1377 break;
1379 mesh->info.nosizreq = val;
1380 break;
1382 if ( mesh->info.par ) {
1384 if ( (mesh->info.imprim > 5) || mesh->info.ddebug )
1385 fprintf(stderr,"\n ## Warning: %s: new local parameter values\n",__func__);
1386 }
1387 mesh->info.npar = val;
1388 mesh->info.npari = 0;
1389 mesh->info.parTyp = 0;
1390
1391 MMG5_ADD_MEM(mesh,mesh->info.npar*sizeof(MMG5_Par),"parameters",
1392 fprintf(stderr," Exit program.\n");
1393 return 0);
1395
1396 MMG5_int inival;
1397 inival = MMG5_INTMAX;
1398
1399 for (k=0; k<mesh->info.npar; k++) {
1401 mesh->info.par[k].ref = inival;
1402 mesh->info.par[k].hausd = mesh->info.hausd;
1403 mesh->info.par[k].hmin = mesh->info.hmin;
1404 mesh->info.par[k].hmax = mesh->info.hmax;
1405 }
1406 break;
1408 if ( mesh->info.br ) {
1410 if ( (mesh->info.imprim > 5) || mesh->info.ddebug )
1411 fprintf(stderr,"\n ## Warning: %s: new level-set based references values\n",__func__);
1412 }
1413 mesh->info.nbr = val;
1414 mesh->info.nbri = 0;
1415 MMG5_ADD_MEM(mesh,mesh->info.nbr*sizeof(MMG5_int),"References",
1416 printf(" Exit program.\n");
1417 return 0);
1418 MMG5_SAFE_CALLOC(mesh->info.br,mesh->info.nbr,MMG5_int,return 0);
1419
1420 for (k=0; k<mesh->info.nbr; k++)
1421 mesh->info.br[k] = 0;
1422
1423 break;
1424
1426 if ( mesh->info.mat ) {
1428 if ( (mesh->info.imprim > 5) || mesh->info.ddebug )
1429 fprintf(stderr,"\n ## Warning: %s: new multi materials values\n",__func__);
1430 }
1431 if ( mesh->info.iso == 2 ) {
1432 fprintf(stderr,"\n ## Warning: %s: multi material mode not compatible with"
1433 " references preservation. Refs preservation disabled.\n",__func__);
1434 mesh->info.iso = 1;
1435 }
1436 mesh->info.nmat = val;
1437 mesh->info.nmati = 0;
1438
1439 MMG5_ADD_MEM(mesh,(mesh->info.nmat)*sizeof(MMG5_Mat),"multi material",
1440 printf(" Exit program.\n");
1441 return 0);
1443 break;
1444
1445#ifdef USE_SCOTCH
1446 case MMGS_IPARAM_renum :
1447 mesh->info.renum = val;
1448 break;
1449#endif
1451 mesh->info.ani = val;
1452 break;
1453 default :
1454 fprintf(stderr,"\n ## Error: %s: unknown type of parameter\n",__func__);
1455 return 0;
1456 }
1457
1458 return 1;
1459}
1460
1461int MMGS_Get_iparameter(MMG5_pMesh mesh, MMG5_int iparam) {
1462
1463 switch ( iparam ) {
1464 /* Integer parameters */
1465 case MMGS_IPARAM_verbose :
1466 return mesh->info.imprim;
1467 break;
1468 case MMGS_IPARAM_mem :
1469 return mesh->info.mem;
1470 break;
1471 case MMGS_IPARAM_debug :
1472 return mesh->info.ddebug;
1473 break;
1474 case MMGS_IPARAM_angle :
1475 if ( mesh->info.dhd <= 0. ) {
1476 return 0;
1477 }
1478 else {
1479 return 1;
1480 }
1481 break;
1483 return mesh->info.noinsert;
1484 break;
1485 case MMGS_IPARAM_noswap :
1486 return mesh->info.noswap;
1487 break;
1488 case MMGS_IPARAM_nomove :
1489 return mesh->info.nomove;
1490 break;
1491 case MMGS_IPARAM_nreg :
1492 return mesh->info.nreg;
1493 break;
1494 case MMGS_IPARAM_xreg :
1495 return mesh->info.xreg;
1496 break;
1498 return mesh->info.npar;
1499 break;
1500#ifdef USE_SCOTCH
1501 case MMGS_IPARAM_renum :
1502 return mesh->info.renum;
1503 break;
1504#endif
1505 default :
1506 fprintf(stderr,"\n ## Error: %s: unknown type of parameter\n",__func__);
1507 return 0;
1508 }
1509}
1510
1511int MMGS_Set_dparameter(MMG5_pMesh mesh, MMG5_pSol sol, int dparam, double val){
1512
1513 switch ( dparam ) {
1514 /* double parameters */
1516 mesh->info.dhd = val;
1517 mesh->info.dhd = MG_MAX(0.0, MG_MIN(180.0,mesh->info.dhd));
1518 mesh->info.dhd = cos(mesh->info.dhd*M_PI/180.0);
1519 break;
1520 case MMGS_DPARAM_hmin :
1521 mesh->info.sethmin = 1;
1522 mesh->info.hmin = val;
1523 if ( mesh->info.sethmax && ( mesh->info.hmin >= mesh->info.hmax ) ) {
1524 fprintf(stderr,"\n ## Warning: hmin value must be strictly lower than hmax one"
1525 " (hmin = %lf hmax = %lf ).\n",mesh->info.hmin, mesh->info.hmax);
1526 }
1527
1528 break;
1529 case MMGS_DPARAM_hmax :
1530 mesh->info.sethmax = 1;
1531 mesh->info.hmax = val;
1532 if ( mesh->info.sethmin && ( mesh->info.hmin >= mesh->info.hmax ) ) {
1533 fprintf(stderr,"\n ## Warning: hmin value must be strictly lower than hmax one"
1534 " (hmin = %lf hmax = %lf ).\n",mesh->info.hmin, mesh->info.hmax);
1535 }
1536
1537 break;
1538 case MMGS_DPARAM_hsiz :
1539 mesh->info.hsiz = val;
1540 break;
1541 case MMGS_DPARAM_hgrad :
1542 mesh->info.hgrad = val;
1543 if ( mesh->info.hgrad <= 0.0 )
1544 mesh->info.hgrad = -1.0;
1545 else
1546 mesh->info.hgrad = log(mesh->info.hgrad);
1547 break;
1549 mesh->info.hgradreq = val;
1550 if ( mesh->info.hgradreq <= 0.0 )
1551 mesh->info.hgradreq = -1.0;
1552 else
1554 break;
1555 case MMGS_DPARAM_hausd :
1556 if ( val <=0 ) {
1557 fprintf(stderr,"\n ## Error: %s: hausdorff number must be strictly"
1558 " positive.\n",__func__);
1559 return 0;
1560 }
1561 else
1562 mesh->info.hausd = val;
1563 break;
1564 case MMGS_DPARAM_ls :
1565 mesh->info.ls = val;
1566 break;
1567 case MMGS_DPARAM_xreg :
1568 if (val < 0.0 || val > 1.0) {
1569 fprintf(stderr,"\n ## Error: %s: Coordinate regularization parameter must be comprised between 0 and 1.\n",__func__);
1570 }
1571 else
1572 mesh->info.lxreg = val;
1573 break;
1574 case MMGS_DPARAM_rmc :
1575 if ( !val ) {
1576 /* Default value */
1578 }
1579 else {
1580 /* User customized value */
1581 mesh->info.rmc = val;
1582 }
1583 break;
1584 default :
1585 fprintf(stderr,"\n ## Error: %s: unknown type of parameter\n",__func__);
1586 return 0;
1587 }
1588 return 1;
1589}
1590
1592 double hmin,double hmax,double hausd){
1593 MMG5_pPar par;
1594 MMG5_int k;
1595
1596 if ( !mesh->info.npar ) {
1597 fprintf(stderr,"\n ## Error: %s: You must set the number of local"
1598 " parameters",__func__);
1599 fprintf(stderr," with the MMGS_Set_iparameters function before setting");
1600 fprintf(stderr," values in local parameters structure. \n");
1601 return 0;
1602 }
1603 if ( mesh->info.npari > mesh->info.npar ) {
1604 fprintf(stderr,"\n ## Error: %s: unable to set a new local parameter.\n",
1605 __func__);
1606 fprintf(stderr," max number of local parameters: %d\n",mesh->info.npar);
1607 return 0;
1608 }
1609 if ( typ != MMG5_Triangle ) {
1610 fprintf(stderr,"\n ## Warning: %s: you must apply your local parameters",
1611 __func__);
1612 fprintf(stderr," on triangles (MMG5_Triangle or %d).\n",MMG5_Triangle);
1613 fprintf(stderr," ## Unknown type of entity: ignored.\n");
1614 return 0;
1615 }
1616 if ( ref < 0 ) {
1617 fprintf(stderr,"\n ## Error: %s: negative references are not allowed.\n",
1618 __func__);
1619 return 0;
1620 }
1621
1622 if ( hmin <= 0 ) {
1623 fprintf(stderr,"\n ## Error: %s: negative hmin value is not allowed.\n",
1624 __func__);
1625 return 0;
1626 }
1627 if ( hmax <= 0 ) {
1628 fprintf(stderr,"\n ## Error: %s: negative hmax value is not allowed.\n",
1629 __func__);
1630 return 0;
1631 }
1632 if ( hausd <= 0 ) {
1633 fprintf(stderr,"\n ## Error: %s: negative hausd value is not allowed.\n",
1634 __func__);
1635 return 0;
1636 }
1637
1638 for (k=0; k<mesh->info.npari; k++) {
1639 par = &mesh->info.par[k];
1640
1641 if ( par->elt == typ && par->ref == ref ) {
1642 par->hausd = hausd;
1643 par->hmin = hmin;
1644 par->hmax = hmax;
1645 if ( (mesh->info.imprim > 5) || mesh->info.ddebug ) {
1646 fprintf(stderr,"\n ## Warning: %s: new parameters (hausd, hmin and hmax)",
1647 __func__);
1648 fprintf(stderr," for entities of type %d and of ref %" MMG5_PRId "\n",typ,ref);
1649 }
1650 return 1;
1651 }
1652 }
1653
1654 mesh->info.par[mesh->info.npari].elt = typ;
1655 mesh->info.par[mesh->info.npari].ref = ref;
1656 mesh->info.par[mesh->info.npari].hmin = hmin;
1657 mesh->info.par[mesh->info.npari].hmax = hmax;
1658 mesh->info.par[mesh->info.npari].hausd = hausd;
1659
1660 switch ( typ )
1661 {
1662 case ( MMG5_Triangle ):
1663 mesh->info.parTyp |= MG_Tria;
1664 break;
1665 default:
1666 fprintf(stderr,"\n ## Error: %s: unexpected entity type: %s.\n",
1667 __func__,MMG5_Get_entitiesName(typ));
1668 return 0;
1669 }
1670
1671 mesh->info.npari++;
1672
1673 return 1;
1674}
1675
1677 int split,MMG5_int rin,MMG5_int rout){
1678 return MMG5_Set_multiMat(mesh,sol,ref,split,rin,rout);
1679}
1680
1683}
1684
1686
1687 return MMG5_Free_allSols(mesh,sol);
1688}
1689
1690int MMGS_Free_all(const int starter,...)
1691{
1692 va_list argptr;
1693 int ier;
1694
1696
1698
1699 va_end(argptr);
1700
1701 return ier;
1702}
1703
1705{
1706 va_list argptr;
1707 int ier;
1708
1710
1712
1713 va_end(argptr);
1714
1715 return ier;
1716}
1717
1718int MMGS_Free_names(const int starter,...)
1719{
1720 va_list argptr;
1721 int ier;
1722
1724
1726
1727 va_end(argptr);
1728
1729 return ier;
1730}
const char * MMG5_Get_typeName(enum MMG5_type typ)
int MMG5_Set_inputParamName(MMG5_pMesh mesh, const char *fparamin)
int MMG5_Set_outputMeshName(MMG5_pMesh mesh, const char *meshout)
int MMG5_Set_inputSolName(MMG5_pMesh mesh, MMG5_pSol sol, const char *solin)
int MMG5_Free_allSols(MMG5_pMesh mesh, MMG5_pSol *sol)
int MMG5_Set_inputMeshName(MMG5_pMesh mesh, const char *meshin)
void MMG5_Init_parameters(MMG5_pMesh mesh)
Definition: API_functions.c:51
const char * MMG5_Get_entitiesName(enum MMG5_entities ent)
void MMG5_Init_fileNames(MMG5_pMesh mesh, MMG5_pSol sol)
int MMG5_Set_outputSolName(MMG5_pMesh mesh, MMG5_pSol sol, const char *solout)
int MMGS_Get_vertices(MMG5_pMesh mesh, double *vertices, MMG5_int *refs, int *areCorners, int *areRequired)
Get the coordinates, references and attributes of all vertices in the mesh.
int MMGS_Set_triangles(MMG5_pMesh mesh, MMG5_int *tria, MMG5_int *refs)
Set the vertices and references of all triangles in the mesh.
int MMGS_Set_iparameter(MMG5_pMesh mesh, MMG5_pSol sol, int iparam, MMG5_int val)
set an integer parameter of the remesher
int MMGS_Get_edges(MMG5_pMesh mesh, MMG5_int *edges, MMG5_int *refs, int *areRidges, int *areRequired)
Get vertices, references and attributes of all edges in the mesh.
int MMGS_Get_edge(MMG5_pMesh mesh, MMG5_int *e0, MMG5_int *e1, MMG5_int *ref, int *isRidge, int *isRequired)
Get the vertices, reference, and attributes of the next edge in the mesh.
int MMGS_Set_inputMeshName(MMG5_pMesh mesh, const char *meshin)
Set the name of the input mesh.
int MMGS_Get_vectorSol(MMG5_pSol met, double *vx, double *vy, double *vz)
Get the next element of a vector solution structure.
int MMGS_Get_tensorSols(MMG5_pSol met, double *sols)
Get all elements of a tensor solution field.
int MMGS_Get_meshSize(MMG5_pMesh mesh, MMG5_int *np, MMG5_int *nt, MMG5_int *na)
Get the number of vertices, triangles, and edges of the mesh.
int MMGS_Set_vertices(MMG5_pMesh mesh, double *vertices, MMG5_int *refs)
Set the coordinates and references of all vertices in a mesh.
int MMGS_Get_vectorSols(MMG5_pSol met, double *sols)
Get all elements of a vector solution structure.
int MMGS_Set_requiredVertex(MMG5_pMesh mesh, MMG5_int k)
Assign the "required" attribute to a vertex.
int MMGS_Set_localParameter(MMG5_pMesh mesh, MMG5_pSol sol, int typ, MMG5_int ref, double hmin, double hmax, double hausd)
set a local parameter
int MMGS_Init_mesh(const int starter,...)
Initialize a mesh structure and optionally the associated solution and metric structures.
int MMGS_Set_inputParamName(MMG5_pMesh mesh, const char *fparamin)
Set the name of the input parameter file.
int MMGS_Free_allSols(MMG5_pMesh mesh, MMG5_pSol *sol)
Deallocate an array of solution fields.
int MMGS_Unset_requiredEdge(MMG5_pMesh mesh, MMG5_int k)
Remove the "required" attribute from an edge.
int MMGS_Set_solsAtVerticesSize(MMG5_pMesh mesh, MMG5_pSol *sol, int nsols, MMG5_int nentities, int *typSol)
Initialize an array of solution fields defined at vertices: set dimension, types and number of fields...
int MMGS_Get_tensorSol(MMG5_pSol met, double *m11, double *m12, double *m13, double *m22, double *m23, double *m33)
Get the next element of a tensor solution structure.
int MMGS_Set_vertex(MMG5_pMesh mesh, double c0, double c1, double c2, MMG5_int ref, MMG5_int pos)
Set the coordinates of a single vertex.
int MMGS_Get_solSize(MMG5_pMesh mesh, MMG5_pSol sol, int *typEntity, MMG5_int *np, int *typSol)
Get the number of elements, dimension, and type of a solution.
int MMGS_Set_requiredTriangle(MMG5_pMesh mesh, MMG5_int k)
Assign the "required" attribute to a triangle.
int MMGS_Set_scalarSols(MMG5_pSol met, double *s)
Set the values of all elements of a scalar solution structure.
int MMGS_Get_ithSols_inSolsAtVertices(MMG5_pSol sol, int i, double *s)
Get one out of several solutions at all vertices in the mesh.
int MMGS_Free_structures(const int starter,...)
Structure deallocations before return.
int MMGS_Set_edges(MMG5_pMesh mesh, MMG5_int *edges, MMG5_int *refs)
Set the vertices and references of all edges in a mesh.
int MMGS_Unset_requiredVertex(MMG5_pMesh mesh, MMG5_int k)
Remove the "required" attribute from a vertex.
int MMGS_Unset_requiredTriangle(MMG5_pMesh mesh, MMG5_int k)
Remove the "required" attribute from a vertex.
int MMGS_Free_all(const int starter,...)
Deallocations before return.
int MMGS_Set_ithSol_inSolsAtVertices(MMG5_pSol sol, int i, double *s, MMG5_int pos)
Set a single element of one out of multiple solution fields that are defined on vertices.
int MMGS_Set_tensorSol(MMG5_pSol met, double m11, double m12, double m13, double m22, double m23, double m33, MMG5_int pos)
Set a single element of a tensor solution structure.
void MMGS_Init_parameters(MMG5_pMesh mesh)
Initialize the input parameters.
int MMGS_Set_requiredEdge(MMG5_pMesh mesh, MMG5_int k)
Assign the "required" attribute to an edge.
int MMGS_Set_ridge(MMG5_pMesh mesh, MMG5_int k)
Assign the "ridge" attribute to an edge.
int MMGS_GetByIdx_vertex(MMG5_pMesh mesh, double *c0, double *c1, double *c2, MMG5_int *ref, int *isCorner, int *isRequired, MMG5_int idx)
Get the coordinates and reference of a specific vertex in the mesh.
int MMGS_Get_scalarSol(MMG5_pSol met, double *s)
Get the next element of a scalar solution structure.
int MMGS_Set_inputSolName(MMG5_pMesh mesh, MMG5_pSol sol, const char *solin)
Set the name of the input solution file.
int MMGS_Get_ithSol_inSolsAtVertices(MMG5_pSol sol, int i, double *s, MMG5_int pos)
Get one out of several solutions at a specific vertex.
int MMGS_Set_edge(MMG5_pMesh mesh, MMG5_int v0, MMG5_int v1, MMG5_int ref, MMG5_int pos)
Set the vertices and reference of one edge in the mesh.
int MMGS_Get_iparameter(MMG5_pMesh mesh, MMG5_int iparam)
Get the value of an integer parameter of the remesher.
void MMGS_Init_fileNames(MMG5_pMesh mesh, MMG5_pSol sol)
Initialize file names to their default values.
int MMGS_Set_lsBaseReference(MMG5_pMesh mesh, MMG5_pSol sol, MMG5_int br)
Set a new level-set base reference.
int MMGS_Set_corner(MMG5_pMesh mesh, MMG5_int k)
Assign the "corner" attribute to a vertex.
int MMGS_Set_scalarSol(MMG5_pSol met, double s, MMG5_int pos)
Set a single element of a scalar solution structure.
int MMGS_Set_solSize(MMG5_pMesh mesh, MMG5_pSol sol, int typEntity, MMG5_int np, int typSol)
Initialize an array of solution fields: set dimension, types and number of fields.
int MMGS_Get_solsAtVerticesSize(MMG5_pMesh mesh, MMG5_pSol *sol, int *nsols, MMG5_int *np, int *typSol)
Get the number of elements, type, and dimensions of several solutions defined on vertices.
int MMGS_Get_scalarSols(MMG5_pSol met, double *s)
Get all elements of a scalar solution structure.
int MMGS_Unset_corner(MMG5_pMesh mesh, MMG5_int k)
Remove the "corner" attribute from a vertex.
int MMGS_Set_vectorSols(MMG5_pSol met, double *sols)
Set all elements of a vector solution structure.
int MMGS_Set_multiMat(MMG5_pMesh mesh, MMG5_pSol sol, MMG5_int ref, int split, MMG5_int rin, MMG5_int rout)
Set the reference mapping for the elements of reference ref in level-set discretization mode.
int MMGS_Get_triangle(MMG5_pMesh mesh, MMG5_int *v0, MMG5_int *v1, MMG5_int *v2, MMG5_int *ref, int *isRequired)
Get the vertices, reference, and required attribute of the next triangle in the mesh.
int MMGS_Set_ithSols_inSolsAtVertices(MMG5_pSol sol, int i, double *s)
Set all elements of one out of multiple solution fields that are defined on vertices.
int MMGS_Set_meshSize(MMG5_pMesh mesh, MMG5_int np, MMG5_int nt, MMG5_int na)
Set the number of vertices, triangles and edges of the mesh and allocate the associated tables.
int MMGS_Set_vectorSol(MMG5_pSol met, double vx, double vy, double vz, MMG5_int pos)
Set a single element of a vector solution structure.
int MMGS_Set_triangle(MMG5_pMesh mesh, MMG5_int v0, MMG5_int v1, MMG5_int v2, MMG5_int ref, MMG5_int pos)
Set the coordinates and reference of a single triangle.
int MMGS_Get_normalAtVertex(MMG5_pMesh mesh, MMG5_int k, double *n0, double *n1, double *n2)
Get the normal orientation at an edge.
int MMGS_Get_vertex(MMG5_pMesh mesh, double *c0, double *c1, double *c2, MMG5_int *ref, int *isCorner, int *isRequired)
Get the coordinates c0, c1,c2 and reference ref of the next vertex of mesh.
double MMGS_Get_triangleQuality(MMG5_pMesh mesh, MMG5_pSol met, MMG5_int k)
Get the quality measure of a triangle.
int MMGS_Chk_meshData(MMG5_pMesh mesh, MMG5_pSol met)
Check if the numbers of given entities match with mesh and solution size and check mesh data.
int MMGS_Set_tensorSols(MMG5_pSol met, double *sols)
Set all elements of a tensor solution structure.
int MMGS_Unset_ridge(MMG5_pMesh mesh, MMG5_int k)
Remove the "ridge" attribute from an edge.
int MMGS_Set_normalAtVertex(MMG5_pMesh mesh, MMG5_int k, double n0, double n1, double n2)
Set the normal orientation at a single vertex.
int MMGS_Set_outputMeshName(MMG5_pMesh mesh, const char *meshout)
Set the name of the output mesh file.
int MMGS_Free_names(const int starter,...)
Structure deallocations before return.
int MMGS_Get_triangles(MMG5_pMesh mesh, MMG5_int *tria, MMG5_int *refs, int *areRequired)
Get the vertices, references, and required attributes of all triangles in the mesh.
int MMGS_Set_dparameter(MMG5_pMesh mesh, MMG5_pSol sol, int dparam, double val)
set a real-valued parameter of the remesher
int MMGS_Set_outputSolName(MMG5_pMesh mesh, MMG5_pSol sol, const char *solout)
Set the name of the output solution file.
int ier
const int starter
MMG5_pMesh MMG5_pSol * sol
if(!ier) exit(EXIT_FAILURE)
va_start(argptr, starter)
MMG5_pMesh char * meshin
MMG5_pMesh * mesh
va_end(argptr)
const int va_list argptr
LIBMMG_CORE_EXPORT int MMG5_Set_multiMat(MMG5_pMesh mesh, MMG5_pSol sol, MMG5_int ref, int split, MMG5_int rin, MMG5_int rex)
Definition: libtools.c:104
#define MMG5_VOLFRAC
API header for the common part of the MMG libraries.
LIBMMG_CORE_EXPORT int MMG5_Set_lsBaseReference(MMG5_pMesh mesh, MMG5_pSol sol, MMG5_int br)
Definition: libtools.c:176
API headers and documentation for the mmgs library.
@ MMGS_IPARAM_keepRef
Definition: libmmgs.h:117
@ MMGS_IPARAM_nreg
Definition: libmmgs.h:122
@ MMGS_IPARAM_optim
Definition: libmmgs.h:118
@ MMGS_IPARAM_numberOfLocalParam
Definition: libmmgs.h:124
@ MMGS_IPARAM_xreg
Definition: libmmgs.h:123
@ MMGS_DPARAM_hgrad
Definition: libmmgs.h:136
@ MMGS_IPARAM_nomove
Definition: libmmgs.h:121
@ MMGS_IPARAM_renum
Definition: libmmgs.h:128
@ MMGS_IPARAM_numsubdomain
Definition: libmmgs.h:127
@ MMGS_IPARAM_anisosize
Definition: libmmgs.h:129
@ MMGS_DPARAM_xreg
Definition: libmmgs.h:139
@ MMGS_IPARAM_nosizreq
Definition: libmmgs.h:130
@ MMGS_DPARAM_angleDetection
Definition: libmmgs.h:131
@ MMGS_IPARAM_verbose
Definition: libmmgs.h:110
@ MMGS_IPARAM_numberOfLSBaseReferences
Definition: libmmgs.h:125
@ MMGS_IPARAM_angle
Definition: libmmgs.h:113
@ MMGS_IPARAM_isoref
Definition: libmmgs.h:116
@ MMGS_DPARAM_hsiz
Definition: libmmgs.h:134
@ MMGS_IPARAM_debug
Definition: libmmgs.h:112
@ MMGS_IPARAM_noswap
Definition: libmmgs.h:120
@ MMGS_DPARAM_ls
Definition: libmmgs.h:138
@ MMGS_DPARAM_hmin
Definition: libmmgs.h:132
@ MMGS_IPARAM_numberOfMat
Definition: libmmgs.h:126
@ MMGS_IPARAM_iso
Definition: libmmgs.h:114
@ MMGS_DPARAM_hausd
Definition: libmmgs.h:135
@ MMGS_IPARAM_mem
Definition: libmmgs.h:111
@ MMGS_DPARAM_rmc
Definition: libmmgs.h:140
@ MMGS_IPARAM_isosurf
Definition: libmmgs.h:115
@ MMGS_DPARAM_hgradreq
Definition: libmmgs.h:137
@ MMGS_DPARAM_hmax
Definition: libmmgs.h:133
@ MMGS_IPARAM_noinsert
Definition: libmmgs.h:119
int MMGS_Init_mesh_var(va_list argptr)
Definition: variadic_s.c:149
int MMGS_setMeshSize_alloc(MMG5_pMesh mesh)
Definition: zaldy_s.c:223
int MMGS_Free_all_var(va_list argptr)
Definition: variadic_s.c:225
int MMGS_Free_names_var(va_list argptr)
Definition: variadic_s.c:426
#define MMGS_ALPHAD
int MMGS_memOption(MMG5_pMesh mesh)
Definition: zaldy_s.c:205
int MMGS_Free_structures_var(va_list argptr)
Definition: variadic_s.c:324
@ MMG5_Vector
Definition: libmmgtypes.h:220
@ MMG5_Tensor
Definition: libmmgtypes.h:221
@ MMG5_Scalar
Definition: libmmgtypes.h:219
@ MMG5_Notype
Definition: libmmgtypes.h:218
@ MMG5_Noentity
Definition: libmmgtypes.h:229
@ MMG5_Vertex
Definition: libmmgtypes.h:230
@ MMG5_Triangle
Definition: libmmgtypes.h:232
#define MG_Tria
#define MG_REQ
#define MG_GEO
#define MMG5_SAFE_CALLOC(ptr, size, type, law)
double MMG5_caltri_ani(MMG5_pMesh mesh, MMG5_pSol met, MMG5_pTria ptt)
Definition: quality.c:115
#define MG_EOK(pt)
#define MG_NUL
#define MMG5_INCREASE_MEM_MESSAGE()
#define MG_MIN(a, b)
#define MG_MAX(a, b)
#define MMG5_ADD_MEM(mesh, size, message, law)
#define MG_CRN
#define MMG5_ANGEDG
double MMG5_caltri_iso(MMG5_pMesh mesh, MMG5_pSol met, MMG5_pTria ptt)
Definition: quality.c:199
#define MG_REF
double MMG5_caltri33_ani(MMG5_pMesh mesh, MMG5_pSol met, MMG5_pTria pt)
Definition: quality.c:47
#define MMG5_DEL_MEM(mesh, ptr)
MMG5_int b
Definition: libmmgtypes.h:312
uint16_t tag
Definition: libmmgtypes.h:316
MMG5_int ref
Definition: libmmgtypes.h:313
MMG5_int a
Definition: libmmgtypes.h:312
int8_t iso
Definition: libmmgtypes.h:541
int8_t parTyp
Definition: libmmgtypes.h:548
int8_t ddebug
Definition: libmmgtypes.h:539
double hsiz
Definition: libmmgtypes.h:525
int8_t isosurf
Definition: libmmgtypes.h:542
int8_t sethmin
Definition: libmmgtypes.h:551
MMG5_int * br
Definition: libmmgtypes.h:527
uint8_t ani
Definition: libmmgtypes.h:553
uint8_t noswap
Definition: libmmgtypes.h:553
double rmc
Definition: libmmgtypes.h:526
double hmin
Definition: libmmgtypes.h:525
MMG5_pMat mat
Definition: libmmgtypes.h:562
double hgrad
Definition: libmmgtypes.h:525
double lxreg
Definition: libmmgtypes.h:526
uint8_t noinsert
Definition: libmmgtypes.h:553
MMG5_int isoref
Definition: libmmgtypes.h:528
uint8_t metRidTyp
Definition: libmmgtypes.h:554
double hmax
Definition: libmmgtypes.h:525
double ls
Definition: libmmgtypes.h:526
uint8_t nomove
Definition: libmmgtypes.h:553
MMG5_int nsd
Definition: libmmgtypes.h:529
int8_t sethmax
Definition: libmmgtypes.h:552
uint8_t nosizreq
Definition: libmmgtypes.h:553
MMG5_pPar par
Definition: libmmgtypes.h:524
uint8_t optim
Definition: libmmgtypes.h:553
double dhd
Definition: libmmgtypes.h:525
double hgradreq
Definition: libmmgtypes.h:525
double hausd
Definition: libmmgtypes.h:525
int8_t xreg
Definition: libmmgtypes.h:538
int8_t nreg
Definition: libmmgtypes.h:537
To store user-defined references in the mesh (useful in LS mode)
Definition: libmmgtypes.h:502
MMG mesh structure.
Definition: libmmgtypes.h:613
MMG5_int ntmax
Definition: libmmgtypes.h:620
MMG5_int nc1
Definition: libmmgtypes.h:623
MMG5_Info info
Definition: libmmgtypes.h:659
MMG5_pPoint point
Definition: libmmgtypes.h:649
MMG5_int npmax
Definition: libmmgtypes.h:620
MMG5_pxPoint xpoint
Definition: libmmgtypes.h:650
MMG5_int namax
Definition: libmmgtypes.h:620
MMG5_int nt
Definition: libmmgtypes.h:620
MMG5_pTria tria
Definition: libmmgtypes.h:655
MMG5_int np
Definition: libmmgtypes.h:620
MMG5_pEdge edge
Definition: libmmgtypes.h:657
MMG5_int nti
Definition: libmmgtypes.h:620
MMG5_int npi
Definition: libmmgtypes.h:620
MMG5_int nai
Definition: libmmgtypes.h:620
MMG5_int na
Definition: libmmgtypes.h:620
Local parameters for a specific entity and reference.
Definition: libmmgtypes.h:263
double hmin
Definition: libmmgtypes.h:264
double hmax
Definition: libmmgtypes.h:265
double hausd
Definition: libmmgtypes.h:266
MMG5_int ref
Definition: libmmgtypes.h:267
int8_t elt
Definition: libmmgtypes.h:268
Structure to store vertices of an MMG mesh.
Definition: libmmgtypes.h:276
double n[3]
Definition: libmmgtypes.h:278
MMG5_int tmp
Definition: libmmgtypes.h:286
double c[3]
Definition: libmmgtypes.h:277
uint16_t tag
Definition: libmmgtypes.h:290
MMG5_int ref
Definition: libmmgtypes.h:284
MMG5_int flag
Definition: libmmgtypes.h:288
MMG5_int npi
Definition: libmmgtypes.h:676
MMG5_int npmax
Definition: libmmgtypes.h:675
double * m
Definition: libmmgtypes.h:680
MMG5_int np
Definition: libmmgtypes.h:674
Structure to store triangles of a MMG mesh.
Definition: libmmgtypes.h:338
MMG5_int ref
Definition: libmmgtypes.h:341
uint16_t tag[3]
Definition: libmmgtypes.h:348
MMG5_int v[3]
Definition: libmmgtypes.h:340