implicit none
real :: l,dl,z,b,dm,f,g,p
integer :: o,j,i,x,n,r,m,k
print *,"横の長さを入力してください"
read *, l
print *,"縦の長さを入力してください"
read *, b
print *,"横の分割数を入力してください"
read *, n
print *,"縦の分割数を入力してください"
read *, m
dm=b/(2*m)
dl=l/(2*n)
o=0
!節点番号の最後は節点が1行分多く出るので注意
do k=0,m
do i=3*k*n+2*k+1,(3*k+2)*n+2*k+1
f=dm*2*k
z=dl*(i-(3*k*n+2*k+1))
print *,i,",",dm*2*k,",",o,",",dl*(i-(3*k*n+2*k+1))
end do
do j=(3*k+2)*n+2*(k+1),3*(k+1)*n+2*(k+1)
g=dm*(2*k+1)
z=2*dl*(j-((3*k+2)*n+2*k+2))
print *,j,",",dm*(2*k+1),",",o,",",2*dl*(j-((3*k+2)*n+2*k+2))
end do
end do
do x=1,m
do r=1,n
p=3*x*n+2*r+2*x-1
p=3*x*n+2*r+2*x+1
p=(3*x-3)*n+2*r+2*x-1
p=(3*x-3)*n+2*r+2*x-3
p=3*x*n+2*r+2*x
p=(3*x-1)*n+r+2*x
p=(3*x-3)*n+2*r+2*x-2
p=(3*x-1)*n+r+2*x-1
print *,(x-1)*n+r,",",3*x*n+2*r+2*x-1,",",3*x*n+2*r+2*x+1,",",(3*x-3)*n+2*r+2*x-1,",",(3*x-3)*n+2*r+2*x-3,",",3*x*n+2*r+2*x& 
&,",",(3*x-1)*n+r+2*x,",",(3*x-3)*n+2*r+2*x-2,",",(3*x-1)*n+r+2*x-1,","
end do
end do
!拘束点の最後の点はいらない点なので注意
do k=0,m 
i=3*k*n+2*k+1 
j=(3*k+2)*n+2*(k+1)
print *,"拘束点:",3*k*n+2*k+1,",",(3*k+2)*n+2*(k+1),","
end do
p=2*n+1
p=(3*m+2)*n+2*m+1
print *,"載荷点(p):",2*n+1,",",(3*m+2)*n+2*m+1,","
do k=1,m
p=3*k*n+2*k
print *,"載荷点(4p):",3*k*n+2*k,","
end do
do k=0,m-2
p=(3*(k+1)+2)*n+2*(k+1)+1
print *,"載荷点(2p):",(3*(k+1)+2)*n+2*(k+1)+1,","
end do 
end

