(git:48c3be8)
Loading...
Searching...
No Matches
cp_output_handling Module Reference

routines to handle the output, The idea is to remove the decision of wheter to output and what to output from the code that does the output, and centralize it here. More...

Functions/Subroutines

subroutine, public cp_print_key_section_create (print_key_section, location, name, description, print_level, each_iter_names, each_iter_values, add_last, filename, common_iter_levels, citations, unit_str)
 creates a print_key section
integer function, public cp_print_key_should_output (iteration_info, basis_section, print_key_path, used_print_key, first_time)
 returns what should be done with the given property if btest(res,cp_p_store) then the property should be stored in memory if btest(res,cp_p_file) then the property should be print ed to a file if res==0 then nothing should be done
logical function, public cp_printkey_is_on (iteration_info, print_key)
 returns true if the printlevel activates this printkey does not look if this iteration it should be printed
character(len=default_string_length) function, public cp_iter_string (iter_info, print_key, for_file)
 returns the iteration string, a string that is useful to create unique filenames (once you trim it)
subroutine, public cp_iterate (iteration_info, last, iter_nr, increment, iter_nr_out)
 adds one to the actual iteration
integer function, public cp_get_iter_level_by_name (iteration_info, level_name)
 Return the index of an iteration level by its name.
subroutine, public cp_get_iter_nr (iteration_info, rlevel, iter_nr, last_iter)
 Return the current iteration number at a given level.
subroutine, public cp_add_iter_level (iteration_info, level_name, n_rlevel_new)
 Adds an iteration level.
subroutine, public cp_rm_iter_level (iteration_info, level_name, n_rlevel_att)
 Removes an iteration level.
character(len=default_path_length) function, public cp_print_key_generate_filename (logger, print_key, middle_name, extension, my_local)
 Utility function that returns a unit number to write the print key. Might open a file with a unique filename, generated from the print_key name and iteration info.
integer function, public cp_print_key_unit_nr (logger, basis_section, print_key_path, extension, middle_name, local, log_filename, ignore_should_output, file_form, file_position, file_action, file_status, do_backup, on_file, is_new_file, mpi_io, fout)
 ...
subroutine, public cp_print_key_finished_output (unit_nr, logger, basis_section, print_key_path, local, ignore_should_output, on_file, mpi_io)
 should be called after you finish working with a unit obtained with cp_print_key_unit_nr, so that the file that might have been opened can be closed.
subroutine, public cp_mpi_io_set (flag)
 Sets flag which determines whether or not to use MPI I/O for I/O routines that have been parallized with MPI.
logical function, public cp_mpi_io_get ()
 Gets flag which determines whether or not to use MPI I/O for I/O routines that have been parallized with MPI.

Variables

integer, parameter, public add_last_no = 0
integer, parameter, public add_last_numeric = 1
integer, parameter, public add_last_symbolic = 2
integer, parameter, public silent_print_level = 0
integer, parameter, public low_print_level = 1
integer, parameter, public medium_print_level = 2
integer, parameter, public high_print_level = 3
integer, parameter, public debug_print_level = 4
integer, parameter, public cp_p_file_if = 3
integer, parameter, public cp_p_store_if = 4
integer, parameter, public cp_p_store = 2
integer, parameter, public cp_p_file = 1
integer, parameter, public cp_p_file_each = 5
integer, parameter, public cp_p_store_each = 6
integer, parameter, public cp_p_calc = 7
integer, parameter, public cp_out_none = 0
integer, parameter, public cp_out_file_if = IBSET(0, cp_p_file_if)
integer, parameter, public cp_out_store_if = IBSET(0, cp_p_store_if)
integer, parameter, public cp_out_file = IBSET(0, cp_p_file)
integer, parameter, public cp_out_store = IBSET(0, cp_p_store)
integer, parameter, public cp_out_calc = IBSET(0, cp_p_calc)
integer, parameter, public cp_out_file_each = IBSET(0, cp_p_file_each)
integer, parameter, public cp_out_store_each = IBSET(0, cp_p_store_each)
integer, parameter, public cp_out_default = cp_out_file_if

Detailed Description

routines to handle the output, The idea is to remove the decision of wheter to output and what to output from the code that does the output, and centralize it here.

Note
These were originally together with the log handling routines, but have been spawned off. Some dependencies are still there, and some of the comments about log handling also applies to output handling:
See also
cp_log_handling
History
12.2001 created [fawzi] 08.2002 updated to new logger [fawzi] 10.2004 big rewrite of the output methods, connected to the new input, and iteration_info [fawzi] 08.2005 property flags [fawzi]
Author
Fawzi Mohamed

Function/Subroutine Documentation

◆ cp_print_key_section_create()

subroutine, public cp_output_handling::cp_print_key_section_create ( type(section_type), pointer print_key_section,
character(len=*), intent(in) location,
character(len=*), intent(in) name,
character(len=*), intent(in) description,
integer, intent(in), optional print_level,
character(len=*), dimension(:), intent(in), optional each_iter_names,
integer, dimension(:), intent(in), optional each_iter_values,
integer, intent(in), optional add_last,
character(len=*), intent(in), optional filename,
integer, intent(in), optional common_iter_levels,
integer, dimension(:), optional citations,
character(len=*), intent(in), optional unit_str )

creates a print_key section

Parameters
print_key_sectionthe print key to create
locationfrom where in the source code cp_print_key_section_create() is called
namethe name of the print key
descriptionthe description of the print key
print_levelprint level starting at which the printing takes place (defaults to debug_print_level)
each_iter_names...
each_iter_values...
add_last...
filename...
common_iter_levels...
citations...
unit_strspecifies an unit of measure for output quantity. If not provided the control is totally left to how the output was coded (i.e. USERS have no possibility to change it)
Author
fawzi

Definition at line 171 of file cp_output_handling.F.

Here is the call graph for this function:

◆ cp_print_key_should_output()

integer function, public cp_output_handling::cp_print_key_should_output ( type(cp_iteration_info_type), intent(in) iteration_info,
type(section_vals_type), intent(in), target basis_section,
character(len=*), intent(in), optional print_key_path,
type(section_vals_type), intent(inout), optional, pointer used_print_key,
logical, intent(out), optional first_time )

returns what should be done with the given property if btest(res,cp_p_store) then the property should be stored in memory if btest(res,cp_p_file) then the property should be print ed to a file if res==0 then nothing should be done

Parameters
iteration_infoinformation about the actual iteration level
basis_sectionsection that contains the printkey
print_key_pathpath to the printkey- "%" between sections, and optionally a "/" and a logical flag to check). Might be empty.
used_print_keyhere the print_key that was used is returned
first_timeif it ist the first time that an output is written (not fully correct, but most of the time)
Returns
...
Author
fawzi
Note
not all the propreties support can be stored

Definition at line 342 of file cp_output_handling.F.

Here is the call graph for this function:

◆ cp_printkey_is_on()

logical function, public cp_output_handling::cp_printkey_is_on ( type(cp_iteration_info_type), intent(in) iteration_info,
type(section_vals_type), pointer print_key )

returns true if the printlevel activates this printkey does not look if this iteration it should be printed

Parameters
iteration_infoinformation about the actual iteration level
print_keythe section values of the key to be printed
Returns
...
Author
fawzi

Definition at line 428 of file cp_output_handling.F.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cp_iter_string()

character(len=default_string_length) function, public cp_output_handling::cp_iter_string ( type(cp_iteration_info_type), pointer iter_info,
type(section_vals_type), optional, pointer print_key,
logical, intent(in), optional for_file )

returns the iteration string, a string that is useful to create unique filenames (once you trim it)

Parameters
iter_infothe iteration info from where to take the iteration number
print_keythe print key to optionally show the last iteration symbolically
for_fileif the string is to be used for file generation (and should consequently ignore some iteration levels depending on COMMON_ITERATION_LEVELS). Defaults to false.
Returns
...
Author
fawzi
Note
If the root level is 1 removes it

Definition at line 516 of file cp_output_handling.F.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cp_iterate()

subroutine, public cp_output_handling::cp_iterate ( type(cp_iteration_info_type), pointer iteration_info,
logical, intent(in), optional last,
integer, intent(in), optional iter_nr,
integer, intent(in), optional increment,
integer, intent(out), optional iter_nr_out )

adds one to the actual iteration

Parameters
iteration_infothe iteration info to update
lastif this iteration is the last one (defaults to false)
iter_nr...
increment...
iter_nr_out...
Author
fawzi
Note
this is supposed to be called at the beginning of each iteration

Definition at line 573 of file cp_output_handling.F.

Here is the caller graph for this function:

◆ cp_get_iter_level_by_name()

integer function, public cp_output_handling::cp_get_iter_level_by_name ( type(cp_iteration_info_type), intent(in), pointer iteration_info,
character(len=*), intent(in) level_name )

Return the index of an iteration level by its name.

Parameters
iteration_infothe iteration info to query
level_namelevel name to query.
Returns
iteration level index or 0 if there is no such level
Author
Sergey Chulkov

Definition at line 610 of file cp_output_handling.F.

Here is the caller graph for this function:

◆ cp_get_iter_nr()

subroutine, public cp_output_handling::cp_get_iter_nr ( type(cp_iteration_info_type), intent(in), pointer iteration_info,
integer, intent(in), optional rlevel,
integer, intent(out), optional iter_nr,
logical, intent(out), optional last_iter )

Return the current iteration number at a given level.

Parameters
iteration_infothe iteration info to query
rlevelindex of the iteration level. Use the level on top of the stack, if it is not given
iter_nriteration number [out]
last_iterlast iteration flag [out]
Author
Sergey Chulkov

Definition at line 632 of file cp_output_handling.F.

Here is the caller graph for this function:

◆ cp_add_iter_level()

subroutine, public cp_output_handling::cp_add_iter_level ( type(cp_iteration_info_type), pointer iteration_info,
character(len=*), intent(in) level_name,
integer, intent(out), optional n_rlevel_new )

Adds an iteration level.

Parameters
iteration_infothe iteration info to which an iteration level has to be added
level_namethe name of this level, for pretty printing only, right now
n_rlevel_newnumber of iteration levels after this call
Author
fawzi

Definition at line 661 of file cp_output_handling.F.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cp_rm_iter_level()

subroutine, public cp_output_handling::cp_rm_iter_level ( type(cp_iteration_info_type), pointer iteration_info,
character(len=*), intent(in) level_name,
integer, intent(in), optional n_rlevel_att )

Removes an iteration level.

Parameters
iteration_infothe iteration info to which an iteration level has to be removed
level_namelevel_name to be destroyed (if does not match gives an error)
n_rlevel_attiteration level before the call (to do some checks)
Author
fawzi

Definition at line 704 of file cp_output_handling.F.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cp_print_key_generate_filename()

character(len=default_path_length) function, public cp_output_handling::cp_print_key_generate_filename ( type(cp_logger_type), pointer logger,
type(section_vals_type), pointer print_key,
character(len=*), intent(in), optional middle_name,
character(len=*), intent(in) extension,
logical, intent(in) my_local )

Utility function that returns a unit number to write the print key. Might open a file with a unique filename, generated from the print_key name and iteration info.

Normally a valid unit (>0) is returned only if cp_print_key_should_output says that the print_key should be printed, and if the unit is global only the io node has a valid unit. So in many cases you can decide if you should print just checking if the returned units is bigger than 0.

IMPORTANT you should call cp_finished_output when an iteration output is finished (to immediately close the file that might have been opened)

Parameters
loggerthe logger for the parallel environment, iteration info and filename generation
print_key...
middle_namename to be added to the generated filename, useful when print_key activates different distinct outputs, to be able to distinguish them
extensionextension to be applied to the filename (including the ".")
my_localif the unit should be local to this task, or global to the program (defaults to false).
Returns
...
Author
Fawzi Mohamed

Definition at line 752 of file cp_output_handling.F.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cp_print_key_unit_nr()

integer function, public cp_output_handling::cp_print_key_unit_nr ( type(cp_logger_type), pointer logger,
type(section_vals_type), intent(in) basis_section,
character(len=*), intent(in), optional print_key_path,
character(len=*), intent(in) extension,
character(len=*), intent(in), optional middle_name,
logical, intent(in), optional local,
logical, intent(in), optional log_filename,
logical, intent(in), optional ignore_should_output,
character(len=*), intent(in), optional file_form,
character(len=*), intent(in), optional file_position,
character(len=*), intent(in), optional file_action,
character(len=*), intent(in), optional file_status,
logical, intent(in), optional do_backup,
logical, intent(in), optional on_file,
logical, intent(out), optional is_new_file,
logical, intent(inout), optional mpi_io,
character(len=default_path_length), intent(out), optional fout )

...

Parameters
logger...
basis_section...
print_key_path...
extension...
middle_name...
local...
log_filename...
ignore_should_output...
file_form...
file_position...
file_action...
file_status...
do_backup...
on_file...
is_new_filetrue if this rank created a new (or rewound) file, false otherwise
mpi_ioTrue if the file should be opened in parallel on all processors belonging to the communicator group. Automatically disabled if the file form or access mode is unsuitable for MPI IO. Return value indicates whether MPI was actually used and therefore the flag must also be passed to the file closing directive.
foutName of the actual file where the output will be written. Needed mainly for MPI IO because inquiring the filename from the MPI filehandle does not work across all MPI libraries.
Returns
...

Definition at line 849 of file cp_output_handling.F.

Here is the call graph for this function:

◆ cp_print_key_finished_output()

subroutine, public cp_output_handling::cp_print_key_finished_output ( integer, intent(inout) unit_nr,
type(cp_logger_type), pointer logger,
type(section_vals_type), intent(in) basis_section,
character(len=*), intent(in), optional print_key_path,
logical, intent(in), optional local,
logical, intent(in), optional ignore_should_output,
logical, intent(in), optional on_file,
logical, intent(in), optional mpi_io )

should be called after you finish working with a unit obtained with cp_print_key_unit_nr, so that the file that might have been opened can be closed.

the inputs should be exactly the same of the corresponding cp_print_key_unit_nr

Parameters
unit_nr...
logger...
basis_section...
print_key_path...
local...
ignore_should_output...
on_file...
mpi_ioTrue if file was opened in parallel with MPI
History
08.2002 created [fawzi]
Author
Fawzi Mohamed
Note
closes if the corresponding filename of the printkey is not STD_OUT

Definition at line 1070 of file cp_output_handling.F.

Here is the call graph for this function:

◆ cp_mpi_io_set()

subroutine, public cp_output_handling::cp_mpi_io_set ( logical, intent(in) flag)

Sets flag which determines whether or not to use MPI I/O for I/O routines that have been parallized with MPI.

Parameters
flag...
History
09.2018 created [Nico Holmberg]

Definition at line 1127 of file cp_output_handling.F.

Here is the caller graph for this function:

◆ cp_mpi_io_get()

logical function, public cp_output_handling::cp_mpi_io_get

Gets flag which determines whether or not to use MPI I/O for I/O routines that have been parallized with MPI.

Returns
...
History
09.2018 created [Nico Holmberg]

Definition at line 1140 of file cp_output_handling.F.

Here is the caller graph for this function:

Variable Documentation

◆ add_last_no

integer, parameter, public cp_output_handling::add_last_no = 0

Definition at line 70 of file cp_output_handling.F.

◆ add_last_numeric

integer, parameter, public cp_output_handling::add_last_numeric = 1

Definition at line 70 of file cp_output_handling.F.

◆ add_last_symbolic

integer, parameter, public cp_output_handling::add_last_symbolic = 2

Definition at line 70 of file cp_output_handling.F.

◆ silent_print_level

integer, parameter, public cp_output_handling::silent_print_level = 0

Definition at line 73 of file cp_output_handling.F.

◆ low_print_level

integer, parameter, public cp_output_handling::low_print_level = 1

Definition at line 73 of file cp_output_handling.F.

◆ medium_print_level

integer, parameter, public cp_output_handling::medium_print_level = 2

Definition at line 73 of file cp_output_handling.F.

◆ high_print_level

integer, parameter, public cp_output_handling::high_print_level = 3

Definition at line 73 of file cp_output_handling.F.

◆ debug_print_level

integer, parameter, public cp_output_handling::debug_print_level = 4

Definition at line 73 of file cp_output_handling.F.

◆ cp_p_file_if

integer, parameter, public cp_output_handling::cp_p_file_if = 3

Definition at line 103 of file cp_output_handling.F.

◆ cp_p_store_if

integer, parameter, public cp_output_handling::cp_p_store_if = 4

Definition at line 103 of file cp_output_handling.F.

◆ cp_p_store

integer, parameter, public cp_output_handling::cp_p_store = 2

Definition at line 103 of file cp_output_handling.F.

◆ cp_p_file

integer, parameter, public cp_output_handling::cp_p_file = 1

Definition at line 103 of file cp_output_handling.F.

◆ cp_p_file_each

integer, parameter, public cp_output_handling::cp_p_file_each = 5

Definition at line 103 of file cp_output_handling.F.

◆ cp_p_store_each

integer, parameter, public cp_output_handling::cp_p_store_each = 6

Definition at line 103 of file cp_output_handling.F.

◆ cp_p_calc

integer, parameter, public cp_output_handling::cp_p_calc = 7

Definition at line 103 of file cp_output_handling.F.

◆ cp_out_none

integer, parameter, public cp_output_handling::cp_out_none = 0

Definition at line 105 of file cp_output_handling.F.

◆ cp_out_file_if

integer, parameter, public cp_output_handling::cp_out_file_if = IBSET(0, cp_p_file_if)

Definition at line 105 of file cp_output_handling.F.

◆ cp_out_store_if

integer, parameter, public cp_output_handling::cp_out_store_if = IBSET(0, cp_p_store_if)

Definition at line 105 of file cp_output_handling.F.

◆ cp_out_file

integer, parameter, public cp_output_handling::cp_out_file = IBSET(0, cp_p_file)

Definition at line 105 of file cp_output_handling.F.

◆ cp_out_store

integer, parameter, public cp_output_handling::cp_out_store = IBSET(0, cp_p_store)

Definition at line 105 of file cp_output_handling.F.

◆ cp_out_calc

integer, parameter, public cp_output_handling::cp_out_calc = IBSET(0, cp_p_calc)

Definition at line 105 of file cp_output_handling.F.

◆ cp_out_file_each

integer, parameter, public cp_output_handling::cp_out_file_each = IBSET(0, cp_p_file_each)

Definition at line 105 of file cp_output_handling.F.

◆ cp_out_store_each

integer, parameter, public cp_output_handling::cp_out_store_each = IBSET(0, cp_p_store_each)

Definition at line 105 of file cp_output_handling.F.

◆ cp_out_default

integer, parameter, public cp_output_handling::cp_out_default = cp_out_file_if

Definition at line 105 of file cp_output_handling.F.