Mmg
Simplicial remeshers (mesh adaptation, isovalue discretization, lagrangian movement)
|
Input / Output Functions. More...
#include "mmgcommon_private.h"
Go to the source code of this file.
Functions | |
int | MMG5_swapbin (int sbin) |
MMG5_int | MMG5_swapbin_int (MMG5_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, MMG5_int *nelts, int *nsols) |
int | MMG5_check_readedMesh (MMG5_pMesh mesh, MMG5_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 MMG5_int nelts, const int nsols) |
void | MMG5_build3DMetric (MMG5_pMesh mesh, MMG5_pSol sol, MMG5_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, MMG5_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, MMG5_int pos) |
void | MMG5_writeDoubleSol3D (MMG5_pMesh mesh, MMG5_pSol sol, FILE *inm, int bin, MMG5_int pos, int metricData) |
int | MMG5_saveSolHeader (MMG5_pMesh mesh, const char *filename, FILE **inm, int ver, int *bin, MMG5_int *bpos, MMG5_int np, int dim, int nsols, int *entities, int *type, int *size) |
int | MMG5_saveSolAtTrianglesHeader (MMG5_pMesh mesh, FILE *inm, int ver, int bin, MMG5_int *bpos, int nsols, int nsolsAtTriangles, int *entities, int *type, int *size) |
int | MMG5_saveSolAtTetrahedraHeader (MMG5_pMesh mesh, FILE *inm, int ver, int bin, MMG5_int *bpos, int nsols, int nsolsAtTetra, int *entities, int *type, int *size) |
int | MMG5_chkMetricType (MMG5_pMesh mesh, int *type, int *entities, 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.
Definition in file inout.c.
void MMG5_build3DMetric | ( | MMG5_pMesh | mesh, |
MMG5_pSol | sol, | ||
MMG5_int | ip, | ||
double | dbuf[6] | ||
) |
mesh | pointer to the mesh structure |
sol | pointer to 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).
Definition at line 1524 of file inout.c.
int MMG5_check_readedMesh | ( | MMG5_pMesh | mesh, |
MMG5_int | nref | ||
) |
mesh | pointer to an Mmg mesh |
nref | pointer to 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.
Definition at line 526 of file inout.c.
int MMG5_chkMetricType | ( | MMG5_pMesh | mesh, |
int * | type, | ||
int * | entities, | ||
FILE * | inm | ||
) |
mesh | pointer to the mesh structure. |
type | type of the metric |
entities | entities on which the metric applies (should be MMG5_Vertex) |
inm | metric file |
Check metric data:
Definition at line 2663 of file inout.c.
|
static |
inm | pointer to file unit |
nelts | number of elements |
iswap | 1 if we need to swap bites for little/big endian conversion |
np | number of points |
na | number of edges |
nt | number of tria |
nq | number of quads |
ne | number of tetra |
npr | number of prisms |
Count number of elts of each type. For now only int32 integers are supported.
Definition at line 127 of file inout.c.
int MMG5_loadMshMesh_part1 | ( | MMG5_pMesh | mesh, |
const char * | filename, | ||
FILE ** | inm, | ||
long * | posNodes, | ||
long * | posElts, | ||
long ** | posNodeData, | ||
int * | bin, | ||
int * | iswp, | ||
MMG5_int * | nelts, | ||
int * | nsols | ||
) |
mesh | pointer to the mesh |
filename | pointer to the name of file |
inm | pointer to the file pointer |
posNodes | pointer to the position of nodes data in file |
posElts | pointer to the position of elts data in file |
posNodeData | pointer to 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.
Definition at line 278 of file inout.c.
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 MMG5_int | nelts, | ||
const int | nsols | ||
) |
mesh | pointer to the mesh |
sol | pointer to the solutions array |
inm | pointer to 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
Definition at line 664 of file inout.c.
int MMG5_loadSolHeader | ( | const char * | filename, |
int | meshDim, | ||
FILE ** | inm, | ||
int * | ver, | ||
int * | bin, | ||
int * | iswp, | ||
MMG5_int * | np, | ||
int * | dim, | ||
int * | nsols, | ||
int ** | type, | ||
long * | posnp, | ||
int | imprim | ||
) |
filename | name of file. |
meshDim | mesh dimenson. |
inm | allocatable pointer to 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 to the position of the point list in the file |
imprim | verbosity |
Open the "filename" solution file and read the file header.
Definition at line 2076 of file inout.c.
void MMG5_printMetStats | ( | MMG5_pMesh | mesh, |
MMG5_pSol | met | ||
) |
void MMG5_printSolStats | ( | MMG5_pMesh | mesh, |
MMG5_pSol * | sol | ||
) |
int MMG5_readDoubleSol3D | ( | MMG5_pSol | sol, |
FILE * | inm, | ||
int | bin, | ||
int | iswp, | ||
MMG5_int | pos | ||
) |
sol | pointer to an allocatable sol structure. |
inm | pointer to 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.
Definition at line 2271 of file inout.c.
int MMG5_readFloatSol3D | ( | MMG5_pSol | sol, |
FILE * | inm, | ||
int | bin, | ||
int | iswp, | ||
int | pos | ||
) |
sol | pointer to an allocatable sol structure. |
inm | pointer to 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.
Definition at line 2222 of file inout.c.
int MMG5_saveEdge | ( | MMG5_pMesh | mesh, |
const char * | filename, | ||
const char * | ext | ||
) |
mesh | pointer to the mesh structure. |
filename | name of file. |
ext | file extension (.poly or .edge) |
Save edge list at .edge file format (Tetgen/Triangle).
Definition at line 2818 of file inout.c.
int MMG5_saveMshMesh | ( | MMG5_pMesh | mesh, |
MMG5_pSol * | sol, | ||
const char * | filename, | ||
int | metricData | ||
) |
mesh | pointer to the mesh structure. |
sol | pointer to 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"
Definition at line 1583 of file inout.c.
int MMG5_saveNode | ( | MMG5_pMesh | mesh, |
const char * | filename | ||
) |
int MMG5_saveSolAtTetrahedraHeader | ( | MMG5_pMesh | mesh, |
FILE * | inm, | ||
int | ver, | ||
int | bin, | ||
MMG5_int * | bpos, | ||
int | nsols, | ||
int | nsolsAtTetra, | ||
int * | entities, | ||
int * | type, | ||
int * | size | ||
) |
mesh | pointer to the mesh structure. |
inm | pointer to 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).
Definition at line 2595 of file inout.c.
int MMG5_saveSolAtTrianglesHeader | ( | MMG5_pMesh | mesh, |
FILE * | inm, | ||
int | ver, | ||
int | bin, | ||
MMG5_int * | bpos, | ||
int | nsols, | ||
int | nsolsAtTriangles, | ||
int * | entities, | ||
int * | type, | ||
int * | size | ||
) |
mesh | pointer to the mesh structure. |
inm | pointer to 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).
Definition at line 2526 of file inout.c.
int MMG5_saveSolHeader | ( | MMG5_pMesh | mesh, |
const char * | filename, | ||
FILE ** | inm, | ||
int | ver, | ||
int * | bin, | ||
MMG5_int * | bpos, | ||
MMG5_int | np, | ||
int | dim, | ||
int | nsols, | ||
int * | entities, | ||
int * | type, | ||
int * | size | ||
) |
mesh | pointer to the mesh structure. |
filename | name of file. |
inm | allocatable pointer to 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).
Definition at line 2389 of file inout.c.
int MMG5_swapbin | ( | int | sbin | ) |
MMG5_int MMG5_swapbin_int | ( | MMG5_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, | ||
MMG5_int | pos, | ||
int | metricData | ||
) |
mesh | pointer to the mesh structure |
sol | pointer to an allocatable sol structure. |
inm | pointer to 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.
Definition at line 2320 of file inout.c.