type Subblocks
integer*4 :: row
integer*4 :: coL
complex*16, dimension(:,:), pointer :: far
complex*16, dimension(:,:), pointer :: nar
complex*16, dimension(:,:), pointer :: nra
complex*16, dimension(:,:), pointer :: nrb
complex*16, dimension(:,:), pointer :: fr
end type Subblocks
type blocks
integer*4 :: row1,row2,coL1,coL2
integer*4 :: rowm,coLm
integer*4 :: dad
integer*4 :: son(4)
integer*4 :: bnum, begin, sbnum
type(Subblocks), allocatable :: Subblocks(:)
complex*16, allocatable :: invMatrix(:,:)
complex*16, allocatable :: offMatrix(:,:)
complex*16, allocatable :: Matrix(:,:)
complex*16, allocatable :: SUMatrix(:,:)
! complex*16, allocatable :: SVMatrix(:,:)
end type blocks
li913 发表于 2023-5-10 22:45
type(Subblocks), allocatable :: Subblocks(:)
这里Subblocks重名了,其他没问题。
楚香饭 发表于 2023-5-11 08:39
allocatable 在生命周期结束时,编译器会自动释放。而 pointer 不会。
caimaxwell 发表于 2023-5-11 10:59
这地方的重名会有影响吗?我的原意是写一个iblocks(i)%subblocks(j)%nr(a1:b1,a2:b2)。我需要修改一下嘛 ...
caimaxwell 发表于 2023-5-11 11:02
谢谢前辈的回答,但是我还有疑问,能够自动释放的话,那deallocate是干啥的? ...
li913 发表于 2023-5-11 11:03
编译可以通过,但是容易混乱。例如 fortran允许定义一个变量 叫 real,但没人这么干。 ...
222.png (10.78 KB, 下载次数: 407)
111.png (129.26 KB, 下载次数: 396)
caimaxwell 发表于 2023-5-11 11:02
谢谢前辈的回答,但是我还有疑问,能够自动释放的话,那deallocate是干啥的? ...
caimaxwell 发表于 2023-5-11 11:51
111是不注释的报错,222是不注释,且在某行加个write的报错。原来矩阵求逆是没问题的
...
欢迎光临 Fortran Coder (http://bbs.fcode.cn/) | Powered by Discuz! X3.2 |