read_job Subroutine

public subroutine read_job(job_file)

Note

Function that reads a script file. Keywords are identified and corresponding actions are triggered.

Arguments

Type IntentOptional Attributes Name
character(len=512), intent(in) :: job_file

job file with macros to execute


Calls

proc~~read_job~~CallsGraph proc~read_job read_job get_unit get_unit proc~read_job->get_unit proc~acf_theo acf_theo proc~read_job->proc~acf_theo proc~calc_acf calc_acf proc~read_job->proc~calc_acf proc~calc_ffh calc_ffh proc~read_job->proc~calc_ffh proc~calc_ord calc_ord proc~read_job->proc~calc_ord proc~calc_z_f calc_z_f proc~read_job->proc~calc_z_f proc~calc_z_i calc_z_i proc~read_job->proc~calc_z_i proc~def_size def_size proc~read_job->proc~def_size proc~digi_fil digi_fil proc~read_job->proc~digi_fil proc~end_loop end_loop proc~read_job->proc~end_loop proc~end_scri end_scri proc~read_job->proc~end_scri proc~nb_procs nb_procs proc~read_job->proc~nb_procs proc~plt__acf plt__acf proc~read_job->proc~plt__acf proc~save_img save_img proc~read_job->proc~save_img proc~smooth__ smooth__ proc~read_job->proc~smooth__ proc~sta_loop sta_loop proc~read_job->proc~sta_loop proc~sta_scri sta_scri proc~read_job->proc~sta_scri proc~sta_theo sta_theo proc~read_job->proc~sta_theo proc~sub_surf sub_surf proc~read_job->proc~sub_surf selectcase selectcase proc~read_job->selectcase str_remove_chars str_remove_chars proc~read_job->str_remove_chars ellipse_acf ellipse_acf proc~acf_theo->ellipse_acf proc~calc_imp_acf calc_imp_acf proc~acf_theo->proc~calc_imp_acf proc~acf_wiener acf_wiener proc~calc_acf->proc~acf_wiener calc_fftw3_real_bwd calc_fftw3_real_bwd proc~calc_ffh->calc_fftw3_real_bwd calc_fftw3_real_fwd calc_fftw3_real_fwd proc~calc_ffh->calc_fftw3_real_fwd calc_moments calc_moments proc~calc_ffh->calc_moments init_order init_order proc~calc_ord->init_order sort_array2 sort_array2 proc~calc_ord->sort_array2 proc~calc_z_f->calc_moments proc~build_heights build_heights proc~calc_z_f->proc~build_heights proc~calc_z_i->calc_moments proc~calc_z_i->proc~build_heights scramble scramble proc~calc_z_i->scramble proc~digi_fil->calc_fftw3_real_bwd proc~digi_fil->calc_fftw3_real_fwd proc~digi_fil->calc_moments end_fftw3 end_fftw3 proc~end_scri->end_fftw3 omp_get_num_procs omp_get_num_procs proc~nb_procs->omp_get_num_procs proc~plt__acf->get_unit proc~plt__acf->ellipse_acf init_scal init_scal proc~save_img->init_scal write_surf write_surf proc~save_img->write_surf proc~smooth__->calc_moments fft_filter fft_filter proc~smooth__->fft_filter random_init random_init proc~sta_scri->random_init proc~sub_surf->calc_moments proc~sub_surf->end_fftw3 fftw_plan_with_nthreads fftw_plan_with_nthreads proc~sub_surf->fftw_plan_with_nthreads proc~sub_surf->init_order omp_get_max_threads omp_get_max_threads proc~sub_surf->omp_get_max_threads proc~sub_surf->proc~acf_wiener proc~sub_surf->proc~build_heights proc~sub_surf->proc~calc_imp_acf proc~calc_res_acf calc_res_acf proc~sub_surf->proc~calc_res_acf progress_bar_terminal progress_bar_terminal proc~sub_surf->progress_bar_terminal proc~sub_surf->sort_array2 tab_end_fftw3_real tab_end_fftw3_real proc~sub_surf->tab_end_fftw3_real tab_init_fftw3_real tab_init_fftw3_real proc~sub_surf->tab_init_fftw3_real proc~acf_wiener->calc_fftw3_real_bwd proc~acf_wiener->calc_fftw3_real_fwd tab_calc_fftw3_real_bwd tab_calc_fftw3_real_bwd proc~acf_wiener->tab_calc_fftw3_real_bwd tab_calc_fftw3_real_fwd tab_calc_fftw3_real_fwd proc~acf_wiener->tab_calc_fftw3_real_fwd trans_corner2center trans_corner2center proc~acf_wiener->trans_corner2center proc~build_heights->calc_moments proc~build_heights->sort_array2 proc~pikaia_skku_solver pikaia_skku_solver proc~build_heights->proc~pikaia_skku_solver proc~profil_theo_trie_1d profil_theo_trie_1D proc~build_heights->proc~profil_theo_trie_1d proc~apod2 apod2 proc~calc_imp_acf->proc~apod2 proc~autocov_impo autocov_impo proc~calc_imp_acf->proc~autocov_impo init pikaia_class%init proc~pikaia_skku_solver->init solve pikaia_class%solve proc~pikaia_skku_solver->solve proc~profil_theo_trie_1d->calc_moments

Called by

proc~~read_job~~CalledByGraph proc~read_job read_job proc~prg_surf prg_surf proc~prg_surf->proc~read_job program~main main program~main->proc~prg_surf

Source Code

   subroutine read_job(job_file)
   !================================================================================================
   !<@note Function that reads a script file. Keywords are identified and corresponding actions are
   !< triggered.
   !<@endnote
   !------------------------------------------------------------------------------------------------
   implicit none
   character(len=512), intent(in) :: job_file   !! job file with macros to execute

      integer  (kind=I4) :: vide
      character(len=512) :: keyword
      logical  (kind=I4) :: first

      ! script file
      call get_unit( JOB )
      open(unit = JOB, file = trim(job_file), status = 'old')

      ! witness file
      call get_unit( SPY )
      open(unit = SPY, file = "out/spy.txt", status = 'unknown')

      LINE_READ = 0
      first     = .true. ! determine if calc_z_f has been already used

      ! default function used: the tangent function
      PARAM%func_gen = FCT_TANG

      ! default is 2 bounds when generating profiles
      PARAM%nparam = 2

o:    do

         keyword = repeat( ' ', len(keyword) )

         read(JOB, *, iostat = vide) keyword ; LINE_READ = LINE_READ + 1

         ! remove unwanted characters from keyword
         keyword = str_remove_chars(string = trim(keyword), chars = '- # *')

         write(SPY, '(a6,I4.4,a)') "line: ", LINE_READ, ' ', trim(keyword)

         selectcase( keyword(1:8) )

            case('STA_SCRI')
               ! start script
               call sta_scri()

            case('DEF_SIZE')
               ! image size
               call def_size()

            case('NB_PROCS')
               ! number of threads
               call nb_procs()

            case('STA_THEO')
               ! desired stat moments
               call sta_theo()

            case('ACF_THEO')
               ! desired acf
               call acf_theo()

            case('CALC_FFH')
               ! deigital filter
               call calc_ffh( calc_m_stt = first )

            case('CALC_Z_I')
               ! starting heights
               call calc_z_i()

            case('DIGI_FIL')
               ! apply digital filter
               call digi_fil()

            case('CALC_ORD')
               ! determine heights order
               call calc_ord()

            case('CALC_Z_F')
               ! final heights
               call calc_z_f( to_be_made = first )
               ! now, calc_z_f is considered as already ran
               first = .false.

            case('STA_LOOP')
               ! loop start
               call sta_loop()

            case('END_LOOP')
               ! loop end
               call end_loop()

            case('SUB_SURF')
               ! extract the best surface
               call sub_surf()

            case('SMOOTH__')
               ! low-pass filter
               call smooth__()

            case('SAVE_PRF')
               ! save image
               call save_img( tab = PARAM%surf )     ! IN

            case('CALC_ACF')
               ! determine the surface acf
               call calc_acf()

            case('PLT__ACF')
               ! print the correlation graphs and/or determine
               ! if the stop criterion is reached.
               call plt__acf()

            case('SAVE_ACF')
               ! save the acf surface
               call save_img( tab = PARAM%imp_acf )    ! IN

            case('END_SCRI')
               ! close the script reading
               call end_scri()

               exit o

         endselect

      enddo o

      close(JOB)

   return
   endsubroutine read_job