caimaxwell 发表于 2023-3-23 17:51:52

赋值问题

na = CtreeInd(1, NLayer)
nb = CtreeInd(2, NLayer)
do i = na, nb                        !!2547,上面call了,应该是先置零再填充
    a2 = iCtrees(i)%begin                !!begin为起始公共边编号
        b2 = a2 + iCtrees(i)%num - 1         !!节点内公共边的始末编号
        j1 = UnadmInd(1, i)                  !!j1是节点i内近区块的起始编号
        j2 = j1 + UnadmInd(2, i) - 1         !!与i节点相关的不可容块有j2个
        do k = j1, j2                         !!k是近区块的个数,并不是说编号1-56个都在10节点内,而是10节点内有56个近区块
          j = iUnadms(k)                     !!第k个近区块所在的不可容块为j,是把3104个近区块填充进节点里/近区块关联的编号
          a1 = iCtrees(j)%begin               !!a1为不可溶块j中包含的起始公共边编号
          b1 = a1 + iCtrees(j)%num - 1      !!b1为不可溶块j中包含的结尾公共边编号
                                          !!存疑?!但最终是将所有的近区块遍历了一遍
          allocate( iNears(k)%nr(a1:b1, a2:b2) )
          call GetZmnMatrix(iNears(k)%nr, iPoints, Npoint, iTris, Ntri, iEdges, Nedge, a1, b1, a2, b2, k0)

        end do
end do
现有一个n*n(6000+*6000+)的方阵,之前的代码已经将矩阵分层,此处iNear(i)代表最小矩阵块,iNear(i)%nr(a1:b1,a2:b2)代表最小矩阵块的边,现在我是把原矩阵重新用簇树结构分层,形式为iblocks(i)%subblocks(j)%nr(a1:b1,a2:b2),现在我做的是将iNear(i)%nr(a1:b1,a2:b2)信息赋给iblocks(i)%subblocks(j)%nr(a1:b1,a2:b2),为啥代码运行一半报错内存溢出?
有个过渡变量iNear(i)%nr(a1:b1,a2:b2)→iboxNears(i)%nr(a1:b1,a2:b2)→iblocks(i1)%Subblocks(i2)%nr(a1:b1,a2:b2)
do i = 1, Nunadm
    do j = 1, sbmax
      if(untmp(1, i) /= iSubblocks(j)%row) then
      cycle
      else
          if(untmp(2, i) /= iSubblocks(j)%coL) then
            cycle
            else
            j1 = iSubblocks(j)%row
            j2 = iSubblocks(j)%coL
            a2 = iCtrees(j1)%begin
            b2 = a2 + iCtrees(j1)%num - 1

            a1 = iCtrees(j2)%begin
            b1 = a1 + iCtrees(j2)%num - 1

            i1 = BParam3(j)
            i2 = j - 49*(i1 - k1)
            write(*,*) i1,i2,i,j

            allocate(iblocks(i1)%Subblocks(i2)%nrb(a1:b1, a2:b2))
            iblocks(i1)%Subblocks(i2)%nrb = iboxNears(i)%nra
!             call GetZmnMatrix(iblocks(i1)%iSubblocks(i2)%nr2, iPoints, Npoint, iTris, Ntri, iEdges, Nedge, a1, b1, a2, b2, k0)
         end if
       end if
    end do
end do求前辈指点一下,我分析不出来..

caimaxwell 发表于 2023-3-23 17:52:41

do i = 1, Nunadm
    do j = 1, sbmax
      if(untmp(1, i) /= iSubblocks(j)%row) then
      cycle
      else
          if(untmp(2, i) /= iSubblocks(j)%coL) then
            cycle
            else
            j1 = iSubblocks(j)%row
            j2 = iSubblocks(j)%coL
            a2 = iCtrees(j1)%begin
            b2 = a2 + iCtrees(j1)%num - 1

            a1 = iCtrees(j2)%begin
            b1 = a1 + iCtrees(j2)%num - 1

            i1 = BParam3(j)
            i2 = j - 49*(i1 - k1)
            write(*,*) i1,i2,i,j

            allocate(iblocks(i1)%Subblocks(i2)%nrb(a1:b1, a2:b2))
            iblocks(i1)%Subblocks(i2)%nrb = iboxNears(i)%nra
!             call GetZmnMatrix(iblocks(i1)%iSubblocks(i2)%nr2, iPoints, Npoint, iTris, Ntri, iEdges, Nedge, a1, b1, a2, b2, k0)
         end if
       end if
    end do
end do

caimaxwell 发表于 2023-3-23 22:09:10

问题解决啦!但不知道怎么删帖及标记已解决。谢谢各位前辈!
页: [1]
查看完整版本: 赋值问题