Mmg
Simplicial remeshers (mesh adaptation, isovalue discretization, lagrangian movement)
API_functions_2d.c
Go to the documentation of this file.
1/* =============================================================================
2** This file is part of the mmg software package for the tetrahedral
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 "libmmg2d.h"
41#include "libmmg2d_private.h"
42
43int MMG2D_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 MMG2D_Set_outputMeshName(MMG5_pMesh mesh, const char* meshout) {
73
74 return MMG5_Set_outputMeshName(mesh,meshout);
75}
76
78 return MMG5_Set_outputSolName(mesh,sol,solout);
79}
80
82
83 /* Init common parameters for mmg2d, mmgs and mmg2d. */
85
86 /* default values for integers */
90 /* [0/1] ,avoid/allow surface modifications */
92 /* [0/1/2] , set 3D mode for 2D mesh */
94 /* [0/1] , set off/on normal regularization */
96 /* [0/1] , set off/on vertex regularization */
98 /* default values for doubles */
99 /* level set value */
100 mesh->info.ls = MMG5_LS;
101
102 /* Ridge detection */
104}
105
106
107int MMG2D_Set_iparameter(MMG5_pMesh mesh, MMG5_pSol sol, int iparam, MMG5_int val){
108 int k;
109
110 switch ( iparam ) {
111 /* Integer parameters */
113 mesh->info.imprim = val;
114 break;
115 case MMG2D_IPARAM_mem :
116 if ( val <= 0 ) {
117 fprintf(stderr,"\n ## Warning: %s: maximal memory authorized must"
118 " be strictly positive.\n",__func__);
119 fprintf(stderr," Reset to default value.\n");
120 }
121 else
122 mesh->info.mem = val;
123 if ( !MMG2D_memOption(mesh) ) return 0;
124 break;
125 case MMG2D_IPARAM_debug :
126 mesh->info.ddebug = val;
127 break;
128 case MMG2D_IPARAM_angle :
129 /* free table that may contains old ridges */
130 if ( mesh->htab.geom )
132 if ( mesh->xpoint )
134 if ( mesh->xtetra )
136 if ( !val )
137 mesh->info.dhd = MMG5_NR;
138 else {
139 if ( (mesh->info.imprim > 5) || mesh->info.ddebug )
140 fprintf(stderr,"\n ## Warning: %s: angle detection parameter"
141 " set to default value\n",__func__);
143 }
144 break;
145 case MMG2D_IPARAM_nofem :
146 mesh->info.setfem = (val==1)? 0 : 1;
147 break;
149 mesh->info.opnbdy = val;
150 break;
151 case MMG2D_IPARAM_iso :
152 mesh->info.iso = val;
153 break;
155 mesh->info.isoref = val;
156 break;
158 mesh->info.isosurf = val;
159 break;
160 case MMG2D_IPARAM_lag :
161#ifdef USE_ELAS
162 if ( val < 0 || val > 2 )
163 return 0;
164 mesh->info.lag = val;
165 /* No connectivity changes unless lag >= 2 */
166 if ( val < 2 ) {
168 return 0;
169 }
170#else
171 fprintf(stderr,"\n ## Error: %s"
172 " \"lagrangian motion\" option unavailable (-lag):\n"
173 " set the USE_ELAS CMake's flag to ON when compiling the mmg3d"
174 " library to enable this feature.\n",__func__);
175 return 0;
176#endif
177 break;
179 mesh->info.renum = val;
180 break;
182 mesh->info.nsd = val;
183 break;
184 case MMG2D_IPARAM_optim :
185 mesh->info.optim = val;
186 break;
188 mesh->info.noinsert = val;
189 break;
191 mesh->info.noswap = val;
192 break;
194 mesh->info.nomove = val;
195 break;
197 mesh->info.nosurf = val;
198 break;
199 case MMG2D_IPARAM_nreg :
200 mesh->info.nreg = val;
201 break;
202 case MMG2D_IPARAM_xreg :
203 mesh->info.xreg = val;
204 break;
206 mesh->info.nosizreq = val;
207 break;
209 if ( mesh->info.par ) {
211 if ( (mesh->info.imprim > 5) || mesh->info.ddebug )
212 fprintf(stderr,"\n ## Warning: %s: new local parameter values\n",__func__);
213 }
214 mesh->info.npar = val;
215 mesh->info.npari = 0;
216 mesh->info.parTyp = 0;
217
218 MMG5_ADD_MEM(mesh,mesh->info.npar*sizeof(MMG5_Par),"parameters",
219 printf(" Exit program.\n");
220 return 0);
222
223 for (k=0; k<mesh->info.npar; k++) {
225 mesh->info.par[k].ref = INT_MAX;
227 mesh->info.par[k].hmin = mesh->info.hmin;
228 mesh->info.par[k].hmax = mesh->info.hmax;
229 }
230 break;
232 if ( mesh->info.br ) {
234 if ( (mesh->info.imprim > 5) || mesh->info.ddebug )
235 fprintf(stderr,"\n ## Warning: %s: new level-set based references values\n",__func__);
236 }
237 mesh->info.nbr = val;
238 mesh->info.nbri = 0;
239 MMG5_ADD_MEM(mesh,mesh->info.nbr*sizeof(MMG5_int),"References",
240 printf(" Exit program.\n");
241 return 0);
242 MMG5_SAFE_CALLOC(mesh->info.br,mesh->info.nbr,MMG5_int,return 0);
243
244 for (k=0; k<mesh->info.nbr; k++)
245 mesh->info.br[k] = 0;
246
247 break;
248
250 if ( mesh->info.mat ) {
252 if ( (mesh->info.imprim > 5) || mesh->info.ddebug )
253 fprintf(stderr,"\n ## Warning: %s: new multi materials values\n",__func__);
254 }
255 mesh->info.nmat = val;
256 mesh->info.nmati = 0;
257
258 MMG5_ADD_MEM(mesh,(mesh->info.nmat)*sizeof(MMG5_Mat),"multi material",
259 printf(" Exit program.\n");
260 return 0);
262 break;
263
265 mesh->info.ani = val;
266 break;
267 default :
268 fprintf(stderr,"\n ## Error: %s: unknown type of parameter\n",__func__);
269 return 0;
270 }
271 /* other options */
272
273 return 1;
274}
275
276int MMG2D_Set_dparameter(MMG5_pMesh mesh, MMG5_pSol sol, int dparam, double val){
277
278 switch ( dparam ) {
279 /* double parameters */
281 mesh->info.dhd = val;
282 mesh->info.dhd = MG_MAX(0.0, MG_MIN(180.0,mesh->info.dhd));
283 mesh->info.dhd = cos(mesh->info.dhd*M_PI/180.0);
284 break;
285 case MMG2D_DPARAM_hmin :
286 mesh->info.sethmin = 1;
287 mesh->info.hmin = val;
288 if ( mesh->info.sethmax && ( mesh->info.hmin >= mesh->info.hmax ) ) {
289 fprintf(stderr,"\n ## Error: hmin value must be strictly lower than hmax one"
290 " (hmin = %lf hmax = %lf ).\n",mesh->info.hmin, mesh->info.hmax);
291 return 0;
292 }
293 if ( val <= 0. ) {
294 fprintf(stderr,"\n ## Error: hmin must be strictly positive "
295 "(minimal edge length).\n");
296 return 0;
297 }
298
299 break;
300 case MMG2D_DPARAM_hmax :
301 mesh->info.sethmax = 1;
302 mesh->info.hmax = val;
303 if ( mesh->info.sethmin && ( mesh->info.hmin >= mesh->info.hmax ) ) {
304 fprintf(stderr,"\n ## Error: hmin value must be strictly lower than hmax one"
305 " (hmin = %lf hmax = %lf ).\n",mesh->info.hmin, mesh->info.hmax);
306 return 0;
307 }
308 if ( val <= 0. ) {
309 fprintf(stderr,"\n ## Error: hmax must be strictly positive "
310 "(maximal edge length).\n");
311 return 0;
312 }
313
314 break;
315 case MMG2D_DPARAM_hsiz :
316 mesh->info.hsiz = val;
317 break;
318 case MMG2D_DPARAM_hgrad :
319 mesh->info.hgrad = val;
320 if ( mesh->info.hgrad <= 0.0 ) {
322 }
323 else {
324 mesh->info.hgrad = log(mesh->info.hgrad);
325 }
326 break;
328 mesh->info.hgradreq = val;
329 if ( mesh->info.hgradreq <= 0.0 ) {
331 }
332 else {
334 }
335 break;
336 case MMG2D_DPARAM_hausd :
337 if ( val <=0 ) {
338 fprintf(stderr,"\n ## Error: %s: hausdorff number must be"
339 " strictly positive.\n",__func__);
340 return 0;
341 }
342 else
343 mesh->info.hausd = val;
344 break;
345 case MMG2D_DPARAM_ls :
346 mesh->info.ls = val;
347 break;
348 case MMG2D_DPARAM_rmc :
349 if ( !val ) {
350 /* Default value */
352 }
353 else {
354 /* User customized value */
355 mesh->info.rmc = val;
356 }
357 break;
358 default :
359 fprintf(stderr,"\n ## Error: %s: unknown type of parameter\n",
360 __func__);
361 return 0;
362 }
363 return 1;
364}
365
367 double hmin,double hmax,double hausd){
368 MMG5_pPar par;
369 int k;
370
371 if ( !mesh->info.npar ) {
372 fprintf(stderr,"\n ## Error: %s: You must set the number of local"
373 " parameters",__func__);
374 fprintf(stderr," with the MMG2D_Set_iparameters function before setting");
375 fprintf(stderr," values in local parameters structure. \n");
376 return 0;
377 }
378 if ( mesh->info.npari >= mesh->info.npar ) {
379 fprintf(stderr,"\n ## Error: %s: unable to set a new local parameter.\n",
380 __func__);
381 fprintf(stderr," max number of local parameters: %d\n",mesh->info.npar);
382 return 0;
383 }
384 if ( typ != MMG5_Triangle && typ != MMG5_Edg ) {
385 fprintf(stderr,"\n ## Warning: %s: you must apply your local parameters",
386 __func__);
387 fprintf(stderr," on triangles (MMG5_Triangle or %d) or edges"
388 " (MMG5_Edg or %d).\n",MMG5_Triangle,MMG5_Edg);
389 fprintf(stderr,"\n ## Unknown type of entity: ignored.\n");
390 return 0;
391 }
392 if ( ref < 0 ) {
393 fprintf(stderr,"\n ## Error: %s: negative references are not allowed.\n",
394 __func__);
395 return 0;
396 }
397 if ( hmin <= 0 ) {
398 fprintf(stderr,"\n ## Error: %s: negative hmin value is not allowed.\n",
399 __func__);
400 return 0;
401 }
402 if ( hmax <= 0 ) {
403 fprintf(stderr,"\n ## Error: %s: negative hmax value is not allowed.\n",
404 __func__);
405 return 0;
406 }
407 if ( hausd <= 0 ) {
408 fprintf(stderr,"\n ## Error: %s: negative hausd value is not allowed.\n",
409 __func__);
410 return 0;
411 }
412
413 for (k=0; k<mesh->info.npari; k++) {
414 par = &mesh->info.par[k];
415
416 if ( par->elt == typ && par->ref == ref ) {
417 par->hausd = hausd;
418 par->hmin = hmin;
419 par->hmax = hmax;
420 if ( (mesh->info.imprim > 5) || mesh->info.ddebug ) {
421 fprintf(stderr,"\n ## Warning: %s: new parameters (hausd, hmin and hmax)",
422 __func__);
423 fprintf(stderr," for entities of type %d and of ref %" MMG5_PRId "\n",typ,ref);
424 }
425 return 1;
426 }
427 }
428
429 mesh->info.par[mesh->info.npari].elt = typ;
430 mesh->info.par[mesh->info.npari].ref = ref;
431 mesh->info.par[mesh->info.npari].hmin = hmin;
432 mesh->info.par[mesh->info.npari].hmax = hmax;
433 mesh->info.par[mesh->info.npari].hausd = hausd;
434
435 switch ( typ )
436 {
437 case ( MMG5_Triangle ):
439 break;
440 case ( MMG5_Edg ):
442 break;
443 default:
444 fprintf(stderr,"\n ## Error: %s: unexpected entity type: %s.\n",
445 __func__,MMG5_Get_entitiesName(typ));
446 return 0;
447 }
448
449 mesh->info.npari++;
450
451 return 1;
452}
453
455 int split,MMG5_int rin,MMG5_int rout){
456 return MMG5_Set_multiMat(mesh,sol,ref,split,rin,rout);
457}
458
461}
462
463
464int MMG2D_Set_meshSize(MMG5_pMesh mesh, MMG5_int np, MMG5_int nt, MMG5_int nquad, MMG5_int na) {
465
466 if ( ( (mesh->info.imprim > 5) || mesh->info.ddebug ) &&
467 ( mesh->point || mesh->tria || mesh->edge) )
468 fprintf(stderr,"\n ## Warning: %s: old mesh deletion.\n",__func__);
469
470 if ( mesh->point )
472 if ( mesh->tria )
474 if ( mesh->quadra )
476 if ( mesh->edge )
478
479 mesh->np = np;
480 mesh->nt = nt;
481 mesh->nquad = nquad;
482 mesh->na = na;
483 mesh->npi = mesh->np;
484 mesh->nti = mesh->nt;
485 mesh->nai = mesh->na;
486
487 /*tester si -m definie : renvoie 0 si pas ok et met la taille min dans info.mem */
488 if( mesh->info.mem > 0) {
489 if((mesh->npmax < mesh->np || mesh->ntmax < mesh->nt || mesh->namax < mesh->na) ) {
490 if ( !MMG2D_memOption(mesh) ) return 0;
491 } else if(mesh->info.mem < 39) {
492 fprintf(stderr,"\n ## Error: %s: not enough memory (%d).\n",
493 __func__,mesh->info.mem);
494 return 0;
495 }
496 } else {
497 if ( !MMG2D_memOption(mesh) ) return 0;
498 }
499
500 /* Mesh allocation and linkage */
501 if ( !MMG2D_setMeshSize_alloc( mesh ) ) return 0;
502
503 return 1;
504}
505
506int MMG2D_Set_solSize(MMG5_pMesh mesh, MMG5_pSol sol, int typEntity, MMG5_int np, int typSol) {
507
508 if ( ( (mesh->info.imprim > 5) || mesh->info.ddebug ) && sol->m )
509 fprintf(stderr,"\n ## Warning: %s: old solution deletion.\n",__func__);
510
511 if ( typEntity != MMG5_Vertex ) {
512 fprintf(stderr,"\n ## Error: %s: mmg2d need a solution imposed on vertices.\n",
513 __func__);
514 return 0;
515 }
516
517 sol->type = typSol;
518
519 if ( typSol == MMG5_Scalar ) {
520 sol->size = 1;
521 }
522 else if ( typSol == MMG5_Vector ) {
523 sol->size = 2;
524 }
525 else if ( typSol == MMG5_Tensor ) {
526 sol->size = 3;
527 }
528 else {
529 fprintf(stderr,"\n ## Error: %s: type of solution not yet implemented.\n",
530 __func__);
531 return 0;
532 }
533
534 sol->dim = 2;
535 if ( np ) {
536 sol->np = np;
537 sol->npi = np;
538 if ( sol->m )
540
541 sol->npmax = mesh->npmax;
542 MMG5_ADD_MEM(mesh,(sol->size*(sol->npmax+1))*sizeof(double),"initial solution",
543 printf(" Exit program.\n");
544 return 0);
545 MMG5_SAFE_CALLOC(sol->m,(sol->size*(sol->npmax+1)),double,return 0);
546 }
547 return 1;
548}
549
551 MMG5_int np, int *typSol) {
552 MMG5_pSol psl;
553 char data[18];
554 int j;
555
556 if ( ( (mesh->info.imprim > 5) || mesh->info.ddebug ) && mesh->nsols ) {
557 if ( *sol ) {
558 fprintf(stderr,"\n ## Warning: %s: old solutions array deletion.\n",
559 __func__);
561 }
562 }
563
565 mesh->nsols = nsols;
566
567 MMG5_ADD_MEM(mesh,nsols*sizeof(MMG5_Sol),"solutions array",
568 return 0);
569 MMG5_SAFE_CALLOC(*sol,nsols,MMG5_Sol,return 0);
570
571 for ( j=0; j<nsols; ++j ) {
572 psl = *sol + j;
573 psl->ver = 2;
574
575 /* Give an arbitrary name to the solution */
576 sprintf(data,"sol_%d",j);
577 if ( !MMG2D_Set_inputSolName(mesh,psl,data) ) {
578 return 0;
579 }
580 /* Give an arbitrary name to the solution */
581 sprintf(data,"sol_%d.o",j);
582 if ( !MMG2D_Set_outputSolName(mesh,psl,data) ) {
583 return 0;
584 }
585
586 if ( !MMG2D_Set_solSize(mesh,psl,MMG5_Vertex,mesh->np,typSol[j]) ) {
587 fprintf(stderr,"\n ## Error: %s: unable to set the size of the"
588 " solution num %d.\n",__func__,j);
589 return 0;
590 }
591 }
592 return 1;
593}
594
595int MMG2D_Get_solSize(MMG5_pMesh mesh, MMG5_pSol sol, int* typEntity, MMG5_int* np,
596 int* typSol) {
597
598 if ( typEntity != NULL )
599 *typEntity = MMG5_Vertex;
600
601 if ( typSol != NULL ) {
602 if ( sol->size == 1 )
603 *typSol = MMG5_Scalar;
604 else if ( sol->size == 2 )
605 *typSol = MMG5_Vector;
606 else if ( sol->size == 3 )
607 *typSol = MMG5_Tensor;
608 else
609 *typSol = MMG5_Notype;
610 }
611
612 assert( (!sol->np) || (sol->np == mesh->np));
613
614 if ( np != NULL )
615 *np = sol->np;
616
617 return 1;
618}
619
621 MMG5_int* np, int* typSol) {
622 MMG5_pSol psl;
623 MMG5_int j;
624
625 if ( !mesh ) {
626 fprintf(stderr,"\n ## Error: %s: your mesh structure must be allocated"
627 " and filled\n",__func__);
628 return 0;
629 }
630
631 if ( nsols != NULL )
632 *nsols = mesh->nsols;
633
634 for ( j=0; j<mesh->nsols; ++j ) {
635 psl = *sol + j;
636
637 if ( typSol != NULL ) {
638 typSol[j] = psl->type;
639 }
640
641 assert( (!psl->np) || (psl->np == mesh->np));
642 }
643 if ( np != NULL )
644 *np = mesh->np;
645
646 return 1;
647}
648
649int MMG2D_Get_meshSize(MMG5_pMesh mesh, MMG5_int* np, MMG5_int* nt, MMG5_int* nquad, MMG5_int* na) {
650 MMG5_int k;
651
652 if ( np != NULL )
653 *np = mesh->np;
654 if ( nt != NULL )
655 *nt = mesh->nt;
656
657 if ( nquad != NULL )
658 *nquad = mesh->nquad;
659
660 if ( na != NULL ) {
661 // Edges are not packed, thus we must count it.
662 *na = 0;
663 if ( mesh->na ) {
664 for (k=1; k<=mesh->na; k++) {
665 if ( mesh->edge[k].a ) ++(*na);
666 }
667 }
668 }
669
670 return 1;
671}
672
673int MMG2D_Set_vertex(MMG5_pMesh mesh, double c0, double c1, MMG5_int ref, MMG5_int pos) {
674
675 if ( !mesh->np ) {
676 fprintf(stderr,"\n ## Error: %s: you must set the number of points with the",
677 __func__);
678 fprintf(stderr," MMG2D_Set_meshSize function before setting vertices in mesh\n");
679 return 0;
680 }
681
682 if ( pos > mesh->npmax ) {
683 fprintf(stderr,"\n ## Error: %s: unable to allocate a new point.\n",
684 __func__);
685 fprintf(stderr," max number of points: %" MMG5_PRId "\n",mesh->npmax);
687 return 0;
688 }
689
690 if ( pos > mesh->np ) {
691 fprintf(stderr,"\n ## Error: %s: attempt to set new vertex at position %" MMG5_PRId ".",
692 __func__,pos);
693 fprintf(stderr," Overflow of the given number of vertices: %" MMG5_PRId "\n",mesh->np);
694 fprintf(stderr," ## Check the mesh size, its compactness or the position");
695 fprintf(stderr," of the vertex.\n");
696 return 0;
697 }
698
699 mesh->point[pos].c[0] = c0;
700 mesh->point[pos].c[1] = c1;
701 mesh->point[pos].ref = ref;
702 if ( mesh->nt )
703 mesh->point[pos].tag = MG_NUL;
704 else
705 mesh->point[pos].tag &= ~MG_NUL;
706
707 mesh->point[pos].flag = 0;
708 mesh->point[pos].tmp = 0;
709
710 return 1;
711}
712
714 assert ( k <= mesh->np );
715 mesh->point[k].tag |= MG_CRN;
716 return 1;
717}
718
720 assert ( k <= mesh->np );
721 mesh->point[k].tag &= ~MG_CRN;
722 return 1;
723}
724
726 assert ( k <= mesh->np );
727 mesh->point[k].tag |= MG_REQ;
728 mesh->point[k].tag &= ~MG_NUL;
729 return 1;
730}
731
733 assert ( k <= mesh->np );
734 mesh->point[k].tag &= ~MG_REQ;
735 return 1;
736}
737
738int MMG2D_Get_vertex(MMG5_pMesh mesh, double* c0, double* c1, MMG5_int* ref,
739 int* isCorner, int* isRequired) {
740
741 if ( mesh->npi == mesh->np ) {
742 mesh->npi = 0;
743 if ( mesh->info.ddebug ) {
744 fprintf(stderr,"\n ## Warning: %s: reset the internal counter of points.\n",
745 __func__);
746 fprintf(stderr," You must pass here exactly one time (the first time ");
747 fprintf(stderr,"you call the MMG2D_Get_vertex function).\n");
748 fprintf(stderr," If not, the number of call of this function");
749 fprintf(stderr," exceed the number of points: %" MMG5_PRId "\n ",mesh->np);
750 }
751 }
752
753 mesh->npi++;
754
755 if ( mesh->npi > mesh->np ) {
756 fprintf(stderr," ## Error: %s: unable to get point.\n",__func__);
757 fprintf(stderr," The number of call of MMG2D_Get_vertex function");
758 fprintf(stderr," exceed the number of points: %" MMG5_PRId "\n ",mesh->np);
759 return 0;
760 }
761
762 return MMG2D_GetByIdx_vertex( mesh,c0,c1,ref,isCorner,isRequired,mesh->npi);
763}
764
765int MMG2D_GetByIdx_vertex(MMG5_pMesh mesh, double* c0, double* c1, MMG5_int* ref,
766 int* isCorner, int* isRequired, MMG5_int idx) {
767
768 if ( idx < 1 || idx > mesh->np ) {
769 fprintf(stderr,"\n ## Error: %s: unable to get point at position %" MMG5_PRId ".\n",
770 __func__,idx);
771 fprintf(stderr," Your vertices numbering goes from 1 to %" MMG5_PRId "\n",mesh->np);
772 return 0;
773 }
774
775 *c0 = mesh->point[idx].c[0];
776 *c1 = mesh->point[idx].c[1];
777 if ( ref != NULL )
778 *ref = mesh->point[idx].ref;
779
780 if ( isCorner != NULL ) {
781 if ( mesh->point[idx].tag & MG_CRN )
782 *isCorner = 1;
783 else
784 *isCorner = 0;
785 }
786
787 if ( isRequired != NULL ) {
788 if ( mesh->point[idx].tag & MG_REQ )
789 *isRequired = 1;
790 else
791 *isRequired = 0;
792 }
793
794 return 1;
795}
796
797int MMG2D_Set_vertices(MMG5_pMesh mesh, double *vertices,MMG5_int *refs) {
798 MMG5_pPoint ppt;
799 MMG5_int i,j;
800
801 /*coordinates vertices*/
802 for (i=1;i<=mesh->np;i++)
803 {
804 ppt = &mesh->point[i];
805
806 j = (i-1)*2;
807 ppt->c[0] = vertices[j];
808 ppt->c[1] = vertices[j+1];
809
810 ppt->flag = 0;
811 ppt->tmp = 0;
812
813 if ( refs != NULL )
814 ppt->ref = refs[i-1];
815
816 if ( mesh->nt )
817 ppt->tag = MG_NUL;
818 else
819 ppt->tag &= ~MG_NUL;
820 }
821
822 return 1;
823}
824
825int MMG2D_Get_vertices(MMG5_pMesh mesh, double* vertices, MMG5_int* refs,
826 int* areCorners, int* areRequired) {
827 MMG5_pPoint ppt;
828 MMG5_int i,j;
829
830 for (i=1;i<=mesh->np;i++)
831 {
832 ppt = &mesh->point[i];
833
834 j = (i-1)*2;
835 vertices[j] = ppt->c[0];
836 vertices[j+1] = ppt->c[1];
837
838 j = i-1;
839 if ( refs != NULL )
840 refs[j] = ppt->ref;
841
842 if ( areCorners !=NULL ) {
843 if ( ppt->tag & MG_CRN )
844 areCorners[j] = 1;
845 else
846 areCorners[j] = 0;
847 }
848
849 if ( areRequired != NULL ) {
850 if ( ppt->tag & MG_REQ )
851 areRequired[j] = 1;
852 else
853 areRequired[j] = 0;
854 }
855 }
856
857 return 1;
858}
859
860int MMG2D_Set_triangle(MMG5_pMesh mesh, MMG5_int v0, MMG5_int v1, MMG5_int v2, MMG5_int ref, MMG5_int pos) {
861 MMG5_pPoint ppt;
862 MMG5_pTria pt;
863 double vol;
864 int i,j,ip;
865 MMG5_int tmp;
866
867 if ( !mesh->nt ) {
868 fprintf(stderr," ## Error: %s: You must set the number of elements with the",
869 __func__);
870 fprintf(stderr," MMG2D_Set_meshSize function before setting elements in mesh\n");
871 return 0;
872 }
873
874 if ( pos > mesh->ntmax ) {
875 fprintf(stderr," ## Error: %s: unable to allocate a new element.\n",
876 __func__);
877 fprintf(stderr," max number of element: %" MMG5_PRId "\n",mesh->ntmax);
879 return 0;
880 }
881
882 if ( pos > mesh->nt ) {
883 fprintf(stderr,"\n ## Error: %s: attempt to set new triangle at position %" MMG5_PRId ".",
884 __func__,pos);
885 fprintf(stderr," Overflow of the given number of triangle: %" MMG5_PRId "\n",mesh->nt);
886 fprintf(stderr," ## Check the mesh size, its compactness or the position");
887 fprintf(stderr," of the triangle.\n");
888 return 0;
889 }
890
891 pt = &mesh->tria[pos];
892 pt->v[0] = v0;
893 pt->v[1] = v1;
894 pt->v[2] = v2;
895 pt->ref = ref;
896
897 mesh->point[pt->v[0]].tag &= ~MG_NUL;
898 mesh->point[pt->v[1]].tag &= ~MG_NUL;
899 mesh->point[pt->v[2]].tag &= ~MG_NUL;
900
901 for(i=0 ; i<3 ; i++)
902 pt->edg[i] = 0;
903
904 vol = MMG2D_quickarea(mesh->point[pt->v[0]].c,mesh->point[pt->v[1]].c,
905 mesh->point[pt->v[2]].c);
906
907 if ( vol == 0.0 ) {
908 fprintf(stderr,"\n ## Error: %s: triangle %" MMG5_PRId " has null area.\n",
909 __func__,pos);
910 for ( ip=0; ip<3; ip++ ) {
911 ppt = &mesh->point[pt->v[ip]];
912 for ( j=0; j<3; j++ ) {
913 if ( fabs(ppt->c[j])>0. ) {
914 fprintf(stderr," Check that you don't have a sliver triangle.\n");
915 return 0;
916 }
917 }
918 }
919 }
920 else if(vol < 0) {
921 tmp = pt->v[2];
922 pt->v[2] = pt->v[1];
923 pt->v[1] = tmp;
924 /* mesh->xt temporary used to count reoriented tria */
925 mesh->xt++;
926 }
927 if ( mesh->info.ddebug && (mesh->nt == pos) && mesh->xt > 0 ) {
928 fprintf(stderr,"\n ## Warning: %s: %" MMG5_PRId " triangles reoriented\n",
929 __func__,mesh->xt);
930 mesh->xt = 0;
931 }
932
933 return 1;
934}
935
937 MMG5_pTria pt;
938
939 assert ( k <= mesh->nt );
940 pt = &mesh->tria[k];
941
942 pt->tag[0] |= MG_REQ;
943 pt->tag[1] |= MG_REQ;
944 pt->tag[2] |= MG_REQ;
945
946 return 1;
947}
948
950 MMG5_pTria pt;
951
952 assert ( k <= mesh->nt );
953 pt = &mesh->tria[k];
954
955 pt->tag[0] &= ~MG_REQ;
956 pt->tag[1] &= ~MG_REQ;
957 pt->tag[2] &= ~MG_REQ;
958
959 return 1;
960}
961
962int MMG2D_Get_triangle(MMG5_pMesh mesh, MMG5_int* v0, MMG5_int* v1, MMG5_int* v2, MMG5_int* ref
963 ,int* isRequired) {
964 MMG5_pTria ptt;
965
966 if ( mesh->nti == mesh->nt ) {
967 mesh->nti = 0;
968 if ( mesh->info.ddebug ) {
969 fprintf(stderr,"\n ## Warning: %s: reset the internal counter of"
970 " triangles.\n",__func__);
971 fprintf(stderr," You must pass here exactly one time (the first time ");
972 fprintf(stderr,"you call the MMG2D_Get_triangle function).\n");
973 fprintf(stderr," If not, the number of call of this function");
974 fprintf(stderr," exceed the number of triangles: %" MMG5_PRId "\n ",mesh->nt);
975 }
976 }
977
978 mesh->nti++;
979
980 if ( mesh->nti > mesh->nt ) {
981 fprintf(stderr,"\n ## Error: %s: unable to get triangle.\n",
982 __func__);
983 fprintf(stderr," The number of call of MMG2D_Get_triangle function");
984 fprintf(stderr," can not exceed the number of triangles: %" MMG5_PRId "\n ",mesh->nt);
985 return 0;
986 }
987
988 ptt = &mesh->tria[mesh->nti];
989
990 *v0 = ptt->v[0];
991 *v1 = ptt->v[1];
992 *v2 = ptt->v[2];
993 if ( ref != NULL )
994 *ref = ptt->ref;
995
996 if ( isRequired != NULL ) {
997 if ( (ptt->tag[0] & MG_REQ) && (ptt->tag[1] & MG_REQ) &&
998 (ptt->tag[2] & MG_REQ) )
999 *isRequired = 1;
1000 else
1001 *isRequired = 0;
1002 }
1003
1004 return 1;
1005}
1006
1007int MMG2D_Set_triangles(MMG5_pMesh mesh, MMG5_int *tria, MMG5_int *refs) {
1008 MMG5_pPoint ppt;
1009 MMG5_pTria ptt;
1010 double vol;
1011 int ip;
1012 MMG5_int j,i,tmp;
1013
1014 mesh->xt = 0;
1015 for (i=1;i<=mesh->nt;i++)
1016 {
1017 j = (i-1)*3;
1018 ptt = &mesh->tria[i];
1019 ptt->v[0] = tria[j] ;
1020 ptt->v[1] = tria[j+2];
1021 ptt->v[2] = tria[j+1];
1022 if ( refs != NULL )
1023 ptt->ref = refs[i-1];
1024
1025 mesh->point[ptt->v[0]].tag &= ~MG_NUL;
1026 mesh->point[ptt->v[1]].tag &= ~MG_NUL;
1027 mesh->point[ptt->v[2]].tag &= ~MG_NUL;
1028
1029 int ii;
1030 for( ii=0 ; ii<3 ; ii++)
1031 ptt->edg[ii] = 0;
1032
1033 vol = MMG2D_quickarea(mesh->point[ptt->v[0]].c,mesh->point[ptt->v[1]].c,
1034 mesh->point[ptt->v[2]].c);
1035
1036 if ( vol == 0.0 ) {
1037 fprintf(stderr,"\n ## Error: %s: triangle %" MMG5_PRId " has null area.\n",
1038 __func__,i);
1039 for ( ip=0; ip<3; ip++ ) {
1040 ppt = &mesh->point[ptt->v[ip]];
1041 int jj;
1042 for ( jj=0; jj<3; jj++ ) {
1043 if ( fabs(ppt->c[jj])>0. ) {
1044 fprintf(stderr," Check that you don't have a sliver triangle.\n");
1045 return 0;
1046 }
1047 }
1048 }
1049 }
1050 else if(vol < 0) {
1051 tmp = ptt->v[2];
1052 ptt->v[2] = ptt->v[1];
1053 ptt->v[1] = tmp;
1054 /* mesh->xt temporary used to count reoriented triangles */
1055 mesh->xt++;
1056 }
1057 if ( mesh->info.ddebug && mesh->xt > 0 ) {
1058 fprintf(stderr,"\n ## Warning: %s: %" MMG5_PRId " triangles reoriented\n",
1059 __func__,mesh->xt);
1060 }
1061 }
1062 return 1;
1063}
1064
1065int MMG2D_Get_triangles(MMG5_pMesh mesh, MMG5_int* tria, MMG5_int* refs,
1066 int* areRequired) {
1067 MMG5_pTria ptt;
1068 MMG5_int i, j;
1069
1070 for (i=1;i<=mesh->nt;i++)
1071 {
1072 j = (i-1)*3;
1073 ptt = &mesh->tria[i];
1074 tria[j] = ptt->v[0];
1075 tria[j+1] = ptt->v[1];
1076 tria[j+2] = ptt->v[2];
1077
1078 if ( refs!=NULL )
1079 refs[i-1] = ptt->ref ;
1080 if ( areRequired != NULL ) {
1081 if ( (ptt->tag[0] & MG_REQ) && (ptt->tag[1] & MG_REQ) &&
1082 (ptt->tag[2] & MG_REQ) )
1083 areRequired[i-1] = 1;
1084 else
1085 areRequired[i-1] = 0;
1086 }
1087 }
1088 return 1;
1089}
1090
1091int MMG2D_Set_quadrilateral(MMG5_pMesh mesh, MMG5_int v0, MMG5_int v1, MMG5_int v2, MMG5_int v3, MMG5_int ref, MMG5_int pos) {
1092 MMG5_pQuad pq;
1093
1094 if ( !mesh->nquad ) {
1095 fprintf(stderr,"\n ## Error: %s: You must set the number of quadrilaterals with the",
1096 __func__);
1097 fprintf(stderr," MMG2D_Set_meshSize function before setting elements in mesh\n");
1098 return 0;
1099 }
1100
1101 if ( pos > mesh->nquad ) {
1102 fprintf(stderr,"\n ## Error: %s: attempt to set new quad at position %" MMG5_PRId ".",
1103 __func__,pos);
1104 fprintf(stderr," Overflow of the given number of quads: %" MMG5_PRId "\n",mesh->nquad);
1105 fprintf(stderr,"\n ## Check the mesh size, its compactness or the position");
1106 fprintf(stderr," of the quad.\n");
1107 return 0;
1108 }
1109
1110 pq = &mesh->quadra[pos];
1111 pq->v[0] = v0;
1112 pq->v[1] = v1;
1113 pq->v[2] = v2;
1114 pq->v[3] = v3;
1115 pq->ref = ref;
1116
1117 mesh->point[pq->v[0]].tag &= ~MG_NUL;
1118 mesh->point[pq->v[1]].tag &= ~MG_NUL;
1119 mesh->point[pq->v[2]].tag &= ~MG_NUL;
1120 mesh->point[pq->v[3]].tag &= ~MG_NUL;
1121
1122 return 1;
1123}
1124
1125int MMG2D_Get_quadrilateral(MMG5_pMesh mesh, MMG5_int* v0, MMG5_int* v1, MMG5_int* v2, MMG5_int* v3,
1126 MMG5_int* ref, int* isRequired) {
1127 static MMG5_int nqi = 0;
1128
1129 if ( nqi == mesh->nquad ) {
1130 nqi = 0;
1131 if ( mesh->info.ddebug ) {
1132 fprintf(stderr,"\n ## Warning: %s: reset the internal counter of"
1133 " quadrilaterals.\n",__func__);
1134 fprintf(stderr," You must pass here exactly one time (the first time ");
1135 fprintf(stderr,"you call the MMG2D_Get_quadrilateral function).\n");
1136 fprintf(stderr," If not, the number of call of this function");
1137 fprintf(stderr," exceed the number of quadrilaterals: %" MMG5_PRId "\n ",mesh->nquad);
1138 }
1139 }
1140
1141 ++nqi;
1142
1143 if ( nqi > mesh->nquad ) {
1144 fprintf(stderr,"\n ## Error: %s: unable to get quadra.\n",__func__);
1145 fprintf(stderr," The number of call of MMG2D_Get_quadrilateral function");
1146 fprintf(stderr," can not exceed the number of quadra: %" MMG5_PRId "\n ",mesh->nquad);
1147 return 0;
1148 }
1149
1150 *v0 = mesh->quadra[nqi].v[0];
1151 *v1 = mesh->quadra[nqi].v[1];
1152 *v2 = mesh->quadra[nqi].v[2];
1153 *v3 = mesh->quadra[nqi].v[3];
1154
1155 if ( ref != NULL ) {
1156 *ref = mesh->quadra[nqi].ref;
1157 }
1158
1159 if ( isRequired != NULL ) {
1160 if ( ( mesh->quadra[nqi].tag[0] & MG_REQ) && ( mesh->quadra[nqi].tag[1] & MG_REQ) &&
1161 ( mesh->quadra[nqi].tag[2] & MG_REQ) && ( mesh->quadra[nqi].tag[3] & MG_REQ) ) {
1162 *isRequired = 1;
1163 }
1164 else
1165 *isRequired = 0;
1166 }
1167
1168 return 1;
1169}
1170
1171int MMG2D_Set_quadrilaterals(MMG5_pMesh mesh, MMG5_int *quadra, MMG5_int *refs) {
1172 MMG5_pQuad pq;
1173 MMG5_int i,j;
1174
1175 for (i=1;i<=mesh->nquad;i++)
1176 {
1177 j = (i-1)*4;
1178 pq = &mesh->quadra[i];
1179 pq->v[0] = quadra[j];
1180 pq->v[1] = quadra[j+1];
1181 pq->v[2] = quadra[j+2];
1182 pq->v[3] = quadra[j+3];
1183
1184 if ( refs != NULL )
1185 pq->ref = refs[i-1];
1186
1187 mesh->point[pq->v[0]].tag &= ~MG_NUL;
1188 mesh->point[pq->v[1]].tag &= ~MG_NUL;
1189 mesh->point[pq->v[2]].tag &= ~MG_NUL;
1190 mesh->point[pq->v[3]].tag &= ~MG_NUL;
1191 }
1192
1193 return 1;
1194}
1195
1196int MMG2D_Get_quadrilaterals(MMG5_pMesh mesh, MMG5_int *quadra, MMG5_int *refs, int * areRequired) {
1197 MMG5_pQuad pq;
1198 MMG5_int i, j;
1199
1200 for (i=1;i<=mesh->nquad;i++)
1201 {
1202 j = (i-1)*4;
1203 pq = &mesh->quadra[i];
1204 quadra[j] = pq->v[0];
1205 quadra[j+1] = pq->v[1];
1206 quadra[j+2] = pq->v[2];
1207 quadra[j+3] = pq->v[3];
1208
1209 if ( refs!=NULL )
1210 refs[i-1] = pq->ref ;
1211
1212 if ( areRequired != NULL ) {
1213 if ( (pq->tag[0] & MG_REQ) && (pq->tag[1] & MG_REQ) &&
1214 (pq->tag[2] & MG_REQ) && (pq->tag[3] & MG_REQ) ) {
1215 areRequired[i-1] = 1;
1216 }
1217 else
1218 areRequired[i-1] = 0;
1219 }
1220
1221 }
1222 return 1;
1223}
1224
1225
1226int MMG2D_Set_edge(MMG5_pMesh mesh, MMG5_int v0, MMG5_int v1, MMG5_int ref, MMG5_int pos) {
1227 MMG5_pEdge pt;
1228
1229 if ( !mesh->na ) {
1230 fprintf(stderr,"\n ## Error: %s: you must set the number of elements"
1231 " with the",__func__);
1232 fprintf(stderr," MMG2D_Set_meshSize function before setting elements in mesh\n");
1233 return 0;
1234 }
1235
1236 if ( pos > mesh->na ) {
1237 fprintf(stderr,"\n ## Error: %s: attempt to set new edge at position %" MMG5_PRId ".",
1238 __func__,pos);
1239 fprintf(stderr," Overflow of the given number of edge: %" MMG5_PRId "\n",mesh->na);
1240 fprintf(stderr," ## Check the mesh size, its compactness or the position");
1241 fprintf(stderr," of the edge.\n");
1242 return 0;
1243 }
1244
1245 pt = &mesh->edge[pos];
1246 pt->a = v0;
1247 pt->b = v1;
1248 pt->ref = ref;
1249 pt->tag &= MG_REF + MG_BDY;
1250
1251 mesh->point[pt->a].tag &= ~MG_NUL;
1252 mesh->point[pt->b].tag &= ~MG_NUL;
1253
1254 return 1;
1255}
1256
1258 MMG5_pEdge ped;
1259
1260 assert ( k <= mesh->na );
1261
1262 ped = &mesh->edge[k];
1263
1264 ped->tag |= MG_REQ;
1265
1266 return 1;
1267}
1268
1270 MMG5_pEdge ped;
1271
1272 assert ( k <= mesh->na );
1273
1274 ped = &mesh->edge[k];
1275
1276 ped->tag &= ~MG_REQ;
1277
1278 return 1;
1279}
1280
1282 MMG5_pPoint ppt;
1283 MMG5_pEdge ped;
1284
1285 assert ( k <= mesh->na );
1286
1287 ped = &mesh->edge[k];
1288
1289 ped->tag |= MG_PARBDY;
1290
1291 ppt = &mesh->point[ped->a];
1292 ppt->tag |= MG_PARBDY;
1293 ppt = &mesh->point[ped->b];
1294 ppt->tag |= MG_PARBDY;
1295
1296 return 1;
1297}
1298
1299int MMG2D_Get_edge(MMG5_pMesh mesh, MMG5_int* e0, MMG5_int* e1, MMG5_int* ref
1300 ,int* isRidge, int* isRequired) {
1301 MMG5_pEdge ped;
1302
1303 if ( mesh->nai == mesh->na ) {
1304 mesh->nai = 0;
1305 if ( mesh->info.ddebug ) {
1306 fprintf(stderr,"\n ## Warning: %s: reset the internal counter of edges.\n",
1307 __func__);
1308 fprintf(stderr," You must pass here exactly one time (the first time ");
1309 fprintf(stderr,"you call the MMG2D_Get_edge function).\n");
1310 fprintf(stderr," If not, the number of call of this function");
1311 fprintf(stderr," exceed the number of edges.\n ");
1312 fprintf(stderr," Please, call the MMG2D_Get_meshSize function to get"
1313 " this number.\n ");
1314 }
1315 }
1316
1317 mesh->nai++;
1318
1319 if ( mesh->nai > mesh->na ) {
1320 fprintf(stderr,"\n ## Error: %s: unable to get edge.\n",__func__);
1321 fprintf(stderr," The number of call of MMG2D_Get_edge function");
1322 fprintf(stderr," can not exceed the number of edges: %" MMG5_PRId "\n ",mesh->na);
1323 return 0;
1324 }
1325
1326 ped = &mesh->edge[mesh->nai];
1327
1328 while ( !ped->a && ++mesh->nai <= mesh->na ) {
1329 ped = &mesh->edge[mesh->nai];
1330 }
1331
1332 *e0 = ped->a;
1333 *e1 = ped->b;
1334
1335 if ( ref != NULL )
1336 *ref = mesh->edge[mesh->nai].ref;
1337
1338 if ( isRidge != NULL ) {
1339 if ( mesh->edge[mesh->nai].tag & MG_GEO )
1340 *isRidge = 1;
1341 else
1342 *isRidge = 0;
1343 }
1344
1345 if ( isRequired != NULL ) {
1346 if ( mesh->edge[mesh->nai].tag & MG_REQ )
1347 *isRequired = 1;
1348 else
1349 *isRequired = 0;
1350 }
1351
1352 return 1;
1353}
1354
1355int MMG2D_Set_edges(MMG5_pMesh mesh, MMG5_int *edges, MMG5_int *refs) {
1356 MMG5_int i,j;
1357
1358 for (i=1;i<=mesh->na;i++)
1359 {
1360 j = (i-1)*2;
1361
1362 mesh->edge[i].a = edges[j];
1363 mesh->edge[i].b = edges[j+1];
1364 if ( refs != NULL )
1365 mesh->edge[i].ref = refs[i-1];
1366 mesh->edge[i].tag &= MG_REF+MG_BDY;
1367
1368 mesh->point[mesh->edge[i].a].tag &= ~MG_NUL;
1369 mesh->point[mesh->edge[i].b].tag &= ~MG_NUL;
1370 }
1371
1372 return 1;
1373}
1374
1375int MMG2D_Get_edges(MMG5_pMesh mesh, MMG5_int* edges,MMG5_int *refs,int* areRidges,int* areRequired) {
1376 MMG5_int i,j;
1377
1378 for (i=1;i<=mesh->na;i++)
1379 {
1380 j = (i-1)*2;
1381 edges[j] = mesh->edge[i].a;
1382 edges[j+1] = mesh->edge[i].b;
1383
1384 if ( refs!=NULL )
1385 refs[i-1] = mesh->edge[i].ref;
1386
1387 if ( areRidges != NULL ) {
1388 if ( mesh->edge[i].tag & MG_GEO )
1389 areRidges[i-1] = 1;
1390 else
1391 areRidges[i-1] = 0;
1392 }
1393
1394 if ( areRequired != NULL ) {
1395 if ( mesh->edge[i].tag & MG_REQ )
1396 areRequired[i-1] = 1;
1397 else
1398 areRequired[i-1] = 0;
1399 }
1400 }
1401
1402 return 1;
1403}
1404
1406 double qual = 0.;
1407 MMG5_pTria pt;
1408
1409 if ( k < 1 || k > mesh->nt ) {
1410 fprintf(stderr,"\n ## Error: %s: unable to access to triangle %" MMG5_PRId ".\n",
1411 __func__,k);
1412 fprintf(stderr," Tria numbering goes from 1 to %" MMG5_PRId "\n",mesh->nt);
1413 return 0.;
1414 }
1415 pt = &mesh->tria[k];
1416 assert ( MG_EOK(pt) );
1417
1418 if ( (!met) || (!met->m) || met->size==1 ) {
1419 /* iso quality */
1420 qual = MMG2D_ALPHAD * MMG2D_caltri_iso(mesh,NULL,pt);
1421 }
1422 else {
1423 qual = MMG2D_ALPHAD * MMG2D_caltri_ani(mesh,met,pt);
1424 }
1425
1426 return qual;
1427}
1428
1429int MMG2D_Set_scalarSol(MMG5_pSol met, double s, MMG5_int pos) {
1430
1431 if ( !met->np ) {
1432 fprintf(stderr,"\n ## Error: %s: You must set the number of"
1433 " solution with the",__func__);
1434 fprintf(stderr," MMG2D_Set_solSize function before setting values");
1435 fprintf(stderr," in solution structure \n");
1436 return 0;
1437 }
1438
1439 if ( pos >= met->npmax ) {
1440 fprintf(stderr,"\n ## Error: %s: unable to set a new solution.\n",
1441 __func__);
1442 fprintf(stderr," max number of solutions: %" MMG5_PRId "\n",met->npmax);
1443 return 0;
1444 }
1445
1446 if ( pos > met->np ) {
1447 fprintf(stderr,"\n ## Error: %s: attempt to set new solution"
1448 " at position %" MMG5_PRId ".",__func__,pos);
1449 fprintf(stderr," Overflow of the given number of solutions: %" MMG5_PRId "\n",met->np);
1450 fprintf(stderr," ## Check the solution size, its compactness or the position");
1451 fprintf(stderr," of the solution.\n");
1452 return 0;
1453 }
1454
1455 met->m[pos] = s;
1456 return 1;
1457}
1458
1460{
1461 int ddebug = 0;
1462
1463 if ( met->npi == met->np ) {
1464 met->npi = 0;
1465 if ( ddebug ) {
1466 fprintf(stderr,"\n ## Warning: %s: reset the internal counter"
1467 " of points.\n",__func__);
1468 fprintf(stderr," You must pass here exactly one time (the first time ");
1469 fprintf(stderr,"you call the MMG2D_Get_scalarSol function).\n");
1470 fprintf(stderr," If not, the number of call of this function");
1471 fprintf(stderr," exceed the number of points: %" MMG5_PRId "\n ",met->np);
1472 }
1473 }
1474
1475 met->npi++;
1476
1477 if ( met->npi > met->np ) {
1478 fprintf(stderr,"\n ## Error: %s: unable to get solution.\n",
1479 __func__);
1480 fprintf(stderr," The number of call of MMG2D_Get_scalarSol function");
1481 fprintf(stderr," can not exceed the number of points: %" MMG5_PRId "\n ",met->np);
1482 return 0;
1483 }
1484
1485 *s = met->m[met->npi];
1486
1487 return 1;
1488}
1489
1490int MMG2D_Set_scalarSols(MMG5_pSol met, double *s) {
1491 MMG5_int k;
1492
1493 if ( !met->np ) {
1494 fprintf(stderr,"\n ## Error: %s: you must set the number of"
1495 " solution with the",__func__);
1496 fprintf(stderr," MMG2D_Set_solSize function before setting values");
1497 fprintf(stderr," in solution structure \n");
1498 return 0;
1499 }
1500
1501 for ( k=0; k<met->np; ++k )
1502 met->m[k+1] = s[k];
1503
1504 return 1;
1505}
1506
1507int MMG2D_Get_scalarSols(MMG5_pSol met, double* s) {
1508 MMG5_int k;
1509
1510 for ( k=0; k<met->np; ++k )
1511 s[k] = met->m[k+1];
1512
1513 return 1;
1514}
1515
1516int MMG2D_Set_vectorSol(MMG5_pSol met, double vx,double vy, MMG5_int pos) {
1517 MMG5_int isol;
1518
1519 if ( !met->np ) {
1520 fprintf(stderr,"\n ## Error: %s: you must set the number of"
1521 " solution with the",__func__);
1522 fprintf(stderr," MMG2D_Set_solSize function before setting values");
1523 fprintf(stderr," in solution structure \n");
1524 return 0;
1525 }
1526 if ( pos < 1 ) {
1527 fprintf(stderr,"\n ## Error: %s: unable to set a new solution.\n",
1528 __func__);
1529 fprintf(stderr," Minimal index of the solution position must be 1.\n");
1530 return 0;
1531 }
1532 if ( pos >= met->npmax ) {
1533 fprintf(stderr,"\n ## Error: %s: unable to set a new solution.\n",
1534 __func__);
1535 fprintf(stderr," max number of solutions: %" MMG5_PRId "\n",met->npmax);
1536 return 0;
1537 }
1538
1539 if ( pos > met->np ) {
1540 fprintf(stderr,"\n ## Error: %s: attempt to set new solution"
1541 " at position %" MMG5_PRId ".",__func__,pos);
1542 fprintf(stderr," Overflow of the given number of solutions: %" MMG5_PRId "\n",met->np);
1543 fprintf(stderr,"\n ## Check the solution size, its compactness or the position");
1544 fprintf(stderr," of the solution.\n");
1545 return 0;
1546 }
1547
1548 isol = (pos-1) * met->size + 1;
1549
1550 met->m[isol] = vx;
1551 met->m[isol+1] = vy;
1552
1553 return 1;
1554}
1555
1556
1557int MMG2D_Get_vectorSol(MMG5_pSol met, double* vx, double* vy) {
1558
1559 int ddebug = 0;
1560
1561 if ( met->npi == met->np ) {
1562 met->npi = 0;
1563 if ( ddebug ) {
1564 fprintf(stderr,"\n ## Warning: %s: reset the internal counter of points.\n",
1565 __func__);
1566 fprintf(stderr," You must pass here exactly one time (the first time ");
1567 fprintf(stderr,"you call the MMG2D_Get_vectorSol function).\n");
1568 fprintf(stderr," If not, the number of call of this function");
1569 fprintf(stderr," exceed the number of points: %" MMG5_PRId "\n ",met->np);
1570 }
1571 }
1572
1573 met->npi++;
1574
1575 if ( met->npi > met->np ) {
1576 fprintf(stderr,"\n ## Error: %s: unable to get solution.\n",__func__);
1577 fprintf(stderr," The number of call of MMG2D_Get_vectorSol function");
1578 fprintf(stderr," can not exceed the number of points: %" MMG5_PRId "\n ",met->np);
1579 return 0;
1580 }
1581
1582 *vx = met->m[met->size*(met->npi-1)+1];
1583 *vy = met->m[met->size*(met->npi-1)+2];
1584
1585 return 1;
1586}
1587
1588int MMG2D_Set_vectorSols(MMG5_pSol met, double *sols) {
1589 double *m;
1590 MMG5_int k,j;
1591
1592 if ( !met->np ) {
1593 fprintf(stderr,"\n ## Error: %s: you must set the number of"
1594 " solution with the",__func__);
1595 fprintf(stderr," MMG2D_Set_solSize function before setting values");
1596 fprintf(stderr," in solution structure \n");
1597 return 0;
1598 }
1599
1600 for ( k=0; k<met->np; ++k ) {
1601 j = 2*k;
1602 m = &met->m[j];
1603 m[1] = sols[j];
1604 m[2] = sols[j+1];
1605 }
1606
1607 return 1;
1608}
1609
1610int MMG2D_Get_vectorSols(MMG5_pSol met, double* sols) {
1611 double *m;
1612 MMG5_int k, j;
1613
1614 for ( k=0; k<met->np; ++k ) {
1615 j = 2*k;
1616 m = &met->m[j];
1617
1618 sols[j] = m[1];
1619 sols[j+1] = m[2];
1620 }
1621
1622 return 1;
1623}
1624
1625
1626int MMG2D_Set_tensorSol(MMG5_pSol met, double m11, double m12, double m22,
1627 MMG5_int pos) {
1628 MMG5_int isol;
1629
1630 if ( !met->np ) {
1631 fprintf(stderr,"\n ## Error: %s: you must set the number of"
1632 " solution with the",__func__);
1633 fprintf(stderr," MMG2D_Set_solSize function before setting values");
1634 fprintf(stderr," in solution structure \n");
1635 return 0;
1636 }
1637
1638 if ( pos >= met->npmax ) {
1639 fprintf(stderr,"\n ## Error: %s: unable to set a new solution.\n",
1640 __func__);
1641 fprintf(stderr," max number of solutions: %" MMG5_PRId "\n",met->npmax);
1642 return 0;
1643 }
1644
1645 if ( pos > met->np ) {
1646 fprintf(stderr,"\n ## Error: %s: attempt to set new solution "
1647 "at position %" MMG5_PRId ".",__func__,pos);
1648 fprintf(stderr," Overflow of the given number of solutions: %" MMG5_PRId "\n",met->np);
1649 fprintf(stderr," ## Check the solution size, its compactness or the position");
1650 fprintf(stderr," of the solution.\n");
1651 return 0;
1652 }
1653 isol = pos * met->size;
1654 met->m[isol ] = m11;
1655 met->m[isol + 1] = m12;
1656 met->m[isol + 2] = m22;
1657 return 1;
1658}
1659
1660int MMG2D_Get_tensorSol(MMG5_pSol met, double *m11,double *m12,double *m22)
1661{
1662 int ddebug = 0;
1663 MMG5_int isol;
1664
1665 if ( met->npi == met->np ) {
1666 met->npi = 0;
1667 if ( ddebug ) {
1668 fprintf(stderr,"\n ## Warning: %s: reset the internal counter of points.\n",
1669 __func__);
1670 fprintf(stderr," You must pass here exactly one time (the first time ");
1671 fprintf(stderr,"you call the MMG2D_Get_tensorSol function).\n");
1672 fprintf(stderr," If not, the number of call of this function");
1673 fprintf(stderr," exceed the number of points: %" MMG5_PRId "\n ",met->np);
1674 }
1675 }
1676
1677 met->npi++;
1678
1679 if ( met->npi > met->np ) {
1680 fprintf(stderr,"\n ## Error: %s: unable to get solution.\n",__func__);
1681 fprintf(stderr," The number of call of MMG2D_Get_tensorSol function");
1682 fprintf(stderr," can not exceed the number of points: %" MMG5_PRId "\n ",met->np);
1683 return 0;
1684 }
1685
1686 isol = met->size*(met->npi);
1687 *m11 = met->m[isol ];
1688 *m12 = met->m[isol+1];
1689 *m22 = met->m[isol+2];
1690
1691 return 1;
1692}
1693
1694int MMG2D_Set_tensorSols(MMG5_pSol met, double *sols) {
1695 double *m;
1696 MMG5_int k,j;
1697
1698 if ( !met->np ) {
1699 fprintf(stderr,"\n ## Error: %s: You must set the number"
1700 " of solution with the",__func__);
1701 fprintf(stderr," MMG2D_Set_solSize function before setting values");
1702 fprintf(stderr," in solution structure \n");
1703 return 0;
1704 }
1705
1706 for ( k=0; k<met->np; ++k ) {
1707 j = 3*k;
1708 m = &met->m[j+3];
1709
1710 m[0] = sols[j];
1711 m[1] = sols[j+1];
1712 m[2] = sols[j+2];
1713 }
1714 return 1;
1715}
1716
1717int MMG2D_Get_tensorSols(MMG5_pSol met, double *sols) {
1718 double *m;
1719 MMG5_int k,j;
1720
1721 for ( k=0; k<met->np; ++k ) {
1722 j = 3*k;
1723 m = &met->m[j+3];
1724
1725 sols[j] = m[0];
1726 sols[j+1] = m[1];
1727 sols[j+2] = m[2];
1728 }
1729
1730 return 1;
1731}
1732
1734 MMG5_pSol psl;
1735
1736 /* Warning: users give indices from 1 to nsols */
1737 psl = sol + (i-1);
1738
1739 switch ( psl->type ) {
1740 case MMG5_Scalar:
1741 return MMG2D_Set_scalarSols(psl,s);
1742 break;
1743
1744 case MMG5_Vector:
1745 MMG2D_Set_vectorSols(psl,s);
1746 break;
1747
1748 case MMG5_Tensor:
1749 MMG2D_Set_tensorSols(psl,s);
1750 break;
1751
1752 default:
1753 fprintf(stderr,"\n ## Error: %s: unexpected type of solution: %s.\n",
1754 __func__,MMG5_Get_typeName(psl->type));
1755 return 0;
1756 }
1757
1758 return 1;
1759}
1760
1762 MMG5_pSol psl;
1763
1764 /* Warning: users give indices from 1 to nsols */
1765 psl = sol + (i-1);
1766
1767 switch ( psl->type ) {
1768 case MMG5_Scalar:
1769 return MMG2D_Get_scalarSols(psl,s);
1770 break;
1771
1772 case MMG5_Vector:
1773 MMG2D_Get_vectorSols(psl,s);
1774 break;
1775
1776 case MMG5_Tensor:
1777 MMG2D_Get_tensorSols(psl,s);
1778 break;
1779
1780 default:
1781 fprintf(stderr,"\n ## Error: %s: unexpected type of solution: %s\n",
1782 __func__,MMG5_Get_typeName(psl->type));
1783 return 0;
1784 }
1785
1786 return 1;
1787}
1788
1789int MMG2D_Set_ithSol_inSolsAtVertices(MMG5_pSol sol,int i, double* s,MMG5_int pos) {
1790 MMG5_pSol psl;
1791
1792 /* Warning: users give indices from 1 to nsols */
1793 psl = sol + (i-1);
1794
1795 switch ( psl->type ) {
1796 case MMG5_Scalar:
1797 return MMG2D_Set_scalarSol(psl,s[0],pos);
1798 break;
1799
1800 case MMG5_Vector:
1801 MMG2D_Set_vectorSol(psl,s[0],s[1],pos);
1802 break;
1803
1804 case MMG5_Tensor:
1805 MMG2D_Set_tensorSol(psl,s[0],s[1],s[2],pos);
1806 break;
1807
1808 default:
1809 fprintf(stderr,"\n ## Error: %s: unexpected type of solution: %s.\n",
1810 __func__,MMG5_Get_typeName(psl->type));
1811 return 0;
1812 }
1813 return 1;
1814}
1815
1816int MMG2D_Get_ithSol_inSolsAtVertices(MMG5_pSol sol,int i, double *s,MMG5_int pos) {
1817 MMG5_pSol psl;
1818
1819 /* Warning: users give indices from 1 to nsols */
1820 psl = sol + (i-1);
1821
1822 psl->npi = pos-1;
1823
1824 switch ( psl->type ) {
1825 case MMG5_Scalar:
1826 return MMG2D_Get_scalarSol(psl,&s[0]);
1827 break;
1828
1829 case MMG5_Vector:
1830 MMG2D_Get_vectorSol(psl,&s[0],&s[1]);
1831 break;
1832
1833 case MMG5_Tensor:
1834 MMG2D_Get_tensorSol(psl,&s[0],&s[1],&s[2]);
1835 break;
1836
1837 default:
1838 fprintf(stderr,"\n ## Error: %s: unexpected type of solution: %s\n",
1839 __func__,MMG5_Get_typeName(psl->type));
1840 return 0;
1841 }
1842
1843 return 1;
1844}
1845
1847
1848 if ( (mesh->npi != mesh->np) || (mesh->nti != mesh->nt) ) {
1849 fprintf(stderr,"\n ## Error: %s: if you don't use the MMG2D_loadMesh function,",
1850 __func__);
1851 fprintf(stderr," you must call the MMG2D_Set_meshSize function to have a");
1852 fprintf(stderr," valid mesh.\n");
1853 fprintf(stderr," Missing datas.\n");
1854 return 0;
1855 }
1856
1857 if ( met->npi != met->np ) {
1858 fprintf(stderr,"\n ## Error: %s: if you don't use the MMG2D_loadMet function,",
1859 __func__);
1860 fprintf(stderr," you must call the MMG2D_Set_solSize function to have a");
1861 fprintf(stderr," valid solution.\n");
1862 fprintf(stderr," Missing datas.\n");
1863 return 0;
1864 }
1865
1866 /* Check mesh data */
1867 if ( mesh->info.ddebug ) {
1868 if ( (!mesh->np) || (!mesh->point) ||
1869 (!mesh->nt) ) {
1870 fprintf(stderr," ** MISSING DATA.\n");
1871 fprintf(stderr," Check that your mesh contains points.\n");
1872 fprintf(stderr," Exit program.\n");
1873 return 0;
1874 }
1875 }
1876
1877 if ( mesh->dim != 2 ) {
1878 fprintf(stderr," ** 2 DIMENSIONAL MESH NEEDED. Exit program.\n");
1879 return 0;
1880 }
1881 if ( met->dim != 2 ) {
1882 fprintf(stderr," ** WRONG DIMENSION FOR METRIC. Exit program.\n");
1883 return 0;
1884 }
1885 if ( !mesh->ver ) mesh->ver = 2;
1886 if ( !met ->ver ) met ->ver = 2;
1887
1888 return 1;
1889}
1890
1892
1893 return MMG5_Free_allSols(mesh,sol);
1894}
1895
1896
1897int MMG2D_Free_all(const int starter,...)
1898{
1899 va_list argptr;
1900 int ier;
1901
1903
1905
1906 va_end(argptr);
1907
1908 return ier;
1909}
1910
1912{
1913 int ier;
1914
1915 va_list argptr;
1916
1918
1920
1921 va_end(argptr);
1922
1923 return ier;
1924}
1925
1926int MMG2D_Free_names(const int starter,...)
1927{
1928 va_list argptr;
1929 int ier;
1930
1932
1934
1935 va_end(argptr);
1936
1937 return ier;
1938}
const char * MMG5_Get_typeName(enum MMG5_type typ)
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 MMG2D_Set_lsBaseReference(MMG5_pMesh mesh, MMG5_pSol sol, MMG5_int br)
int MMG2D_Set_scalarSol(MMG5_pSol met, double s, MMG5_int pos)
int MMG2D_Get_ithSols_inSolsAtVertices(MMG5_pSol sol, int i, double *s)
void MMG2D_Init_parameters(MMG5_pMesh mesh)
void MMG2D_Init_fileNames(MMG5_pMesh mesh, MMG5_pSol sol)
int MMG2D_Set_quadrilateral(MMG5_pMesh mesh, MMG5_int v0, MMG5_int v1, MMG5_int v2, MMG5_int v3, MMG5_int ref, MMG5_int pos)
int MMG2D_Unset_requiredEdge(MMG5_pMesh mesh, MMG5_int k)
int MMG2D_Set_vertex(MMG5_pMesh mesh, double c0, double c1, MMG5_int ref, MMG5_int pos)
int MMG2D_Set_scalarSols(MMG5_pSol met, double *s)
int MMG2D_Init_mesh(const int starter,...)
int MMG2D_Get_vectorSols(MMG5_pSol met, double *sols)
int MMG2D_Set_iparameter(MMG5_pMesh mesh, MMG5_pSol sol, int iparam, MMG5_int val)
int MMG2D_Set_meshSize(MMG5_pMesh mesh, MMG5_int np, MMG5_int nt, MMG5_int nquad, MMG5_int na)
int MMG2D_Set_requiredEdge(MMG5_pMesh mesh, MMG5_int k)
int MMG2D_Get_quadrilateral(MMG5_pMesh mesh, MMG5_int *v0, MMG5_int *v1, MMG5_int *v2, MMG5_int *v3, MMG5_int *ref, int *isRequired)
int MMG2D_Set_tensorSol(MMG5_pSol met, double m11, double m12, double m22, MMG5_int pos)
int MMG2D_Get_vectorSol(MMG5_pSol met, double *vx, double *vy)
int MMG2D_Set_edge(MMG5_pMesh mesh, MMG5_int v0, MMG5_int v1, MMG5_int ref, MMG5_int pos)
int MMG2D_Set_ithSols_inSolsAtVertices(MMG5_pSol sol, int i, double *s)
int MMG2D_Unset_requiredTriangle(MMG5_pMesh mesh, MMG5_int k)
int MMG2D_Set_triangles(MMG5_pMesh mesh, MMG5_int *tria, MMG5_int *refs)
int MMG2D_GetByIdx_vertex(MMG5_pMesh mesh, double *c0, double *c1, MMG5_int *ref, int *isCorner, int *isRequired, MMG5_int idx)
int MMG2D_Free_allSols(MMG5_pMesh mesh, MMG5_pSol *sol)
int MMG2D_Set_ithSol_inSolsAtVertices(MMG5_pSol sol, int i, double *s, MMG5_int pos)
int MMG2D_Get_scalarSol(MMG5_pSol met, double *s)
int MMG2D_Get_vertices(MMG5_pMesh mesh, double *vertices, MMG5_int *refs, int *areCorners, int *areRequired)
int MMG2D_Unset_corner(MMG5_pMesh mesh, MMG5_int k)
int MMG2D_Get_solSize(MMG5_pMesh mesh, MMG5_pSol sol, int *typEntity, MMG5_int *np, int *typSol)
int MMG2D_Get_tensorSol(MMG5_pSol met, double *m11, double *m12, double *m22)
int MMG2D_Set_solSize(MMG5_pMesh mesh, MMG5_pSol sol, int typEntity, MMG5_int np, int typSol)
int MMG2D_Free_structures(const int starter,...)
int MMG2D_Chk_meshData(MMG5_pMesh mesh, MMG5_pSol met)
int MMG2D_Set_inputSolName(MMG5_pMesh mesh, MMG5_pSol sol, const char *solin)
int MMG2D_Set_tensorSols(MMG5_pSol met, double *sols)
int MMG2D_Set_inputMeshName(MMG5_pMesh mesh, const char *meshin)
int MMG2D_Get_vertex(MMG5_pMesh mesh, double *c0, double *c1, MMG5_int *ref, int *isCorner, int *isRequired)
int MMG2D_Get_scalarSols(MMG5_pSol met, double *s)
int MMG2D_Set_vectorSol(MMG5_pSol met, double vx, double vy, MMG5_int pos)
int MMG2D_Get_edge(MMG5_pMesh mesh, MMG5_int *e0, MMG5_int *e1, MMG5_int *ref, int *isRidge, int *isRequired)
double MMG2D_Get_triangleQuality(MMG5_pMesh mesh, MMG5_pSol met, MMG5_int k)
int MMG2D_Set_triangle(MMG5_pMesh mesh, MMG5_int v0, MMG5_int v1, MMG5_int v2, MMG5_int ref, MMG5_int pos)
int MMG2D_Set_solsAtVerticesSize(MMG5_pMesh mesh, MMG5_pSol *sol, int nsols, MMG5_int np, int *typSol)
int MMG2D_Get_tensorSols(MMG5_pSol met, double *sols)
int MMG2D_Get_meshSize(MMG5_pMesh mesh, MMG5_int *np, MMG5_int *nt, MMG5_int *nquad, MMG5_int *na)
int MMG2D_Get_edges(MMG5_pMesh mesh, MMG5_int *edges, MMG5_int *refs, int *areRidges, int *areRequired)
int MMG2D_Get_quadrilaterals(MMG5_pMesh mesh, MMG5_int *quadra, MMG5_int *refs, int *areRequired)
int MMG2D_Set_localParameter(MMG5_pMesh mesh, MMG5_pSol sol, int typ, MMG5_int ref, double hmin, double hmax, double hausd)
int MMG2D_Set_vertices(MMG5_pMesh mesh, double *vertices, MMG5_int *refs)
int MMG2D_Get_triangle(MMG5_pMesh mesh, MMG5_int *v0, MMG5_int *v1, MMG5_int *v2, MMG5_int *ref, int *isRequired)
int MMG2D_Set_vectorSols(MMG5_pSol met, double *sols)
int MMG2D_Set_corner(MMG5_pMesh mesh, MMG5_int k)
int MMG2D_Set_edges(MMG5_pMesh mesh, MMG5_int *edges, MMG5_int *refs)
int MMG2D_Set_requiredVertex(MMG5_pMesh mesh, MMG5_int k)
int MMG2D_Get_ithSol_inSolsAtVertices(MMG5_pSol sol, int i, double *s, MMG5_int pos)
int MMG2D_Set_parallelEdge(MMG5_pMesh mesh, MMG5_int k)
int MMG2D_Set_dparameter(MMG5_pMesh mesh, MMG5_pSol sol, int dparam, double val)
int MMG2D_Free_all(const int starter,...)
int MMG2D_Set_multiMat(MMG5_pMesh mesh, MMG5_pSol sol, MMG5_int ref, int split, MMG5_int rin, MMG5_int rout)
int MMG2D_Get_solsAtVerticesSize(MMG5_pMesh mesh, MMG5_pSol *sol, int *nsols, MMG5_int *np, int *typSol)
int MMG2D_Get_triangles(MMG5_pMesh mesh, MMG5_int *tria, MMG5_int *refs, int *areRequired)
int MMG2D_Set_quadrilaterals(MMG5_pMesh mesh, MMG5_int *quadra, MMG5_int *refs)
int MMG2D_Free_names(const int starter,...)
int MMG2D_Unset_requiredVertex(MMG5_pMesh mesh, MMG5_int k)
int MMG2D_Set_outputMeshName(MMG5_pMesh mesh, const char *meshout)
int MMG2D_Set_requiredTriangle(MMG5_pMesh mesh, MMG5_int k)
int MMG2D_Set_outputSolName(MMG5_pMesh mesh, MMG5_pSol sol, const char *solout)
int ier
tmp[*strlen0]
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
API headers for the mmg2d library.
@ MMG2D_DPARAM_hgradreq
Definition: libmmg2d.h:87
@ MMG2D_IPARAM_numsubdomain
Definition: libmmg2d.h:75
@ MMG2D_IPARAM_iso
Definition: libmmg2d.h:63
@ MMG2D_IPARAM_optim
Definition: libmmg2d.h:68
@ MMG2D_IPARAM_numberOfLocalParam
Definition: libmmg2d.h:76
@ MMG2D_IPARAM_nosurf
Definition: libmmg2d.h:72
@ MMG2D_DPARAM_hgrad
Definition: libmmg2d.h:86
@ MMG2D_DPARAM_hmin
Definition: libmmg2d.h:82
@ MMG2D_IPARAM_mem
Definition: libmmg2d.h:60
@ MMG2D_IPARAM_nofem
Definition: libmmg2d.h:90
@ MMG2D_IPARAM_nosizreq
Definition: libmmg2d.h:80
@ MMG2D_IPARAM_isoref
Definition: libmmg2d.h:91
@ MMG2D_DPARAM_rmc
Definition: libmmg2d.h:89
@ MMG2D_DPARAM_hausd
Definition: libmmg2d.h:85
@ MMG2D_IPARAM_angle
Definition: libmmg2d.h:62
@ MMG2D_DPARAM_hmax
Definition: libmmg2d.h:83
@ MMG2D_IPARAM_isosurf
Definition: libmmg2d.h:64
@ MMG2D_DPARAM_ls
Definition: libmmg2d.h:88
@ MMG2D_IPARAM_noinsert
Definition: libmmg2d.h:69
@ MMG2D_IPARAM_nreg
Definition: libmmg2d.h:73
@ MMG2D_IPARAM_noswap
Definition: libmmg2d.h:70
@ MMG2D_IPARAM_xreg
Definition: libmmg2d.h:74
@ MMG2D_IPARAM_nomove
Definition: libmmg2d.h:71
@ MMG2D_IPARAM_lag
Definition: libmmg2d.h:66
@ MMG2D_IPARAM_opnbdy
Definition: libmmg2d.h:65
@ MMG2D_IPARAM_verbose
Definition: libmmg2d.h:59
@ MMG2D_IPARAM_3dMedit
Definition: libmmg2d.h:67
@ MMG2D_IPARAM_anisosize
Definition: libmmg2d.h:79
@ MMG2D_IPARAM_numberOfLSBaseReferences
Definition: libmmg2d.h:77
@ MMG2D_IPARAM_numberOfMat
Definition: libmmg2d.h:78
@ MMG2D_DPARAM_angleDetection
Definition: libmmg2d.h:81
@ MMG2D_DPARAM_hsiz
Definition: libmmg2d.h:84
@ MMG2D_IPARAM_debug
Definition: libmmg2d.h:61
int MMG2D_setMeshSize_alloc(MMG5_pMesh)
Definition: zaldy_2d.c:252
int MMG2D_memOption(MMG5_pMesh mesh)
Definition: zaldy_2d.c:233
double MMG2D_caltri_ani(MMG5_pMesh mesh, MMG5_pSol sol, MMG5_pTria)
Definition: quality_2d.c:121
double MMG2D_caltri_iso(MMG5_pMesh mesh, MMG5_pSol sol, MMG5_pTria)
Definition: quality_2d.c:107
#define MMG2D_ALPHAD
int MMG2D_Free_all_var(va_list argptr)
Definition: variadic_2d.c:259
int MMG2D_Free_structures_var(va_list argptr)
Definition: variadic_2d.c:368
int MMG2D_Free_names_var(va_list argptr)
Definition: variadic_2d.c:483
int MMG2D_Init_mesh_var(va_list argptr)
Definition: variadic_2d.c:176
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:102
#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:174
@ MMG5_Vector
Definition: libmmgtypes.h:214
@ MMG5_Tensor
Definition: libmmgtypes.h:215
@ MMG5_Scalar
Definition: libmmgtypes.h:213
@ MMG5_Notype
Definition: libmmgtypes.h:212
@ MMG5_Noentity
Definition: libmmgtypes.h:223
@ MMG5_Vertex
Definition: libmmgtypes.h:224
@ MMG5_Edg
Definition: libmmgtypes.h:225
@ MMG5_Triangle
Definition: libmmgtypes.h:226
#define MG_Tria
#define MG_Edge
#define MG_REQ
#define MG_GEO
#define MMG5_SAFE_CALLOC(ptr, size, type, law)
double MMG2D_quickarea(double a[2], double b[2], double c[2])
Definition: tools.c:971
#define MG_EOK(pt)
#define MG_NUL
#define MMG5_INCREASE_MEM_MESSAGE()
#define MG_PARBDY
#define MMG5_LAG
#define MG_MIN(a, b)
#define MG_MAX(a, b)
#define MMG5_ADD_MEM(mesh, size, message, law)
#define MMG5_LS
#define MMG5_OFF
#define MG_CRN
#define MMG5_NR
#define MG_BDY
#define MMG5_ANGEDG
#define MMG5_NOHGRAD
#define MG_REF
#define MMG5_FEM
#define MMG5_DEL_MEM(mesh, ptr)
Structure to store edges of a MMG mesh.
Definition: libmmgtypes.h:305
MMG5_int b
Definition: libmmgtypes.h:306
MMG5_int ref
Definition: libmmgtypes.h:307
int16_t tag
Definition: libmmgtypes.h:310
MMG5_int a
Definition: libmmgtypes.h:306
MMG5_hgeom * geom
Definition: libmmgtypes.h:575
int8_t iso
Definition: libmmgtypes.h:534
int8_t parTyp
Definition: libmmgtypes.h:541
int8_t ddebug
Definition: libmmgtypes.h:532
double hsiz
Definition: libmmgtypes.h:518
int8_t isosurf
Definition: libmmgtypes.h:535
int8_t sethmin
Definition: libmmgtypes.h:544
MMG5_int * br
Definition: libmmgtypes.h:520
uint8_t ani
Definition: libmmgtypes.h:546
uint8_t noswap
Definition: libmmgtypes.h:546
double rmc
Definition: libmmgtypes.h:519
double hmin
Definition: libmmgtypes.h:518
int8_t setfem
Definition: libmmgtypes.h:536
MMG5_pMat mat
Definition: libmmgtypes.h:554
double hgrad
Definition: libmmgtypes.h:518
uint8_t noinsert
Definition: libmmgtypes.h:546
MMG5_int isoref
Definition: libmmgtypes.h:521
double hmax
Definition: libmmgtypes.h:518
double ls
Definition: libmmgtypes.h:519
uint8_t nomove
Definition: libmmgtypes.h:546
int8_t lag
Definition: libmmgtypes.h:540
MMG5_int nsd
Definition: libmmgtypes.h:522
uint8_t nosurf
Definition: libmmgtypes.h:546
int8_t sethmax
Definition: libmmgtypes.h:545
uint8_t nosizreq
Definition: libmmgtypes.h:546
MMG5_pPar par
Definition: libmmgtypes.h:517
uint8_t optim
Definition: libmmgtypes.h:546
double dhd
Definition: libmmgtypes.h:518
double hgradreq
Definition: libmmgtypes.h:518
double hausd
Definition: libmmgtypes.h:518
int8_t xreg
Definition: libmmgtypes.h:531
int8_t nreg
Definition: libmmgtypes.h:530
To store user-defined references in the mesh (useful in LS mode)
Definition: libmmgtypes.h:495
MMG mesh structure.
Definition: libmmgtypes.h:605
MMG5_int ntmax
Definition: libmmgtypes.h:612
MMG5_pQuad quadra
Definition: libmmgtypes.h:648
MMG5_Info info
Definition: libmmgtypes.h:651
MMG5_int xt
Definition: libmmgtypes.h:620
MMG5_pPoint point
Definition: libmmgtypes.h:641
MMG5_int nquad
Definition: libmmgtypes.h:613
MMG5_int npmax
Definition: libmmgtypes.h:612
MMG5_pxPoint xpoint
Definition: libmmgtypes.h:642
MMG5_HGeom htab
Definition: libmmgtypes.h:650
MMG5_int namax
Definition: libmmgtypes.h:612
MMG5_int nt
Definition: libmmgtypes.h:612
MMG5_pTria tria
Definition: libmmgtypes.h:647
MMG5_int np
Definition: libmmgtypes.h:612
MMG5_pEdge edge
Definition: libmmgtypes.h:649
MMG5_int nti
Definition: libmmgtypes.h:612
MMG5_int npi
Definition: libmmgtypes.h:612
MMG5_pxTetra xtetra
Definition: libmmgtypes.h:644
MMG5_int nai
Definition: libmmgtypes.h:612
MMG5_int na
Definition: libmmgtypes.h:612
double hmin
Definition: libmmgtypes.h:258
double hmax
Definition: libmmgtypes.h:259
double hausd
Definition: libmmgtypes.h:260
MMG5_int ref
Definition: libmmgtypes.h:261
int8_t elt
Definition: libmmgtypes.h:262
Structure to store points of a MMG mesh.
Definition: libmmgtypes.h:270
int16_t tag
Definition: libmmgtypes.h:284
MMG5_int tmp
Definition: libmmgtypes.h:280
double c[3]
Definition: libmmgtypes.h:271
MMG5_int ref
Definition: libmmgtypes.h:278
MMG5_int flag
Definition: libmmgtypes.h:282
MMG5_int ref
Definition: libmmgtypes.h:368
int16_t tag[4]
Definition: libmmgtypes.h:372
MMG5_int v[4]
Definition: libmmgtypes.h:367
MMG5_int npi
Definition: libmmgtypes.h:667
MMG5_int npmax
Definition: libmmgtypes.h:666
double * m
Definition: libmmgtypes.h:671
MMG5_int np
Definition: libmmgtypes.h:665
MMG5_int edg[3]
Definition: libmmgtypes.h:339
int16_t tag[3]
Definition: libmmgtypes.h:342
MMG5_int ref
Definition: libmmgtypes.h:335
MMG5_int v[3]
Definition: libmmgtypes.h:334