![]() |
(git:b77b4be)
|
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 |
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.
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
print_key_section | the print key to create |
location | from where in the source code cp_print_key_section_create() is called |
name | the name of the print key |
description | the description of the print key |
print_level | print 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_str | specifies 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) |
Definition at line 171 of file cp_output_handling.F.
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
iteration_info | information about the actual iteration level |
basis_section | section that contains the printkey |
print_key_path | path to the printkey- "%" between sections, and optionally a "/" and a logical flag to check). Might be empty. |
used_print_key | here the print_key that was used is returned |
first_time | if it ist the first time that an output is written (not fully correct, but most of the time) |
Definition at line 342 of file cp_output_handling.F.
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
iteration_info | information about the actual iteration level |
print_key | the section values of the key to be printed |
Definition at line 428 of file cp_output_handling.F.
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)
iter_info | the iteration info from where to take the iteration number |
print_key | the print key to optionally show the last iteration symbolically |
for_file | if the string is to be used for file generation (and should consequently ignore some iteration levels depending on COMMON_ITERATION_LEVELS). Defaults to false. |
Definition at line 516 of file cp_output_handling.F.
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
iteration_info | the iteration info to update |
last | if this iteration is the last one (defaults to false) |
iter_nr | ... |
increment | ... |
iter_nr_out | ... |
Definition at line 573 of file cp_output_handling.F.
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.
iteration_info | the iteration info to query |
level_name | level name to query. |
Definition at line 610 of file cp_output_handling.F.
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.
iteration_info | the iteration info to query |
rlevel | index of the iteration level. Use the level on top of the stack, if it is not given |
iter_nr | iteration number [out] |
last_iter | last iteration flag [out] |
Definition at line 632 of file cp_output_handling.F.
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.
iteration_info | the iteration info to which an iteration level has to be added |
level_name | the name of this level, for pretty printing only, right now |
n_rlevel_new | number of iteration levels after this call |
Definition at line 661 of file cp_output_handling.F.
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.
iteration_info | the iteration info to which an iteration level has to be removed |
level_name | level_name to be destroyed (if does not match gives an error) |
n_rlevel_att | iteration level before the call (to do some checks) |
Definition at line 704 of file cp_output_handling.F.
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)
logger | the logger for the parallel environment, iteration info and filename generation |
print_key | ... |
middle_name | name to be added to the generated filename, useful when print_key activates different distinct outputs, to be able to distinguish them |
extension | extension to be applied to the filename (including the ".") |
my_local | if the unit should be local to this task, or global to the program (defaults to false). |
Definition at line 752 of file cp_output_handling.F.
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 | ||
) |
...
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 | true if this rank created a new (or rewound) file, false otherwise |
mpi_io | True 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. |
fout | Name 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. |
Definition at line 849 of file cp_output_handling.F.
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
unit_nr | ... |
logger | ... |
basis_section | ... |
print_key_path | ... |
local | ... |
ignore_should_output | ... |
on_file | ... |
mpi_io | True if file was opened in parallel with MPI |
Definition at line 1060 of file cp_output_handling.F.
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.
flag | ... |
Definition at line 1117 of file cp_output_handling.F.
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.
Definition at line 1130 of file cp_output_handling.F.
integer, parameter, public cp_output_handling::add_last_no = 0 |
Definition at line 70 of file cp_output_handling.F.
integer, parameter, public cp_output_handling::add_last_numeric = 1 |
Definition at line 70 of file cp_output_handling.F.
integer, parameter, public cp_output_handling::add_last_symbolic = 2 |
Definition at line 70 of file cp_output_handling.F.
integer, parameter, public cp_output_handling::silent_print_level = 0 |
Definition at line 73 of file cp_output_handling.F.
integer, parameter, public cp_output_handling::low_print_level = 1 |
Definition at line 73 of file cp_output_handling.F.
integer, parameter, public cp_output_handling::medium_print_level = 2 |
Definition at line 73 of file cp_output_handling.F.
integer, parameter, public cp_output_handling::high_print_level = 3 |
Definition at line 73 of file cp_output_handling.F.
integer, parameter, public cp_output_handling::debug_print_level = 4 |
Definition at line 73 of file cp_output_handling.F.
integer, parameter, public cp_output_handling::cp_p_file_if = 3 |
Definition at line 103 of file cp_output_handling.F.
integer, parameter, public cp_output_handling::cp_p_store_if = 4 |
Definition at line 103 of file cp_output_handling.F.
integer, parameter, public cp_output_handling::cp_p_store = 2 |
Definition at line 103 of file cp_output_handling.F.
integer, parameter, public cp_output_handling::cp_p_file = 1 |
Definition at line 103 of file cp_output_handling.F.
integer, parameter, public cp_output_handling::cp_p_file_each = 5 |
Definition at line 103 of file cp_output_handling.F.
integer, parameter, public cp_output_handling::cp_p_store_each = 6 |
Definition at line 103 of file cp_output_handling.F.
integer, parameter, public cp_output_handling::cp_p_calc = 7 |
Definition at line 103 of file cp_output_handling.F.
integer, parameter, public cp_output_handling::cp_out_none = 0 |
Definition at line 105 of file cp_output_handling.F.
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.
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.
integer, parameter, public cp_output_handling::cp_out_file = IBSET(0, cp_p_file) |
Definition at line 105 of file cp_output_handling.F.
integer, parameter, public cp_output_handling::cp_out_store = IBSET(0, cp_p_store) |
Definition at line 105 of file cp_output_handling.F.
integer, parameter, public cp_output_handling::cp_out_calc = IBSET(0, cp_p_calc) |
Definition at line 105 of file cp_output_handling.F.
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.
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.
integer, parameter, public cp_output_handling::cp_out_default = cp_out_file_if |
Definition at line 105 of file cp_output_handling.F.