我正在尝试编译以下Fortran模块(使用gfortran 7.2.0)。关键是要定义一个派生类型,该派生类型又包含bspline_3d来自bspline-fortran库(https://github.com/jacobwilliams/bspline-fortran)的两个派生类型实例。然后,我想定义一个类型绑定过程,该过程将依次调用这两种类型的类型绑定evaluate过程,并将结果返回为包含两个元素的数组。
当我尝试编译下面的模块时,出现一条错误消息,提示
procedure :: evaluate => evaluate_2d
1
Error: Non-polymorphic passed-object dummy argument of 'evaluate_2d' at (1)
Run Code Online (Sandbox Code Playgroud)
我完全不了解错误消息。
我设法编译了以下简单的示例程序:http : //fortranwiki.org/fortran/show/Object-oriented+programming,据我所知,唯一的区别是在我的情况下,“ passed-object” “(this)本身确实具有派生类型成员变量(type(bspline_3d) :: fvx, fvy),而后者又可能包含各种内容。
module interpolator_module
use bspline_module
use parameters, only: WP
implicit none
private
public :: interpolator
type :: interpolator
type(bspline_3d) :: fvx, fvy
contains
private
procedure :: evaluate => evaluate_2d
end type interpolator
contains
function evaluate_2d(this, X, t) result(V)
implicit none
! inputs …Run Code Online (Sandbox Code Playgroud)