14#include "mmg/mmg3d/libmmg3df.h"
16 mmg5_data_ptr_t :: mmgmesh
17 mmg5_data_ptr_t :: mmgsol,mmgmet,tmpsol
18 INTEGER :: ier,argc,opt,i4
21 INTEGER(MMG5F_INT) :: np,j
22 INTEGER :: nsol,typsol(mmg5_nsols_max)
23 REAL(kind=8),dimension(:),
ALLOCATABLE :: sols
25 CHARACTER(len=300) :: exec_name,filename,fileout,option
27 print*,
" -- TEST MMG3DLIB"
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
63 CALL mmg3d_init_mesh(mmg5_arg_start, &
64 mmg5_arg_ppmesh,mmgmesh,mmg5_arg_ppmet,mmgmet, &
73 CALL mmg3d_loadmesh(mmgmesh,trim(adjustl(filename)),&
74 len(trim(adjustl(filename))),ier)
75 IF ( ier /= 1 )
CALL exit(102)
77 CALL mmg3d_loadallsols(mmgmesh,mmgsol,trim(adjustl(filename)),&
78 len(trim(adjustl(filename))),ier)
79 IF ( ier /= 1 )
CALL exit(103)
85 CALL mmg3d_get_solsatverticessize(mmgmesh,mmgsol,nsol,np,typsol,ier)
86 IF ( ier /= 1 )
CALL exit(104)
91 CALL mmg3d_set_solsatverticessize(mmgmesh,tmpsol,nsol,np,typsol,ier)
92 IF ( ier /= 1 )
CALL exit(105)
102 IF ( typsol(i4) == mmg5_scalar )
THEN
104 ELSE IF ( typsol(i4) == mmg5_vector )
THEN
106 ELSE IF ( typsol(i4) == mmg5_tensor )
THEN
110 CALL mmg3d_get_ithsols_insolsatvertices(mmgsol,i4,sols,ier)
111 IF ( ier /= 1 )
CALL exit(107)
114 CALL mmg3d_set_ithsols_insolsatvertices(tmpsol,i4,sols,ier)
115 IF ( ier /= 1 )
CALL exit(108)
117 IF ( typsol(i4) == mmg5_scalar )
THEN
119 ELSE IF ( typsol(i4) == mmg5_vector )
THEN
121 ELSE IF ( typsol(i4) == mmg5_tensor )
THEN
127 CALL mmg3d_get_ithsol_insolsatvertices(mmgsol,i4,sols,j,ier)
128 IF ( ier /= 1 )
CALL exit(107)
131 CALL mmg3d_set_ithsol_insolsatvertices(tmpsol,i4,sols,j,ier)
132 IF ( ier /= 1 )
CALL exit(108)
145 CALL mmg3d_savemesh(mmgmesh,trim(adjustl(fileout)),len(trim(adjustl(fileout))),ier)
146 IF ( ier /= 1 )
CALL exit(110)
149 CALL mmg3d_saveallsols(mmgmesh,tmpsol,trim(adjustl(fileout)), &
150 len(trim(adjustl(fileout))),ier)
151 IF ( ier /= 1 )
CALL exit(111)
154 CALL mmg3d_free_allsols(mmgmesh,mmgsol,ier)
156 CALL mmg3d_free_all(mmg5_arg_start, &
157 mmg5_arg_ppmesh,mmgmesh,mmg5_arg_ppsols,tmpsol, &
int main(int argc, char *argv[])