cvd/F90 'allocate' problen

cvd/F90 'allocate' problen

Post by bill lower » Sat, 02 Sep 2000 03:03:50



Unable to determine the values of the array GRID using WorkShop de*
Example code follows: (File name: tst.F90)

       program tst
         !
         !
         implicit none
         integer :: ntau,itau,nvar,ivar,npatches,ipatch
         integer :: j,k,id
         integer :: i1,j1,k1,kstart,kstop,nfiles,ifile,njmax,nkmax
         real :: xmin,xmax,ymin,ymax,zmin,zmax,dx,dy,dz
         real :: psi0dat,dtau, tau
         real, allocatable :: qcell(:,:)
         type :: patch_type
           integer :: nj,nk
           real, pointer, dimension(:,:) :: x,y,z
         end type patch_type
         type (patch_type), dimension(2) :: GRID

         !
         ! assume 3 input data on a cube
         nvar = 5
         npatches = 2
         !
       ! set up grid(1)
         xmin = 0.0
         xmax = 1.0
         dx = 0.1
         ymin = 0.0
         ymax = 1.0
         dy = 0.1
         zmin = 0.0
         zmax = 1.0
         dz = 0.1
       !
         GRID(1)%nj = 10
         GRID(1)%nk = 10
         allocate (GRID(1)%x(GRID(1)%nj,GRID(1)%nk),&
              GRID(1)%y(GRID(1)%nj,GRID(1)%nk),&
              GRID(1)%z(GRID(1)%nj,GRID(1)%nk))
         do j = 1,GRID(1)%nj
            do k=1,GRID(1)%nk
               GRID(1)%x(j,k) = xmin
               GRID(1)%y(j,k) = ymax - dy*(j-1)
               GRID(1)%z(j,k) = zmin + dz*(k-1)
            enddo
         enddo
       ! set up grid(2)
         xmin = 0.0
         xmax = 1.0
         dx = 0.05
         ymin = 0.0
         ymax = 1.0
         dy = 0.05
         zmin = 0.0
         zmax = 1.0
         dz = 0.05
       !
         GRID(2)%nj = 20
         GRID(2)%nk = 20
         allocate (GRID(2)%x(GRID(2)%nj,GRID(2)%nk),&
              GRID(2)%y(GRID(2)%nj,GRID(2)%nk),&
              GRID(2)%z(GRID(2)%nj,GRID(2)%nk))
         do j = 1,GRID(2)%nj
            do k=1,GRID(2)%nk
               GRID(2)%x(j,k) = xmin
               GRID(2)%y(j,k) = ymax - dy*(j-1)
               GRID(2)%z(j,k) = zmin + dz*(k-1)
            enddo
         enddo
         write(6,*) 'after grid(2) assignments'
         !
       !
         !
         do ipatch = 1,npatches
            !
            ! compute the data
            !
            if (allocated(qcell)) deallocate(qcell)
            allocate(qcell( GRID(ipatch)%nj-1,nvar ))
            do j=1,GRID(ipatch)%nj-1
               !        
               qcell(j,1) = 1.0
               qcell(j,2) = 2.0
               qcell(j,3) = 3.0
               qcell(j,4) = 4.0
               qcell(j,5) = 5.0
              enddo
            call donothing( GRID(ipatch)%nj-1,nvar,qcell)
         enddo
         !
         stop
       end program tst

       subroutine donothing(idim,jdim,q)
         real :: q(idim,jdim)
         integer :: i,j
         write(6,'(2i6)')idim,jdim
         do i = 1,idim
            do j=1,jdim
               write(6,'(f10.4)') q(i,j)
            enddo
         enddo
       return
       end subroutine donothing

--
=======================================================
Bill Lowery           SGI Federal
Office: 757.873.4300  11832 Rocklanding Drive Suite 104
Direct: 757.873.4306  Newport News, VA 23606

=======================================================

 
 
 

1. HELP: Error: Can't allocate color 'Red'...

You have some color-mad program running, like xv with a "tasteful" photo
in the background, or netscape running with unrestricted colors.  

Say good-bye to the pin-up and you'll be able to see colors in other
programs.  X can only allocate a fixed number of colors (typically 256).

--


Department of Mathematics               http://www.lehigh.edu/~dlj0/dlj0.html
Lehigh University
14 E. Packer Avenue                     (610) 758-3759
Bethlehem, PA 18015-3174                (610) 828-3708

2. if [ ? = ? ]

3. Can not allocate colormap entry for:'#e3e0e0', what is it?

4. How to find the JRE version used by the processes?

5. what is 'macro-allocate netmask' please

6. imake/xmkmf on RedHat (2.1/3.0.3)

7. Allocating many 'net_device's (virtual interfaces)

8. Voice mailbox software for Linux?

9. wmaker: warning: could not allocate color 'gray50'

10. Shared 'Allocated' Memory

11. Netscape 'cannot allocate...'

12. sun's 4.2 f90 compiler, nothing new

13. 'double' or 'dbl' or 'dble', the disk space utilty