mmg2d
|
Input / Output Functions. More...
#include "mmgcommon.h"
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, int imprim) |
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) |
Input / Output Functions.
#define sd 8 |
#define sw 4 |
|
static |
|
static |
|
static |
|
static |
|
inlinestatic |
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_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, deallocate the type array and close the metric file.
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 | ||
) |
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 |
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
void 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.
void 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_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_saveSolHeader | ( | MMG5_pMesh | mesh, |
const char * | filename, | ||
FILE ** | inm, | ||
int | ver, | ||
int * | bin, | ||
int | np, | ||
int | dim, | ||
int | nsols, | ||
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. |
np | number of solutions of each type. |
dim | solution dimension. |
nsols | number of solutions of different types in the file. |
type | type of solutions. |
size | size of solutions. |
Open the "filename" solution file and read the file header.
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.