mmg2d
inout.c File Reference

Input / Output Functions. More...

#include "mmgcommon.h"
Include dependency graph for inout.c:

Functions

int MMG5_swapbin (int sbin)
 
float MMG5_swapf (float sbin)
 
double MMG5_swapd (double sbin)
 
static int MMG5_countBinaryElts (FILE **inm, const int nelts, const int iswp, int *np, int *na, int *nt, int *nq, int *ne, int *npr)
 
int MMG5_loadMshMesh_part1 (MMG5_pMesh mesh, const char *filename, FILE **inm, long *posNodes, long *posElts, long **posNodeData, int *bin, int *iswp, int *nelts, int *nsols)
 
int MMG5_check_readedMesh (MMG5_pMesh mesh, int nref)
 
int MMG5_loadMshMesh_part2 (MMG5_pMesh mesh, MMG5_pSol *sol, FILE **inm, const long posNodes, const long posElts, const long *posNodeData, const int bin, const int iswp, const int nelts, const int nsols)
 
void MMG5_build3DMetric (MMG5_pMesh mesh, MMG5_pSol sol, int ip, double dbuf[6])
 
int MMG5_saveMshMesh (MMG5_pMesh mesh, MMG5_pSol *sol, const char *filename, int metricData)
 
int MMG5_loadSolHeader (const char *filename, int meshDim, FILE **inm, int *ver, int *bin, int *iswp, int *np, int *dim, int *nsols, int **type, long *posnp, int imprim)
 
int MMG5_readFloatSol3D (MMG5_pSol sol, FILE *inm, int bin, int iswp, int pos)
 
int MMG5_readDoubleSol3D (MMG5_pSol sol, FILE *inm, int bin, int iswp, int pos)
 
void MMG5_writeDoubleSol3D (MMG5_pMesh mesh, MMG5_pSol sol, FILE *inm, int bin, int pos, int metricData)
 
int MMG5_saveSolHeader (MMG5_pMesh mesh, const char *filename, FILE **inm, int ver, int *bin, int *bpos, int np, int dim, int nsols, int *entities, int *type, int *size)
 
int MMG5_saveSolAtTrianglesHeader (MMG5_pMesh mesh, FILE *inm, int ver, int bin, int *bpos, int nsols, int nsolsAtTriangles, int *entities, int *type, int *size)
 
int MMG5_saveSolAtTetrahedraHeader (MMG5_pMesh mesh, FILE *inm, int ver, int bin, int *bpos, int nsols, int nsolsAtTetra, int *entities, int *type, int *size)
 
int MMG5_chkMetricType (MMG5_pMesh mesh, int *type, FILE *inm)
 
void MMG5_printMetStats (MMG5_pMesh mesh, MMG5_pSol met)
 
void MMG5_printSolStats (MMG5_pMesh mesh, MMG5_pSol *sol)
 
int MMG5_saveNode (MMG5_pMesh mesh, const char *filename)
 
int MMG5_saveEdge (MMG5_pMesh mesh, const char *filename, const char *ext)
 

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.

Function Documentation

◆ MMG5_build3DMetric()

void MMG5_build3DMetric ( MMG5_pMesh  mesh,
MMG5_pSol  sol,
int  ip,
double  dbuf[6] 
)
Parameters
meshpointer toward the mesh structure
solpointer toward the sol structure.
indexof point in which we want to build the metric
dbufbuilded metric

Build the metric at point ip depending with its type (ridge/not ridge).

Here is the caller graph for this function:

◆ MMG5_check_readedMesh()

int MMG5_check_readedMesh ( MMG5_pMesh  mesh,
int  nref 
)
Parameters
meshpointer toward an Mmg mesh
nrefpointer toward the number of negative refs (replaced by abolute values).
Returns
1 if success, 0 otherwise

Check the tetra orientation, print warning it negative refs have been detected, mark points as used and remove elt refs in iso mode.

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

◆ MMG5_chkMetricType()

int MMG5_chkMetricType ( MMG5_pMesh  mesh,
int *  type,
FILE *  inm 
)
Parameters
meshpointer toward the mesh structure.
typetype of the metric
inmmetric file
Returns
1 if success, -1 if fail

Check if the type of the metric is compatible with the remeshing mode. If not, close the metric file (note that if type is an allocated array, you must unallocate it outside).

Here is the caller graph for this function:

◆ MMG5_countBinaryElts()

static int MMG5_countBinaryElts ( FILE **  inm,
const int  nelts,
const int  iswp,
int *  np,
int *  na,
int *  nt,
int *  nq,
int *  ne,
int *  npr 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ MMG5_loadMshMesh_part1()

int MMG5_loadMshMesh_part1 ( MMG5_pMesh  mesh,
const char *  filename,
FILE **  inm,
long *  posNodes,
long *  posElts,
long **  posNodeData,
int *  bin,
int *  iswp,
int *  nelts,
int *  nsols 
)
Parameters
meshpointer toward the mesh
filenamepointer toward the name of file
inmpointer toward the file pointer
posNodespointer toward the position of nodes data in file
posEltspointer toward the position of elts data in file
posNodeDatapointer toward the list of the positions of data in file
bin1 if binary format
neltsnumber of elements in file
nsolnumber of data in file
Returns
1 if success, 0 if file is not found, -1 if fail.

Begin to read mesh at MSH file format. Read the mesh size informations.

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

◆ MMG5_loadMshMesh_part2()

int MMG5_loadMshMesh_part2 ( MMG5_pMesh  mesh,
MMG5_pSol sol,
FILE **  inm,
const long  posNodes,
const long  posElts,
const long *  posNodeData,
const int  bin,
const int  iswp,
const int  nelts,
const int  nsols 
)
Parameters
meshpointer toward the mesh
solpointer toward the solutions array
inmpointer toward the file pointer
posNodesposition of nodes data in file
posEltsposition of elts data in file
posNodeDataposition of solution data in file
bin1 if binary format
neltsnumber of elements in file
nsolsnumber of silutions in file
Returns
1 if success, 0 if fail.

End to read mesh and solution array at MSH file format after the mesh/solution array alloc.

Second step: read the nodes and elements

Read the solution at nodes

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

◆ MMG5_loadSolHeader()

int MMG5_loadSolHeader ( const char *  filename,
int  meshDim,
FILE **  inm,
int *  ver,
int *  bin,
int *  iswp,
int *  np,
int *  dim,
int *  nsols,
int **  type,
long *  posnp,
int  imprim 
)
Parameters
filenamename of file.
meshDimmesh dimenson.
inmallocatable pointer toward the FILE structure
verfile version (1=simple precision, 2=double)
bin1 if the file is a binary
iswp1 or 0 depending on the endianness (binary only)
npnumber of solutions of each type
dimsolution dimension
nsolsnumber of solutions of different types in the file
typetype of solutions
posnppointer toward the position of the point list in the file
imprimverbosity
Returns
-1 data invalid or we fail, 0 no file, 1 ok.

Open the "filename" solution file and read the file header.

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

◆ MMG5_printMetStats()

void MMG5_printMetStats ( MMG5_pMesh  mesh,
MMG5_pSol  met 
)
Parameters
meshpointer toward the mesh structure.
metpointer toward the metric structure.

print metric statistics

Here is the caller graph for this function:

◆ MMG5_printSolStats()

void MMG5_printSolStats ( MMG5_pMesh  mesh,
MMG5_pSol sol 
)
Parameters
meshpointer toward the mesh structure.
solpointer toward the solutions array.

print solutions statistics

Here is the caller graph for this function:

◆ MMG5_readDoubleSol3D()

int MMG5_readDoubleSol3D ( MMG5_pSol  sol,
FILE *  inm,
int  bin,
int  iswp,
int  pos 
)
Parameters
solpointer toward an allocatable sol structure.
inmpointer toward 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.

Here is the call graph for this function:

◆ MMG5_readFloatSol3D()

int MMG5_readFloatSol3D ( MMG5_pSol  sol,
FILE *  inm,
int  bin,
int  iswp,
int  pos 
)
Parameters
solpointer toward an allocatable sol structure.
inmpointer toward 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.

Here is the call graph for this function:

◆ MMG5_saveEdge()

int MMG5_saveEdge ( MMG5_pMesh  mesh,
const char *  filename,
const char *  ext 
)
Parameters
meshpointer toward the mesh structure.
filenamename of file.
extfile extension (.poly or .edge)
Returns
1 if success, 0 if fail.

Save edge list at .edge file format (Tetgen/Triangle).

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

◆ MMG5_saveMshMesh()

int MMG5_saveMshMesh ( MMG5_pMesh  mesh,
MMG5_pSol sol,
const char *  filename,
int  metricData 
)
Parameters
meshpointer toward the mesh structure.
solpointer toward an array of solutions.
filenamename of file.
metricData1 if the data saved is a metric (if only 1 data)
Returns
0 if failed, 1 otherwise.

Write mesh and a list of solutions at MSH file format (.msh extension). Write binary file for .mshb extension.and ASCII for .msh one.

First step: Count the number of elements of each type

Second step: save the elements at following format: "idx type tagNumber tag0 tag1... v0_elt v1_elt..."

Write solution

Save the solution at following format: "idx sol"

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

◆ MMG5_saveNode()

int MMG5_saveNode ( MMG5_pMesh  mesh,
const char *  filename 
)
Parameters
meshpointer toward the mesh structure.
filenamename of file.
Returns
1 if success, 0 if fail.

Save node list at .node file format (Tetgen/Triangle).

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

◆ MMG5_saveSolAtTetrahedraHeader()

int MMG5_saveSolAtTetrahedraHeader ( MMG5_pMesh  mesh,
FILE *  inm,
int  ver,
int  bin,
int *  bpos,
int  nsols,
int  nsolsAtTetra,
int *  entities,
int *  type,
int *  size 
)
Parameters
meshpointer toward the mesh structure.
inmpointer toward the opened file unit.
verfile version (1=simple precision, 2=double).
bin1 if the file is a binary.
bposcumulative field position for binary Medit format.
nsolsnumber of solutions of different types in the file.
nsolsAtTetranumber of solutions at tetra in the file.
entitieskind of entity on which the solution applies.
typetype of solutions.
sizesize of solutions.

Save the number and type of solutions at Tetrahedron (not used by Mmg).

◆ MMG5_saveSolAtTrianglesHeader()

int MMG5_saveSolAtTrianglesHeader ( MMG5_pMesh  mesh,
FILE *  inm,
int  ver,
int  bin,
int *  bpos,
int  nsols,
int  nsolsAtTriangles,
int *  entities,
int *  type,
int *  size 
)
Parameters
meshpointer toward the mesh structure.
inmpointer toward the opened file unit.
verfile version (1=simple precision, 2=double).
bin1 if the file is a binary.
bposcumulative field position for binary Medit format.
nsolsnumber of solutions of different types in the file.
nsolsAtTrianglesnumber of solutions at triangles in the file.
entitieskind of entity on which the solution applies.
typetype of solutions.
sizesize of solutions.

Save the number and type of solutions at Triangles (not used by Mmg).

Here is the caller graph for this function:

◆ MMG5_saveSolHeader()

int MMG5_saveSolHeader ( MMG5_pMesh  mesh,
const char *  filename,
FILE **  inm,
int  ver,
int *  bin,
int *  bpos,
int  np,
int  dim,
int  nsols,
int *  entities,
int *  type,
int *  size 
)
Parameters
meshpointer toward the mesh structure.
filenamename of file.
inmallocatable pointer toward the FILE structure.
verfile version (1=simple precision, 2=double).
bin1 if the file is a binary.
bposcumulative field position for binary Medit format.
npnumber of solutions of each type.
dimsolution dimension.
nsolsnumber of solutions of different types in the file.
entitieskind of entity on which the solution applies (Vertex or Tetra)
typetype of solutions.
sizesize of solutions.
Returns
0 if unable to open the file, 1 if success.

Open the "filename" solution file and save the file header and the number and type of solutions at vertices (Native solutions for Mmg).

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

◆ MMG5_swapbin()

int MMG5_swapbin ( int  sbin)
Here is the caller graph for this function:

◆ MMG5_swapd()

double MMG5_swapd ( double  sbin)
Here is the caller graph for this function:

◆ MMG5_swapf()

float MMG5_swapf ( float  sbin)
Here is the caller graph for this function:

◆ MMG5_writeDoubleSol3D()

void MMG5_writeDoubleSol3D ( MMG5_pMesh  mesh,
MMG5_pSol  sol,
FILE *  inm,
int  bin,
int  pos,
int  metricData 
)
Parameters
meshpointer toward the mesh structure
solpointer toward an allocatable sol structure.
inmpointer toward the solution file
bin1 if binary file
posof the writted solution
metricData1 if the data saved is a metric (if only 1 data)

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

Here is the call graph for this function: