1

As of now I am defining a new type and having a procedure added to it pointing to a function.

type    ::  species
    character(len=50)                   ::  species_name                    ! Species Name
    integer                             ::  species_number                  ! Species Number
    procedure(sub_crosssection), pointer, pass(self)      ::    calculate_cross_section     ! Collision Reaction        

end type

What I want is an array of function pointers, I tried

    procedure(sub_crosssection), pointer, pass(self)      ::    calculate_cross_section_ar(10)      ! Collision Reaction        

and

    procedure(sub_crosssection), allocatable, pointer, pass(self)     ::    calculate_cross_section_ar(:)       ! Collision Reaction        

However I am not able to define any of this. I wanted to know even something like this is even possible in Fortran?

TLDR: I want an array of function pointers in type data structure. Is this possible?

1
  • Arrays of pointers must use wrappers in Fortran, see the links. Your code certainly is not Fortran 90 but at least 2003. Commented Aug 14, 2024 at 5:49

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.