Skip to content

Commit

Permalink
Merge pull request #10 from jalvesz/master
Browse files Browse the repository at this point in the history
add fpm toml and change select case using integers instead of boz
  • Loading branch information
ivan-pi authored Aug 5, 2024
2 parents cb6f0ab + da48103 commit d0bfac4
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 18 deletions.
23 changes: 23 additions & 0 deletions fpm.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name = "fmetis"
version = "0.1.0"
license = "license"
author = "Ivan Privec"
maintainer = "ivan privec"
copyright = "Copyright 2019, Ivan Privec"

[build]
auto-executables = true
auto-tests = true
auto-examples = true
module-naming = false

external-modules = ["libmetis5", "libmetis-dev"]
link = ["libmetis5", "libmetis-dev"]

[install]
library = false

[fortran]
implicit-typing = false
implicit-external = false
source-form = "free"
36 changes: 18 additions & 18 deletions src/lib/metis_oo_interface.f90
Original file line number Diff line number Diff line change
Expand Up @@ -118,39 +118,39 @@ subroutine write_graph(unit,xadj,adjncy,numflag,vwgt,adjwgt,vsize)
end if


select case(fmt)
case(b'000')
select case(int(fmt))
case(int(b'000'))
do i = 1, nvxts
! v1 v2 v3 ...
write(unit,fstring) (adjncy(j),j=xadj(i),xadj(i+1)-1)
end do
case(b'001') ! edge weights
case(int(b'001')) ! edge weights
do i = 1, nvxts
! v1 e1 v2 e2 ...
write(unit,fstring) (adjncy(j),adjwgt(j),j=xadj(i),xadj(i+1)-1)
end do
case(b'010') ! vertex weights
case(int(b'010')) ! vertex weights
do i = 1, nvxts
! w1 w2 ... wncon v1 v2 v3 ...
write(unit,fstring) vwgt((i-1)*ncon+1:(i-1)*ncon+ncon),(adjncy(j),j=xadj(i),xadj(i+1)-1)
end do
case(b'100') ! vertex sizes
case(int(b'100')) ! vertex sizes
do i = 1, nvxts
write(unit,fstring) vsize(i), (adjncy(j),j=xadj(i),xadj(i+1)-1)
end do
case(b'011')
case(int(b'011'))
do i = 1, nvxts
write(unit,fstring) vwgt((i-1)*ncon+1:(i-1)*ncon+ncon), (adjncy(j),adjwgt(j),j=xadj(i),xadj(i+1)-1)
end do
case(b'110')
case(int(b'110'))
do i = 1, nvxts
write(unit,fstring) vsize(i), vwgt((i-1)*ncon+1:(i-1)*ncon+ncon),(adjncy(j),j=xadj(i),xadj(i+1)-1)
end do
case(b'101')
case(int(b'101'))
do i = 1, nvxts
write(unit,fstring) vsize(i), (adjncy(j),adjwgt(j),j=xadj(i),xadj(i+1)-1)
end do
case(b'111')
case(int(b'111'))
do i = 1, nvxts
write(unit,fstring) vsize(i), vwgt((i-1)*ncon+1:(i-1)*ncon+ncon), (adjncy(j),adjwgt(j),j=xadj(i),xadj(i+1)-1)
end do
Expand Down Expand Up @@ -269,50 +269,50 @@ subroutine read_graph(unit,xadj,adjncy,numflag,vwgt,adjwgt,vsize)


xadj(1) = 0
select case(fmt)
case (b'000')
select case(int(fmt))
case (int(b'000'))
do i = 1, nvtxs
rowcol = count_columns(unit,stat=ios)
xadj(i+1) = xadj(i) + rowcol
read(unit,*) adjncy(xadj(i)+1:xadj(i+1))
end do
case(b'001')
case(int(b'001'))
do i = 1, nvtxs
rowcol = count_columns(unit,stat=ios)/2
xadj(i+1) = xadj(i) + rowcol
read(unit,*) (adjncy(j),adjwgt(j),j=xadj(i)+1,xadj(i+1))
end do
case(b'010')
case(int(b'010'))
do i = 1, nvtxs
rowcol = count_columns(unit,stat=ios) - ncon
xadj(i+1) = xadj(i) + rowcol
read(unit,*) vwgt((i-1)*ncon+1:(i-1)*ncon+ncon), adjncy(xadj(i)+1:xadj(i+1))
end do
case(b'100')
case(int(b'100'))
do i = 1, nvtxs
rowcol = count_columns(unit,stat=ios) - 1
xadj(i+1) = xadj(i) + rowcol
read(unit,*) vsize(i), adjncy(xadj(i)+1:xadj(i+1))
end do
case(b'011')
case(int(b'011'))
do i = 1, nvtxs
rowcol = (count_columns(unit,stat=ios) - ncon)/2
xadj(i+1) = xadj(i) + rowcol
read(unit,*) vwgt((i-1)*ncon+1:(i-1)*ncon+ncon), (adjncy(j),adjwgt(j),j=xadj(i)+1,xadj(i+1))
end do
case(b'110')
case(int(b'110'))
do i = 1, nvtxs
rowcol = count_columns(unit,stat=ios) - 1 - ncon
xadj(i+1) = xadj(i) + rowcol
read(unit,*) vsize(i), vwgt((i-1)*ncon+1:(i-1)*ncon+ncon), adjncy(xadj(i)+1:xadj(i+1))
end do
case(b'101')
case(int(b'101'))
do i = 1, nvtxs
rowcol = (count_columns(unit,stat=ios) - 1)/2
xadj(i+1) = xadj(i) + rowcol
read(unit,*) vsize(i), (adjncy(j),adjwgt(j),j=xadj(i)+1,xadj(i+1))
end do
case(b'111')
case(int(b'111'))
do i = 1, nvtxs
rowcol = (count_columns(unit,stat=ios) - 1 - ncon)/2
xadj(i+1) = xadj(i) + rowcol
Expand Down

0 comments on commit d0bfac4

Please sign in to comment.