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

Input / Output Functions. More...

#include "libmmgs.h"
#include "libmmgs_private.h"
#include <math.h>
Include dependency graph for inout_s.c:

Go to the source code of this file.

Functions

int MMGS_loadMesh (MMG5_pMesh mesh, const char *filename)
 Load a mesh (in .mesh/.mesb format) from file.
 
int MMGS_loadMshMesh (MMG5_pMesh mesh, MMG5_pSol sol, const char *filename)
 Load a mesh and possibly a solution in .msh format from file.
 
int MMGS_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 MMGS_loadGenericMesh (MMG5_pMesh mesh, MMG5_pSol met, MMG5_pSol sol, const char *filename)
 Load a mesh and all data from a file. The format will be guessed from the filename extension.
 
int MMGS_saveMesh (MMG5_pMesh mesh, const char *filename)
 Save a mesh in .mesh or .meshb format.
 
int MMGS_saveMshMesh (MMG5_pMesh mesh, MMG5_pSol sol, const char *filename)
 Write mesh and optionally one data field in MSH file format (.msh extension).
 
int MMGS_saveMshMesh_and_allData (MMG5_pMesh mesh, MMG5_pSol *sol, const char *filename)
 Save a mesh and multiple data fields in MSH format, ascii or binary depending on the filename extension.
 
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_loadAllSols (MMG5_pMesh mesh, MMG5_pSol *sol, const char *filename)
 Load one or more solutions in a solution file in medit file 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_saveAllSols (MMG5_pMesh mesh, MMG5_pSol *sol, const char *filename)
 Save one or more solutions in a solution file in medit file format.
 
int MMGS_saveGenericMesh (MMG5_pMesh mesh, MMG5_pSol sol, const char *filename)
 Save mesh data in a file whose format depends on the filename extension.
 

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_s.c.

Function Documentation

◆ MMGS_loadAllSols()

int MMGS_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 the file to load.
Returns
0 on failure, 1 otherwise.
Remarks
Fortran interface:

‍ SUBROUTINE MMGS_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 1387 of file inout_s.c.

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

◆ MMGS_loadGenericMesh()

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

Load a mesh and all data from a file. The format will be guessed from 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 the file to load.
Returns
0 on failure, 1 otherwise.
Remarks
Fortran interface:

‍ SUBROUTINE MMGS_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 764 of file inout_s.c.

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

◆ MMGS_loadMesh()

int MMGS_loadMesh ( MMG5_pMesh  mesh,
const char *  filename 
)

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

Parameters
meshpointer to the mesh structure.
filenamename of the file to load.
Returns
0 on failure, 1 otherwise.

This function reads .mesh (ASCII) and .meshb (binary) files. If the name contains ".mesh" the file will be read as an ASCII file and if the name contains .meshb it be read as a binary file. If the file contains neither of these strings the function will first try to open "[filename].meshb" and if this fails it will try "[filename].mesh".

Remarks
Fortran interface:

‍ SUBROUTINE MMGS_LOADMESH(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 41 of file inout_s.c.

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

◆ MMGS_loadMshMesh()

int MMGS_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 the file to load.
Returns
0 on failure, 1 otherwise.

Read a mesh and optionally one data field in MSH file format (.msh extension). We read only low-order vertices, edges, triangles, quadrangles, tetrahedra and prisms.

Remarks
Fortran interface:

‍ SUBROUTINE MMGS_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 645 of file inout_s.c.

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

◆ MMGS_loadMshMesh_and_allData()

int MMGS_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 the file to load.
Returns
0 on failure, 1 otherwise.

Read a mesh and multiple data in MSH file format (.msh extension). We read only low-order vertices, edges, triangles, quadrangles, tetrahedra and prisms.

Remarks
Fortran interface:

‍ SUBROUTINE MMGS_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 706 of file inout_s.c.

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

◆ MMGS_loadSol()

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

Load a metric field (or other solution) in medit's .sol format.

Parameters
meshpointer to the mesh structure.
metpointer to the sol structure.
filenamename of the file to load.
Returns
0 on failure, 1 otherwise.

Load metric field. The solution file (in medit file format) must contain only 1 solution: the metric.

Remarks
Fortran interface:

‍ SUBROUTINE MMGS_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 1312 of file inout_s.c.

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

◆ MMGS_saveAllSols()

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

Save 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 the solution file.
Returns
0 or -1 on failure, 1 otherwise.
Remarks
Fortran interface:

‍ SUBROUTINE MMGS_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 1520 of file inout_s.c.

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

◆ MMGS_saveGenericMesh()

int MMGS_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 the file to write.
Returns
0 on failure, 1 otherwise.
Remarks
Fortran interface:

‍ SUBROUTINE MMGS_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 1609 of file inout_s.c.

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

◆ MMGS_saveMesh()

int MMGS_saveMesh ( MMG5_pMesh  mesh,
const char *  filename 
)

Save a mesh in .mesh or .meshb format.

Parameters
meshpointer to the mesh structure.
filenamename of the file to load.
Returns
0 on failure, 1 otherwise.

This function saves a mesh in .mesh or .meshb format (depending on the filename extension).

Remarks
Fortran interface:

‍ SUBROUTINE MMGS_SAVEMESH(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 842 of file inout_s.c.

Here is the caller graph for this function:

◆ MMGS_saveMshMesh()

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

Write mesh and optionally one data field in MSH file format (.msh extension).

Parameters
meshpointer to the mesh structure.
solpointer to the solution structure.
filenamename of the file to load.
Returns
0 on failure, 1 otherwise.

The file is saved in ASCII format for .msh extension, an in binary format for a .mshb extension.

Remarks
Fortran interface:

‍ SUBROUTINE MMGS_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 1302 of file inout_s.c.

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

◆ MMGS_saveMshMesh_and_allData()

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

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

Parameters
meshpointer to the mesh structure.
solpointer to the solution structure.
filenamename of the file to write.
Returns
0 on failure, 1 otherwise.

This function saves a mesh and multiple data fields (that are considered as solutions and not metrics, thus, we do nothing over the ridge vertices) in MSH file format (.msh extension). The file is saved in ASCII format for .msh extension and in binary format for a .mshb extension.

Remarks
Fortran interface:

‍ SUBROUTINE MMGS_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 1307 of file inout_s.c.

Here is the call graph for this function:

◆ MMGS_saveSol()

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

Write an isotropic or anisotropic metric in medit file format.

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

‍ SUBROUTINE MMGS_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 1483 of file inout_s.c.

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