Mmg
Simplicial remeshers (mesh adaptation, isovalue discretization, lagrangian movement)
Functions
inout_3d.c File Reference

Input / Output Functions. More...

#include "libmmg3d.h"
#include "libmmg3d_private.h"
Include dependency graph for inout_3d.c:

Go to the source code of this file.

Functions

int MMG3D_openMesh (int imprim, const char *filename, FILE **inm, int *bin, char *modeASCII, char *modeBIN)
 
int MMG3D_loadMesh_opened (MMG5_pMesh mesh, FILE *inm, int bin)
 
int MMG3D_loadMesh (MMG5_pMesh mesh, const char *filename)
 Load a mesh (in .mesh/.mesb format) from file.
 
int MMG3D_loadMshMesh (MMG5_pMesh mesh, MMG5_pSol sol, const char *filename)
 Load a mesh and possibly a solution in .msh format from file.
 
int MMG3D_loadMshMesh_and_allData (MMG5_pMesh mesh, MMG5_pSol *sol, const char *filename)
 Load a mesh and all data from a file in MSH format.
 
int MMG3D_loadGenericMesh (MMG5_pMesh mesh, MMG5_pSol met, MMG5_pSol sol, const char *filename)
 Read mesh data in a format determined by the filename extension.
 
int MMG3D_saveMesh (MMG5_pMesh mesh, const char *filename)
 Save a mesh in .mesh/.meshb format.
 
int MMG3D_saveGenericMesh (MMG5_pMesh mesh, MMG5_pSol sol, const char *filename)
 Save mesh data in a file whose format depends on the filename extension.
 
int MMG3D_saveMshMesh (MMG5_pMesh mesh, MMG5_pSol sol, const char *filename)
 Save a mesh in MSH format, ascii or binary depending on the filename extension.
 
int MMG3D_saveMshMesh_and_allData (MMG5_pMesh mesh, MMG5_pSol *sol, const char *filename)
 Save a mesh and data in MSH format, ascii or binary depending on the filename extension.
 
int MMG3D_loadSol (MMG5_pMesh mesh, MMG5_pSol met, const char *filename)
 Load a metric field (or other solution).
 
int MMG3D_loadAllSols (MMG5_pMesh mesh, MMG5_pSol *sol, const char *filename)
 Load one or more solutions in a solution file in medit file format.
 
int MMG3D_saveSol (MMG5_pMesh mesh, MMG5_pSol met, const char *filename)
 Write isotropic or anisotropic metric.
 
int MMG3D_saveAllSols (MMG5_pMesh mesh, MMG5_pSol *sol, const char *filename)
 Save 1 or more solutions in medit solution file format.
 
static int MMG3D_saveEle (MMG5_pMesh mesh, const char *filename)
 
static int MMG3D_saveNeigh (MMG5_pMesh mesh, const char *filename)
 
static int MMG3D_saveFace (MMG5_pMesh mesh, const char *filename)
 
int MMG3D_saveTetgenMesh (MMG5_pMesh mesh, const char *filename)
 Save data in Tetgen's Triangle format.
 

Detailed Description

Input / Output Functions.

Author
Charles Dapogny (UPMC)
Cécile Dobrzynski (Bx INP/Inria/UBordeaux)
Pascal Frey (UPMC)
Algiane Froehly (Inria/UBordeaux)
Version
5
Todo:
doxygen documentation.

Definition in file inout_3d.c.

Function Documentation

◆ MMG3D_loadAllSols()

int MMG3D_loadAllSols ( MMG5_pMesh  mesh,
MMG5_pSol sol,
const char *  filename 
)

Load one or more solutions in a solution file in medit file format.

Parameters
meshpointer to the mesh structure.
solpointer to the solutions array
filenamename of file.
Returns
0 if file is not found, -1 if fail for another reason (insufficient memory, file format...), 1 if successful.
Remarks
Fortran interface:

‍ SUBROUTINE MMG3D_LOADALLSOLS(mesh,sol,filename,strlen0,retval)
MMG5_DATA_PTR_T, INTENT(INOUT) :: mesh,sol
CHARACTER(LEN=*), INTENT(IN) :: filename
INTEGER, INTENT(IN) :: strlen0
INTEGER, INTENT(OUT) :: retval
END SUBROUTINE

Read the file header

Sol tab allocation

Definition at line 2216 of file inout_3d.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ MMG3D_loadGenericMesh()

int MMG3D_loadGenericMesh ( MMG5_pMesh  mesh,
MMG5_pSol  met,
MMG5_pSol  sol,
const char *  filename 
)

Read mesh data in a format determined by the filename extension.

Parameters
meshpointer to the mesh structure.
metpointer to the metric structure or the NULL pointer.
solpointer to the level-set structure or the NULL pointer.
filenamename of file.
Returns
0 if file is not found, -1 if fail for another reason (insufficient memory, file format...), 1 if success.
Remarks
Fortran interface:

‍ SUBROUTINE MMG3D_LOADGENERICMESH(mesh,met,sol,filename,strlen0,retval)
MMG5_DATA_PTR_T, INTENT(INOUT) :: mesh,met,sol
CHARACTER(LEN=*), INTENT(IN) :: filename
INTEGER, INTENT(IN) :: strlen0
INTEGER, INTENT(OUT) :: retval
END SUBROUTINE

Definition at line 1190 of file inout_3d.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ MMG3D_loadMesh()

int MMG3D_loadMesh ( MMG5_pMesh  mesh,
const char *  filename 
)

Load a mesh (in .mesh/.mesb format) from file.

Parameters
meshpointer to the mesh structure.
filenamename of file.
Returns
0 if the file is not found, -1 if we detect mismatch parameters or we fail, 1 otherwise.

Read mesh data.

Definition at line 1049 of file inout_3d.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ MMG3D_loadMesh_opened()

int MMG3D_loadMesh_opened ( MMG5_pMesh  mesh,
FILE *  inm,
int  bin 
)

Definition at line 113 of file inout_3d.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ MMG3D_loadMshMesh()

int MMG3D_loadMshMesh ( MMG5_pMesh  mesh,
MMG5_pSol  sol,
const char *  filename 
)

Load a mesh and possibly a solution in .msh format from file.

Parameters
meshpointer to the mesh structure.
solpointer to the solution structure.
filenamename of file.
Returns
0 if file is not found, -1 if fail for another reason (insufficient memory, file format...), 1 if success.

This function reads a mesh and 0 or 1 data fields in MSH file format (.msh extension). We read only low-order vertices, edges, triangles, quadrangles, tetrahedra and prisms.

Remarks
Fortran interface:

‍ SUBROUTINE MMG3D_LOADMSHMESH(mesh,sol,filename,strlen0,retval)
MMG5_DATA_PTR_T, INTENT(INOUT) :: mesh,sol
CHARACTER(LEN=*), INTENT(IN) :: filename
INTEGER, INTENT(IN) :: strlen0
INTEGER, INTENT(OUT) :: retval
END SUBROUTINE

Definition at line 1063 of file inout_3d.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ MMG3D_loadMshMesh_and_allData()

int MMG3D_loadMshMesh_and_allData ( MMG5_pMesh  mesh,
MMG5_pSol sol,
const char *  filename 
)

Load a mesh and all data from a file in MSH format.

Parameters
meshpointer to the mesh structure.
solpointer to a list of solution structures.
filenamename of file.
Returns
0 if file is not found, -1 if fail for another reason (insufficient memory, file format...), 1 if success.

Read mesh and a list of data in MSH file format (.msh extension). We read only low-order vertices, edges, tria, quadra, tetra and prisms.

Remarks
Fortran interface:

‍ SUBROUTINE MMG3D_LOADMSHMESH_AND_ALLDATA(mesh,sol,filename,strlen0,retval)
MMG5_DATA_PTR_T, INTENT(INOUT) :: mesh,sol
CHARACTER(LEN=*), INTENT(IN) :: filename
INTEGER, INTENT(IN) :: strlen0
INTEGER, INTENT(OUT) :: retval
END SUBROUTINE

Definition at line 1132 of file inout_3d.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ MMG3D_loadSol()

int MMG3D_loadSol ( MMG5_pMesh  mesh,
MMG5_pSol  met,
const char *  filename 
)

Load a metric field (or other solution).

Parameters
meshpointer to the mesh structure.
metpointer to the sol structure.
filenamename of file.
Returns
0 if file is not found, -1 if fail for another reason (insufficient memory, file format...), 1 if successful.

Load metric field. The solution file must contains only 1 solution: the metric

Remarks
Fortran interface:

‍ SUBROUTINE MMG3D_LOADSOL(mesh,met,filename,strlen0,retval)
MMG5_DATA_PTR_T, INTENT(INOUT) :: mesh,met
CHARACTER(LEN=*), INTENT(IN) :: filename
INTEGER, INTENT(IN) :: strlen0
INTEGER, INTENT(OUT) :: retval
END SUBROUTINE

Read the file header

Definition at line 2143 of file inout_3d.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ MMG3D_openMesh()

int MMG3D_openMesh ( int  imprim,
const char *  filename,
FILE **  inm,
int *  bin,
char *  modeASCII,
char *  modeBIN 
)
Parameters
imprimverbosity level (muted for stdout if -1)
filenamefile to open
inmpointer to the file unit
bin1 if file will be at binary format
modeASCIImode in which to open an ascii file ("r","r+","w","w+",...)
modeASCIImode in which to open an ascii file ("r","r+","w","w+",...)
Returns
0 if the file could not be opened, -1 for other errors, 1 if success.

Try to open a Medit file in the requested mode (read only, write, etc) and store if file is binary (depending on the extension).

Definition at line 53 of file inout_3d.c.

Here is the caller graph for this function:

◆ MMG3D_saveAllSols()

int MMG3D_saveAllSols ( MMG5_pMesh  mesh,
MMG5_pSol sol,
const char *  filename 
)

Save 1 or more solutions in medit solution file format.

Parameters
meshpointer to the mesh structure.
solpointer to the solutions array
filenamename of the solution file.
Returns
0 or -1 if fail, 1 otherwise.
Remarks
Fortran interface:

‍ SUBROUTINE MMG3D_SAVEALLSOLS(mesh,sol,filename,strlen0,retval)
MMG5_DATA_PTR_T, INTENT(INOUT) :: mesh,sol
CHARACTER(LEN=*), INTENT(IN) :: filename
INTEGER, INTENT(IN) :: strlen0
INTEGER, INTENT(OUT) :: retval
END SUBROUTINE

Definition at line 2352 of file inout_3d.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ MMG3D_saveEle()

static int MMG3D_saveEle ( MMG5_pMesh  mesh,
const char *  filename 
)
inlinestatic

Definition at line 2442 of file inout_3d.c.

Here is the caller graph for this function:

◆ MMG3D_saveFace()

static int MMG3D_saveFace ( MMG5_pMesh  mesh,
const char *  filename 
)
inlinestatic

Definition at line 2594 of file inout_3d.c.

Here is the caller graph for this function:

◆ MMG3D_saveGenericMesh()

int MMG3D_saveGenericMesh ( MMG5_pMesh  mesh,
MMG5_pSol  sol,
const char *  filename 
)

Save mesh data in a file whose format depends on the filename extension.

Parameters
meshpointer to the mesh structure.
filenamename of file.
Returns
0 if failed, 1 otherwise.
Remarks
Fortran interface:

‍ SUBROUTINE MMG3D_SAVEGENERICMESH(mesh,sol,filename,strlen0,retval)
MMG5_DATA_PTR_T, INTENT(INOUT) :: mesh,sol
CHARACTER(LEN=*), INTENT(IN) :: filename
INTEGER, INTENT(IN) :: strlen0
INTEGER, INTENT(OUT) :: retval
END SUBROUTINE

Definition at line 2062 of file inout_3d.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ MMG3D_saveMesh()

int MMG3D_saveMesh ( MMG5_pMesh  mesh,
const char *  filename 
)

Save a mesh in .mesh/.meshb format.

Parameters
meshpointer to the mesh structure.
filenamepointer to the name of file.
Returns
0 if failed, 1 otherwise.

Save mesh data.

Warning
you must call the MMG3D_packMesh function before saving your mesh.

Definition at line 1273 of file inout_3d.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ MMG3D_saveMshMesh()

int MMG3D_saveMshMesh ( MMG5_pMesh  mesh,
MMG5_pSol  sol,
const char *  filename 
)

Save a mesh in MSH format, ascii or binary depending on the filename extension.

Parameters
meshpointer to the mesh structure.
solpointer to the solution structure.
filenamename of file.
Returns
0 if failed, 1 otherwise.

Write mesh and 0 or 1 data in MSH file format (.msh extension). Write binary file for .mshb extension and ASCII for .msh one.

Remarks
Fortran interface:

‍ SUBROUTINE MMG3D_SAVEMSHMESH(mesh,sol,filename,strlen0,retval)
MMG5_DATA_PTR_T, INTENT(INOUT) :: mesh,sol
CHARACTER(LEN=*), INTENT(IN) :: filename
INTEGER, INTENT(IN) :: strlen0
INTEGER, INTENT(OUT) :: retval
END SUBROUTINE

Definition at line 2133 of file inout_3d.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ MMG3D_saveMshMesh_and_allData()

int MMG3D_saveMshMesh_and_allData ( MMG5_pMesh  mesh,
MMG5_pSol sol,
const char *  filename 
)

Save a mesh and data in MSH format, ascii or binary depending on the filename extension.

Parameters
meshpointer to the mesh structure.
solpointer to the solution structure.
filenamename of file.
Returns
0 if failed, 1 otherwise.

Write mesh and a list of data fields (that are considered as solutions and not metrics, thus, we do nothing over the ridge vertices) in MSH file format (.msh extension). Save file in ASCII format for .msh extension, in binary format for .mshb one.

Remarks
Fortran interface:

‍ SUBROUTINE MMG3D_SAVEMSHMESH_AND_ALLDATA(mesh,sol,filename,strlen0,retval)
MMG5_DATA_PTR_T, INTENT(INOUT) :: mesh,sol
CHARACTER(LEN=*), INTENT(IN) :: filename
INTEGER, INTENT(IN) :: strlen0
INTEGER, INTENT(OUT) :: retval
END SUBROUTINE

Definition at line 2138 of file inout_3d.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ MMG3D_saveNeigh()

static int MMG3D_saveNeigh ( MMG5_pMesh  mesh,
const char *  filename 
)
inlinestatic

Definition at line 2514 of file inout_3d.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ MMG3D_saveSol()

int MMG3D_saveSol ( MMG5_pMesh  mesh,
MMG5_pSol  met,
const char *  filename 
)

Write isotropic or anisotropic metric.

Parameters
meshpointer to the mesh structure.
metpointer to the sol structure.
filenamename of file.
Returns
0 if failed, 1 otherwise.
Remarks
Fortran interface:

‍ SUBROUTINE MMG3D_SAVESOL(mesh,met,filename,strlen0,retval)
MMG5_DATA_PTR_T, INTENT(INOUT) :: mesh,met
CHARACTER(LEN=*), INTENT(IN) :: filename
INTEGER, INTENT(IN) :: strlen0
INTEGER, INTENT(OUT) :: retval
END SUBROUTINE

Definition at line 2314 of file inout_3d.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ MMG3D_saveTetgenMesh()

int MMG3D_saveTetgenMesh ( MMG5_pMesh  mesh,
const char *  filename 
)

Save data in Tetgen's Triangle format.

Parameters
meshpointer to the mesh structure.
filenamename of the readed file.
Returns
0 or -1 if fail, 1 otherwise.

Save mesh data in Triangle (or equivalent to Tetgen in 3D) file format.

Remarks
Fortran interface:

‍ SUBROUTINE MMG3D_SAVETETGENMESH(mesh,filename,strlen0,retval)
MMG5_DATA_PTR_T, INTENT(INOUT) :: mesh
CHARACTER(LEN=*), INTENT(IN) :: filename
INTEGER, INTENT(IN) :: strlen0
INTEGER, INTENT(OUT) :: retval
END SUBROUTINE

Definition at line 2658 of file inout_3d.c.

Here is the call graph for this function:
Here is the caller graph for this function: