set_tools Subroutine

private pure elemental subroutine set_tools(this, id, args)

Type Bound

options

Arguments

Type IntentOptional Attributes Name
class(options), intent(inout) :: this
character(len=*), intent(in) :: id
character(len=*), intent(in) :: args

Contents

Source Code


Source Code

   elemental pure subroutine set_tools(this, id, args)
      class(options), intent(inout) :: this
      character(len=*), intent(in)  :: id
      character(len=*), intent(in)  :: args
      type(tools), allocatable      :: tmp(:)

      if (.not. allocated(this%tools)) then
         allocate(this%tools(1))
         this%tools(1)%id_args(1) = trim(id)
         this%tools(1)%id_args(2) = trim(args)
      else
         call move_alloc(this%tools, tmp)
         allocate(this%tools(size(tmp)+1))
         this%tools(1:size(tmp)) = tmp
         this%tools(size(tmp)+1)%id_args(1) = trim(id)
         this%tools(size(tmp)+1)%id_args(2) = trim(args)
      end if
   end subroutine set_tools