| 5 | 1/1 | 返回列表 |
| 查看: 3273 | 回復(fù): 9 | ||
| 當(dāng)前只顯示滿足指定條件的回帖,點(diǎn)擊這里查看本話題的所有回帖 | ||
鴻影驚天下金蟲(chóng) (小有名氣)
|
[求助]
主程序中未分配的可變數(shù)組,如何在子程序中調(diào)用?
|
|
|
請(qǐng)前輩們幫忙,自己編的一段程序: 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)試沒(méi)有錯(cuò)誤,但是主程序在調(diào)試過(guò)程中總報(bào)錯(cuò)。 ![]() 一個(gè)錯(cuò)誤是可變數(shù)組ele_concentrate,ele_c,vcl:ALLOCATABLE or POINTER attribute dictates a deferred-shape-array 另外一個(gè)錯(cuò)誤是An allocatable dummy argument may only be argument associated with an allocatable actual argument. 同樣也是可變數(shù)組出錯(cuò)。 兩個(gè)錯(cuò)誤都出在interface塊。 求有經(jīng)驗(yàn)的前輩幫忙指點(diǎn)一二!謝謝 [ Last edited by 鴻影驚天下 on 2014-3-4 at 15:06 ] |

金蟲(chóng) (小有名氣)
|
對(duì)不起我不是很明白,你的意思是vcl這個(gè)數(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ù)組不再提示錯(cuò)誤,但是其他兩個(gè)數(shù)組還是會(huì)報(bào)原來(lái)的錯(cuò)誤。但是如果把interface里申請(qǐng)可變數(shù)組的allocatable都去掉,錯(cuò)誤提示就會(huì)變成: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ā)表 | |
|---|---|---|---|---|
|
[考研] 材料學(xué)學(xué)碩080502 337求調(diào)劑-一志愿華中科技大學(xué) +3 | 順順順mr 2026-03-18 | 4/200 |
|
|---|---|---|---|---|
|
[考研] 328求調(diào)劑,英語(yǔ)六級(jí)551,有科研經(jīng)歷 +4 | 生物工程調(diào)劑 2026-03-17 | 8/400 |
|
|
[考研] 材料 336 求調(diào)劑 +3 | An@. 2026-03-18 | 4/200 |
|
|
[考研] 321求調(diào)劑 +9 | 何潤(rùn)采123 2026-03-18 | 11/550 |
|
|
[考研] 317求調(diào)劑 +5 | 申子申申 2026-03-19 | 9/450 |
|
|
[考研] 藥學(xué)383 求調(diào)劑 +3 | 藥學(xué)chy 2026-03-15 | 5/250 |
|
|
[考研] 求調(diào)劑 +3 | @taotao 2026-03-20 | 3/150 |
|
|
[考研] 求調(diào)劑 +3 | eation27 2026-03-20 | 3/150 |
|
|
[考研] 086500 325 求調(diào)劑 +3 | 領(lǐng)帶小熊 2026-03-19 | 3/150 |
|
|
[考研] 工科材料085601 279求調(diào)劑 +7 | 困于星晨 2026-03-17 | 9/450 |
|
|
[考研] 材料學(xué)碩318求調(diào)劑 +5 | February_Feb 2026-03-19 | 5/250 |
|
|
[考研] 生物學(xué)調(diào)劑招人。。 +3 | 山海天嵐 2026-03-17 | 4/200 |
|
|
[考研] 085601材料工程專碩求調(diào)劑 +10 | 慕寒mio 2026-03-16 | 10/500 |
|
|
[考研] 材料考研調(diào)劑 +3 | xwt。 2026-03-19 | 3/150 |
|
|
[考研] 302求調(diào)劑 +4 | 小賈同學(xué)123 2026-03-15 | 8/400 |
|
|
[考研] 283求調(diào)劑 +3 | 聽(tīng)風(fēng)就是雨; 2026-03-16 | 3/150 |
|
|
[考研]
|
zhouzhen654 2026-03-16 | 3/150 |
|
|
[考研] 一志愿211 0703方向310分求調(diào)劑 +3 | 努力奮斗112 2026-03-15 | 3/150 |
|
|
[考研] 327求調(diào)劑 +6 | 拾光任染 2026-03-15 | 11/550 |
|
|
[考研] 289求調(diào)劑 +4 | 這么名字咋樣 2026-03-14 | 6/300 |
|