83 fprintf(stdout,
"-3dMedit val read and write for gmsh visu: output only if val=1, input and output if val=2, input if val=3\n");
86 fprintf(stdout,
"-nofem do not force Mmg to create a finite element mesh \n");
87 fprintf(stdout,
"-nosurf no surface modifications\n");
95 fprintf(stdout,
"\n\n");
110 for ( i=1; i< argc; ++i ) {
111 if ( !strcmp(argv[i],
"-val") ) {
115 else if ( ( !strcmp( argv[ i ],
"-?" ) ) || ( !strcmp( argv[ i ],
"-h" ) ) ) {
124 if ( *argv[i] ==
'-' ) {
127 if ( !strcmp(argv[i],
"-ar") ) {
128 if ( i >= argc -1 ) {
129 fprintf(stderr,
"\nMissing argument option %s\n",argv[i]);
133 val = strtof(argv[i+1],&endptr);
134 if ( endptr == &(argv[i+1][strlen(argv[i+1])]) ) {
141 fprintf(stderr,
"\nMissing argument option %s\n",argv[i]);
152 if ( !strcmp(argv[i],
"-default") ) {
160 if ( !strcmp(argv[i],
"-f") ) {
161 if ( ++i < argc && isascii(argv[i][0]) && argv[i][0]!=
'-' ) {
166 fprintf(stderr,
"\nMissing filename for %s\n",argv[i-1]);
174 if ( i >= argc -1 ) {
175 fprintf(stderr,
"\nMissing argument option %s\n",argv[i]);
179 if ( !strcmp(argv[i],
"-hmin") ) {
182 else if ( !strcmp(argv[i],
"-hmax") ) {
185 else if ( !strcmp(argv[i],
"-hsiz") ) {
188 else if ( !strcmp(argv[i],
"-hausd") ) {
191 else if ( !strcmp(argv[i],
"-hgradreq") ) {
194 else if ( !strcmp(argv[i],
"-hgrad") ) {
205 val = strtof(argv[i+1],&endptr);
206 if ( endptr == &(argv[i+1][strlen(argv[i+1])]) ) {
213 fprintf(stderr,
"\nMissing argument option %s\n",argv[i]);
220 if ( !strcmp(argv[i],
"-in") ) {
221 if ( ++i < argc && isascii(argv[i][0]) && argv[i][0]!=
'-') {
228 fprintf(stderr,
"\nMissing filname for %s\n",argv[i]);
233 else if ( !strcmp(argv[i],
"-isoref") && ++i <= argc ) {
244 if ( !strcmp(argv[i],
"-lag") ) {
245 if ( ++i < argc && isdigit(argv[i][0]) ) {
250 fprintf(stderr,
"\nMissing or unexpected argument option %s\n",argv[i-1]);
255 else if ( !strcmp(argv[i],
"-ls") ) {
260 val = strtof(argv[i+1],&endptr);
261 if ( endptr == &(argv[i+1][strlen(argv[i+1])]) ) {
268 else if ( !strcmp(argv[i],
"-lssurf") ) {
273 val = strtof(argv[i+1],&endptr);
274 if ( endptr == &(argv[i+1][strlen(argv[i+1])]) ) {
283 if ( !strcmp(argv[i],
"-met") ) {
285 fprintf(stderr,
"\nNo metric structure allocated for %s option\n",
289 if ( ++i < argc && isascii(argv[i][0]) && argv[i][0]!=
'-' ) {
294 fprintf(stderr,
"\nMissing filname for %s\n",argv[i-1]);
299 else if (!strcmp(argv[i],
"-m") ) {
300 if ( ++i < argc && isdigit(argv[i][0]) ) {
305 fprintf(stderr,
"\nMissing argument option %s\n",argv[i-1]);
312 if ( !strcmp(argv[i],
"-nofem") ) {
316 if ( !strcmp(argv[i],
"-nreg") ) {
320 else if ( !strcmp(argv[i],
"-nr") ) {
324 else if ( !strcmp(argv[i],
"-nsd") ) {
325 if ( ++i < argc && isdigit(argv[i][0]) ) {
330 fprintf(stderr,
"\nMissing argument option %s\n",argv[i-1]);
334 }
else if ( !strcmp(argv[i],
"-noswap") ) {
338 else if( !strcmp(argv[i],
"-noinsert") ) {
342 else if( !strcmp(argv[i],
"-nomove") ) {
346 else if( !strcmp(argv[i],
"-nosurf") ) {
350 else if( !strcmp(argv[i],
"-nosizreq") ) {
357 if ( (!strcmp(argv[i],
"-out")) || (!strcmp(argv[i],
"-o")) ) {
358 if ( ++i < argc && isascii(argv[i][0]) && argv[i][0]!=
'-') {
362 fprintf(stderr,
"\nMissing filname for %s\n",argv[i-1]);
367 else if ( !strcmp(argv[i],
"-opnbdy") ) {
371 else if( !strcmp(argv[i],
"-optim") ) {
377 if ( !strcmp(argv[i],
"-rmc") ) {
381 val = strtof(argv[i+1],&endptr);
382 if ( endptr == &(argv[i+1][strlen(argv[i+1])]) ) {
391 if ( !strcmp(argv[i],
"-sol") ) {
396 if ( ++i < argc && isascii(argv[i][0]) && argv[i][0]!=
'-' ) {
401 fprintf(stderr,
"\nMissing filname for %s\n",argv[i-1]);
409 if ( argv[i][0] ==
'-' || isdigit(argv[i][0]) ) {
417 fprintf(stderr,
"\nMissing argument option for %s\n",argv[i-1]);
423 if ( !strcmp(argv[i],
"-xreg") ) {
427 val = strtof(argv[i+1],&endptr);
428 if ( endptr == &(argv[i+1][strlen(argv[i+1])]) ) {
437 if(!strcmp(argv[i],
"-3dMedit") ) {
438 if ( ++i < argc && isdigit(argv[i][0]) ) {
443 fprintf(stderr,
"\nMissing argument option for %s\n",argv[i-1]);
450 fprintf(stderr,
"\nUnrecognized option %s\n",argv[i]);
471 fprintf(stdout,
"\nArgument %s ignored\n",argv[i]);
481 fprintf(stdout,
"\n -- PRINT (0 10(advised) -10) ?\n");
489 fprintf(stdout,
"\n -- INPUT MESH NAME ?\n");
511 if (
tmp->namein == NULL ) {
534 fprintf(stdout,
"\n\n");
549 int ret,i,j,npar,nbr,split;
550 MMG5_int ref,rin,rex,br;
566 if ( ptr ) *ptr =
'\0';
567 strcat(data,
".mmg2d");
569 in = fopen(data,
"rb");
573 sprintf(data,
"%s",
"DEFAULT.mmg2d");
574 in = fopen(data,
"rb");
579 fprintf(stderr,
" ** In %s: %s file NOT FOUND. \n",__func__,data);
580 fprintf(stdout,
" ## ERROR: UNABLE TO LOAD PARAMETER FILE.\n");
585 fprintf(stdout,
"\n %%%% %s OPENED\n",data);
589 while ( !feof(in) ) {
590 ret = fscanf(in,
"%255s",data);
591 if ( !ret || feof(in) )
break;
592 for (i=0; (size_t)i<strlen(data); i++) data[i] = tolower(data[i]);
595 if ( !strcmp(data,
"lsreferences") ) {
596 ret = fscanf(in,
"%d",&npar);
598 fprintf(stderr,
" %%%% Wrong format for lsreferences: %d\n",npar);
607 fgetpos(in,&position);
611 if ( strcmp(data,
"nosplit") ) {
612 fsetpos(in,&position);
623 else if ( !strcmp(data,
"parameters") ) {
624 ret = fscanf(in,
"%d",&npar);
627 fprintf(stderr,
" %%%% Wrong format for parameters: %d\n",npar);
631 fprintf(stderr,
" %%%% Too many local parameters %d. Abort\n",npar);
641 ret = fscanf(in,
"%" MMG5_PRId
" %255s",&ref,data);
642 if ( ret ) ret = fscanf(in,
"%f %f %f",&fp1,&fp2,&fp3);
645 fprintf(stderr,
" %%%% Wrong format: %s\n",data);
649 for (j=0; (size_t)j<strlen(data); j++) data[j] = tolower(data[j]);
650 if ( !strcmp(data,
"triangles") || !strcmp(data,
"triangle") ) {
655 else if ( !strcmp(data,
"edges") || !strcmp(data,
"edge") ) {
661 fprintf(stderr,
" %%%% Wrong format: %s\n",data);
668 else if ( !strcmp(data,
"lsbasereferences") ) {
681 fprintf(stderr,
" %%%% Wrong format: %s\n",data);
702 MMG5_int *adja,k,i,j,i1,i2,iel;
709 fprintf(stderr,
"\n ## Error: %s: unable to create "
710 "adjacency table.\n",__func__);
716 for ( k=1; k<=
mesh->
nt; k++ ) {
718 if ( !
MG_EOK(pt) )
continue;
722 for ( i=0; i<3; i++ ) {
728 if ( (!iel) || (pt->
ref != pt1->
ref) ||
744 printf(
" Exit program.\n");
747 MMG5_Edge,
"non bdy edges arrray",
return 0);
751 printf(
" Exit program.\n");
754 MMG5_Edge,
"non bdy edges arrray",
return 0);
758 for ( k=1; k<=
mesh->
nt; k++ ) {
760 if ( !
MG_EOK(pt) )
continue;
764 for ( i=0; i<3; i++ ) {
772 if ( (!iel) || (pt->
ref != pt1->
ref) ||
798 fprintf(stderr,
"\n ## Error: %s: edge array is not allocated.\n"
799 " Please, call the MMG2D_Get_numberOfNonBdyEdges function"
800 " before the %s one.\n",
805 ptr_c = ptr_c-
sizeof(size_t);
806 na_tot = *((
size_t*)ptr_c);
809 fprintf(stderr,
"\n ## Error: %s: no internal edge.\n"
810 " Please, call the MMG2D_Get_numberOfNonBdyEdges function"
811 " before the %s one and check that the number of internal"
812 " edges is non null.\n",
817 if (
mesh->
namax+idx > (MMG5_int)na_tot ) {
818 fprintf(stderr,
"\n ## Error: %s: Can't get the internal edge of index %" MMG5_PRId
"."
819 " Index must be between 1 and %"MMG5_PRId
".\n",
820 __func__,idx,(MMG5_int)na_tot-
mesh->
namax);
843 listri[0] =
mesh->
adja[3*(kel-1)+1]/3;
844 listri[1] =
mesh->
adja[3*(kel-1)+2]/3;
845 listri[2] =
mesh->
adja[3*(kel-1)+3]/3;
857 if ( !start )
return 0;
866 MMG5_int prevk,k,*adja,nbpoi;
870 for ( iploc=0; iploc<3; ++iploc ) {
871 if ( pt->
v[iploc] == ip )
break;
881 fprintf(stderr,
"\n ## Warning: %s: unable to compute adjacent"
882 " vertices of the vertex %" MMG5_PRId
":\nthe ball of point contain too many"
883 " elements.\n",__func__,ip);
896 while ( k && k != start );
898 if ( k > 0 )
return nbpoi;
902 fprintf(stderr,
"\n ## Warning: %s: unable to compute adjacent vertices of the"
903 " vertex %" MMG5_PRId
":\nthe ball of point contain too many elements.\n",
921 fprintf(stderr,
"\n ## Warning: %s: unable to compute adjacent vertices of the"
922 " vertex %" MMG5_PRId
":\nthe ball of point contain too many elements.\n",
944 fprintf(stderr,
" ## Error: %s: the main fonction of the Mmg library must be"
945 " called before this function.\n",__func__);
961 MMG5_int ia0,ib0,ia1,ib1;
964 ktri[0] = ktri[1] = 0;
969 if ( !
ier )
return 0;
976 itri =
mesh->
adja[3*(*ktri-1) + *ied + 1 ];
989 assert ( ( (ia0 == ia1) && (ib0 == ib1) ) ||
990 ( (ia0 == ib1) && (ib0 == ia1) ) );
1032 for ( k=1; k<=
mesh->
np; ++k ) {
int MMG5_Compute_constantSize(MMG5_pMesh mesh, MMG5_pSol met, double *hsiz)
void MMG5_Set_constantSize(MMG5_pMesh mesh, MMG5_pSol met, double hsiz)
char * MMG5_Get_filenameExt(char *filename)
int MMG2D_Set_lsBaseReference(MMG5_pMesh mesh, MMG5_pSol sol, MMG5_int br)
Set level-set base reference.
int MMG2D_Set_iparameter(MMG5_pMesh mesh, MMG5_pSol sol, int iparam, MMG5_int val)
Set integer parameter iparam to value val.
int MMG2D_Set_solSize(MMG5_pMesh mesh, MMG5_pSol sol, int typEntity, MMG5_int np, int typSol)
Set the size and type of a solution field.
int MMG2D_Set_inputSolName(MMG5_pMesh mesh, MMG5_pSol sol, const char *solin)
Set the name of the input solution file.
int MMG2D_Set_inputMeshName(MMG5_pMesh mesh, const char *meshin)
Set the name of the input mesh.
int MMG2D_Set_localParameter(MMG5_pMesh mesh, MMG5_pSol sol, int typ, MMG5_int ref, double hmin, double hmax, double hausd)
Set local parameters.
int MMG2D_Set_dparameter(MMG5_pMesh mesh, MMG5_pSol sol, int dparam, double val)
Set double parameter dparam to value val.
int MMG2D_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 ref ref in LS discretization mode.
int MMG2D_Set_inputParamName(MMG5_pMesh mesh, const char *fparamin)
Set the name of the input parameter file.
int MMG2D_Set_outputMeshName(MMG5_pMesh mesh, const char *meshout)
Set the name of the output mesh file.
int MMG2D_Set_outputSolName(MMG5_pMesh mesh, MMG5_pSol sol, const char *solout)
Set the name of the output solution file.
MMG5_pMesh MMG5_pSol * sol
if(!ier) exit(EXIT_FAILURE)
int MMG5_gradsizreq_ani(MMG5_pMesh mesh, MMG5_pSol met)
int MMG5_compute_meanMetricAtMarkedPoints_ani(MMG5_pMesh mesh, MMG5_pSol met)
int MMG2D_defsiz_ani(MMG5_pMesh mesh, MMG5_pSol met)
int MMG5_eigensym(double m[3], double lambda[2], double vp[2][2])
int MMG2D_hashTria(MMG5_pMesh mesh)
int MMG2D_intmet_iso(MMG5_pMesh mesh, MMG5_pSol met, MMG5_int k, int8_t i, MMG5_int ip, double s)
int MMG2D_intmet_ani(MMG5_pMesh mesh, MMG5_pSol met, MMG5_int k, int8_t i, MMG5_int ip, double s)
int MMG5_gradsiz_iso(MMG5_pMesh mesh, MMG5_pSol met)
int MMG5_compute_meanMetricAtMarkedPoints_iso(MMG5_pMesh mesh, MMG5_pSol met)
int MMG5_gradsizreq_iso(MMG5_pMesh mesh, MMG5_pSol met)
int MMG2D_defsiz_iso(MMG5_pMesh mesh, MMG5_pSol met)
double MMG2D_lencurv_iso(MMG5_pMesh mesh, MMG5_pSol met, MMG5_int ip1, MMG5_int ip2)
double MMG2D_lencurv_ani(MMG5_pMesh mesh, MMG5_pSol met, MMG5_int ip1, MMG5_int ip2)
API headers and documentation for the mmg2d library.
@ MMG2D_IPARAM_numsubdomain
@ MMG2D_IPARAM_numberOfLocalParam
@ MMG2D_IPARAM_numberOfLSBaseReferences
@ MMG2D_IPARAM_numberOfMat
@ MMG2D_DPARAM_angleDetection
LIBMMG2D_EXPORT int(* MMG2D_doSol)(MMG5_pMesh mesh, MMG5_pSol met)
Compute unit tensor according to the lengths of the edges passing through a vertex.
MMG5_int MMG2D_findTria(MMG5_pMesh, MMG5_int)
int lissmet_ani(MMG5_pMesh mesh, MMG5_pSol sol)
double MMG2D_caltri_ani(MMG5_pMesh mesh, MMG5_pSol sol, MMG5_pTria)
int MMG2D_doSol_iso(MMG5_pMesh mesh, MMG5_pSol sol)
int MMG2D_doSol_ani(MMG5_pMesh mesh, MMG5_pSol sol)
double MMG2D_caltri_iso(MMG5_pMesh mesh, MMG5_pSol sol, MMG5_pTria)
#define MMG5_MMAT_NoSplit
#define MMG5_ADD_MEM(mesh, size, message, law)
static const uint8_t MMG5_iprv2[3]
static const uint8_t MMG5_inxt2[6]
#define MMG5_FILESTR_LGTH
#define MMG_FSCANF(stream, format,...)
#define MMG5_DEL_MEM(mesh, ptr)
#define MMG5_SAFE_RECALLOC(ptr, prevSize, newSize, type, message, law)
Structure to store edges of am MMG mesh.
Structure to store triangles of a MMG mesh.