23#include "mmg/mmg3d/libmmg3d.h"
25int main(
int argc,
char *argv[]) {
38 fprintf(stdout,
" -- TEST MMG3DLIB \n");
41 printf(
" Usage: %s filein fileout io_option\n",argv[0]);
42 printf(
" io_option = 0 to Get/Set the solution field by field\n");
43 printf(
" io_option = 1 to Get/Set the solution field by field"
44 " and vertex by vertex\n");
49 filename = (
char *) calloc(strlen(argv[1]) + 1,
sizeof(char));
51 perror(
" ## Memory problem: calloc");
56 fileout = (
char *) calloc(strlen(argv[2]) + 1,
sizeof(char));
57 if ( fileout == NULL ) {
58 perror(
" ## Memory problem: calloc");
61 strcpy(fileout,argv[2]);
109 for ( i=1; i<=nsol; ++i ) {
113 sols = (
double*) calloc(np,
sizeof(
double));
115 sols = (
double*) calloc(np*3,
sizeof(
double));
117 sols = (
double*) calloc(np*6,
sizeof(
double));
120 puts(
"Unexpected solution type.");
132 sols = (
double*) calloc(1,
sizeof(
double));
134 sols = (
double*) calloc(3,
sizeof(
double));
136 sols = (
double*) calloc(6,
sizeof(
double));
139 puts(
"Unexpected solution type.");
143 for ( j=1; j<=np; ++j ) {
151 free(sols); sols = NULL;
int MMG3D_Init_mesh(const int starter,...)
Initialize a mesh structure and optionally the associated solution and metric structures.
int MMG3D_Set_ithSols_inSolsAtVertices(MMG5_pSol sol, int i, double *s)
Set all elements of one out of multiple solution fields that are defined on vertices.
int MMG3D_Get_ithSol_inSolsAtVertices(MMG5_pSol sol, int i, double *s, MMG5_int pos)
Get one out of several solutions at a specific vertex.
int MMG3D_Free_allSols(MMG5_pMesh mesh, MMG5_pSol *sol)
Deallocate an array of solution fields.
int MMG3D_Set_ithSol_inSolsAtVertices(MMG5_pSol sol, int i, double *s, MMG5_int pos)
Set a single element of one out of multiple solution fields that are defined on vertices.
int MMG3D_Set_solsAtVerticesSize(MMG5_pMesh mesh, MMG5_pSol *sol, int nsols, MMG5_int nentities, int *typSol)
Initialize an array of solution values defined at vertices.
int MMG3D_Get_ithSols_inSolsAtVertices(MMG5_pSol sol, int i, double *s)
Get one out of several solutions at all vertices in the mesh.
int MMG3D_Get_solsAtVerticesSize(MMG5_pMesh mesh, MMG5_pSol *sol, int *nsols, MMG5_int *np, int *typSol)
Get the number of elements, type, and dimensions of several solutions defined on vertices.
int MMG3D_Free_all(const int starter,...)
Deallocations before return.
MMG5_pMesh char * filename
program main
Example for using mmglib (basic use)
int MMG3D_saveMesh(MMG5_pMesh mesh, const char *filename)
Save a mesh in .mesh/.meshb format.
int MMG3D_loadMesh(MMG5_pMesh mesh, const char *filename)
Load a mesh (in .mesh/.mesb format) from file.
int MMG3D_loadAllSols(MMG5_pMesh mesh, MMG5_pSol *sol, const char *filename)
Load one or more solutions in a solution file in medit file format.
int MMG3D_saveAllSols(MMG5_pMesh mesh, MMG5_pSol *sol, const char *filename)
Save 1 or more solutions in medit solution file format.