梅蒂斯与 Fortran
我正在使用 metis 5 和 Fortran。我正在使用 PartGraphRecursive
函数以及手册中给出的简单示例。给出的代码不是工作条件。
program main
implicit none
integer,parameter::nvtxs=15, Edges=22
integer::xadj(nvtxs+1),adjncy(2*Edges)
integer::objval, part(nvtxs)
xadj=[0, 2, 5, 8, 11, 13, 16, 20, 24, 28, 31, 33, 36, 39, 42, 44]
adjncy=[1, 5, 0, 2, 6, 1, 3, 7, 2, 4, 8, 3, 9, 0, 6, 10, 1, 5, 7, 11, 2, 6, 8, 12, 3, 7, 9, 13, 4, 8, 14, 5, 11, 6, 10, 12, 7, 11, 13, 8, 12, 14, 9, 13]
call METIS_PartGraphRecursive(vortices,1,xadj,adjncy,,,,2,,,,objval,part)
end program main
有人可以完成这段代码吗?我不太清楚如何使用 METIS_PartGraphRecursive 调用的不同输入,因为我想使用的大多数输入都是 NULL。
PS 我正在使用带有 pgf90
Fortran 编译器的 Linux,并且我使用以下命令来编译和链接该文件。
Pgf90 –o main main.f90 libmetis.a
libmetis.a 文件与 main 位于同一目录中。
I am using metis 5 with Fortran. I am using the PartGraphRecursive
function with the simple example given in the manual. The code is given as which is not the working condition.
program main
implicit none
integer,parameter::nvtxs=15, Edges=22
integer::xadj(nvtxs+1),adjncy(2*Edges)
integer::objval, part(nvtxs)
xadj=[0, 2, 5, 8, 11, 13, 16, 20, 24, 28, 31, 33, 36, 39, 42, 44]
adjncy=[1, 5, 0, 2, 6, 1, 3, 7, 2, 4, 8, 3, 9, 0, 6, 10, 1, 5, 7, 11, 2, 6, 8, 12, 3, 7, 9, 13, 4, 8, 14, 5, 11, 6, 10, 12, 7, 11, 13, 8, 12, 14, 9, 13]
call METIS_PartGraphRecursive(vortices,1,xadj,adjncy,,,,2,,,,objval,part)
end program main
Can anybody complete this code? I am not very clear how to use the different inputs to the METIS_PartGraphRecursive
call as most of the input I want to use is NULL.
P.S. I am using Linux with the pgf90
Fortran compiler and I am using the following command to compile and link the file.
Pgf90 –o main main.f90 libmetis.a
The libmetis.a file is in the same directory as main.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Fortran 2003 模块 ISO_C_BINDING 定义了一个常量 C_NULL_PTR,其类型为 type(C_PTR)。您可以使用此模块定义子例程的接口。
它将是这样的,
您可以对所有参数使用 type(c_ptr),value ,但您必须为它们定义指针并使用函数 C_LOC
Fortran 2003 module ISO_C_BINDING defines a constant C_NULL_PTR which is of type type(C_PTR). You can define an interface to the subroutine using this module.
It would be something as
You could use type(c_ptr),value for all parameters, but you would have to define pointers for them and use function C_LOC