parse_params Subroutine

public subroutine parse_params(filename, packet, dects, spectrum, dict, error)

entry point for parsing toml file

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: filename

filename of input toml file

type(photon), intent(out) :: packet

some input options set up data in the photon class

type(dect_array), intent(out), allocatable :: dects(:)

detector array which is setup during parsing

type(spectrum_t), intent(out) :: spectrum

spectrum type which is set up during parsing

type(toml_table), intent(inout) :: dict

dictionary that stores potential metadata to be saved with simulation output

type(toml_error), intent(out), allocatable :: error

Last error raised during parsing. Unallocated if no error raised. Need to handle this on return from parse_params.


Source Code

    subroutine parse_params(filename, packet, dects, spectrum, dict, error)
        !! entry point for parsing toml file

        use detectors,   only : dect_array
        use photonmod
        use piecewiseMod
        
        !> filename of input toml file
        character(*),      intent(IN)    :: filename
        !> dictionary that stores potential metadata to be saved with simulation output
        type(toml_table),  intent(INOUT) :: dict
        !> some input options set up data in the photon class
        type(photon),      intent(OUT)   :: packet
        !> detector array which is setup during parsing
        type(dect_array), allocatable, intent(out) :: dects(:)
        !> spectrum type which is set up during parsing
        type(spectrum_t), intent(out) :: spectrum
        !> Last error raised during parsing. Unallocated if no error raised. Need to handle this on return from parse_params.
        type(toml_error), allocatable, intent(out) :: error

        type(toml_table), allocatable :: table
        type(toml_context) :: context

        call toml_load(table, trim(filename), context=context, error=error)
        if(allocated(error))return

        call parse_source(table, packet, dict, spectrum, context, error)
        if(allocated(error))return

        call parse_grid(table, dict, error)
        if(allocated(error))return

        call parse_geometry(table, dict, error)
        if(allocated(error))return

        call parse_detectors(table, dects, context, error)
        if(allocated(error))return

        call parse_output(table, error)
        if(allocated(error))return

        call parse_simulation(table, error)
        if(allocated(error))return

    end subroutine parse_params