Note
Function that reads a script file. Keywords are identified and corresponding actions are triggered.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=512), | intent(in) | :: | job_file |
job file with macros to execute |
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