This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Error: Invalid form of array reference at (1)


the entire subroutine is ...

------------------------------------------
subroutine PerformAngularIntegration(theta, wtheta, phi, wphi, f, r, wr,
summation)

real(8), allocatable, dimension(:) :: theta, phi, wtheta, wphi, r, wr
integer :: nr, ntheta, nphi, rcounter, thetacounter, phicounter
real(8) :: summation, sumtheta, sumphi, tn, rn, pn, wtn, wrn, wpn
real(8), allocatable, dimension(:,:) :: f

ntheta = size(theta)
nphi = size(phi)
nr = size(r)

sumphi = 0
sumtheta = 0

do thetacounter = 1,ntheta
  sumtheta = sumtheta + (wtheta(thetacounter)*f(thetacounter, 1)**2)
enddo
sumtheta = (0.5)*sumtheta
print*, "--------------------------------------"
print*,"sumtheta = ", sumtheta

do phicounter = 1,nphi
  sumphi = sumphi + (wphi(phicounter)*f(1,phicounter)**2)
enddo
sumphi = (0.5)*sumphi
print*, "sumphi = ", sumphi

! do phicounter = 1,nphi
!   do thetacounter = 1,ntheta
!     do rcounter = 1, nr
!       summation = summation +
f(thetacounter,phicounter)*(r(rcounter)**2)*sin(theta(thetacounter))*wr(rcounter)*wtheta(thetacounter)*wphi(phicounter)
!     enddo
!   enddo
! enddo

do phicounter = 1,nphi
  do thetacounter = 1,ntheta
    do rcounter = 1, nr
      
      tn = theta(thetacounter)
      rn = r(rcounter)
      pn = phi(phicounter)
      wtn = wtheta(thetacounter)
      wrn = wr(rcounter)
      wpn = wphi(phicounter)

      summation = summation +
f(thetacounter,phicounter)*(rn**2)*sin(tn)*wtn*wrn*wpn
      
    enddo
  enddo
enddo


end subroutine
-----------------------------------------
honestly the problem may have been that i was writing too many characters on
one line as you said. i decided to declare each reference to an array as a
constant variable (as shown in the code) and it is working now, so you may
have hit the nail on the head. would it have given me an error like i got if
i had written too many characters on one line?
-- 
View this message in context: http://old.nabble.com/Error%3A-Invalid-form-of-array-reference-at-%281%29-tp30876985p30877178.html
Sent from the gcc - fortran mailing list archive at Nabble.com.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]