new_funcgroup Function

private function new_funcgroup(input_names) result(group)

Create a new group of functional names

Arguments

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

List of spellings/names of the functional

Return Value type(functional_group)

Functional with possibly different spellings


Source Code

function new_funcgroup(input_names) result(group)

   !> List of spellings/names of the functional
   character(len=*), intent(in) :: input_names(:)

   !> Functional with possibly different spellings
   type(functional_group) :: group
   
   integer :: n, i, max_len
   n = size(input_names)

   ! Determine the length of the longest name
   max_len = 0
   do i = 1, n
      max_len = max(max_len, len_trim(input_names(i)))
   end do

   ! Allocate based on the longest name's length
   allocate(character(len=max_len) :: group%names(n))
   do i = 1, n
      group%names(i) = trim(input_names(i))
   end do
end function new_funcgroup