37 fprintf(stdout,
"\n ELAPSED TIME %s\n",stim);
63 fprintf(stderr,
"\n ## Error: %s: unable to allocate the first boundary"
64 " reference node.\n",__func__);
72 for ( k=1; k<=
mesh->
na; ++k ) {
76 fprintf(stderr,
"\n ## Warning: %s: unable to list the edge references.\n"
77 " Uncomplete parameters file.\n",__func__);
80 else if (
ier ) ++npar;
102 fprintf(out,
"%"MMG5_PRId
" Edge %e %e %e \n",cur->val,
132 if ( ptr ) *ptr =
'\0';
133 strcat(data,
".mmg2d");
135 if ( !(out = fopen(data,
"wb")) ) {
136 fprintf(stderr,
"\n ** UNABLE TO OPEN %s.\n",data);
140 fprintf(stdout,
"\n %%%% %s OPENED\n",data);
154 fprintf(out,
"parameters\n %d\n",nparTri+nparEdg);
169 fprintf(stdout,
" -- WRITING COMPLETED\n");
205 fprintf(stderr,
"\n ## Error: %s: "
206 "unable to save of a local parameter file with"
207 " the default parameters values because local parameters"
208 " are provided.\n",__func__);
213 if (
mesh->
info.
imprim > 0 ) fprintf(stdout,
"\n -- INPUT DATA\n");
217 if ( met && met->
np && (met->
np !=
mesh->
np) ) {
218 fprintf(stderr,
"\n ## WARNING: WRONG SOLUTION NUMBER. IGNORED\n");
224 fprintf(stderr,
"\n ## WARNING: WRONG SOLUTION NUMBER. IGNORED\n");
232 fprintf(stdout,
" -- INPUT DATA COMPLETED. %s\n",stim);
240 fprintf(stdout,
"\n -- DEFAULT PARAMETERS COMPUTATION\n");
267 fprintf(stderr,
"\n ## Error: %s: Unable to save the local parameters file.\n"
268 " Exit program.\n",__func__);
275int main(
int argc,
char *argv[]) {
278 int ier,ierSave,fmtin,fmtout;
283 setvbuf(stdout, NULL, _IOLBF, 1024);
284 setvbuf(stderr, NULL, _IOLBF, 1024);
287#ifndef MMG_COMPARABLE_OUTPUT
288 fprintf(stdout,
" -- MMG2D, Release %s (%s) \n",MMG_VERSION_RELEASE,MMG_RELEASE_DATE);
289 fprintf(stdout,
" %s\n",MMG_COPYRIGHT);
290 fprintf(stdout,
" %s %s\n",__DATE__,__TIME__);
330 fprintf(stdout,
"\n -- INPUT DATA\n");
367 if (
ier < 1 ) {
break; }
382 fprintf(stdout,
" ## ERROR: UNABLE TO LOAD SOLUTION.\n");
389 fprintf(stdout,
"\n ## ERROR: WRONG DATA TYPE OR WRONG SOLUTION NUMBER.\n");
398 fprintf(stdout,
" ## ERROR: UNABLE TO LOAD METRIC.\n");
405 fprintf(stdout,
" ## ERROR: UNABLE TO GIVE A NAME TO THE METRIC.\n");
416 fprintf(stderr,
" ** %s NOT FOUND.\n",
mesh->
namein);
417 fprintf(stderr,
" ** UNABLE TO OPEN INPUT FILE.\n");
425 fprintf(stdout,
" ## WARNING: MESH ADAPTATION UNAVAILABLE IN"
426 " LAGRANGIAN MODE. METRIC IGNORED.\n");
431 if ( ls->
m == NULL ) {
432 fprintf(stderr,
"\n ## ERROR: NO ISOVALUE DATA.\n");
444 fprintf(stdout,
" -- DATA READING COMPLETED. %s\n",stim);
467 fprintf(stdout,
"\n ## ERROR: IMPOSSIBLE TO PROVIDE BOTH A METRIC"
468 " AND A SOLUTION IN ADAPTATION MODE.\n");
478 fprintf(stdout,
"\n -- WRITING DATA FILE %s\n",
mesh->
nameout);
502 if ( met && met->
np ) {
511 if ( met && met->
np ) {
521 if (
mesh->
info.
imprim > 0 ) fprintf(stdout,
" -- WRITING COMPLETED\n");
int MMG5_Compute_constantSize(MMG5_pMesh mesh, MMG5_pSol met, double *hsiz)
const char * MMG5_Get_formatName(enum MMG5_Format fmt)
int MMG5_Get_format(char *ptr, int fmt)
char * MMG5_Get_filenameExt(char *filename)
int MMG2D_Init_mesh(const int starter,...)
Initialize a mesh structure and optionally the associated solution and metric structures.
int MMG2D_Set_solSize(MMG5_pMesh mesh, MMG5_pSol sol, int typEntity, MMG5_int np, int typSol)
Set the size and type of a solution field.
int MMG2D_Set_inputSolName(MMG5_pMesh mesh, MMG5_pSol sol, const char *solin)
Set the name of the input solution file.
int MMG2D_Free_names(const int starter,...)
Structure deallocations before return.
MMG5_pMesh MMG5_pSol * sol
program main
Example for using mmglib (basic use)
void tminit(mytime *t, int maxtim)
Initialize mytime object.
void printim(double elps, char *stim)
Print real time.
void chrono(int cmode, mytime *ptt)
Function to measure time.
int MMG2D_saveTetgenMesh(MMG5_pMesh mesh, const char *filename)
Save data in Tetgen's Triangle format.
int MMG2D_saveMesh(MMG5_pMesh mesh, const char *filename)
Save a mesh in .mesh/.meshb format.
int MMG2D_saveMshMesh(MMG5_pMesh mesh, MMG5_pSol sol, const char *filename)
Save a mesh and optionally one data field in MSH format, ascii or binary depending on the filename ex...
int MMG2D_saveSol(MMG5_pMesh mesh, MMG5_pSol sol, const char *filename)
Save metric field in medit solution file format.
int MMG2D_loadMesh(MMG5_pMesh mesh, const char *filename)
Load a mesh (in .mesh/.mesb format) from file.
int MMG2D_loadSol(MMG5_pMesh mesh, MMG5_pSol sol, const char *filename)
Load a metric field (or other solution) in medit's .sol format.
int MMG2D_loadMshMesh(MMG5_pMesh mesh, MMG5_pSol sol, const char *filename)
Load a mesh and possibly a solution in .msh format from file.
int MMG2D_loadVtpMesh(MMG5_pMesh mesh, MMG5_pSol met, MMG5_pSol sol, const char *filename)
Load a mesh and possibly a solution in VTP (VTK) format from file.
int MMG2D_loadVtkMesh(MMG5_pMesh mesh, MMG5_pSol met, MMG5_pSol sol, const char *filename)
Load a mesh and possibly data in VTK format from file.
int MMG2D_saveVtkMesh(MMG5_pMesh mesh, MMG5_pSol sol, const char *filename)
Save a mesh and optionally one solution in VTK format.
int MMG2D_saveVtuMesh(MMG5_pMesh mesh, MMG5_pSol sol, const char *filename)
Save a mesh and optionally one data field in VTU format.
int MMG2D_saveVtpMesh(MMG5_pMesh mesh, MMG5_pSol sol, const char *filename)
Save a mesh and optionally one data field in VTP format.
int MMG2D_loadVtuMesh(MMG5_pMesh mesh, MMG5_pSol met, MMG5_pSol sol, const char *filename)
Load a mesh and possibly data in VTU (VTK) format from file.
int MMG2D_mmg2dlib(MMG5_pMesh mesh, MMG5_pSol met)
Main "program" for the mesh adaptation library.
int MMG2D_mmg2dls(MMG5_pMesh mesh, MMG5_pSol sol, MMG5_pSol umet)
Main "program" for the level-set discretization library.
int MMG2D_mmg2dmesh(MMG5_pMesh mesh, MMG5_pSol met)
Main "program" for the mesh generation library.
void MMG2D_Set_commonFunc(void)
Set common function pointers between mmgs and mmg2d to the matching mmg2d functions.
int MMG2D_mmg2dmov(MMG5_pMesh mesh, MMG5_pSol met, MMG5_pSol disp)
Main "program" for the rigid-body movement library.
API headers and documentation for the mmg2d library.
LIBMMG2D_EXPORT int MMG2D_parsop(MMG5_pMesh mesh, MMG5_pSol met)
Read a file containing Local parameters (.mmg2d extension)
LIBMMG2D_EXPORT int MMG2D_parsar(int argc, char *argv[], MMG5_pMesh mesh, MMG5_pSol met, MMG5_pSol sol)
Store command line arguments.
LIBMMG2D_EXPORT int(* MMG2D_doSol)(MMG5_pMesh mesh, MMG5_pSol met)
Compute unit tensor according to the lengths of the edges passing through a vertex.
LIBMMG2D_EXPORT void MMG2D_setfunc(MMG5_pMesh mesh, MMG5_pSol met)
Set function pointers for length, caltri... depending if case is iso or aniso.
static void MMG2D_excfun(int sigid)
#define MMG2D_RETURN_AND_FREE(mesh, met, ls, disp, val)
LIBMMG_CORE_EXPORT int MMG5_unscaleMesh(MMG5_pMesh mesh, MMG5_pSol met, MMG5_pSol ls)
LIBMMG_CORE_EXPORT int MMG5_scaleMesh(MMG5_pMesh mesh, MMG5_pSol met, MMG5_pSol ls)
#define MMG5_STRONGFAILURE
static int MMG2D_writeLocalParamAtEdg(MMG5_pMesh mesh, MMG5_iNode *bdryRefs, FILE *out)
static int MMG2D_countLocalParamAtEdg(MMG5_pMesh mesh, MMG5_iNode **bdyRefs)
static int MMG2D_defaultOption(MMG5_pMesh mesh, MMG5_pSol met, MMG5_pSol sol)
mytime MMG5_ctim[TIMEMAX]
static void MMG5_endcod(void)
static int MMG2D_writeLocalParam(MMG5_pMesh mesh)
#define _LIBMMG5_RETURN(mesh, sol, met, val)
#define MMG5_FILESTR_LGTH
#define MMG5_DEL_MEM(mesh, ptr)
Cell for linked list of integer value.