mmg3d
inout.c File Reference

Input / Output Functions. More...

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

Macros

#define sw   4
 
#define sd   8
 

Functions

static int _MMG5_swapbin (int sbin)
 
static float _MMG5_swapf (float sbin)
 
static 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_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)
 
static 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)
 
void MMG5_readFloatSol3D (MMG5_pSol sol, FILE *inm, int bin, int iswp, int pos)
 
void 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 np, int dim, int nsols, 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)
 

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.

Macro Definition Documentation

◆ sd

#define sd   8

◆ sw

#define sw   4

Function Documentation

◆ _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_swapbin()

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

◆ _MMG5_swapd()

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

◆ _MMG5_swapf()

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

◆ MMG5_build3DMetric()

static void MMG5_build3DMetric ( MMG5_pMesh  mesh,
MMG5_pSol  sol,
int  ip,
double  dbuf[6] 
)
inlinestatic
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_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, deallocate the type array and close the metric file.

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 
)
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
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 
)
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
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()

void 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

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

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

◆ MMG5_readFloatSol3D()

void 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

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

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_saveSolHeader()

int MMG5_saveSolHeader ( MMG5_pMesh  mesh,
const char *  filename,
FILE **  inm,
int  ver,
int *  bin,
int  np,
int  dim,
int  nsols,
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.
npnumber of solutions of each type.
dimsolution dimension.
nsolsnumber of solutions of different types in the file.
typetype of solutions.
sizesize of solutions.
Returns
0 if unable to open the file, 1 if success.

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_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:
Here is the caller graph for this function: