FORTRAN III
■ このスレッドは過去ログ倉庫に格納されています
0397デフォルトの名無しさん
2005/09/29(木) 20:37:20普通はmodule内に、allocateするためのルーチンを作っておいて、それを呼びます。例えば
module variables
implicit none
real(8),dimension(:,:),allocatable :: x
contains
subroutine alloc_x(n1,n2)
implicit none
integer, intent(IN) :: n1, n2
allocate(x(n1,n2))
end subroutine
end module
みたいな感じで作っておいて、呼び出し側では
use variables
read(i,j)
call alloc_x(i,j)
で配列確保します。メリットはC++ライクなカプセル化ですかね。
■ このスレッドは過去ログ倉庫に格納されています