get_type Interface

public interface get_type

Module Procedures

private function get_type_arr(anything) result(chars)

NAME

get_type(3f) - [M_anything] return array of strings containing type
names of arguments
(LICENSE:MIT)

SYNOPSIS

function get_type(anything) result(chars)

 class(*),intent(in)  :: anything
         or
 class(*),intent(in)  :: anything(..)

 character(len=:),allocatable :: chars

DESCRIPTION

This function uses polymorphism to allow input arguments of different
types. It is used by other procedures that can take many
argument types as input options.

OPTIONS

VALUEIN  input array or scalar to return type of
         May be of KIND INTEGER(kind=int8), INTEGER(kind=int16),
         INTEGER(kind=int32), INTEGER(kind=int64),
         REAL(kind=real32, REAL(kind=real64),
         REAL(kind=real128), complex, or CHARACTER(len=*)

RETURN

CHARS    The returned value is an array of names

EXAMPLE

Sample program

program demo_get_type
use M_anything,      only : get_type
implicit none
integer :: i
   write(*,*)get_type([(i*i,i=1,10)])
   write(*,*)get_type([11.11,22.22,33.33])
   write(*,*)get_type('This is a string')
   write(*,*)get_type(30.0d0)
end program demo_get_type

Results:

 int32
 real32
 character
 real64

AUTHOR

John S. Urban

LICENSE

MIT

Arguments

Type IntentOptional Attributes Name
class(*), intent(in) :: anything(:)

Return Value character(len=20)

private impure elemental function get_type_scalar(anything) result(chars)

Arguments

Type IntentOptional Attributes Name
class(*), intent(in) :: anything

Return Value character(len=20)