mmg3d
|
Input / Output Functions. More...
#include "mmgcommon.h"
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) |
Input / Output Functions.
void MMG5_build3DMetric | ( | MMG5_pMesh | mesh, |
MMG5_pSol | sol, | ||
int | ip, | ||
double | dbuf[6] | ||
) |
mesh | pointer toward the mesh structure |
sol | pointer toward the sol structure. |
index | of point in which we want to build the metric |
dbuf | builded metric |
Build the metric at point ip depending with its type (ridge/not ridge).
int MMG5_check_readedMesh | ( | MMG5_pMesh | mesh, |
int | nref | ||
) |
mesh | pointer toward an Mmg mesh |
nref | pointer toward the number of negative refs (replaced by abolute values). |
Check the tetra orientation, print warning it negative refs have been detected, mark points as used and remove elt refs in iso mode.
int MMG5_chkMetricType | ( | MMG5_pMesh | mesh, |
int * | type, | ||
FILE * | inm | ||
) |
mesh | pointer toward the mesh structure. |
type | type of the metric |
inm | metric file |
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).
|
static |
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 | ||
) |
mesh | pointer toward the mesh |
filename | pointer toward the name of file |
inm | pointer toward the file pointer |
posNodes | pointer toward the position of nodes data in file |
posElts | pointer toward the position of elts data in file |
posNodeData | pointer toward the list of the positions of data in file |
bin | 1 if binary format |
nelts | number of elements in file |
nsol | number of data in file |
Begin to read mesh at MSH file format. Read the mesh size informations.
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 | ||
) |
mesh | pointer toward the mesh |
sol | pointer toward the solutions array |
inm | pointer toward the file pointer |
posNodes | position of nodes data in file |
posElts | position of elts data in file |
posNodeData | position of solution data in file |
bin | 1 if binary format |
nelts | number of elements in file |
nsols | number of silutions in file |
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
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 | ||
) |
filename | name of file. |
meshDim | mesh dimenson. |
inm | allocatable pointer toward the FILE structure |
ver | file version (1=simple precision, 2=double) |
bin | 1 if the file is a binary |
iswp | 1 or 0 depending on the endianness (binary only) |
np | number of solutions of each type |
dim | solution dimension |
nsols | number of solutions of different types in the file |
type | type of solutions |
posnp | pointer toward the position of the point list in the file |
imprim | verbosity |
Open the "filename" solution file and read the file header.
void MMG5_printMetStats | ( | MMG5_pMesh | mesh, |
MMG5_pSol | met | ||
) |
mesh | pointer toward the mesh structure. |
met | pointer toward the metric structure. |
print metric statistics
void MMG5_printSolStats | ( | MMG5_pMesh | mesh, |
MMG5_pSol * | sol | ||
) |
mesh | pointer toward the mesh structure. |
sol | pointer toward the solutions array. |
print solutions statistics
int MMG5_readDoubleSol3D | ( | MMG5_pSol | sol, |
FILE * | inm, | ||
int | bin, | ||
int | iswp, | ||
int | pos | ||
) |
sol | pointer toward an allocatable sol structure. |
inm | pointer toward the solution file |
bin | 1 if binary file |
iswp | Endianess |
index | of the readed solution |
Read the solution value for vertex of index pos in double precision.
int MMG5_readFloatSol3D | ( | MMG5_pSol | sol, |
FILE * | inm, | ||
int | bin, | ||
int | iswp, | ||
int | pos | ||
) |
sol | pointer toward an allocatable sol structure. |
inm | pointer toward the solution file |
bin | 1 if binary file |
iswp | Endianess |
index | of the readed solution |
Read the solution value for vertex of index pos in floating precision.
int MMG5_saveEdge | ( | MMG5_pMesh | mesh, |
const char * | filename, | ||
const char * | ext | ||
) |
mesh | pointer toward the mesh structure. |
filename | name of file. |
ext | file extension (.poly or .edge) |
Save edge list at .edge file format (Tetgen/Triangle).
int MMG5_saveMshMesh | ( | MMG5_pMesh | mesh, |
MMG5_pSol * | sol, | ||
const char * | filename, | ||
int | metricData | ||
) |
mesh | pointer toward the mesh structure. |
sol | pointer toward an array of solutions. |
filename | name of file. |
metricData | 1 if the data saved is a metric (if only 1 data) |
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"
int MMG5_saveNode | ( | MMG5_pMesh | mesh, |
const char * | filename | ||
) |
mesh | pointer toward the mesh structure. |
filename | name of file. |
Save node list at .node file format (Tetgen/Triangle).
int MMG5_saveSolAtTetrahedraHeader | ( | MMG5_pMesh | mesh, |
FILE * | inm, | ||
int | ver, | ||
int | bin, | ||
int * | bpos, | ||
int | nsols, | ||
int | nsolsAtTetra, | ||
int * | entities, | ||
int * | type, | ||
int * | size | ||
) |
mesh | pointer toward the mesh structure. |
inm | pointer toward the opened file unit. |
ver | file version (1=simple precision, 2=double). |
bin | 1 if the file is a binary. |
bpos | cumulative field position for binary Medit format. |
nsols | number of solutions of different types in the file. |
nsolsAtTetra | number of solutions at tetra in the file. |
entities | kind of entity on which the solution applies. |
type | type of solutions. |
size | size of solutions. |
Save the number and type of solutions at Tetrahedron (not used by Mmg).
int MMG5_saveSolAtTrianglesHeader | ( | MMG5_pMesh | mesh, |
FILE * | inm, | ||
int | ver, | ||
int | bin, | ||
int * | bpos, | ||
int | nsols, | ||
int | nsolsAtTriangles, | ||
int * | entities, | ||
int * | type, | ||
int * | size | ||
) |
mesh | pointer toward the mesh structure. |
inm | pointer toward the opened file unit. |
ver | file version (1=simple precision, 2=double). |
bin | 1 if the file is a binary. |
bpos | cumulative field position for binary Medit format. |
nsols | number of solutions of different types in the file. |
nsolsAtTriangles | number of solutions at triangles in the file. |
entities | kind of entity on which the solution applies. |
type | type of solutions. |
size | size of solutions. |
Save the number and type of solutions at Triangles (not used by Mmg).
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 | ||
) |
mesh | pointer toward the mesh structure. |
filename | name of file. |
inm | allocatable pointer toward the FILE structure. |
ver | file version (1=simple precision, 2=double). |
bin | 1 if the file is a binary. |
bpos | cumulative field position for binary Medit format. |
np | number of solutions of each type. |
dim | solution dimension. |
nsols | number of solutions of different types in the file. |
entities | kind of entity on which the solution applies (Vertex or Tetra) |
type | type of solutions. |
size | size of solutions. |
Open the "filename" solution file and save the file header and the number and type of solutions at vertices (Native solutions for Mmg).
int MMG5_swapbin | ( | int | sbin | ) |
double MMG5_swapd | ( | double | sbin | ) |
float MMG5_swapf | ( | float | sbin | ) |
void MMG5_writeDoubleSol3D | ( | MMG5_pMesh | mesh, |
MMG5_pSol | sol, | ||
FILE * | inm, | ||
int | bin, | ||
int | pos, | ||
int | metricData | ||
) |
mesh | pointer toward the mesh structure |
sol | pointer toward an allocatable sol structure. |
inm | pointer toward the solution file |
bin | 1 if binary file |
pos | of the writted solution |
metricData | 1 if the data saved is a metric (if only 1 data) |
Write the solution value for vertex of index pos in double precision.