dbcsr_logger_generate_filename Subroutine

public subroutine dbcsr_logger_generate_filename(logger, res, root, postfix, local)

generates a unique filename (ie adding eventual suffixes and process ids)

Note

this should be a function returning a variable length string. All spaces are moved to the end of the string. Not fully optimized: result must be a little longer than the resulting compressed filename

Arguments

Type IntentOptional Attributes Name
type(dbcsr_logger_type), POINTER :: logger
character(len=*), intent(inout) :: res

the resulting string

character(len=*), intent(in) :: root

the start of filename the end of the name

character(len=*), intent(in) :: postfix

the start of filename the end of the name

logical, intent(in), optional :: local

if the name should be local to this task (defaults to false)


Source Code

   SUBROUTINE dbcsr_logger_generate_filename(logger, res, root, postfix, &
                                             local)
      !! generates a unique filename (ie adding eventual suffixes and
      !! process ids)
      !! @note
      !! this should be a function returning a variable length string.
      !! All spaces are moved to the end of the string.
      !! Not fully optimized: result must be a little longer than the
      !! resulting compressed filename

      TYPE(dbcsr_logger_type), POINTER                   :: logger
      CHARACTER(len=*), INTENT(inout)                    :: res
         !! the resulting string
      CHARACTER(len=*), INTENT(in)                       :: root, postfix
         !! the start of filename
         !! the end of the name
      LOGICAL, INTENT(in), OPTIONAL                      :: local
         !! if the name should be local to this task (defaults to false)

      CHARACTER(len=*), PARAMETER :: routineN = 'dbcsr_logger_generate_filename', &
                                     routineP = moduleN//':'//routineN

      LOGICAL                                            :: loc
      TYPE(dbcsr_logger_type), POINTER                   :: lggr

      loc = .FALSE.
      res = ' '
      lggr => logger

      IF (.NOT. ASSOCIATED(lggr)) lggr => dbcsr_get_default_logger()
      IF (lggr%ref_count < 1) &
         DBCSR_ABORT(routineP//" logger%ref_count<1")
      IF (PRESENT(local)) loc = local
      IF (loc) THEN
         res = TRIM(root)//TRIM(lggr%suffix)//'_p'// &
               dbcsr_to_string(lggr%mp_env%mp%mynode)//postfix
      ELSE
         res = TRIM(root)//TRIM(lggr%suffix)//postfix
      END IF
      CALL compress(res, full=.TRUE.)
   END SUBROUTINE dbcsr_logger_generate_filename