Mmg
Simplicial remeshers (mesh adaptation, isovalue discretization, lagrangian movement)
main.F90
Go to the documentation of this file.
1
5
6PROGRAM main
7
8 IMPLICIT NONE
9
11! if the header file is in the "include" directory
12! #include "libmmg3df.h"
13
14! if the header file is in "include/mmg/mmg3d"
15#include "mmg/mmg3d/libmmg3df.h"
16
17 mmg5_data_ptr_t :: mmgmesh
18 mmg5_data_ptr_t :: mmgsol
19 INTEGER :: ier,argc
20 CHARACTER(len=300) :: exec_name,filename,fileout
21
22 WRITE(*,*) " -- TEST MMG3DLIB"
23
24 argc = command_argument_count();
25 CALL get_command_argument(0, exec_name)
26
27 IF ( argc /=2 ) THEN
28 print*," Usage: ",trim(exec_name)," input_file_name output_filename"
29 CALL exit(1);
30 ENDIF
31
32 ! Name and path of the mesh file
33 CALL get_command_argument(1, filename)
34 CALL get_command_argument(2, fileout)
35
44
45 mmgmesh = 0
46 mmgsol = 0
47
48 CALL mmg3d_init_mesh(mmg5_arg_start, &
49 mmg5_arg_ppmesh,mmgmesh,mmg5_arg_ppmet,mmgsol, &
50 mmg5_arg_end)
51
55
57 CALL mmg3d_loadmesh(mmgmesh,trim(adjustl(filename)),&
58 len(trim(adjustl(filename))),ier)
59 IF ( ier == 0 ) CALL exit(102)
60
64
66 CALL mmg3d_loadsol(mmgmesh,mmgsol,trim(adjustl(filename)),&
67 len(trim(adjustl(filename))),ier)
68 IF ( ier /= 1 ) THEN
69 CALL exit(104)
70 ENDIF
71
73 CALL mmg3d_chk_meshdata(mmgmesh,mmgsol,ier)
74 IF ( ier /= 1 ) CALL exit(105)
75
78 CALL mmg3d_mmg3dlib(mmgmesh,mmgsol,ier)
79
80 IF ( ier == mmg5_strongfailure ) THEN
81 print*,"BAD ENDING OF MMG3DLIB: UNABLE TO SAVE MESH"
82 stop 2
83 ELSE IF ( ier == mmg5_lowfailure ) THEN
84 print*,"BAD ENDING OF MMG3DLIB"
85 ENDIF
86
92
94 CALL mmg3d_savemesh(mmgmesh,trim(adjustl(fileout)),&
95 len(trim(adjustl(fileout))),ier)
96 IF ( ier /= 1 ) THEN
97 CALL exit(106)
98 ENDIF
99
101 CALL mmg3d_savesol(mmgmesh,mmgsol,trim(adjustl(fileout)),&
102 len(trim(adjustl(fileout))),ier)
103 IF ( ier /= 1 ) THEN
104 CALL exit(107)
105 ENDIF
106
108 CALL mmg3d_free_all(mmg5_arg_start, &
109 mmg5_arg_ppmesh,mmgmesh,mmg5_arg_ppmet,mmgsol, &
110 mmg5_arg_end)
111
112END PROGRAM main
int main(int argc, char *argv[])
Definition: mmg2d.c:275