dbcsr_files Module

Utility routines to open and close files.



Variables

Type Visibility Attributes Name Initial
character(len=*), private, parameter :: moduleN = 'dbcsr_files'
integer, private, parameter :: max_preconnections = 10
integer, private, parameter :: max_unit_number = 999
type(preconnection_type), private, DIMENSION(max_preconnections) :: preconnected

Derived Types

type, private ::  preconnection_type

Components

Type Visibility Attributes Name Initial
character(len=default_path_length), private :: file_name = ""
integer, private :: unit_number = -1

Functions

public function get_unit_number(file_name) result(unit_number)

Returns the first logical unit that is not preconnected

Read more…

Arguments

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

Return Value integer

public function file_exists(file_name) result(exist)

Checks if file exists, considering also the file discovery mechanism.

Arguments

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

Return Value logical


Subroutines

private subroutine assign_preconnection(file_name, unit_number)

Add an entry to the list of preconnected units

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: file_name
integer, intent(in) :: unit_number

public subroutine close_file(unit_number, file_status, keep_preconnection)

Close an open file given by its logical unit number. Optionally, keep the file and unit preconnected.

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: unit_number
character(len=*), intent(in), optional :: file_status
logical, intent(in), optional :: keep_preconnection

private subroutine delete_preconnection(file_name, unit_number)

Remove an entry from the list of preconnected units

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: file_name
integer :: unit_number

public subroutine open_file(file_name, file_status, file_form, file_action, file_position, file_pad, unit_number, debug, skip_get_unit_number, file_access)

Opens the requested file using a free unit number

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: file_name
character(len=*), intent(in), optional :: file_status
character(len=*), intent(in), optional :: file_form
character(len=*), intent(in), optional :: file_action
character(len=*), intent(in), optional :: file_position
character(len=*), intent(in), optional :: file_pad
integer, intent(inout) :: unit_number
integer, intent(in), optional :: debug
logical, intent(in), optional :: skip_get_unit_number
character(len=*), intent(in), optional :: file_access

file access mode

private subroutine print_preconnection_list(output_unit)

Print the list of preconnected units

Arguments

Type IntentOptional Attributes Name
integer, intent(in), optional :: output_unit

which unit to print to (optional)