Re: NEC-LIST: Adjustable arrays in NEC-4 FORTRAN source

From: Chuck Counselman <ccc_at_email.domain.hidden>
Date: Tue, 09 Jun 1998 02:22:59 -0400

At 9:28 AM -0400 6/8/98, Michael S Kluskens wrote:
>At 5:00 PM -0400 6/6/98, Chuck Counselman wrote:
>>In the FORTRAN source code of NEC-4, so-called "adjustable" array
>>dimensioning is used to facilitate user adjustment of array sizes.
>>For example, in SUBROUTINE NEWINF you'll find
>>
>> PARAMETER (MAXSEG=2000,MAXMAT=2000)
>>...
>> COMMON/PATDAT/NPAT,XPAT(MAXSEG),YPAT(MAXSEG),ZPAT(MAXSEG),
>> &PNX(MAXSEG),PNY(MAXSEG),PNZ(MAXSEG),APAT(MAXSEG),PCURXR(MAXSEG),
>> &PCURXI(MAXSEG),PCURYR(MAXSEG),PCURYI(MAXSEG),PCURZR(MAXSEG),
>> &PCURZI(MAXSEG)
>>....
>>
>>When I tried to compile this code with Absoft's Fortran 77 compiler
>>for the PowerMac, v. 4.2 (which works fine for NEC-2, BTW), the
>>compiler complained about an adjustable array being used in this
>>subroutine. I RTFM and -- sure enough -- on page 11-18 it is stated,
>>"..."only _constant_ array declarators are allowed in
>>COMMON...statements. Adjustable and assumed size array declarators do
>>not supply sufficient information to map the static memory at compile
>>time."
>
>I can't find NEWINF or PATDAT in my copy of NEC-4. Perhaps you have a
>modified version.
>
>In any case, the problem you encountered is not specific to the particular
>compiler you used. Apparently someone took advantage of a feature of a
>specific compiler which has not been copied by others resulting in
>nonportable code.

I'm pleased (and somewhat embarrassed) to report now that

1. NEC-4 is pure FORTRAN 77. (Thanks to Jerry Burke for this info.)

2. NEC-4 has no "adjustable" array dimensioning. The compiler error
message that I received resulted from my having garbled the PARAMETER
statement so that the compiler didn't recognize it. Therefore the
compiler regarded MAXSEG as a variable, not a constant. False alarm.
My fault. Sorry.

3. NEWINF and PATDAT are in the related plotting utility NECPLOT, not
in NEC-4 itself.

4. With my error (see 2., above) corrected, Absoft's Fortran 77
compiler for the PowerMac, v. 4.2, works just fine on NECPLOT and on
NEC-4.

5. BTW, if you haven't used NECPLOT, try it. Its automatic
segment-checking is very useful. You may be surprised at what
violations it finds in your model.

Thanks to all who responded to my query, on or off the List.

Best regards -Chuck.
Received on Wed Jun 10 1998 - 09:26:14 EDT

This archive was generated by hypermail 2.2.0 : Sat Oct 02 2010 - 00:10:38 EDT