53int main(
int argc,
char *argv[]) {
57 string filename,filename_os,filename_o2d,filename_o3d;
60 fprintf(stdout,
" -- TEST MMGLIB \n");
63 printf(
" Usage: %s 2d_filein 3d_filein fileout\n",argv[0]);
100 fprintf(stdout,
"BAD ENDING OF MMG2DLIB: UNABLE TO SAVE MESH\n");
103 fprintf(stdout,
"BAD ENDING OF MMG2DLIB\n");
111 filename_o2d = argv[3];
113 found = filename_o2d.find(
".mesh");
114 if (found==std::string::npos) {
115 found = filename_o2d.find(
".msh");
118 if (found!=std::string::npos) {
119 filename_o2d.replace(found,1,
"\0");
121 filename_o2d +=
".2d";
124 if (
MMG2D_saveMesh(mmgMesh,filename_o2d.c_str()) != 1 ) exit(EXIT_FAILURE);
126 if (
MMG2D_saveSol(mmgMesh,mmgSol,filename_o2d.c_str()) != 1 ) exit(EXIT_FAILURE);
137 filename_os = argv[3];
139 found = filename_os.find(
".mesh");
140 if (found==std::string::npos) {
141 found = filename_os.find(
".msh");
144 if (found!=std::string::npos) {
145 filename_os.replace(found,1,
"\0");
183 fprintf(stdout,
"BAD ENDING OF MMGSLIB: UNABLE TO SAVE MESH\n");
186 fprintf(stdout,
"BAD ENDING OF MMGSLIB\n");
195 if (
MMGS_saveMesh(mmgMesh,filename_os.c_str()) != 1 ) exit(EXIT_FAILURE);
198 if (
MMGS_saveSol(mmgMesh,mmgSol,filename_os.c_str()) != 1 ) exit(EXIT_FAILURE);
206 filename_o3d = argv[2];
208 found = filename_o3d.find(
".mesh");
209 if (found==std::string::npos) {
210 found = filename_o3d.find(
".msh");
213 if (found!=std::string::npos) {
214 filename_o3d.replace(found,1,
"\0");
216 filename_o3d +=
".3d";
251 fprintf(stdout,
"BAD ENDING OF MMG3DLIB: UNABLE TO SAVE MESH\n");
254 fprintf(stdout,
"BAD ENDING OF MMG3DLIB\n");
263 if (
MMG3D_saveMesh(mmgMesh,filename_o3d.c_str()) != 1 ) exit(EXIT_FAILURE);
266 if (
MMG3D_saveSol(mmgMesh,mmgSol,filename_o3d.c_str()) != 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