14#include "mmg/mmg2d/libmmg2df.h"
16 mmg5_data_ptr_t :: mmgmesh
17 mmg5_data_ptr_t :: mmgsol,mmgmet,tmpsol
18 INTEGER :: ier,argc,i,opt
21 INTEGER :: nsol,typsol(mmg5_nsols_max)
22 INTEGER(MMG5F_INT) :: np,j
23 REAL(kind=8),dimension(:),
ALLOCATABLE :: sols
25 CHARACTER(len=300) :: exec_name,filename,fileout,option
27 print*,
" -- TEST MMG2DLIB"
29 argc = command_argument_count();
30 CALL get_command_argument(0, exec_name)
34 print*,
" Usage: ",trim(adjustl(exec_name)),&
35 " input_file_name output_file_name io_option"
36 print*,
" io_option = 0 to Get/Set the solution field by field"
37 print*,
" io_option = 1 to Get/Set the solution field by field &
38 & and vertex by vertex"
43 CALL get_command_argument(1, filename)
44 CALL get_command_argument(2, fileout)
45 CALL get_command_argument(3, option)
47 READ(option,
'(I2)') opt
62 CALL mmg2d_init_mesh(mmg5_arg_start, &
63 mmg5_arg_ppmesh,mmgmesh,mmg5_arg_ppmet,mmgmet, &
72 CALL mmg2d_loadmesh(mmgmesh,trim(adjustl(filename)),&
73 len(trim(adjustl(filename))),ier)
74 IF ( ier /= 1 )
CALL exit(102)
76 CALL mmg2d_loadallsols(mmgmesh,mmgsol,trim(adjustl(filename)),&
77 len(trim(adjustl(filename))),ier)
78 IF ( ier /= 1 )
CALL exit(103)
84 CALL mmg2d_get_solsatverticessize(mmgmesh,mmgsol,nsol,np,typsol,ier)
85 IF ( ier /= 1 )
CALL exit(104)
90 CALL mmg2d_set_solsatverticessize(mmgmesh,tmpsol,nsol,np,typsol,ier)
91 IF ( ier /= 1 )
CALL exit(105)
101 IF ( typsol(i) == mmg5_scalar )
THEN
103 ELSE IF ( typsol(i) == mmg5_vector )
THEN
105 ELSE IF ( typsol(i) == mmg5_tensor )
THEN
109 CALL mmg2d_get_ithsols_insolsatvertices(mmgsol,i,sols,ier)
110 IF ( ier /= 1 )
CALL exit(107)
113 CALL mmg2d_set_ithsols_insolsatvertices(tmpsol,i,sols,ier)
114 IF ( ier /= 1 )
CALL exit(108)
116 IF ( typsol(i) == mmg5_scalar )
THEN
118 ELSE IF ( typsol(i) == mmg5_vector )
THEN
120 ELSE IF ( typsol(i) == mmg5_tensor )
THEN
126 CALL mmg2d_get_ithsol_insolsatvertices(mmgsol,i,sols,j,ier)
127 IF ( ier /= 1 )
CALL exit(107)
130 CALL mmg2d_set_ithsol_insolsatvertices(tmpsol,i,sols,j,ier)
131 IF ( ier /= 1 )
CALL exit(108)
144 CALL mmg2d_savemesh(mmgmesh,trim(adjustl(fileout)),len(trim(adjustl(fileout))),ier)
145 IF ( ier /= 1 )
CALL exit(110)
148 CALL mmg2d_saveallsols(mmgmesh,tmpsol,trim(adjustl(fileout)), &
149 len(trim(adjustl(fileout))),ier)
150 IF ( ier /= 1 )
CALL exit(111)
153 CALL mmg2d_free_allsols(mmgmesh,mmgsol,ier)
155 CALL mmg2d_free_all(mmg5_arg_start, &
156 mmg5_arg_ppmesh,mmgmesh,mmg5_arg_ppsols,tmpsol, &
int main(int argc, char *argv[])