Opened 17 years ago

Closed 17 years ago

#31 closed bug (Fixed)

ana_psource.h problem

Reported by: m.hadfield Owned by: arango
Priority: major Milestone: Release ROMS/TOMS 3.1
Component: Nonlinear Version: 3.1
Keywords: Cc:

Description

When compiled with explicit-shape declarations, subroutine ana_psource_grid (file ROMS/Functionals/ana_psource.h, revision 48) contains

integer, intent(out)
Nsrc

and later there are several arguments dimensioned with this, eg:

logical, intent(out)
Lsrc(Nsrc,NT(ng))
integer, intent(out)
Isrc(Nsrc)

So Lsrc, Isrc, etc are dimensioned with an intent(out) argument, which is illegal and obviously problematic, as the compiler needs to knwo the dimensions before calling the subroutine. However Nsrc can't be made intent(in) as its value is specified inside the subroutine.

Arguments Lsrc, Isrc, etc need to be declared with the same dimensions as the actual arrays they correspond to, namely SOURCES(ng)%Lsrc, SOURCES(ng)%Isrc, etc. The dimensions are determined when they are allocated in subroutine allocate_sources, module mod_sources, the declarations above should be

logical, intent(out)
Lsrc(Msrc,NT(ng))
integer, intent(out)
Isrc(Msrc)

This value has to be fed to the subroutine somehow. I've done it with

#ifndef ASSUMED_SHAPE

USE mod_sources, ONLY : Msrc

#endif

but alternatively it could be fed in as an extra argument.

Corrected file is attached.

Attachments (1)

ana_psource.h (12.2 KB ) - added by m.hadfield 17 years ago.

Download all attachments as: .zip

Change History (3)

by m.hadfield, 17 years ago

Attachment: ana_psource.h added

comment:1 by m.hadfield, 17 years ago

Those explicit-shape declarations are a pain, aren't they?

comment:2 by arango, 17 years ago

Resolution: fixed
Status: newclosed

Yes, they are a pain. I think that you are about the only one using them. Anyway, it is good to resolve all these bugs.

Note: See TracTickets for help on using tickets.