📄 coedge.f90
字号:
! coedge.f90
!
! FUNCTIONS:
! coedge - Entry point of console application.
!
! Example of displaying 'Hello World' at execution time.
!
!****************************************************************************
!
! PROGRAM: coedge
!
! PURPOSE: Entry point for 'Hello World' sample console application.
!
!****************************************************************************
program coedge
implicit none
integer::nfacet,n,nn,nnn,nnnn,i,j,k
integer,allocatable::lfacet(:,:),face(:,:)
write(*,*)'input the number of the facet:'
read(*,*)nfacet
open(unit=11,file='1.facet')
open(unit=12,file='1.edge')
allocate (lfacet(nfacet,6),face(nfacet,6))
do i=1,nfacet
read(11,*)lfacet(i,1),lfacet(i,4),lfacet(i,2),lfacet(i,5),lfacet(i,3),lfacet(i,6)
nnn=max(lfacet(i,1),lfacet(i,2),lfacet(i,3))
nnnn=min(lfacet(i,1),lfacet(i,2),lfacet(i,3))
do j=1,3
if (lfacet(i,j)==nnnn) then
face(i,1)=nnnn
face(i,4)=j
else if (lfacet(i,j)==nnn) then
face(i,3)=nnn
face(i,6)=j
end if
end do
face(i,5)=6-face(i,4)-face(i,6)
face(i,2)=lfacet(i,face(i,5))
end do
write(*,*)'caculating, wait please!'
do i=1,nfacet
do j=i+1,nfacet
call judge(i,j,face,nfacet)
end do
end do
write(*,*)'congratulations!'
pause 'rui'
end program coedge
subroutine judge(i,j,face,nfacet)
implicit none
integer i,j,nfacet,n,nn,nnn,nnnn,p,q
integer n1(1:2),n2(1:2)
integer face(nfacet,6)
n=0
if (face(i,1)>=face(j,3).or.face(i,3)<=face(j,1)) then
return
end if
if (face(i,1)<face(j,1).and.face(i,2)>face(j,3)) then
return
end if
if (face(j,1)<face(i,1).and.face(j,2)>face(i,3)) then
return
end if
do p=1,3
do q=1,3
if (face(i,p)==face(j,q)) then
n=n+1
n1(n)=p
n2(n)=q
end if
end do
end do
if (n==2) then
write(12,*)i,j,face(i,9-n1(1)-n1(2)),face(j,9-n2(1)-n2(2))
end if
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -