Adding grid generating data file opening and closing codes¶
Adds codes for opening and closing grid generating data file.
The grid generating program has to open calculation data file in the first step, and close it in the last step.
iRIC will handle the file name of grid generating data file as the first argument, so open that file.
The way to handle the number of arguments is described in Handling command line arguments in Fortran programs.
List 19 shows the source code with the lines to open and close grid generating data file. The added lines are shown with highlight.
1program SampleProgram
2 use iric
3 implicit none
4
5 integer:: fin, ier
6 integer:: icount, istatus
7
8 character(200)::condFile
9
10 icount = nargs()
11 if ( icount.eq.2 ) then
12 call getarg(1, condFile, istatus)
13 else
14 stop "Input File not specified."
15 endif
16
17 ! Opens grid generating data file
18 call cg_iric_open(condFile, IRIC_MODE_MODIFY, fin, ier)
19 if (ier /=0) stop "*** Open error of CGNS file ***"
20
21 ! Closes grid generating data file
22 call cg_iric_close(fin, ier)
23end program SampleProgram
Compile the executable file, just like in Creating a scelton.
Check that the source code can be compiled successfully.
Refer to Opening a CGNS file and Closing a CGNS file for the details of the subroutines added in this section.