PartMC 2.1.2
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.
subroutine spec_file_open (filename, file)
 Open a spec file for reading.
subroutine spec_file_close (file)
 Close a spec file.
subroutine spec_file_read_line_raw (file, line, eof)
 Read a single line from a spec file, signaling if we have hit EOF.
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).
subroutine spec_file_read_line (file, line, eof)
 Read a spec_line from the spec_file.
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.
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.
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.
subroutine spec_file_check_line_name (file, line, name)
 Check that the name of the line data is as given.
subroutine spec_file_check_name (file, name, read_name)
 Checks that the read_name is the same as name.
subroutine spec_file_check_line_length (file, line, length)
 Check that the length of the line data is as given.
subroutine spec_file_check_read_iostat (file, ios, type)
 Check the IOSTAT and error if it is bad.
integer spec_file_string_to_integer (file, string)
 Convert a string to an integer.
real(kind=dp) spec_file_string_to_real (file, string)
 Convert a string to an real.
logical spec_file_string_to_logical (file, string)
 Convert a string to an logical.
subroutine spec_file_read_integer (file, name, var)
 Read an integer from a spec file that must have the given name.
subroutine spec_file_read_real (file, name, var)
 Read a real number from a spec file that must have the given name.
subroutine spec_file_read_logical (file, name, var)
 Read a logical from a spec file that must have a given name.
subroutine spec_file_read_string (file, name, var)
 Read a string from a spec file that must have a given name.
subroutine spec_file_read_complex (file, name, var)
 Read a complex number from a spec file that must have the given name.
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.
subroutine spec_file_read_timed_real_array (file, name, times, vals)
 Read an a time-indexed array of real data.

Variables

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

Detailed Description

Reading formatted text input.


Function/Subroutine Documentation

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:
fileSpec file.
lineSpec line.
lengthExpected data length.

Definition at line 425 of file spec_file.F90.

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:
fileSpec file.
lineSpec line.
nameExpected line name.

Definition at line 383 of file spec_file.F90.

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:
fileSpec file.
nameName that we should have.
read_nameName that we do have.

Definition at line 403 of file spec_file.F90.

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:
fileSpec file.
iosIostat result.
typeType being read during error.

Definition at line 444 of file spec_file.F90.

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

Close a spec file.

Parameters:
fileSpec file.

Definition at line 113 of file spec_file.F90.

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:
codeFailure status code.
fileSpec file.
msgError message.

Definition at line 73 of file spec_file.F90.

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:
filenameName of file to open.
fileSpec file.

Definition at line 90 of file spec_file.F90.

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:
fileSpec file.
nameName.
varVariable to store data.

Definition at line 628 of file spec_file.F90.

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:
fileSpec file.
nameName.
varVariable to store data.

Definition at line 534 of file spec_file.F90.

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:
fileSpec file.
lineSpec line.
eofTrue if EOF encountered.

Definition at line 193 of file spec_file.F90.

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(:),pointer  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:
fileSpec file.
max_linesMax lines to read (0 = no max).
line_arrayArray of spec_lines,.

Definition at line 356 of file spec_file.F90.

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(:),pointer  line_list 
)

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

Parameters:
fileSpec file.
max_linesMax lines to read (0 = no max).
line_listList of spec_lines.

Definition at line 297 of file spec_file.F90.

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:
fileSpec file.
lineSpec line.

Definition at line 277 of file spec_file.F90.

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:
fileSpec file.
lineComplete line read.
eofTrue if at EOF.

Definition at line 126 of file spec_file.F90.

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:
fileSpec file.
nameName.
varVariable to store data.

Definition at line 581 of file spec_file.F90.

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:
fileSpec file.
lineComplete line read.
eofTrue if EOF encountered.

Definition at line 162 of file spec_file.F90.

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:
fileSpec file.
nameName.
varVariable to store data.

Definition at line 558 of file spec_file.F90.

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(:),pointer  names,
real(kind=dp),dimension(:,:),pointer  vals 
)

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

Parameters:
fileSpec file.
max_linesMax lines to read (0 = no max).
namesNames of lines.
valsData values.

Definition at line 653 of file spec_file.F90.

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:
fileSpec file.
nameName.
varVariable to store data.

Definition at line 604 of file spec_file.F90.

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(:),pointer  times,
real(kind=dp),dimension(:),pointer  vals 
)

Read an a time-indexed array of real data.

Parameters:
fileSpec file.
nameVariable name.
timesNames of lines.
valsData values.

Definition at line 696 of file spec_file.F90.

integer 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:
fileSpec file.
stringString to convert.

Definition at line 463 of file spec_file.F90.

logical 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:
fileSpec file.
stringString to convert.

Definition at line 501 of file spec_file.F90.

real(kind=dp) 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:
fileSpec file.
stringString to convert.

Definition at line 482 of file spec_file.F90.


Variable Documentation

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.