57 mesh->info.imprim = 1;
104 mesh->info.mat = NULL;
113 if (
mesh->memMax ) {
118 printf(
" Maximum memory set to default value: %d MB.\n",
MMG5_MEMMAX);
161 fprintf(stderr,
" Exit program.\n");
168 fprintf(stderr,
" Exit program.\n");
171 strcpy(
mesh->namein,
"mesh.mesh");
172 if ( (
mesh->info.imprim > 5) ||
mesh->info.ddebug ) {
173 fprintf(stderr,
"\n ## Warning: %s: no name given for input mesh.\n",__func__);
174 fprintf(stderr,
" Use of default value \"mesh.mesh\".\n");
195 if ( solin && strlen(solin) ) {
197 fprintf(stderr,
" Exit program.\n");
200 strcpy(
sol->namein,solin);
203 if (
mesh->namein && strlen(
mesh->namein) ) {
204 int mesh_len = strlen(
mesh->namein)+1;
206 strcpy(
sol->namein,
mesh->namein);
209 char *dot = strrchr(
sol->namein,
'.');
212 ptr = strstr(dot,
".mesh");
219 "input sol name",
return 0);
222 fprintf(stderr,
" Exit program.\n");
224 strcat(
sol->namein,
".sol");
228 fprintf(stderr,
" Exit program.\n");
231 strcpy(
sol->namein,
"mesh.sol");
247 if (
mesh->info.fparam )
250 if ( fparamin && strlen(fparamin) ) {
252 fprintf(stderr,
" Exit program.\n");
255 strcpy(
mesh->info.fparam,fparamin);
258 fprintf(stderr,
"\n ## Warning: %s: no name given for the parameter file.\n",__func__);
259 fprintf(stderr,
" We should have never end here.\n");
280 if ( meshout && strlen(meshout) ) {
281 ptr = strrchr(meshout,
'.');
284 fprintf(stderr,
" Exit program.\n");
287 strcpy(
mesh->nameout,meshout);
295 strcpy(
mesh->nameout,meshout);
301 strcat(
mesh->nameout,
".msh");
304 strcat(
mesh->nameout,
".mshb");
307 strcat(
mesh->nameout,
".vtu");
310 strcat(
mesh->nameout,
".vtp");
313 strcat(
mesh->nameout,
".vtk");
316 strcat(
mesh->nameout,
".meshb");
319 strcat(
mesh->nameout,
".mesh");
325 if (
mesh->namein && strlen(
mesh->namein) ) {
327 fprintf(stderr,
" Exit program.\n");
335 if ( ptr ) *ptr =
'\0';
340 strcat(
mesh->nameout,
".o.msh");
343 strcat(
mesh->nameout,
".o.mshb");
346 strcat(
mesh->nameout,
".o.vtu");
349 strcat(
mesh->nameout,
".o.vtp");
352 strcat(
mesh->nameout,
".o.vtk");
355 strcat(
mesh->nameout,
".o.meshb");
358 strcat(
mesh->nameout,
".o.mesh");
364 fprintf(stderr,
" Exit program.\n");
367 if ( (
mesh->info.imprim > 5) ||
mesh->info.ddebug ) {
368 fprintf(stderr,
"\n ## Warning: %s: no name given for output mesh.\n",
370 fprintf(stderr,
" Use of default value \"mesh.o.mesh\".\n");
372 strcpy(
mesh->nameout,
"mesh.o.mesh");
395 if ( solout && strlen(solout) ) {
397 fprintf(stderr,
" Exit program.\n");
400 strcpy(
sol->nameout,solout);
403 if (
mesh->nameout && strlen(
mesh->nameout) ) {
405 char *dot = strrchr(
mesh->nameout,
'.');
408 ptr = strstr(dot,
".mesh");
412 oldsize = strlen(
mesh->nameout)+1;
416 oldsize = strlen(
mesh->nameout)+6;
418 strcpy(
sol->nameout,
mesh->nameout);
419 dot = strrchr(
sol->nameout,
'.');
422 ptr = strstr(dot,
".mesh");
429 fprintf(stderr,
" Exit program.\n");
432 "output sol name",
return 0);
433 strcat(
sol->nameout,
".sol");
437 fprintf(stderr,
"\n ## Error: %s: no name for output mesh. please, use",
439 fprintf(stderr,
" the MMG5_Set_outputMeshName to set the mesh name.\n");
450 if ( met->
size == 1 ) {
451 for (k=1; k<=
mesh->np; k++) {
452 ppt = &
mesh->point[k];
453 if ( !
MG_VOK(ppt) )
continue;
458 hsiz = 1./(hsiz*hsiz);
460 if (
mesh->dim==2 ) {
461 for (k=1; k<=
mesh->np; k++) {
462 ppt = &
mesh->point[k];
463 if ( !
MG_VOK(ppt) )
continue;
468 met->
m[iadr+2] = hsiz;
472 assert (
mesh->dim==3 );
473 for (k=1; k<=
mesh->np; k++) {
474 ppt = &
mesh->point[k];
475 if ( !
MG_VOK(ppt) )
continue;
481 met->
m[iadr+3] = hsiz;
483 met->
m[iadr+5] = hsiz;
496 for ( i=0; i<
mesh->nsols; ++i ) {
538 if (
mesh->info.npar &&
mesh->info.par )
541 if (
mesh->info.nmat ) {
544 if(
mesh->info.invmat.lookup )
548 if (
mesh->info.imprim>5 ||
mesh->info.ddebug ) {
549 printf(
" MEMORY USED AT END (Bytes) %zu\n",
mesh->memCur);
565 if (
mesh->nameout ) {
569 if (
mesh->namein ) {
605 if (
mesh->info.hmax <
mesh->info.hmin ) {
606 assert ( sethmin && sethmax );
607 fprintf(stderr,
"\n ## Error: %s: Mismatched options:"
608 " minimal mesh size larger than maximal one.\n",__func__);
612 if (
mesh->info.ddebug ) {
614 fprintf(stdout,
" After truncature computation: hmin %lf (user setted %d)\n"
615 " hmax %lf (user setted %d)\n",
625 if (
mesh->info.hmin >
mesh->info.hsiz ) {
626 fprintf(stderr,
"\n ## Error: %s: Mismatched options: hmin (%e) is greater"
627 " than hsiz (%e). Exit Program.\n",__func__,
632 if (
mesh->info.hmax > 0. &&
mesh->info.hmax <
mesh->info.hsiz ) {
633 fprintf(stderr,
"\n ## Error: %s: Mismatched options: hmax (%e) is lower"
634 " than hsiz (%e). Exit Program.\n",__func__,
639 *hsiz =
mesh->info.hsiz;
645 if (
mesh->info.sethmin ) {
649 if (
mesh->info.sethmax ) {
654 if ( !
mesh->info.sethmin ) {
655 if (
mesh->info.sethmax ) {
658 mesh->info.hmin = 0.1*(*hsiz);
663 if ( !
mesh->info.sethmax ) {
664 if (
mesh->info.sethmin ) {
667 mesh->info.hmax = 10.*(*hsiz);
671 if (
mesh->info.ddebug ) {
673 fprintf(stdout,
" After hsiz computation: hmin %lf (user setted %d)\n"
674 " hmax %lf (user setted %d)\n",
684 char *s = strrchr(path,
'/');
689 return strdup(s + 1);
698 return "MMG5_Noentity";
701 return "MMG5_Vertex";
707 return "MMG5_Triangle";
710 return "MMG5_Tetrahedron";
713 return"MMG5_Unknown";
721 return "MMG5_Notype";
724 return "MMG5_Scalar";
727 return "MMG5_Vector";
730 return "MMG5_Tensor";
733 return "MMG5_Unknown";
739 static char tags_name[1024];
750 strcpy(tags_name,
"\0");
753 strcat(tags_name,
"Reference ");
757 strcat(tags_name,
"Ridge ");
761 strcat(tags_name,
"Required ");
765 strcat(tags_name,
"Non-manifold ");
769 strcat(tags_name,
"Boundary ");
773 strcat(tags_name,
"Corner ");
777 strcat(tags_name,
"Nosurf ");
781 strcat(tags_name,
"Opnbdy ");
785 strcat(tags_name,
"Old-parbdy ");
789 strcat(tags_name,
"Parbdybdy ");
793 strcat(tags_name,
"Parbdy ");
797 strcat(tags_name,
"Overlap ");
800 strcat(tags_name,
"tag(s).");
820 if ( !ptr )
return defFmt;
822 if ( !strncmp ( ptr,
".meshb",strlen(
".meshb") ) ) {
825 else if ( !strncmp( ptr,
".mesh",strlen(
".mesh") ) ) {
828 else if ( !strncmp( ptr,
".mshb",strlen(
".mshb") ) ) {
831 else if ( !strncmp( ptr,
".msh",strlen(
".msh") ) ) {
834 else if ( !strncmp ( ptr,
".pvtu",strlen(
".pvtu") ) ) {
837 else if ( !strncmp ( ptr,
".vtu",strlen(
".vtu") ) ) {
840 else if ( !strncmp ( ptr,
".pvtp",strlen(
".pvtu") ) ) {
843 else if ( !strncmp ( ptr,
".vtp",strlen(
".vtp") ) ) {
846 else if ( !strncmp ( ptr,
".vtk",strlen(
".vtk") ) ) {
849 else if ( !strncmp ( ptr,
".node",strlen(
".node") ) ) {
869 return "MMG5_FMT_MeditASCII";
872 return "MMG5_FMT_MeditBinary";
875 return "MMG5_FMT_VtkVtu";
878 return "MMG5_FMT_VtkVtp";
881 return "MMG5_FMT_VtkPvtu";
884 return "MMG5_FMT_VtkPvtp";
887 return "MMG5_FMT_VtkVtk";
890 return "MMG5_FMT_GmshASCII";
893 return "MMG5_FMT_GmshBinary";
896 return "MMG5_FMT_Tetgen";
899 return "MMG5_Unknown";
913 const char pathsep=
'/';
921 lastpath = (pathsep == 0) ? NULL : strrchr (
filename, pathsep);
923 if ( (!dot) || dot ==
filename || (lastpath>dot) || (!strcmp(dot,
".o")) ) {
940 char *lastpath,*retpath;
943 if ( path == NULL)
return NULL;
953 while ( path+len != lastpath ) {
960 strncpy ( retpath, path, len );
976 char *retpath, *lastext, *lastpath;
980 if ( (!ext) || !*ext ) {
988 if ( path == NULL)
return NULL;
992 lastext = strstr (path, extloc);
995 if ( lastext == NULL || (lastpath != NULL && lastpath > lastext) ) {
1003 while ( path+len != lastext ) {
1011 strncpy ( retpath, path, len );
1012 retpath[len] =
'\0';
const char * MMG5_Get_tagName(uint16_t tag)
const char * MMG5_Get_typeName(enum MMG5_type typ)
int MMG5_Compute_constantSize(MMG5_pMesh mesh, MMG5_pSol met, double *hsiz)
int MMG5_Set_inputParamName(MMG5_pMesh mesh, const char *fparamin)
int MMG5_Set_outputMeshName(MMG5_pMesh mesh, const char *meshout)
char * MMG5_Get_basename(char *path)
int MMG5_Set_inputSolName(MMG5_pMesh mesh, MMG5_pSol sol, const char *solin)
const char * MMG5_Get_formatName(enum MMG5_Format fmt)
int MMG5_Free_allSols(MMG5_pMesh mesh, MMG5_pSol *sol)
int MMG5_Set_defaultTruncatureSizes(MMG5_pMesh mesh, int8_t sethmin, int8_t sethmax)
int MMG5_Set_inputMeshName(MMG5_pMesh mesh, const char *meshin)
void MMG5_Init_parameters(MMG5_pMesh mesh)
const char * MMG5_Get_entitiesName(enum MMG5_entities ent)
char * MMG5_Remove_ext(char *path, char *ext)
int MMG5_Get_format(char *ptr, int fmt)
void MMG5_mmgFree_names(MMG5_pMesh mesh, MMG5_pSol met)
void MMG5_Free_structures(MMG5_pMesh mesh, MMG5_pSol sol)
char * MMG5_Get_path(char *path)
void MMG5_Set_constantSize(MMG5_pMesh mesh, MMG5_pSol met, double hsiz)
void MMG5_Init_fileNames(MMG5_pMesh mesh, MMG5_pSol sol)
char * MMG5_Get_filenameExt(char *filename)
int MMG5_Set_outputSolName(MMG5_pMesh mesh, MMG5_pSol sol, const char *solout)
strncpy(tmp, meshin, *strlen0)
MMG5_pMesh MMG5_pSol * sol
MMG5_pMesh char * filename
MMG5_type
Type of solutions.
MMG5_Format
Type of supported file format.
MMG5_entities
Identifies the types of mesh entities.
#define MMG5_BITWIZE_MB_TO_B
#define MMG5_SAFE_CALLOC(ptr, size, type, law)
size_t MMG5_memSize(void)
#define MMG5_ADD_MEM(mesh, size, message, law)
#define MMG5_SAFE_REALLOC(ptr, prevSize, newSize, type, message, law)
#define MMG5_SAFE_MALLOC(ptr, size, type, law)
int MMG5_check_setted_hminhmax(MMG5_pMesh mesh)
#define MMG5_DEL_MEM(mesh, ptr)
Structure to store input parameters of the job.