Mmg
Simplicial remeshers (mesh adaptation, isovalue discretization, lagrangian movement)
main_hsiz.F90
Go to the documentation of this file.
1!! =============================================================================
2!! This file is part of the mmg software package for the tetrahedral
3!! mesh modification.
4!! Copyright (c) Bx INP/Inria/UBordeaux/UPMC, 2004- .
5!!
6!! mmg is free software: you can redistribute it and/or modify it
7!! under the terms of the GNU Lesser General Public License as published
8!! by the Free Software Foundation, either version 3 of the License, or
9!! (at your option) any later version.
10!!
11!! mmg is distributed in the hope that it will be useful, but WITHOUT
12!! ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13!! FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
14!! License for more details.
15!!
16!! You should have received a copy of the GNU Lesser General Public
17!! License and of the GNU General Public License along with mmg (in
18!! files COPYING.LESSER and COPYING). If not, see
19!! <http://www.gnu.org/licenses/>. Please read their terms carefully and
20!! use this copy of the mmg distribution only if you accept them.
21!! =============================================================================
22!!
23
34
35PROGRAM main
36
37 IMPLICIT NONE
38
40! if the header file is in the "include" directory
41! #include "libmmg3df.h"
42
43! if the header file is in "include/mmg/mmg3d"
44#include "mmg/mmg3d/libmmg3df.h"
45
46 mmg5_data_ptr_t :: mmgmesh
47 mmg5_data_ptr_t :: mmgls,mmgmet
48 INTEGER :: ier,argc
49 CHARACTER(len=300) :: exec_name,inname,outname,lsname
51 INTEGER,PARAMETER :: immg = mmg5f_int
52
53 WRITE(*,*) " -- TEST MMG3DLIB"
54
55 argc = command_argument_count();
56 CALL get_command_argument(0, exec_name)
57
58 IF ( argc /=3 ) THEN
59 print*," Usage: ",trim(exec_name)," meshfile lsfile meshout"
60 CALL exit(1);
61 ENDIF
62
63 ! Name and path of the mesh file
64 CALL get_command_argument(1, inname)
65 CALL get_command_argument(2, lsname)
66 CALL get_command_argument(3, outname)
67
76
77 mmgmesh = 0
78 mmgls = 0
79 mmgmet = 0
80
81 CALL mmg3d_init_mesh(mmg5_arg_start, &
82 mmg5_arg_ppmesh,mmgmesh,mmg5_arg_ppls,mmgls, &
83 mmg5_arg_ppmet,mmgmet, &
84 mmg5_arg_end)
85
86 !!------------------- Level set discretization option ---------------------
87 ! Ask for level set discretization: note that it is important to do this step
88 ! here because in iso mode, some filters are applied at mesh loading
89 CALL mmg3d_set_iparameter(mmgmesh,0_8,mmg3d_iparam_iso, 1_immg,ier)
90 IF ( ier == 0 ) CALL exit(101)
91
92 ! Ask for constant edge size of length 0.1
93 CALL mmg3d_set_dparameter(mmgmesh,0_8,mmg3d_dparam_hsiz, 0.5d0,ier)
94 IF ( ier == 0 ) CALL exit(101)
95
99
101 CALL mmg3d_loadmesh(mmgmesh,trim(adjustl(inname)),&
102 len(trim(adjustl(inname))),ier)
103 IF ( ier == 0 ) CALL exit(102)
104
108
110 CALL mmg3d_loadsol(mmgmesh,mmgls,trim(adjustl(lsname)),&
111 len(trim(adjustl(lsname))),ier)
112 IF ( ier /= 1 ) THEN
113 CALL exit(104)
114 ENDIF
115
117 CALL mmg3d_chk_meshdata(mmgmesh,mmgls,ier)
118 IF ( ier /= 1 ) CALL exit(105)
119
123 CALL mmg3d_mmg3dls(mmgmesh,mmgls,mmgmet,ier)
124
125 IF ( ier == mmg5_strongfailure ) THEN
126 print*,"BAD ENDING OF MMG3DLIB: UNABLE TO SAVE MESH"
127 stop 2
128 ELSE IF ( ier == mmg5_lowfailure ) THEN
129 print*,"BAD ENDING OF MMG3DLIB"
130 ENDIF
131
137
139 CALL mmg3d_savemesh(mmgmesh,trim(adjustl(outname)),&
140 len(trim(adjustl(outname))),ier)
141 IF ( ier /= 1 ) THEN
142 CALL exit(106)
143 ENDIF
144
146 CALL mmg3d_savesol(mmgmesh,mmgmet,trim(adjustl(outname)),&
147 len(trim(adjustl(outname))),ier)
148 IF ( ier /= 1 ) THEN
149 CALL exit(107)
150 ENDIF
151
153 CALL mmg3d_free_all(mmg5_arg_start, &
154 mmg5_arg_ppmesh,mmgmesh,mmg5_arg_ppls,mmgls, &
155 mmg5_arg_ppmet,mmgmet, &
156 mmg5_arg_end)
157
158END PROGRAM
int main(int argc, char *argv[])
Definition: mmg2d.c:275