PartMC  2.6.1
Data Types | Functions/Subroutines | Variables
pmc_spec_file Module Reference

Reading formatted text input. More...

Data Types

type  spec_file_t
 An input file with extra data for printing messages. More...
 

Functions/Subroutines

subroutine spec_file_die_msg (code, file, msg)
 Exit with an error message containing filename and line number. More...
 
subroutine spec_file_assert_msg (code, file, condition_ok, msg)
 Exit with an error message containing filename and line number if condition_ok is .false. More...
 
subroutine spec_file_open (filename, file)
 Open a spec file for reading. More...
 
subroutine spec_file_close (file)
 Close a spec file. More...
 
subroutine spec_file_read_line_raw (file, line, eof)
 Read a single line from a spec file, signaling if we have hit EOF. More...
 
subroutine spec_file_read_next_data_line (file, line, eof)
 Read the next line from the spec file that contains useful data (stripping comments and blank lines). More...
 
subroutine spec_file_read_line (file, line, eof)
 Read a spec_line from the spec_file. More...
 
subroutine spec_file_read_line_no_eof (file, line)
 Read a spec_line from the spec_file. This will always succeed or error out, so should only be called if we know there should be a valid line coming. More...
 
subroutine spec_file_read_line_list (file, max_lines, line_list)
 Read a list of spec_lines from a file, stopping at max_lines or EOF, whichever comes first. More...
 
subroutine spec_file_read_line_array (file, max_lines, line_array)
 Read an array of spec_lines from a file, stopping at max_lines or EOF. All lines must have the same number of elements. More...
 
subroutine spec_file_check_line_name (file, line, name)
 Check that the name of the line data is as given. More...
 
subroutine spec_file_check_name (file, name, read_name)
 Checks that the read_name is the same as name. More...
 
subroutine spec_file_check_line_length (file, line, length)
 Check that the length of the line data is as given. More...
 
subroutine spec_file_check_read_iostat (file, ios, type)
 Check the IOSTAT and error if it is bad. More...
 
integer function spec_file_string_to_integer (file, string)
 Convert a string to an integer. More...
 
real(kind=dp) function spec_file_string_to_real (file, string)
 Convert a string to an real. More...
 
logical function spec_file_string_to_logical (file, string)
 Convert a string to an logical. More...
 
subroutine spec_file_read_integer (file, name, var)
 Read an integer from a spec file that must have the given name. More...
 
subroutine spec_file_read_real (file, name, var)
 Read a real number from a spec file that must have the given name. More...
 
subroutine spec_file_read_logical (file, name, var)
 Read a logical from a spec file that must have a given name. More...
 
subroutine spec_file_read_string (file, name, var)
 Read a string from a spec file that must have a given name. More...
 
subroutine spec_file_read_complex (file, name, var)
 Read a complex number from a spec file that must have the given name. More...
 
subroutine spec_file_read_real_named_array (file, max_lines, names, vals)
 Read an array of named lines with real data. All lines must have the same number of data elements. More...
 
subroutine spec_file_read_timed_real_array (file, name, times, vals)
 Read an a time-indexed array of real data. More...
 

Variables

integer, parameter spec_file_max_list_lines = 1000
 Maximum number of lines in an array. More...
 

Detailed Description

Reading formatted text input.

Function/Subroutine Documentation

◆ spec_file_assert_msg()

subroutine pmc_spec_file::spec_file_assert_msg ( integer, intent(in)  code,
type(spec_file_t), intent(in)  file,
logical, intent(in)  condition_ok,
character(len=*), intent(in)  msg 
)

Exit with an error message containing filename and line number if condition_ok is .false.

Parameters
[in]codeFailure status code.
[in]fileSpec file.
[in]condition_okWhether the assertion is ok.
[in]msgError message.

Definition at line 90 of file spec_file.F90.

◆ spec_file_check_line_length()

subroutine pmc_spec_file::spec_file_check_line_length ( type(spec_file_t), intent(in)  file,
type(spec_line_t), intent(in)  line,
integer, intent(in)  length 
)

Check that the length of the line data is as given.

Parameters
[in]fileSpec file.
[in]lineSpec line.
[in]lengthExpected data length.

Definition at line 431 of file spec_file.F90.

◆ spec_file_check_line_name()

subroutine pmc_spec_file::spec_file_check_line_name ( type(spec_file_t), intent(in)  file,
type(spec_line_t), intent(in)  line,
character(len=*), intent(in)  name 
)

Check that the name of the line data is as given.

Parameters
[in]fileSpec file.
[in]lineSpec line.
[in]nameExpected line name.

Definition at line 389 of file spec_file.F90.

◆ spec_file_check_name()

subroutine pmc_spec_file::spec_file_check_name ( type(spec_file_t), intent(inout)  file,
character(len=*), intent(in)  name,
character(len=*), intent(in)  read_name 
)

Checks that the read_name is the same as name.

Parameters
[in,out]fileSpec file.
[in]nameName that we should have.
[in]read_nameName that we do have.

Definition at line 409 of file spec_file.F90.

◆ spec_file_check_read_iostat()

subroutine pmc_spec_file::spec_file_check_read_iostat ( type(spec_file_t), intent(in)  file,
integer, intent(in)  ios,
character(len=*), intent(in)  type 
)

Check the IOSTAT and error if it is bad.

Parameters
[in]fileSpec file.
[in]iosIostat result.
[in]typeType being read during error.

Definition at line 450 of file spec_file.F90.

◆ spec_file_close()

subroutine pmc_spec_file::spec_file_close ( type(spec_file_t), intent(in)  file)

Close a spec file.

Parameters
[in]fileSpec file.

Definition at line 134 of file spec_file.F90.

◆ spec_file_die_msg()

subroutine pmc_spec_file::spec_file_die_msg ( integer, intent(in)  code,
type(spec_file_t), intent(in)  file,
character(len=*), intent(in)  msg 
)

Exit with an error message containing filename and line number.

Parameters
[in]codeFailure status code.
[in]fileSpec file.
[in]msgError message.

Definition at line 73 of file spec_file.F90.

◆ spec_file_open()

subroutine pmc_spec_file::spec_file_open ( character(len=*), intent(in)  filename,
type(spec_file_t), intent(out)  file 
)

Open a spec file for reading.

Parameters
[in]filenameName of file to open.
[out]fileSpec file.

Definition at line 111 of file spec_file.F90.

◆ spec_file_read_complex()

subroutine pmc_spec_file::spec_file_read_complex ( type(spec_file_t), intent(inout)  file,
character(len=*), intent(in)  name,
complex(kind=dc), intent(out)  var 
)

Read a complex number from a spec file that must have the given name.

Parameters
[in,out]fileSpec file.
[in]nameName.
[out]varVariable to store data.

Definition at line 626 of file spec_file.F90.

◆ spec_file_read_integer()

subroutine pmc_spec_file::spec_file_read_integer ( type(spec_file_t), intent(inout)  file,
character(len=*), intent(in)  name,
integer, intent(out)  var 
)

Read an integer from a spec file that must have the given name.

Parameters
[in,out]fileSpec file.
[in]nameName.
[out]varVariable to store data.

Definition at line 540 of file spec_file.F90.

◆ spec_file_read_line()

subroutine pmc_spec_file::spec_file_read_line ( type(spec_file_t), intent(inout)  file,
type(spec_line_t), intent(inout)  line,
logical, intent(out)  eof 
)

Read a spec_line from the spec_file.

Parameters
[in,out]fileSpec file.
[in,out]lineSpec line.
[out]eofTrue if EOF encountered.

Definition at line 214 of file spec_file.F90.

◆ spec_file_read_line_array()

subroutine pmc_spec_file::spec_file_read_line_array ( type(spec_file_t), intent(inout)  file,
integer, intent(in)  max_lines,
type(spec_line_t), dimension(:), allocatable  line_array 
)

Read an array of spec_lines from a file, stopping at max_lines or EOF. All lines must have the same number of elements.

Parameters
[in,out]fileSpec file.
[in]max_linesMax lines to read (0 = no max).
line_arrayArray of spec_lines,.

Definition at line 362 of file spec_file.F90.

◆ spec_file_read_line_list()

subroutine pmc_spec_file::spec_file_read_line_list ( type(spec_file_t), intent(inout)  file,
integer, intent(in)  max_lines,
type(spec_line_t), dimension(:), allocatable  line_list 
)

Read a list of spec_lines from a file, stopping at max_lines or EOF, whichever comes first.

Parameters
[in,out]fileSpec file.
[in]max_linesMax lines to read (0 = no max).
line_listList of spec_lines.

Definition at line 317 of file spec_file.F90.

◆ spec_file_read_line_no_eof()

subroutine pmc_spec_file::spec_file_read_line_no_eof ( type(spec_file_t), intent(inout)  file,
type(spec_line_t), intent(inout)  line 
)

Read a spec_line from the spec_file. This will always succeed or error out, so should only be called if we know there should be a valid line coming.

Parameters
[in,out]fileSpec file.
[in,out]lineSpec line.

Definition at line 297 of file spec_file.F90.

◆ spec_file_read_line_raw()

subroutine pmc_spec_file::spec_file_read_line_raw ( type(spec_file_t), intent(inout)  file,
character(len=*), intent(out)  line,
logical, intent(out)  eof 
)

Read a single line from a spec file, signaling if we have hit EOF.

Parameters
[in,out]fileSpec file.
[out]lineComplete line read.
[out]eofTrue if at EOF.

Definition at line 147 of file spec_file.F90.

◆ spec_file_read_logical()

subroutine pmc_spec_file::spec_file_read_logical ( type(spec_file_t), intent(inout)  file,
character(len=*), intent(in)  name,
logical, intent(out)  var 
)

Read a logical from a spec file that must have a given name.

Parameters
[in,out]fileSpec file.
[in]nameName.
[out]varVariable to store data.

Definition at line 583 of file spec_file.F90.

◆ spec_file_read_next_data_line()

subroutine pmc_spec_file::spec_file_read_next_data_line ( type(spec_file_t), intent(inout)  file,
character(len=*), intent(out)  line,
logical, intent(out)  eof 
)

Read the next line from the spec file that contains useful data (stripping comments and blank lines).

Parameters
[in,out]fileSpec file.
[out]lineComplete line read.
[out]eofTrue if EOF encountered.

Definition at line 183 of file spec_file.F90.

◆ spec_file_read_real()

subroutine pmc_spec_file::spec_file_read_real ( type(spec_file_t), intent(inout)  file,
character(len=*), intent(in)  name,
real(kind=dp), intent(out)  var 
)

Read a real number from a spec file that must have the given name.

Parameters
[in,out]fileSpec file.
[in]nameName.
[out]varVariable to store data.

Definition at line 562 of file spec_file.F90.

◆ spec_file_read_real_named_array()

subroutine pmc_spec_file::spec_file_read_real_named_array ( type(spec_file_t), intent(inout)  file,
integer, intent(in)  max_lines,
character(len=spec_line_max_var_len), dimension(:), allocatable  names,
real(kind=dp), dimension(:,:), allocatable  vals 
)

Read an array of named lines with real data. All lines must have the same number of data elements.

Parameters
[in,out]fileSpec file.
[in]max_linesMax lines to read (0 = no max).
namesNames of lines.
valsData values.

Definition at line 649 of file spec_file.F90.

◆ spec_file_read_string()

subroutine pmc_spec_file::spec_file_read_string ( type(spec_file_t), intent(inout)  file,
character(len=*), intent(in)  name,
character(len=*), intent(out)  var 
)

Read a string from a spec file that must have a given name.

Parameters
[in,out]fileSpec file.
[in]nameName.
[out]varVariable to store data.

Definition at line 604 of file spec_file.F90.

◆ spec_file_read_timed_real_array()

subroutine pmc_spec_file::spec_file_read_timed_real_array ( type(spec_file_t), intent(inout)  file,
character(len=*), intent(in)  name,
real(kind=dp), dimension(:), allocatable  times,
real(kind=dp), dimension(:), allocatable  vals 
)

Read an a time-indexed array of real data.

Parameters
[in,out]fileSpec file.
[in]nameVariable name.
timesNames of lines.
valsData values.

Definition at line 687 of file spec_file.F90.

◆ spec_file_string_to_integer()

integer function pmc_spec_file::spec_file_string_to_integer ( type(spec_file_t), intent(in)  file,
character(len=*), intent(in)  string 
)

Convert a string to an integer.

Parameters
[in]fileSpec file.
[in]stringString to convert.

Definition at line 469 of file spec_file.F90.

◆ spec_file_string_to_logical()

logical function pmc_spec_file::spec_file_string_to_logical ( type(spec_file_t), intent(in)  file,
character(len=*), intent(in)  string 
)

Convert a string to an logical.

Parameters
[in]fileSpec file.
[in]stringString to convert.

Definition at line 507 of file spec_file.F90.

◆ spec_file_string_to_real()

real(kind=dp) function pmc_spec_file::spec_file_string_to_real ( type(spec_file_t), intent(in)  file,
character(len=*), intent(in)  string 
)

Convert a string to an real.

Parameters
[in]fileSpec file.
[in]stringString to convert.

Definition at line 488 of file spec_file.F90.

Variable Documentation

◆ spec_file_max_list_lines

integer, parameter pmc_spec_file::spec_file_max_list_lines = 1000

Maximum number of lines in an array.

Definition at line 49 of file spec_file.F90.