58#include "../base/base_uses.f90"
63 LOGICAL,
PRIVATE,
PARAMETER :: debug_this_module = .true.
64 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'cp_output_handling'
113 LOGICAL,
PRIVATE,
SAVE :: enable_mpi_io = .false.
140 TYPE cp_out_flags_type
141 INTEGER :: ref_count = 0, n_flags = 0
142 CHARACTER(default_string_length),
DIMENSION(:),
POINTER :: names => null()
143 INTEGER,
DIMENSION(:),
POINTER :: control_val => null()
146 LOGICAL :: strict = .false.
147 INTEGER :: default_val = 0
148 END TYPE cp_out_flags_type
172 print_level, each_iter_names, each_iter_values, add_last, filename, &
173 common_iter_levels, citations, unit_str)
175 CHARACTER(len=*),
INTENT(IN) :: location, name, description
176 INTEGER,
INTENT(IN),
OPTIONAL :: print_level
177 CHARACTER(LEN=*),
DIMENSION(:),
INTENT(IN), &
178 OPTIONAL :: each_iter_names
179 INTEGER,
DIMENSION(:),
INTENT(IN),
OPTIONAL :: each_iter_values
180 INTEGER,
INTENT(IN),
OPTIONAL :: add_last
181 CHARACTER(LEN=*),
INTENT(IN),
OPTIONAL :: filename
182 INTEGER,
INTENT(IN),
OPTIONAL :: common_iter_levels
183 INTEGER,
DIMENSION(:),
OPTIONAL :: citations
184 CHARACTER(LEN=*),
INTENT(IN),
OPTIONAL :: unit_str
186 CHARACTER(len=default_path_length) :: my_filename
187 INTEGER :: i_each, i_iter, my_add_last, &
188 my_comm_iter_levels, my_print_level, &
190 LOGICAL :: check, ext_each
194 cpassert(.NOT.
ASSOCIATED(print_key_section))
196 IF (
PRESENT(print_level)) my_print_level = print_level
198 CALL section_create(print_key_section, location=location, name=name, description=description, &
199 n_keywords=2, n_subsections=0, repeats=.false., &
202 NULLIFY (keyword, subsection)
203 CALL keyword_create(keyword, __location__, name=
"_SECTION_PARAMETERS_", &
204 description=
"Level starting at which this property is printed", &
207 enum_c_vals=
s2a(
"on",
"off",
"silent",
"low",
"medium",
"high",
"debug"), &
214 CALL keyword_create(keyword, __location__, name=
"__CONTROL_VAL", &
215 description=
' hidden parameter that controls storage, printing,...'// &
216 ' of the print_key', &
222 description=
"This section specifies how often this property is printed. "// &
223 "Each keyword inside this section is mapping to a specific iteration level and "// &
224 "the value of each of these keywords is matched with the iteration level during "// &
225 "the calculation. How to handle the last iteration is treated "// &
226 "separately in ADD_LAST (this mean that each iteration level (MD, GEO_OPT, etc..), "// &
227 "though equal to 0, might print the last iteration). If an iteration level is specified "// &
228 "that is not present in the flow of the calculation it is just ignored.", &
229 n_keywords=2, n_subsections=0, repeats=.false., &
233 check = (
PRESENT(each_iter_names)) .EQV. (
PRESENT(each_iter_values))
235 ext_each = (
PRESENT(each_iter_names)) .AND. (
PRESENT(each_iter_values))
242 DO i_iter = 1,
SIZE(each_iter_names)
244 my_value = each_iter_values(i_iter)
251 default_i_val=my_value)
259 IF (
PRESENT(add_last))
THEN
260 my_add_last = add_last
263 description=
"If the last iteration should be added, and if it "// &
264 "should be marked symbolically (with lowercase letter l) or with "// &
265 "the iteration number. "// &
266 "Not every iteration level is able to identify the last iteration "// &
267 "early enough to be able to output. When this keyword is activated "// &
268 "all iteration levels are checked for the last iteration step.", &
269 usage=
"ADD_LAST (NO|NUMERIC|SYMBOLIC)", &
270 enum_c_vals=
s2a(
"no",
"numeric",
"symbolic"), &
272 enum_desc=
s2a(
"Do not mark last iteration specifically", &
273 "Mark last iteration with its iteration number", &
274 "Mark last iteration with lowercase letter l"), &
275 default_i_val=my_add_last)
279 my_comm_iter_levels = 0
280 IF (
PRESENT(common_iter_levels)) my_comm_iter_levels = common_iter_levels
281 CALL keyword_create(keyword, __location__, name=
"COMMON_ITERATION_LEVELS", &
282 description=
"How many iterations levels should be written"// &
283 " in the same file (no extra information about the actual"// &
284 " iteration level is written to the file)", &
285 usage=
"COMMON_ITERATION_LEVELS <INTEGER>", &
286 default_i_val=my_comm_iter_levels)
291 IF (
PRESENT(filename)) my_filename = filename
293 description=
' controls part of the filename for output. '// &
294 ' use __STD_OUT__ (exactly as written here) for the screen or standard logger. '// &
295 ' use filename to obtain projectname-filename. '// &
296 ' use ./filename to get filename.'// &
297 ' A middle name (if present), iteration numbers'// &
298 ' and extension are always added to the filename.'// &
299 ' if you want to avoid it use =filename, in this'// &
300 ' case the filename is always exactly as typed.'// &
301 ' Please note that this can lead to clashes of'// &
303 usage=
"FILENAME ./filename ", &
304 default_lc_val=my_filename)
308 CALL keyword_create(keyword, __location__, name=
"LOG_PRINT_KEY", &
309 description=
"This keywords enables the logger for the print_key (a message is printed on "// &
310 "screen everytime data, controlled by this print_key, are written)", &
311 usage=
"LOG_PRINT_KEY <LOGICAL>", default_l_val=.false., lone_keyword_l_val=.true.)
315 IF (
PRESENT(unit_str))
THEN
317 description=
'Specify the unit of measurement for the quantity in output. '// &
318 "All available CP2K units can be used.", &
319 usage=
"UNIT angstrom", default_c_val=trim(unit_str))
343 print_key_path, used_print_key, first_time) &
347 CHARACTER(len=*),
INTENT(IN),
OPTIONAL :: print_key_path
349 POINTER :: used_print_key
350 LOGICAL,
INTENT(OUT),
OPTIONAL :: first_time
353 INTEGER :: end_str, my_control_val, to_path
354 LOGICAL :: flags, is_iter, is_on
358 IF (
PRESENT(first_time)) first_time = .false.
359 cpassert(basis_section%ref_count > 0)
360 IF (
PRESENT(used_print_key))
NULLIFY (used_print_key)
362 IF (
PRESENT(print_key_path))
THEN
363 end_str = len_trim(print_key_path)
364 to_path = index(print_key_path,
"/")
365 IF (to_path < 1)
THEN
366 to_path = end_str + 1
369 IF (to_path > 1)
THEN
371 print_key_path(1:(to_path - 1)))
373 print_key => basis_section
375 cpassert(
ASSOCIATED(print_key))
376 cpassert(print_key%ref_count > 0)
377 IF (to_path + 1 < end_str)
THEN
384 print_key => basis_section
387 IF (
PRESENT(used_print_key)) used_print_key => print_key
389 IF (.NOT. flags)
RETURN
392 i_val=my_control_val)
398 is_iter = cp_printkey_is_iter(iteration_info, print_key, first_time=first_time)
402 ELSE IF (btest(my_control_val,
cp_p_store_if) .AND. is_iter .AND. is_on)
THEN
408 IF (btest(my_control_val,
cp_p_file))
THEN
410 ELSE IF (btest(my_control_val,
cp_p_file_if) .AND. is_iter .AND. is_on)
THEN
412 ELSE IF (btest(my_control_val,
cp_p_file_each) .AND. is_iter)
THEN
415 IF (btest(my_control_val,
cp_p_calc) .OR. res /= 0)
THEN
433 INTEGER :: print_level
435 cpassert(iteration_info%ref_count > 0)
436 IF (.NOT.
ASSOCIATED(print_key))
THEN
439 cpassert(print_key%ref_count > 0)
441 res = iteration_info%print_level >= print_level
456 FUNCTION cp_printkey_is_iter(iteration_info, print_key, first_time) &
460 LOGICAL,
INTENT(OUT),
OPTIONAL :: first_time
463 INTEGER :: add_last, ilevel, iter_nr, ival
464 LOGICAL :: first, level_passed
466 cpassert(iteration_info%ref_count > 0)
467 IF (.NOT.
ASSOCIATED(print_key))
THEN
469 first = all(iteration_info%iteration(1:iteration_info%n_rlevel) == 1)
471 cpassert(print_key%ref_count > 0)
477 DO ilevel = 1, iteration_info%n_rlevel
478 level_passed = .false.
482 iter_nr = iteration_info%iteration(ilevel)
483 IF (iter_nr/ival > 1) first = .false.
484 IF (
modulo(iter_nr, ival) == 0)
THEN
485 level_passed = .true.
489 IF (iteration_info%last_iter(ilevel))
THEN
490 level_passed = .true.
493 IF (.NOT. level_passed) res = .false.
496 first = first .AND. res
497 IF (
PRESENT(first_time)) first_time = first
498 END FUNCTION cp_printkey_is_iter
519 LOGICAL,
INTENT(IN),
OPTIONAL :: for_file
520 CHARACTER(len=default_string_length) :: res
522 INTEGER :: add_last, c_i_level, ilevel, n_rlevel, &
524 LOGICAL :: my_for_file
528 my_for_file = .false.
529 IF (
PRESENT(for_file)) my_for_file = for_file
530 cpassert(
ASSOCIATED(iter_info))
531 cpassert(iter_info%ref_count > 0)
532 NULLIFY (my_print_key)
533 IF (
PRESENT(print_key)) my_print_key => print_key
535 IF (
ASSOCIATED(my_print_key))
THEN
538 n_rlevel = iter_info%n_rlevel
539 IF (my_for_file) n_rlevel = min(n_rlevel, max(0, n_rlevel - c_i_level))
540 DO ilevel = s_level, n_rlevel
541 IF (iter_info%last_iter(ilevel))
THEN
543 WRITE (res(9*ilevel - 8:9*ilevel),
"('l_')")
545 WRITE (res(9*ilevel - 8:9*ilevel),
"(i8,'_')") iter_info%iteration(ilevel)
548 WRITE (res(9*ilevel - 8:9*ilevel),
"(i8,'_')") iter_info%iteration(ilevel)
552 DO ilevel = s_level, iter_info%n_rlevel
553 WRITE (res(9*ilevel - 8:9*ilevel),
"(i8,'_')") iter_info%iteration(ilevel)
557 IF (len_trim(res) > 0)
THEN
558 res(len_trim(res):len_trim(res)) =
" "
573 SUBROUTINE cp_iterate(iteration_info, last, iter_nr, increment, iter_nr_out)
575 LOGICAL,
INTENT(IN),
OPTIONAL :: last
576 INTEGER,
INTENT(IN),
OPTIONAL :: iter_nr, increment
577 INTEGER,
INTENT(OUT),
OPTIONAL :: iter_nr_out
579 INTEGER :: my_increment
584 IF (
PRESENT(last)) my_last = last
585 IF (
PRESENT(increment)) my_increment = increment
586 IF (
PRESENT(iter_nr_out)) iter_nr_out = -1
588 cpassert(
ASSOCIATED(iteration_info))
589 cpassert(iteration_info%ref_count > 0)
590 IF (
PRESENT(iter_nr))
THEN
591 iteration_info%iteration(iteration_info%n_rlevel) = iter_nr
593 iteration_info%iteration(iteration_info%n_rlevel) = &
594 iteration_info%iteration(iteration_info%n_rlevel) + my_increment
597 IF (
PRESENT(iter_nr_out)) iter_nr_out = iteration_info%iteration(iteration_info%n_rlevel)
600 iteration_info%last_iter(iteration_info%n_rlevel) = my_last
612 CHARACTER(LEN=*),
INTENT(IN) :: level_name
615 cpassert(
ASSOCIATED(iteration_info))
616 cpassert(iteration_info%ref_count > 0)
617 DO rlevel = iteration_info%n_rlevel, 1, -1
618 IF (iteration_info%level_name(rlevel) == level_name)
EXIT
634 INTEGER,
INTENT(IN),
OPTIONAL :: rlevel
635 INTEGER,
INTENT(OUT),
OPTIONAL :: iter_nr
636 LOGICAL,
INTENT(OUT),
OPTIONAL :: last_iter
640 cpassert(
ASSOCIATED(iteration_info))
641 cpassert(iteration_info%ref_count > 0)
642 IF (
PRESENT(rlevel))
THEN
643 cpassert(rlevel > 0 .AND. rlevel <= iteration_info%n_rlevel)
646 ilevel = iteration_info%n_rlevel
649 IF (
PRESENT(iter_nr)) iter_nr = iteration_info%iteration(ilevel)
650 IF (
PRESENT(last_iter)) last_iter = iteration_info%last_iter(ilevel)
663 CHARACTER(LEN=*),
INTENT(IN) :: level_name
664 INTEGER,
INTENT(OUT),
OPTIONAL :: n_rlevel_new
669 cpassert(
ASSOCIATED(iteration_info))
670 cpassert(iteration_info%ref_count > 0)
680 iteration_info%n_rlevel = iteration_info%n_rlevel + 1
681 CALL reallocate(iteration_info%iteration, 1, iteration_info%n_rlevel)
682 CALL reallocate(iteration_info%level_name, 1, iteration_info%n_rlevel)
683 CALL reallocate(iteration_info%last_iter, 1, iteration_info%n_rlevel)
684 iteration_info%iteration(iteration_info%n_rlevel) = 0
685 iteration_info%level_name(iteration_info%n_rlevel) = level_name
686 iteration_info%last_iter(iteration_info%n_rlevel) = .false.
687 IF (
PRESENT(n_rlevel_new)) n_rlevel_new = iteration_info%n_rlevel
689 CALL cp_abort(__location__, &
690 "Trying to create an iteration level ("//trim(level_name)//
") not defined. "// &
691 "Please update the module: cp_iter_types.")
706 CHARACTER(LEN=*),
INTENT(IN) :: level_name
707 INTEGER,
INTENT(IN),
OPTIONAL :: n_rlevel_att
711 cpassert(
ASSOCIATED(iteration_info))
712 cpassert(iteration_info%ref_count > 0)
713 IF (
PRESENT(n_rlevel_att))
THEN
714 cpassert(n_rlevel_att == iteration_info%n_rlevel)
719 check = iteration_info%level_name(iteration_info%n_rlevel) == level_name
721 iteration_info%n_rlevel = iteration_info%n_rlevel - 1
722 CALL reallocate(iteration_info%iteration, 1, iteration_info%n_rlevel)
723 CALL reallocate(iteration_info%level_name, 1, iteration_info%n_rlevel)
724 CALL reallocate(iteration_info%last_iter, 1, iteration_info%n_rlevel)
753 my_local)
RESULT(filename)
756 CHARACTER(len=*),
INTENT(IN),
OPTIONAL :: middle_name
757 CHARACTER(len=*),
INTENT(IN) :: extension
758 LOGICAL,
INTENT(IN) :: my_local
759 CHARACTER(len=default_path_length) :: filename
761 CHARACTER(len=default_path_length) :: outpath, postfix, root
762 CHARACTER(len=default_string_length) :: my_middle_name, outname
763 INTEGER :: my_ind1, my_ind2
767 IF (outpath(1:1) ==
'=')
THEN
768 cpassert(len(outpath) - 1 <= len(filename))
769 filename = outpath(2:)
772 IF (outpath ==
"__STD_OUT__") outpath =
""
775 my_ind1 = index(outpath,
"/")
776 my_ind2 = len_trim(outpath)
777 IF (my_ind1 /= 0)
THEN
779 DO WHILE (index(outpath(my_ind1 + 1:my_ind2),
"/") /= 0)
780 my_ind1 = index(outpath(my_ind1 + 1:my_ind2),
"/") + my_ind1
782 IF (my_ind1 == my_ind2)
THEN
785 outname = outpath(my_ind1 + 1:my_ind2)
789 IF (
PRESENT(middle_name))
THEN
790 IF (outname /=
"")
THEN
791 my_middle_name =
"-"//trim(outname)//
"-"//middle_name
793 my_middle_name =
"-"//middle_name
796 IF (outname /=
"")
THEN
797 my_middle_name =
"-"//trim(outname)
803 IF (.NOT. has_root)
THEN
804 root = trim(logger%iter_info%project_name)//trim(my_middle_name)
805 ELSE IF (outname ==
"")
THEN
806 root = outpath(1:my_ind1)//trim(logger%iter_info%project_name)//trim(my_middle_name)
808 root = outpath(1:my_ind1)//my_middle_name(2:len_trim(my_middle_name))
812 postfix =
"-"//trim(
cp_iter_string(logger%iter_info, print_key=print_key, for_file=.true.))
813 IF (trim(postfix) ==
"-") postfix =
""
816 postfix = trim(postfix)//extension
819 root=root, postfix=postfix, local=my_local)
850 middle_name, local, log_filename, ignore_should_output, file_form, file_position, &
851 file_action, file_status, do_backup, on_file, is_new_file, mpi_io, &
855 CHARACTER(len=*),
INTENT(IN),
OPTIONAL :: print_key_path
856 CHARACTER(len=*),
INTENT(IN) :: extension
857 CHARACTER(len=*),
INTENT(IN),
OPTIONAL :: middle_name
858 LOGICAL,
INTENT(IN),
OPTIONAL :: local, log_filename, ignore_should_output
859 CHARACTER(len=*),
INTENT(IN),
OPTIONAL :: file_form, file_position, file_action, &
861 LOGICAL,
INTENT(IN),
OPTIONAL :: do_backup, on_file
862 LOGICAL,
INTENT(OUT),
OPTIONAL :: is_new_file
863 LOGICAL,
INTENT(INOUT),
OPTIONAL :: mpi_io
864 CHARACTER(len=default_path_length),
INTENT(OUT), &
868 CHARACTER(len=default_path_length) :: filename, filename_bak, filename_bak_1, &
870 CHARACTER(len=default_string_length) :: my_file_action, my_file_form, &
871 my_file_position, my_file_status, &
873 INTEGER :: c_i_level, f_backup_level, i, mpi_amode, &
874 my_backup_level, my_nbak, nbak, &
875 s_backup_level, unit_nr
876 LOGICAL :: do_log, found, my_do_backup, my_local, &
877 my_mpi_io, my_on_file, &
878 my_should_output, replace
884 my_do_backup = .false.
889 my_file_form =
"FORMATTED"
890 my_file_position =
"APPEND"
891 my_file_action =
"WRITE"
892 my_file_status =
"UNKNOWN"
895 IF (
PRESENT(file_form)) my_file_form = file_form
896 IF (
PRESENT(file_position)) my_file_position = file_position
897 IF (
PRESENT(file_action)) my_file_action = file_action
898 IF (
PRESENT(file_status)) my_file_status = file_status
899 IF (
PRESENT(do_backup)) my_do_backup = do_backup
900 IF (
PRESENT(on_file)) my_on_file = on_file
901 IF (
PRESENT(local)) my_local = local
902 IF (
PRESENT(is_new_file)) is_new_file = .false.
903 IF (
PRESENT(mpi_io))
THEN
904#if defined(__parallel)
905 IF (
cp_mpi_io_get() .AND. logger%para_env%num_pe > 1 .AND. mpi_io)
THEN
912 trim(my_file_action), trim(my_file_status), trim(my_file_position))
913 replace = replace .AND. logger%para_env%is_source()
922 cpassert(
ASSOCIATED(logger))
923 cpassert(basis_section%ref_count > 0)
924 cpassert(logger%ref_count > 0)
926 basis_section, print_key_path, used_print_key=print_key),
cp_p_file)
927 IF (
PRESENT(ignore_should_output)) my_should_output = my_should_output .OR. ignore_should_output
928 IF (.NOT. my_should_output)
RETURN
930 logger%para_env%is_source() .OR. &
934 IF (outpath ==
'__STD_OUT__' .AND. .NOT. my_on_file)
THEN
946 IF (
PRESENT(is_new_file))
THEN
947 INQUIRE (file=filename, exist=found)
948 is_new_file = .NOT. found
949 IF (my_file_position ==
"REWIND") is_new_file = .true.
953 IF (
PRESENT(log_filename))
THEN
954 do_log = log_filename
959 IF (my_do_backup)
THEN
960 INQUIRE (file=filename, exist=found)
963 iteration_info => logger%iter_info
965 IF (
ASSOCIATED(print_key%ibackup)) s_backup_level =
SIZE(print_key%ibackup)
967 my_backup_level = max(1, iteration_info%n_rlevel - c_i_level + 1)
968 f_backup_level = max(s_backup_level, my_backup_level)
969 IF (f_backup_level > s_backup_level)
THEN
970 CALL reallocate(print_key%ibackup, 1, f_backup_level)
971 DO i = s_backup_level + 1, f_backup_level
972 print_key%ibackup(i) = 0
976 print_key%ibackup(my_backup_level) = print_key%ibackup(my_backup_level) + 1
977 my_nbak = print_key%ibackup(my_backup_level)
979 DO i = min(nbak, my_nbak), 2, -1
980 filename_bak_1 = trim(filename)//
".bak-"//adjustl(
cp_to_string(i))
981 filename_bak_2 = trim(filename)//
".bak-"//adjustl(
cp_to_string(i - 1))
985 WRITE (unit_nr, *)
"Moving file "//trim(filename_bak_2)// &
986 " into file "//trim(filename_bak_1)//
"."
988 INQUIRE (file=filename_bak_2, exist=found)
989 IF (.NOT. found)
THEN
993 WRITE (unit_nr, *)
"File "//trim(filename_bak_2)//
" not existing.."
996 CALL m_mov(trim(filename_bak_2), trim(filename_bak_1))
1000 filename_bak = trim(filename)//
".bak-"//adjustl(
cp_to_string(1))
1004 WRITE (unit_nr, *)
"Moving file "//trim(filename)//
" into file "//trim(filename_bak)//
"."
1006 CALL m_mov(trim(filename), trim(filename_bak))
1009 print_key%ibackup(my_backup_level) = 0
1014 IF (.NOT. my_mpi_io)
THEN
1015 CALL open_file(file_name=filename, file_status=my_file_status, &
1016 file_form=my_file_form, file_action=my_file_action, &
1017 file_position=my_file_position, unit_number=res)
1020 CALL mp_unit%open(groupid=logger%para_env, &
1021 filepath=filename, amode_status=mpi_amode)
1022 IF (
PRESENT(fout)) fout = filename
1023 res = mp_unit%get_handle()
1028 WRITE (unit_nr, *)
"Writing "//trim(print_key%section%name)//
" "// &
1061 print_key_path, local, ignore_should_output, on_file, &
1063 INTEGER,
INTENT(INOUT) :: unit_nr
1066 CHARACTER(len=*),
INTENT(IN),
OPTIONAL :: print_key_path
1067 LOGICAL,
INTENT(IN),
OPTIONAL :: local, ignore_should_output, on_file, &
1070 CHARACTER(len=default_string_length) :: outpath
1071 LOGICAL :: my_local, my_mpi_io, my_on_file, &
1077 my_on_file = .false.
1080 IF (
PRESENT(local)) my_local = local
1081 IF (
PRESENT(on_file)) my_on_file = on_file
1082 IF (
PRESENT(mpi_io)) my_mpi_io = mpi_io
1083 cpassert(
ASSOCIATED(logger))
1084 cpassert(basis_section%ref_count > 0)
1085 cpassert(logger%ref_count > 0)
1087 print_key_path, used_print_key=print_key),
cp_p_file)
1088 IF (
PRESENT(ignore_should_output)) my_should_output = my_should_output .OR. ignore_should_output
1089 IF (my_should_output .AND. (my_local .OR. &
1090 logger%para_env%is_source() .OR. &
1093 IF (my_on_file .OR. outpath .NE.
'__STD_OUT__')
THEN
1094 cpassert(unit_nr > 0)
1095 IF (.NOT. my_mpi_io)
THEN
1098 CALL mp_unit%set_handle(unit_nr)
1099 CALL mp_unit%close()
1106 cpassert(unit_nr == -1)
1118 LOGICAL,
INTENT(IN) :: flag
1120 enable_mpi_io = flag
1133 flag = enable_mpi_io
static GRID_HOST_DEVICE int modulo(int a, int m)
Equivalent of Fortran's MODULO, which always return a positive number. https://gcc....
Utility routines to open and close files. Tracking of preconnections.
subroutine, public 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.
subroutine, public 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.
Collection of routines to handle the iteration info.
character(len=default_path_length), dimension(18), parameter, public each_possible_labels
subroutine, public cp_iteration_info_retain(iteration_info)
retains the iteration_info (see doc/ReferenceCounting.html)
subroutine, public cp_iteration_info_release(iteration_info)
releases the iteration_info (see doc/ReferenceCounting.html)
character(len=default_path_length), dimension(18), parameter, public each_desc_labels
various routines to log and control the output. The idea is that decisions about where to log should ...
recursive integer function, public cp_logger_get_default_unit_nr(logger, local, skip_not_ionode)
asks the default unit number of the given logger. try to use cp_logger_get_unit_nr
integer function, public cp_logger_get_unit_nr(logger, local)
returns the unit nr for the requested kind of log.
subroutine, public cp_logger_generate_filename(logger, res, root, postfix, local)
generates a unique filename (ie adding eventual suffixes and process ids)
routines to handle the output, The idea is to remove the decision of wheter to output and what to out...
integer, parameter, public cp_out_calc
integer, parameter, public cp_out_file_each
integer, parameter, public cp_p_store_each
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_mpi_io_set(flag)
Sets flag which determines whether or not to use MPI I/O for I/O routines that have been parallized w...
integer, parameter, public cp_out_default
integer, parameter, public cp_out_store_if
integer, parameter, public debug_print_level
integer, parameter, public cp_out_store_each
integer, parameter, public cp_p_calc
integer, parameter, public cp_p_store_if
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)
...
integer, parameter, public cp_out_file_if
integer, parameter, public cp_out_store
integer, parameter, public low_print_level
integer, parameter, public medium_print_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 f...
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,...
integer, parameter, public cp_p_file
integer, parameter, public cp_out_none
integer, parameter, public high_print_level
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 w...
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 p...
subroutine, public cp_iterate(iteration_info, last, iter_nr, increment, iter_nr_out)
adds one to the actual iteration
integer, parameter, public add_last_symbolic
integer, parameter, public cp_p_file_if
subroutine, public cp_rm_iter_level(iteration_info, level_name, n_rlevel_att)
Removes an iteration level.
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...
integer, parameter, public add_last_numeric
integer, parameter, public silent_print_level
integer function, public cp_get_iter_level_by_name(iteration_info, level_name)
Return the index of an iteration level by its name.
integer, parameter, public cp_out_file
integer, parameter, public cp_p_file_each
integer, parameter, public cp_p_store
integer, parameter, public add_last_no
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_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
subroutine, public cp_add_iter_level(iteration_info, level_name, n_rlevel_new)
Adds an iteration level.
Defines the basic variable types.
integer, parameter, public default_string_length
integer, parameter, public default_path_length
Machine interface based on Fortran 2003 and POSIX.
subroutine, public m_mov(source, target)
...
Utility routines for the memory handling.
Interface to the message passing library MPI.
subroutine, public mp_file_delete(filepath, info)
Deletes a file. Auxiliary routine to emulate 'replace' action for mp_file_open. Only the master proce...
subroutine, public mp_file_get_amode(mpi_io, replace, amode, form, action, status, position)
(parallel) Utility routine to determine MPI file access mode based on variables
Utilities for string manipulations.
subroutine, public compress(string, full)
Eliminate multiple space characters in a string. If full is .TRUE., then all spaces are eliminated.
contains the information about the current state of the program to be able to decide if output is nec...
type of a logger, at the moment it contains just a print level starting at which level it should be l...