Fortran Tip集

前へ   上へ   次へ

10 include行の活用について

他のファイルの内容をソースファイルの特定の位置に含めたい場合に include行が利用可能です。 include行は下記の形式を持ちます。

include 文字定数表現

ここで通常は文字定数表現の部分にファイル名を指定します。

例)
...
...
include "sortImpl.f90"
...
...

include行で含まれる側のファイルも更にinclude行を含むことが許されています。(include行のネスト)

include行は過去のプログラムにおいてすべての共通ブロックの宣言を合わせるために多く利用されています。 現在では同等な機能をモジュールでより安全に実装することができますので、このような利用方法は推奨されません。

現在でもinclude行が役立つ場面として同じアルゴリズムを異なるいくつかの型向けに実装したいといったケースがあげられます。例えば並べ替えを行うサブルーチンの宣言部分以外をincludeすることによりコードの保守性を高めるといった利用が考えられます。

例)

! 整数型のソートルーチン
subroutine sortInt(data)
    integer data(:), tmp
    include "sortImpl.f90"
end subroutine sortInt

! 実数型のソートルーチン
subroutine sortReal(data)
    real data(:), tmp
    include "sortImpl.f90"
end subroutine sortReal

[sortImpl.f90の内容]
integer i, j
do i=1, size(data)-1
    do j=i+1, size(data)
        if ( data(i) > data(j) ) then
            tmp = data(i)
            data(i) = data(j)
            data(j) = tmp
        end if
    end do
end do



前へ   上へ   次へ
関連情報
ご案内
© 鬯ッ�ッ�ス�ョ�ス�ス�ス�ォ�ス�ス�ス�ス�ス�ス�ス�エ鬯ッ�ッ�ス�イ�ス�ス�ス�ス�ス�ス�ス�シ髯樊サゑスス�イ�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�・鬯ッ�ッ�ス�ョ�ス�ス�ス�ォ�ス�ス�ス�ス�ス�ス�ス�エ鬯ョ�ッ隴趣ス「�ス�ス�ス�キ�ス�ス�ス�ス�ス�ス�ス�「�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ャ鬯ッ�ッ�ス�ゥ髯晢スキ�ス�「�ス�ス�ス�ス�ス�ス�ス�「鬯ョ�ォ�ス�エ髣包スオ隴会スヲ�ス�ソ�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ケ鬯ョ�ォ�ス�エ驕カ謫セ�ス�オ�ス�ス�ス�コ�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�、�ス�ス�ス�ス�ス�ス�ス�シ�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ケ鬯ョ�ォ�ス�エ鬮ョ諛カ�ス�」�ス�ス�ス�ス�ス�ス�ス�「�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�シ鬯ッ�ッ�ス�ゥ髯晢スキ�ス�「�ス�ス�ス�ス�ス�ス�ス�「鬯ョ�ォ�ス�エ鬮ョ諛カ�ス�」�ス�ス�ス�ス�ス�ス�ス�「�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�。鬯ッ�ッ�ス�ゥ髯晢スキ�ス�「�ス�ス�ス�ス�ス�ス�ス�「鬯ョ�ォ�ス�エ鬮ョ諛カ�ス�」�ス�ス�ス�ス�ス�ス�ス�「�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ェ鬯ッ�ッ�ス�ゥ髯晢スキ�ス�「�ス�ス�ス�ス�ス�ス�ス�「�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ァ�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ォ鬯ッ�ッ�ス�ゥ髯晢スキ�ス�「�ス�ス�ス�ス�ス�ス�ス�「鬯ョ�ォ�ス�エ鬮ョ諛カ�ス�」�ス�ス�ス�ス�ス�ス�ス�「�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ォ鬯ッ�ッ�ス�ゥ髯晢スキ�ス�「�ス�ス�ス�ス�ス�ス�ス�「�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ァ�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�「鬯ッ�ッ�ス�ゥ髯晢スキ�ス�「�ス�ス�ス�ス�ス�ス�ス�「鬯ョ�ォ�ス�エ鬮ョ諛カ�ス�」�ス�ス�ス�ス�ス�ス�ス�「�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ォ鬯ッ�ッ�ス�ゥ髯晢スキ�ス�「�ス�ス�ス�ス�ス�ス�ス�「�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ァ�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�エ鬯ッ�ッ�ス�ゥ髯晢スキ�ス�「�ス�ス�ス�ス�ス�ス�ス�「鬯ョ�ォ�ス�エ鬮ョ諛カ�ス�」�ス�ス�ス�ス�ス�ス�ス�「�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ェ鬯ッ�ッ�ス�ゥ髯晢スキ�ス�「�ス�ス�ス�ス�ス�ス�ス�「�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ァ�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�コ鬯ッ�ッ�ス�ゥ髯晢スキ�ス�「�ス�ス�ス�ス�ス�ス�ス�「鬯ョ�ォ�ス�エ鬮ョ諛カ�ス�」�ス�ス�ス�ス�ス�ス�ス�「�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ソ�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス鬯ッ�ッ�ス�ゥ髯晢スキ�ス�「�ス�ス�ス�ス�ス�ス�ス�「�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ァ�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�コ鬯ッ�ッ�ス�ゥ髯晢スキ�ス�「�ス�ス�ス�ス�ス�ス�ス�「�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ァ�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ー鬯ッ�ッ�ス�ゥ髯晢スキ�ス�「�ス�ス�ス�ス�ス�ス�ス�「鬯ョ�ォ�ス�エ鬮ョ諛カ�ス�」�ス�ス�ス�ス�ス�ス�ス�「�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ォ鬯ッ�ッ�ス�ゥ髯晢スキ�ス�「�ス�ス�ス�ス�ス�ス�ス�「鬯ョ�ォ�ス�エ鬮ョ諛カ�ス�」�ス�ス�ス�ス�ス�ス�ス�「�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�シ鬯ッ�ッ�ス�ゥ髯晢スキ�ス�「�ス�ス�ス�ス�ス�ス�ス�「鬯ョ�ォ�ス�エ髫ー�ス邇�ソス�ュ鬮ョ�」�ス�ソ�ス�ス�ス�ス�ス�サ�ス�ス�ス�ス�ス�ス�ス�ク�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ェ鬯ッ�ッ�ス�ョ�ス�ス�ス�ッ鬮ョ蜈キ�ソ�ス�ス�ス�ス�キ鬮ッ貊会スク�サ�ス�・�ス�ス�ス�ス�ス�ソ�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ク鬯ッ�ョ�ス�」鬯イ�ス�シ螟イ�ス�ス�ス�ス�ス�ス�ス�ィ�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�シ鬯ッ�ョ�ス�ッ髫カ轣假ス・�ス�ス�ス�ス�コ髯句ケ「�ソ�ス�ス�ス�ス�ス髫ー�ス竏橸ソス�ス�ス�ソ�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�、�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�ス�セ 2024
Privacy Policy  /  Trademarks