# Re: Could this result in Array Distortion ??

"monir" <monirg@xxxxxxxxxxxx> wrote in message news:8ff69493-7eda-4715-b82f-7d59a51a6748@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

| Could someone please have a quick look at the following snippets of
| code and advise whether there is a potential problem.
|
| My concern is: (F77, g95)
| 1) In main: variable Vx is declared as 3D array (10,10,30), and is
| passed as argument to Sub Splint3d().
| Sub Splint3d() sees the 3D Vx array as ya(k,m,n) of size
| (k=nP,m=nR,n=nT), where nP<=10, nR<=10, nT<=30.
| (I believe it would be correct if: nP=10, nR=10, nT<=30 ??)
|
| 2) I'm also using similar arrangements with 2D arrays, and I suspect
| might be causing array distortions as well.
|
| 3) For the 1D arrays Xg, Rg, Tg, there shouldn't be a problem
| resulting from k<=10, m<=10, n<=30
|
| Your help would be greatly appreciated.
| Monir
|
|
| Program main_1
| implicit double precision (a-h,o-z)
| Parameter (maxP=10, maxR=10, maxT=30)
|
| dimension Xg(maxP), Rg(maxR), Tg(maxT)
| dimension Vx(maxP,maxR,maxT)
| ! ......................................................
| call Splint3d( Xg, Rg, Tg,
| 1 Vx,
| 2 nP,nR,nT,
| 3 P1,P2,P3,
| 4 VxPm)
| ! ......................................................
| end program main_1
|
| ! ************************************************************
| Subroutine Splint3d( x1a, x2a, x3a,
| 1 ya,
| 2 k, m, n,
| 3 x1, x2, x3,
| 4 Z)
| ! ************************************************************
| implicit double precision (a-h,o-z)
|
| dimension x1a(k),x2a(m),x3a(n)
| dimension ya(k,m,n)
| ! ......................................................
| return
| end subroutine splint3d

This is generally OK as long as you don't read in or compute
any values for Vx in the main program.

All values for a 2-D or 3-D array must be computed and/or used
in subroutines or in functions.

(the declaration stays in the main program, of course.)

.