Mmg
Simplicial remeshers (mesh adaptation, isovalue discretization, lagrangian movement)
Macros | Functions
main.c File Reference
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <signal.h>
#include <string.h>
#include <ctype.h>
#include <math.h>
#include <float.h>
#include "mmg/mmg3d/libmmg3d.h"
Include dependency graph for main.c:

Go to the source code of this file.

Macros

#define MAX0(a, b)   (((a) > (b)) ? (a) : (b))
 
#define MAX4(a, b, c, d)   (((MAX0(a,b)) > (MAX0(c,d))) ? (MAX0(a,b)) : (MAX0(c,d)))
 

Functions

int main (int argc, char *argv[])
 

Macro Definition Documentation

◆ MAX0

#define MAX0 (   a,
 
)    (((a) > (b)) ? (a) : (b))

============================================================================= This file is part of the mmg software package for the tetrahedral mesh modification. Copyright (c) Bx INP/Inria/UBordeaux/UPMC, 2004- .

mmg is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

mmg is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License and of the GNU General Public License along with mmg (in files COPYING.LESSER and COPYING). If not, see http://www.gnu.org/licenses/. Please read their terms carefully and

use this copy of the mmg distribution only if you accept them.

Example of use of the mmg3d library (basic use of mesh adaptation)

Author
Charles Dapogny (LJLL, UPMC)
Cécile Dobrzynski (Inria / IMB, Université de Bordeaux)
Pascal Frey (LJLL, UPMC)
Algiane Froehly (Inria / IMB, Université de Bordeaux)
Version
5

Definition at line 50 of file main.c.

◆ MAX4

#define MAX4 (   a,
  b,
  c,
 
)    (((MAX0(a,b)) > (MAX0(c,d))) ? (MAX0(a,b)) : (MAX0(c,d)))

Definition at line 51 of file main.c.

Function Documentation

◆ main()

int main ( int  argc,
char *  argv[] 
)

---------------------------— STEP I -----------------------—

1) Initialisation of mesh and sol structures

2) Build mesh in MMG5 format

Two solutions: just use the MMG3D_loadMesh function that will read a .mesh(b) file formatted or manually set your mesh using the MMG3D_Set* functions

Manually set of the mesh

a) give the size of the mesh: 12 vertices, 12 tetra,0 prisms, 20 triangles, 0 quads, 0 edges

b) give the vertices: for each vertex, give the coordinates, the reference and the position in mesh of the vertex

c) give the tetrahedras: for each tetrahedra, give the vertices index, the reference and the position of the tetra

d) give the triangles (not mandatory): for each triangle, give the vertices index, the reference and the position of the triangle

3) Build sol in MMG5 format

Two solutions: just use the MMG3D_loadSol function that will read a .sol(b) file formatted or manually set your sol using the MMG3D_Set* functions

Manually set of the sol

a) give info for the sol structure: sol applied on vertex entities, number of vertices=12, the sol is scalar

b) give solutions values and positions

4) (not mandatory): check if the number of given entities match with mesh size

---------------------------— STEP II -----------------------—

remesh function

---------------------------— STEP III -----------------------—

get results

Two solutions: just use the MMG3D_saveMesh/MMG3D_saveSol functions that will write .mesh(b)/.sol formatted files or manually get your mesh/sol using the MMG3D_getMesh/MMG3D_getSol functions

1) Manually get the mesh

a) get the size of the mesh: vertices, tetra, triangles, edges

b) Vertex recovering

d) Triangles recovering

e) Edges recovering

c) Tetra recovering

2) Manually get the solution

a) get the size of the sol: type of entity (SolAtVertices,...), number of sol, type of solution (scalar, tensor...)

b) Vertex recovering

3) Free the MMG3D5 structures

Definition at line 53 of file main.c.

Here is the call graph for this function: