| 5 | 1/1 | 返回列表 |
| 查看: 3283 | 回復(fù): 9 | ||
| 當前只顯示滿足指定條件的回帖,點擊這里查看本話題的所有回帖 | ||
鴻影驚天下金蟲 (小有名氣)
|
[求助]
主程序中未分配的可變數(shù)組,如何在子程序中調(diào)用?
|
|
|
請前輩們幫忙,自己編的一段程序: Program test_main implicit none integer NP,ele_n,NE,NNE,npt,num integer,pointer :: ele_concentrate( : ),ele_c( : ) double precision,pointer::vcl( : , : ) interface subroutine new_node(NP,ele_n,NE,NNE,ele_concentrate,ele_c,vcl,npt,num) implicit none integer NP,ele_n,NE,NNE,npt,num integer,allocatable :: ele_concentrate(NE),ele_c(NNE) double precision,allocatable :: vcl(2,npt) end subroutine new_node subroutine zhaobian_gj01(NP,ele_n,NE,NNE,ele_concentrate,ele_c,vcl,npt,num) implicit none integer NP,ele_n,NE,NNE,npt,num integer :: ele_concentrate(NE),ele_c(NNE) double precision ::vcl(2,npt) end subroutine zhaobian_gj01 end interface call zhaobian_gj01(NP,ele_n,NE,NNE,ele_concentrate,ele_c,vcl,npt,num) call new_node(NP,ele_n,NE,NNE,ele_concentrate,ele_c,vcl,npt,num) end 后面的zhaobian_gj01, new_node是子程序經(jīng)調(diào)試沒有錯誤,但是主程序在調(diào)試過程中總報錯。 ![]() 一個錯誤是可變數(shù)組ele_concentrate,ele_c,vcl:ALLOCATABLE or POINTER attribute dictates a deferred-shape-array 另外一個錯誤是An allocatable dummy argument may only be argument associated with an allocatable actual argument. 同樣也是可變數(shù)組出錯。 兩個錯誤都出在interface塊。 求有經(jīng)驗的前輩幫忙指點一二!謝謝 [ Last edited by 鴻影驚天下 on 2014-3-4 at 15:06 ] |

金蟲 (小有名氣)
|
對不起我不是很明白,你的意思是vcl這個數(shù)組定義成(2,: )是已經(jīng)給定了大小嗎?我把interface塊改成這樣: interface subroutine new_node(NP,ele_n,NE,NNE,ele_concentrate,ele_c,vcl,npt,num) implicit none integer NP,ele_n,NE,NNE,npt,num integer,allocatable :: ele_concentrate(NE),ele_c(NNE) double precision :: vcl(2,npt) end subroutine new_node end interface interface subroutine zhaobian_gj01(NP,ele_n,NE,NNE,ele_concentrate,ele_c,vcl,npt,num) implicit none integer NP,ele_n,NE,NNE,npt,num integer,allocatable :: ele_concentrate(NE),ele_c(NNE) double precision ::vcl(2,npt) end subroutine zhaobian_gj01 end interface 之后,vcl數(shù)組不再提示錯誤,但是其他兩個數(shù)組還是會報原來的錯誤。但是如果把interface里申請可變數(shù)組的allocatable都去掉,錯誤提示就會變成:error #8000: There is a conflict between local interface block and external interface block. [ELE_CONCENTRATE] 位置是在interface里zhaobian_gj01(NP,ele_n,NE,NNE,ele_concentrate,ele_c,vcl,npt,num)這一句。 這是為什么呢? |

| 最具人氣熱帖推薦 [查看全部] | 作者 | 回/看 | 最后發(fā)表 | |
|---|---|---|---|---|
|
[考研] 收08調(diào)劑生 +6 | komorebi69 2026-03-18 | 6/300 |
|
|---|---|---|---|---|
|
[考研] 化工專碩求調(diào)劑 +3 | question挽風(fēng) 2026-03-24 | 3/150 |
|
|
[考研] 08工學(xué)調(diào)劑 +10 | 用戶573181 2026-03-20 | 15/750 |
|
|
[考研] 291求調(diào)劑 +3 | HanBeiNingZC 2026-03-24 | 3/150 |
|
|
[考研] 081700 調(diào)劑 267分 +9 | 迷人的哈哈 2026-03-23 | 9/450 |
|
|
[考研] 一志愿重慶大學(xué)085700資源與環(huán)境,總分308求調(diào)劑 +7 | 墨墨漠 2026-03-23 | 8/400 |
|
|
[論文投稿] 急發(fā)核心期刊論文 +3 | 賢達問津 2026-03-23 | 5/250 |
|
|
[考研] 石河子大學(xué)(211、雙一流)碩博研究生長期招生公告 +3 | 李子目 2026-03-22 | 3/150 |
|
|
[考研] 考研調(diào)劑 +4 | 來好運來來來 2026-03-21 | 4/200 |
|
|
[考研] 296求調(diào)劑 +4 | www_q 2026-03-20 | 4/200 |
|
|
[考研] 一志愿重慶大學(xué)085700資源與環(huán)境總分308求調(diào)劑 +7 | 墨墨漠 2026-03-20 | 7/350 |
|
|
[考研] 330求調(diào)劑0854 +3 | assdll 2026-03-21 | 3/150 |
|
|
[考研] 22408 344分 求調(diào)劑 一志愿 華電計算機技術(shù) +4 | solanXXX 2026-03-20 | 4/200 |
|
|
[考研] 321求調(diào)劑 +9 | 何潤采123 2026-03-18 | 11/550 |
|
|
[考研] 290求調(diào)劑 +7 | ^O^乜 2026-03-19 | 7/350 |
|
|
[考研] 295材料求調(diào)劑,一志愿武漢理工085601專碩 +5 | Charlieyq 2026-03-19 | 5/250 |
|
|
[考研]
|
不想起名字112 2026-03-19 | 3/150 |
|
|
[考研] 0703化學(xué)調(diào)劑 +4 | 18889395102 2026-03-18 | 4/200 |
|
|
[考研] 一志愿福大288有機化學(xué),求調(diào)劑 +3 | 小木蟲200408204 2026-03-18 | 3/150 |
|
|
[考研] 本科鄭州大學(xué)物理學(xué)院,一志愿華科070200學(xué)碩,346求調(diào)劑 +4 | 我不是一根蔥 2026-03-18 | 4/200 |
|