51int main(
int argc,
char *argv[]) {
55 char *
filename,*filename_o2d,*filename_os,*filename_o3d,*ptr;
57 fprintf(stdout,
" -- TEST MMGLIB \n");
60 printf(
" Usage: %s 2d_filein 3d_filein fileout\n",argv[0]);
67 filename = (
char *) calloc(strlen(argv[1]) + 1,
sizeof(char));
69 perror(
" ## Memory problem: calloc");
106 fprintf(stdout,
"BAD ENDING OF MMG2DLIB: UNABLE TO SAVE MESH\n");
109 fprintf(stdout,
"BAD ENDING OF MMG2DLIB\n");
119 filename_o2d = (
char *) calloc(strlen(argv[3]) + 4,
sizeof(char));
120 if ( filename_o2d == NULL ) {
121 perror(
" ## Memory problem: calloc");
124 strcpy(filename_o2d,argv[3]);
125 ptr = strstr(filename_o2d,
".mesh");
126 if ( !ptr ) ptr = strstr(filename_o2d,
".msh");
127 if ( ptr ) *ptr =
'\0';
128 strcat(filename_o2d,
".2d");
130 if (
MMG2D_saveMesh(mmgMesh,filename_o2d) != 1 ) exit(EXIT_FAILURE);
132 if (
MMG2D_saveSol(mmgMesh,mmgSol,filename_o2d) != 1 ) exit(EXIT_FAILURE);
144 filename = (
char *) calloc(strlen(argv[2]) + 1,
sizeof(char));
146 perror(
" ## Memory problem: calloc");
151 filename_os = (
char *) calloc(strlen(argv[3]) + 3,
sizeof(char));
152 if ( filename_os == NULL ) {
153 perror(
" ## Memory problem: calloc");
156 strcpy(filename_os,argv[3]);
157 ptr = strstr(filename_os,
".mesh");
158 if ( !ptr ) ptr = strstr(filename_os,
".msh");
159 if ( ptr ) *ptr =
'\0';
160 strcat(filename_os,
".s");
196 fprintf(stdout,
"BAD ENDING OF MMGSLIB: UNABLE TO SAVE MESH\n");
199 fprintf(stdout,
"BAD ENDING OF MMGSLIB\n");
208 if (
MMGS_saveMesh(mmgMesh,filename_os) != 1 ) exit(EXIT_FAILURE);
211 if (
MMGS_saveSol(mmgMesh,mmgSol,filename_os) != 1 ) exit(EXIT_FAILURE);
219 filename_o3d = (
char *) calloc(strlen(argv[3]) + 4,
sizeof(char));
220 if ( filename_o3d == NULL ) {
221 perror(
" ## Memory problem: calloc");
224 strcpy(filename_o3d,argv[3]);
225 ptr = strstr(filename_o3d,
".mesh");
226 if ( !ptr ) ptr = strstr(filename_o3d,
".msh");
227 if ( ptr ) *ptr =
'\0';
228 strcat(filename_o3d,
".3d");
263 fprintf(stdout,
"BAD ENDING OF MMG3DLIB: UNABLE TO SAVE MESH\n");
266 fprintf(stdout,
"BAD ENDING OF MMG3DLIB\n");
275 if (
MMG3D_saveMesh(mmgMesh,filename_o3d) != 1 ) exit(EXIT_FAILURE);
278 if (
MMG3D_saveSol(mmgMesh,mmgSol,filename_o3d) != 1 ) exit(EXIT_FAILURE);
int MMG2D_Init_mesh(const int starter,...)
Initialize a mesh structure and optionally the associated solution and metric structures.
int MMG2D_Free_all(const int starter,...)
Deallocations before return.
int MMG3D_Init_mesh(const int starter,...)
Initialize a mesh structure and optionally the associated solution and metric structures.
int MMG3D_Free_all(const int starter,...)
Deallocations before return.
int MMGS_Init_mesh(const int starter,...)
Initialize a mesh structure and optionally the associated solution and metric structures.
int MMGS_Free_all(const int starter,...)
Deallocations before return.
MMG5_pMesh char * filename
program main
Example for using mmglib (basic use)
int MMG2D_saveMesh(MMG5_pMesh mesh, const char *filename)
Save a mesh in .mesh/.meshb format.
int MMG2D_saveSol(MMG5_pMesh mesh, MMG5_pSol sol, const char *filename)
Save metric field in medit solution file format.
int MMG2D_loadMesh(MMG5_pMesh mesh, const char *filename)
Load a mesh (in .mesh/.mesb format) from file.
int MMG2D_loadSol(MMG5_pMesh mesh, MMG5_pSol sol, const char *filename)
Load a metric field (or other solution) in medit's .sol format.
int MMG3D_saveMesh(MMG5_pMesh mesh, const char *filename)
Save a mesh in .mesh/.meshb format.
int MMG3D_loadSol(MMG5_pMesh mesh, MMG5_pSol met, const char *filename)
Load a metric field (or other solution).
int MMG3D_loadMesh(MMG5_pMesh mesh, const char *filename)
Load a mesh (in .mesh/.mesb format) from file.
int MMG3D_saveSol(MMG5_pMesh mesh, MMG5_pSol met, const char *filename)
Write isotropic or anisotropic metric.
int MMGS_loadSol(MMG5_pMesh mesh, MMG5_pSol met, const char *filename)
Load a metric field (or other solution) in medit's .sol format.
int MMGS_saveMesh(MMG5_pMesh mesh, const char *filename)
Save a mesh in .mesh or .meshb format.
int MMGS_saveSol(MMG5_pMesh mesh, MMG5_pSol met, const char *filename)
Write an isotropic or anisotropic metric in medit file format.
int MMGS_loadMesh(MMG5_pMesh mesh, const char *filename)
Load a mesh (in .mesh/.mesb format) from file.
int MMG2D_mmg2dlib(MMG5_pMesh mesh, MMG5_pSol met)
Main "program" for the mesh adaptation library.
int MMG3D_mmg3dlib(MMG5_pMesh mesh, MMG5_pSol met)
Main "program" for the mesh adaptation library.
int MMGS_mmgslib(MMG5_pMesh mesh, MMG5_pSol met)
Main "program" for mesh adaptation.
#define MMG5_STRONGFAILURE