Mmg
Simplicial remeshers (mesh adaptation, isovalue discretization, lagrangian movement)
Functions
inout_2d.c File Reference
#include "libmmg2d.h"
#include "libmmg2d_private.h"
Include dependency graph for inout_2d.c:

Go to the source code of this file.

Functions

int MMG2D_loadMesh (MMG5_pMesh mesh, const char *filename)
 Load a mesh (in .mesh/.mesb format) from file.
 
int MMG2D_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 MMG2D_2dMeshCheck (MMG5_pMesh mesh)
 
int MMG2D_loadMshMesh (MMG5_pMesh mesh, MMG5_pSol sol, const char *filename)
 Load a mesh and possibly a solution in .msh format from file.
 
int MMG2D_loadMshMesh_and_allData (MMG5_pMesh mesh, MMG5_pSol *sol, const char *filename)
 Load a mesh and all data from a file in MSH format.
 
static int MMG2D_readFloatSol (MMG5_pSol sol, FILE *inm, int bin, int iswp, MMG5_int pos)
 
static int MMG2D_readDoubleSol (MMG5_pSol sol, FILE *inm, int bin, int iswp, MMG5_int pos)
 
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 MMG2D_loadAllSols (MMG5_pMesh mesh, MMG5_pSol *sol, const char *filename)
 Load one or more solutions in a solution file in medit file format.
 
int MMG2D_saveMesh (MMG5_pMesh mesh, const char *filename)
 Save a mesh in .mesh/.meshb format.
 
int MMG2D_saveMshMesh (MMG5_pMesh mesh, MMG5_pSol sol, const char *filename)
 Save a mesh and optionally one data field in MSH format, ascii or binary depending on the filename extension.
 
int MMG2D_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.
 
static void MMG2D_writeDoubleSol (MMG5_pSol sol, FILE *inm, int bin, MMG5_int pos, int gmsh)
 
int MMG2D_saveSol (MMG5_pMesh mesh, MMG5_pSol sol, const char *filename)
 Save metric field in medit solution file format.
 
int MMG2D_saveAllSols (MMG5_pMesh mesh, MMG5_pSol *sol, const char *filename)
 Save one or more solutions in a solution file in medit file format.
 
int MMG2D_savemesh_db (MMG5_pMesh mesh, char *filename, int8_t pack)
 
int MMG2D_savemet_db (MMG5_pMesh mesh, MMG5_pSol met, char *filename, int8_t pack)
 
int MMG2D_savenor_db (MMG5_pMesh mesh, char *filename, int8_t pack)
 
int MMG2D_savedisp_db (MMG5_pMesh mesh, MMG5_pSol disp, char *filename, int8_t pack)
 
static int MMG2D_saveEle (MMG5_pMesh mesh, const char *filename)
 
static int MMG2D_saveNeigh (MMG5_pMesh mesh, const char *filename)
 
static int MMG2D_saveEdge (MMG5_pMesh mesh, const char *filename)
 
int MMG2D_saveTetgenMesh (MMG5_pMesh mesh, const char *filename)
 Save data in Tetgen's Triangle format.
 
int MMG2D_saveGenericMesh (MMG5_pMesh mesh, MMG5_pSol sol, const char *filename)
 Save mesh data in a file whose format depends on the filename extension.
 

Function Documentation

◆ MMG2D_2dMeshCheck()

int MMG2D_2dMeshCheck ( MMG5_pMesh  mesh)
Parameters
meshpointer to the mesh structure.
Returns
0 if failed, 1 otherwise.

Check mesh data for a Msh mesh : mark the vertices as used if no triangles in the mesh (mesh generation) and check that all z-componants are 0.

Definition at line 679 of file inout_2d.c.

Here is the caller graph for this function:

◆ MMG2D_loadAllSols()

int MMG2D_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 an allocatable sol structure.
filenamename of file.
Returns
-1 data invalid or we fail, 0 no file, 1 ok.

Load a medit solution file containing 1 or more solutions.

Read the file header

Sol tab allocation

Definition at line 996 of file inout_2d.c.

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

◆ MMG2D_loadGenericMesh()

int MMG2D_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 the file to load.
Returns
0 if the file is not found, -1 if failing for another reason (insufficient memory, file format...), 1 on success.
Remarks
Fortran interface:

‍ SUBROUTINE MMG2D_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 597 of file inout_2d.c.

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

◆ MMG2D_loadMesh()

int MMG2D_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 readed file.
Returns
0 if the file is not found, -1 in case of failure for another reason (insufficient memory, file format...), 1 on success.
Remarks
Fortran interface:

‍ SUBROUTINE MMG2D_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 28 of file inout_2d.c.

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

◆ MMG2D_loadMshMesh()

int MMG2D_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 if the file is not found, -1 if failing for another reason (lack of memory, file format...), 1 on 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, and quadrangles.

Remarks
Fortran interface:

‍ SUBROUTINE MMG2D_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 706 of file inout_2d.c.

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

◆ MMG2D_loadMshMesh_and_allData()

int MMG2D_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 if the file is not found, -1 if failing for another reason (lack of memory, file format...), 1 on success.

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

Remarks
Fortran interface:

‍ SUBROUTINE MMG2D_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 772 of file inout_2d.c.

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

◆ MMG2D_loadSol()

int MMG2D_loadSol ( MMG5_pMesh  mesh,
MMG5_pSol  sol,
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 file.
Returns
-1 data invalid or we fail, 0 no file, 1 ok.

Load metric field.

Read the file header

Definition at line 905 of file inout_2d.c.

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

◆ MMG2D_readDoubleSol()

static int MMG2D_readDoubleSol ( MMG5_pSol  sol,
FILE *  inm,
int  bin,
int  iswp,
MMG5_int  pos 
)
inlinestatic
Parameters
solpointer to an allocatable sol structure.
inmpointer to the solution file
bin1 if binary file
iswpEndianess
indexof the readed solution
Returns
1 if success, -1 if fail

Read the solution value for vertex of index pos in double precision.

Definition at line 878 of file inout_2d.c.

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

◆ MMG2D_readFloatSol()

static int MMG2D_readFloatSol ( MMG5_pSol  sol,
FILE *  inm,
int  bin,
int  iswp,
MMG5_int  pos 
)
inlinestatic
Parameters
solpointer to an allocatable sol structure.
inmpointer to the solution file
bin1 if binary file
iswpEndianess
indexof the readed solution
Returns
1 if success, -1 if fail

Read the solution value for vertex of index pos in floating precision.

Definition at line 847 of file inout_2d.c.

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

◆ MMG2D_saveAllSols()

int MMG2D_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 file.
Returns
0 if failed, 1 otherwise.

Write 1 or more solutions.

Definition at line 1678 of file inout_2d.c.

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

◆ MMG2D_savedisp_db()

int MMG2D_savedisp_db ( MMG5_pMesh  mesh,
MMG5_pSol  disp,
char *  filename,
int8_t  pack 
)

Definition at line 1989 of file inout_2d.c.

◆ MMG2D_saveEdge()

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

Definition at line 2192 of file inout_2d.c.

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

◆ MMG2D_saveEle()

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

Definition at line 2041 of file inout_2d.c.

Here is the caller graph for this function:

◆ MMG2D_saveGenericMesh()

int MMG2D_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 MMG2D_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 2235 of file inout_2d.c.

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

◆ MMG2D_saveMesh()

int MMG2D_saveMesh ( MMG5_pMesh  mesh,
const char *  filename 
)

Save a mesh in .mesh/.meshb format.

Parameters
meshpointer to the mesh structure.
filenamename of the readed file.
Returns
0 or -1 on failure, 1 otherwise.
Remarks
Fortran interface:

‍ SUBROUTINE MMG2D_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 1101 of file inout_2d.c.

Here is the caller graph for this function:

◆ MMG2D_savemesh_db()

int MMG2D_savemesh_db ( MMG5_pMesh  mesh,
char *  filename,
int8_t  pack 
)

Definition at line 1781 of file inout_2d.c.

◆ MMG2D_savemet_db()

int MMG2D_savemet_db ( MMG5_pMesh  mesh,
MMG5_pSol  met,
char *  filename,
int8_t  pack 
)

Definition at line 1874 of file inout_2d.c.

◆ MMG2D_saveMshMesh()

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

Save a mesh and optionally one data field 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 writes a mesh and optionally one data field in MSH file format (.msh extension). It uses ASCII format for .msh extension, binary format for .msb extension.

Remarks
Fortran interface:

‍ SUBROUTINE MMG2D_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 1536 of file inout_2d.c.

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

◆ MMG2D_saveMshMesh_and_allData()

int MMG2D_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 writes a mesh and a list of data fields in MSH file format (.msh extension). It uses ASCII format for .msh extension, binary format for .mshb extension.

Remarks
Fortran interface:

‍ SUBROUTINE MMG2D_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 1540 of file inout_2d.c.

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

◆ MMG2D_saveNeigh()

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

Definition at line 2113 of file inout_2d.c.

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

◆ MMG2D_savenor_db()

int MMG2D_savenor_db ( MMG5_pMesh  mesh,
char *  filename,
int8_t  pack 
)

Definition at line 1934 of file inout_2d.c.

◆ MMG2D_saveSol()

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

Save metric field in medit solution file format.

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

Write isotropic or anisotropic metric.

Definition at line 1617 of file inout_2d.c.

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

◆ MMG2D_saveTetgenMesh()

int MMG2D_saveTetgenMesh ( MMG5_pMesh  mesh,
const char *  filename 
)

Save data in Tetgen's Triangle format.

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

This function saves mesh data in Triangle (or equivalent to Tetgen in 2D) file format.

Remarks
Fortran interface:

‍ SUBROUTINE MMG2D_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 2214 of file inout_2d.c.

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

◆ MMG2D_writeDoubleSol()

static void MMG2D_writeDoubleSol ( MMG5_pSol  sol,
FILE *  inm,
int  bin,
MMG5_int  pos,
int  gmsh 
)
inlinestatic
Parameters
solpointer to an allocatable sol structure.
inmpointer to the solution file
bin1 if binary file
indexof the writted solution
gmshwrite in 3D (for gmsh) if 1

Write the solution value for vertex of index pos in double precision.

Definition at line 1555 of file inout_2d.c.

Here is the caller graph for this function: