0

これが多少冗長である場合は事前にお詫び申し上げます。Fortran コードでの Metis の使用を参照する他の投稿を確認しました。また、私は非常に初心者なので、小さな言葉を使ってゆっくり言ってください!:p

Metis 5.1.0 を使用して、私が作成した Fortran コードでメッシュを分割しようとしています。c ライブラリへの呼び出しを含む Fortran コードのコンパイルの基本について疑問に思っていますか? それ、どうやったら出来るの?それはコンパイル時に行われますか、それともコードにある種の include ステートメントが必要ですか? 現在、コンパイルしようとすると、次の関連スニペットがあります。

プログラムの先頭 ( include または use ステートメントが必要ですか?)

PROGRAM ONEDGRIDGEN
IMPLICIT NONE
!include 'meshpart.c'
!use 'meshpart.c'

makefile (エラーがあると確信しています)

CC = gcc
FC = gfortran
FCFLAG1 = -g -fbacktrace -ffree-line-length-0 -fdefault-real-8
FCFLAG2 =
CCFLAG  =
OBJ   = 1Dgridgen_Mod
OBJ2  = meshpart

1Dgridgen: ${OBJ}.f95
        ${FC} -o ${OBJ} ${OBJ}.f95 ${OBJ2}.c ${FCFLAG1}

metis パーティショニングの呼び出しに関連するサブルーチン (直接呼び出しを使用)

SUBROUTINE METIS_CALL(ne,nn,eptr,eind)
use iso_c_binding
IMPLICIT NONE

integer(c_int),INTENT(IN):: ne,nn
integer(c_int)::nparts,objval,ncommon 
integer(c_int),dimension(0:((nn)*2-1)),INTENT(IN)::eind
integer(c_int),dimension(nn),INTENT(IN)::eptr
integer(c_int),dimension(:),allocatable::epart,npart 
integer,pointer::vwgt=>null(), vsize=>null(), options=>null() 
real(kind=8),pointer::tpwgts=>null()       

ALLOCATE(epart(ne),npart(nn))
ncommon = 1

write(*,*) 'How many domains do you wish to have?'
read(*,*) nparts

CALL METIS_PartMeshDual(ne,nn,eptr,eind,vwgt,vsize,ncommon,nparts,tpwgts,options,objval,epart,npart)

write(*,*) 'epart', epart
write(*,*) 'npart', npart


END SUBROUTINE METIS_CALL

コンパイルしようとすると、次のエラーが発生します

gfortran -o 1Dgridgen_Mod 1Dgridgen_Mod.f95 meshpart.c -g -fbacktrace -ffree-line-length-0 -fdefault-real-8
cc1: warning: command line option "-fbacktrace" is valid for Fortran but not for C
cc1: warning: command line option "-ffree-line-length-0" is valid for Fortran but not for C
cc1: warning: command line option "-fdefault-real-8" is valid for Fortran but not for C
In file included from meshpart.c:15:
metislib.h:17:19: error: GKlib.h: No such file or directory
metislib.h:24:19: error: metis.h: No such file or directory
metislib.h:25:20: error: rename.h: No such file or directory
metislib.h:26:24: error: gklib_defs.h: No such file or directory
metislib.h:28:18: error: defs.h: No such file or directory
metislib.h:29:20: error: struct.h: No such file or directory
metislib.h:30:20: error: macros.h: No such file or directory
metislib.h:31:19: error: proto.h: No such file or directory
meshpart.c:22: error: expected ')' before '*' token
meshpart.c:90: error: expected ')' before '*' token
meshpart.c:179: error: expected ')' before 'nrows'
make: *** [1Dgridgen] Error 1

私のmakeファイルが間違っていることはわかりますが、コードとすべてが同じフォルダーに「住んでいる」のに、なぜmetisから必要なcライブラリを参照すると、cライブラリのエラーが発生するのか疑問に思っていますmetis ライブラリ meshpart.c。適切にインストールされたメティスには、ライブラリと必要なコンポーネントが適切にリンクまたは参照されていませんか?

誰でも提供できるヘルプをありがとう!! 繰り返しになりますが、ご辛抱いただきありがとうございます。これは非常に基本的な質問であることを理解しています。

4

1 に答える 1