0

問題なくコンパイルされる Fortran プログラムがありますが、エラーが発生します。

実数 (種類 = 2) が必要なときに、引数番号 1 を持つルーチンをプロシージャとして呼び出そうとしました

ROOTS!X_ROOT - ファイル Exercise2base.f90 の 20 行目 [+0074]

main - ファイル Exercise2base.f90 の 65 行目 [+00c8]

これが何を意味するのかよくわかりません。おそらく、正しい型ではない関数に引数を渡すことを意味していると思いましたが、与えられた参照は意味がありません:

  • 20行目は end function x_rtsmpl
  • 66行目はanswer=x_root(bb_integral,l1,l2,epsx,epsf,root_type)

だから何が起こっているのか理解できません...

Plato IDE で Silverfrost を使用しています。

module roots
  implicit none
  character(20) :: root_type

contains

  function x_rtsmpl(f,x1,x2,epsx,epsf) result(x_root)
    implicit none
    real(2) :: x_root
    real(2), intent(IN) :: x1,x2,epsx,epsf
    interface
      function f(x)
        implicit none
        real(2), intent(IN) :: x
        real(2) :: f
      end function f
    end interface
    real(2) :: xx,fx
    x_root=x1
  end function x_rtsmpl

  function x_root(f,x1,x2,epsx,epsf) result(x_r)
    implicit none
    real(2) :: x_r
    real(2), intent(IN) :: x1,x2,epsx,epsf
    interface
      function f(x)
        implicit none
        real(2), intent(IN) :: x
        real(2) :: f
      end function f
    end interface
      x_r=x_rtsmpl(f,x1,x2,epsx,epsf)
    return
  end function x_root

end module roots

module blackbody
  implicit none
  private
  public :: Ibb

contains
  function Ibb(lambda)
    real(2) , intent (in) :: lambda
    real(2) :: Ibb
    Ibb=lambda+1._2
    return
  end function Ibb

end module blackbody

program master

  use roots
  use blackbody
  implicit none
  real(2) :: l2,epsx,epsf,answer,l1,epsi,requested
  l1=4.d-7
  l2=1.d-4
  epsx=1.d-2*l1
  epsf=1.d-1
  epsi=1.d-4
  answer=x_root(Ibb,l1,l2,epsx,epsf)

end program master

編集:コードは、宣言と単純な「ダミー」計算のみを使用して、基本的な機能に至るまでトリミングされています。

4

0 に答える 0