主题:有关动态数组问题?
! 这是一个读取主应力轨迹线(即构件内一条曲线)起始点坐标的程序
program main
implicit none
character(len=50)::beam,out
real(kind=8),dimension(:,:,:,:),allocatable::TSC0
!NE,NEI分别是积分点所在的单元及在单中的编号
integer::NE,NEI,i,j,NSI,N,l
!用TYPE定义任意积分点信息,包括坐标EIC(3)应力分量EISC(6)主应力EISP(3)
type points
real(kind=8)::EIC(3)
real(kind=8)::EISP(3)
real(kind=8)::EISC(6)
end type points
!定义积分点,二维数组,不知这样定义可不可以?
type(points),dimension(NE,NEI)::P
open (1,file=beam)!读入文件
open (2,file=OUT) !读出文件
read (1,*) NE,NEI
do i=1,NE
do j=1,NEI
read(1,*) i,j,p(i,j)%EIC(1),p(i,j)%EIC(2),p(i,j)%EIC(3),
# p(i,j)%EISP(1),p(i,j)%EISP(2),p(i,j)%EISP(3),
# p(i,j)%EISC(1),p(i,j)%EISC(2),p(i,j)%EISC(3),
# p(i,j)%EISC(4),p(i,j)%EISC(5), p(i,j)%EISC(6)
end do
end do
allocate (TSC0(3,3,NE,NEI))
!NSI是确定起始点个数
write(*,*)'NSI='
read(*,*) NSI
do N=1,NSI
write(*,*)'读入起画积分点所在单元及编号''i=','j='
read (*,*) i,j
do l=1,3
TSC0(1,l,i,j)=p(i,j)%EIC(1) !TSC0是起始点坐标
TSC0(2,l,i,j)=p(i,j)%EIC(2)
TSC0(3,l,i,j)=p(i,j)%EIC(3)
write(*,1) i,j,TSC0(1,l,i,j),TSC0(2,l,i,j),TSC0(3,l,i,j)
1 format(1x,5i,5i,'TSC0(1,'3I','5I','5I')='D15.8,5X,
# 'TSC0(2,'3I','5I','5I')='D15.8,5X,
# 'TSC0(3,'3I','5I','5I')='D15.8 )
end do
end do
end
在编译时总是提示.FOR(17): error FOR2942: symbol NE is not permitted in a specification expression
我想可能是动态数组使用不当,但不知道怎么解决,调了很久还是搞不定,恳请高手前辈指点迷津,谢谢!
program main
implicit none
character(len=50)::beam,out
real(kind=8),dimension(:,:,:,:),allocatable::TSC0
!NE,NEI分别是积分点所在的单元及在单中的编号
integer::NE,NEI,i,j,NSI,N,l
!用TYPE定义任意积分点信息,包括坐标EIC(3)应力分量EISC(6)主应力EISP(3)
type points
real(kind=8)::EIC(3)
real(kind=8)::EISP(3)
real(kind=8)::EISC(6)
end type points
!定义积分点,二维数组,不知这样定义可不可以?
type(points),dimension(NE,NEI)::P
open (1,file=beam)!读入文件
open (2,file=OUT) !读出文件
read (1,*) NE,NEI
do i=1,NE
do j=1,NEI
read(1,*) i,j,p(i,j)%EIC(1),p(i,j)%EIC(2),p(i,j)%EIC(3),
# p(i,j)%EISP(1),p(i,j)%EISP(2),p(i,j)%EISP(3),
# p(i,j)%EISC(1),p(i,j)%EISC(2),p(i,j)%EISC(3),
# p(i,j)%EISC(4),p(i,j)%EISC(5), p(i,j)%EISC(6)
end do
end do
allocate (TSC0(3,3,NE,NEI))
!NSI是确定起始点个数
write(*,*)'NSI='
read(*,*) NSI
do N=1,NSI
write(*,*)'读入起画积分点所在单元及编号''i=','j='
read (*,*) i,j
do l=1,3
TSC0(1,l,i,j)=p(i,j)%EIC(1) !TSC0是起始点坐标
TSC0(2,l,i,j)=p(i,j)%EIC(2)
TSC0(3,l,i,j)=p(i,j)%EIC(3)
write(*,1) i,j,TSC0(1,l,i,j),TSC0(2,l,i,j),TSC0(3,l,i,j)
1 format(1x,5i,5i,'TSC0(1,'3I','5I','5I')='D15.8,5X,
# 'TSC0(2,'3I','5I','5I')='D15.8,5X,
# 'TSC0(3,'3I','5I','5I')='D15.8 )
end do
end do
end
在编译时总是提示.FOR(17): error FOR2942: symbol NE is not permitted in a specification expression
我想可能是动态数组使用不当,但不知道怎么解决,调了很久还是搞不定,恳请高手前辈指点迷津,谢谢!