get_case_name Function

public function get_case_name(me) result(case_name)

Returns a string that can be used for file names, etc. (read the values of the global variables).

Note

We are only saving sec as an integer.

Type Bound

mission_type

Arguments

Type IntentOptional Attributes Name
class(mission_type), intent(in) :: me

Return Value character(len=:), allocatable


Called by

proc~~get_case_name~~CalledByGraph proc~get_case_name mission_type%get_case_name proc~generate_eclipse_data mission_type%generate_eclipse_data proc~generate_eclipse_data->proc~get_case_name proc~halo_solver_main halo_solver_main proc~halo_solver_main->proc~get_case_name proc~halo_solver_main->proc~generate_eclipse_data proc~plot_trajectory mission_type%plot_trajectory proc~halo_solver_main->proc~plot_trajectory proc~write_optvars_to_file mission_type%write_optvars_to_file proc~halo_solver_main->proc~write_optvars_to_file proc~plot_trajectory->proc~get_case_name proc~write_optvars_to_file->proc~get_case_name

Source Code

    function get_case_name(me) result(case_name)

    implicit none

    class(mission_type),intent(in) :: me
    character(len=:),allocatable :: case_name

    case_name = int_to_string(me%year,4)//int_to_string(me%month,2)//&
                int_to_string(me%day,2)//int_to_string(me%hour,2)//&
                int_to_string(me%minute,2)//int_to_string(int(me%sec),2)//&
                '_'//me%L1_or_L2//'_'//me%N_or_S//'_NREVS='//int_to_string(me%n_revs)

    contains

    !*************************************************
        function int_to_string(i,ipad) result(str)
        !! integer to string with zero padding
        implicit none
        integer,intent(in) :: i
        character(len=:),allocatable :: str
        integer,intent(in),optional :: ipad !! number of digits to pad with zeros
        character(len=100) :: istr
        integer :: istat
        write(istr,'(I100)',iostat=istat) i
        if (istat==0) then
            str = trim(adjustl(istr))
            if (present(ipad)) then
                if (len(str)<ipad) then
                    str = repeat('0',ipad-len(str))//str
                end if
            end if
        else
            str ='****'
        end if
        end function int_to_string
    !*************************************************

    end function get_case_name