Daniel Reynolds avatar Daniel Reynolds committed f322bbc

updated handling of Fortran constants in interpolation routines.

Comments (0)

Files changed (3)

src/enzo/interp1d.F

 c     dim1        - declared dimension of parent
 c     start1      - starting index in parent in units of grid (one based)
 c     end1        - ending index in parent in units of grid (one based)
-c     refine1     - INTG_PREC refinement factors
+c     refine1     - integer refinement factors
 c     gdim1       - declared dimension of grid
 c     gstart1     - starting offset of refined region in grid (one based)
 c     wdim1       - work dimensions
          delf0 =     min(abs(fbar - work(i  )),
      &                   abs(fbar - work(i+1)) )*
      &            sign(one, (fbar - work(i  )))
-         if ((work(i+1) - fbar) * (fbar - work(i)) .lt. 0._RKIND) 
-     &        delf0=0._RKIND
+         if ((work(i+1) - fbar) * (fbar - work(i)) .lt. 0.0) 
+     &        delf0=0.0
 c
 c        Now, find the the interpolation coefficients.
 c
 c
          do i1 = 0, refine1-1
             grid(gstart1+(i-1)*refine1+i1) = (fbar +
-     &            (REAL(i1,RKIND)+0.5_RKIND - 
-     &             0.5_RKIND*REAL(refine1,RKIND)) / 
-     &             REAL(refine1,RKIND)*fx)
+     &            (REAL(i1)+0.5_RKIND - 
+     &             0.5_RKIND*REAL(refine1)) / 
+     &             REAL(refine1)*fx)
          enddo
 c
       enddo

src/enzo/interp2d.F

 c     dim1,2      - declared dimension of parent
 c     start1,2    - starting index in parent in units of grid (one based)
 c     end1,2      - ending index in parent in units of grid (one based)
-c     refine1,2   - INTG_PREC refinement factors
+c     refine1,2   - integer refinement factors
 c     gdim1,2     - declared dimension of grid
 c     gstart1,2   - starting offset of refined region in grid (one based)
 c     wdim1,2     - work dimensions
      &                      abs(fbar - work(i+1, j+1)) )*
      &               sign(one, (fbar - work(i  , j  )))
             if ((work(i+1, j+1) - fbar) * (fbar - work(i, j)) .lt. 0.0)
-     &         delf0 = 0._RKIND
+     &         delf0 = 0.0
 c
             delf1 =     min(abs(fbar - work(i+1, j  )),
      &                      abs(fbar - work(i  , j+1)) )*
      &               sign(one, (fbar - work(i+1, j  )))
             if ((work(i, j+1) - fbar) * (fbar - work(i+1, j)) .lt. 0.0)
-     &         delf1 = 0._RKIND
+     &         delf1 = 0.0
 c
 c           Now, find the the interpolation coefficients.
 c
                do i1 = 0, refine1-1
                   grid(gstart1+(i-1)*refine1+i1,
      &                 gstart2+(j-1)*refine2+j1) = (fbar +
-     &               (REAL(i1,RKIND)+0.5_RKIND -
-     &                 0.5_RKIND*REAL(refine1,RKIND)) / 
-     &                 REAL(refine1,RKIND)*fx +
-     &               (REAL(j1,RKIND)+0.5_RKIND - 
-     &                 0.5_RKIND*REAL(refine2,RKIND)) / 
-     &                 REAL(refine2,RKIND)*fy )
+     &               (REAL(i1)+0.5_RKIND -
+     &                 0.5_RKIND*REAL(refine1)) / 
+     &                 REAL(refine1)*fx +
+     &               (REAL(j1)+0.5_RKIND - 
+     &                 0.5_RKIND*REAL(refine2)) / 
+     &                 REAL(refine2)*fy )
 c                  if (grid(gstart1+(i-1)*refine1+i1,
 c     &                     gstart2+(j-1)*refine2+j1) .lt. 0.0)
 c     &                write(6,*) 'b',i,j,i1,j1

src/enzo/interp3d.F

 c     dim1,2,3    - declared dimension of parent
 c     start1,2,3  - starting index in parent in units of grid (one based)
 c     end1,2,3    - ending index in parent in units of grid (one based)
-c     refine1,2,3 - INTG_PREC refinement factors
+c     refine1,2,3 - integer refinement factors
 c     gdim1,2,3   - declared dimension of grid
 c     gstart1,2,3 - starting offset of refined region in grid (one based)
 c     wdim1,2,3   - work dimensions
                   ierror = 1
                   return
                endif
-               if (work(i,j,k) .le. 0._RKIND .or.
-     &             parent(pstart1+i, pstart2+j, pstart3+k).le.0._RKIND) 
+               if (work(i,j,k) .le. 0.0 .or.
+     &             parent(pstart1+i, pstart2+j, pstart3+k) .le. 0.0) 
      &             nneg = nneg+1
             enddo
          enddo
      &                         abs(fbar - work(i+1, j+1, k+1)) )*
      &                  sign(one, (fbar - work(i  , j  , k  )))
                if ((work(i+1, j+1, k+1) - fbar) *
-     &             (fbar - work(i  , j  , k  )  ) .le. 0._RKIND) 
-     &              delf0 = 0._RKIND
+     &             (fbar - work(i  , j  , k  )  ) .le. 0.0) 
+     &              delf0 = 0.0
 c
                delf1 =     min(abs(fbar - work(i+1, j  , k  )),
      &                         abs(fbar - work(i  , j+1, k+1)) )*
      &                  sign(one, (fbar - work(i+1, j  , k  )))
                if ((work(i  , j+1, k+1) - fbar) *
-     &             (fbar - work(i+1, j  , k  )  ) .le. 0._RKIND) 
-     &              delf1 = 0._RKIND
+     &             (fbar - work(i+1, j  , k  )  ) .le. 0.0) 
+     &              delf1 = 0.0
 c
                delf2 =     min(abs(fbar - work(i  , j+1, k  )),
      &                         abs(fbar - work(i+1, j  , k+1)) )*
      &                  sign(one, (fbar - work(i  , j+1, k  )))
                if ((work(i+1, j  , k+1) - fbar) *
-     &             (fbar - work(i  , j+1, k  )  ) .le. 0._RKIND) 
-     &              delf2 = 0._RKIND
+     &             (fbar - work(i  , j+1, k  )  ) .le. 0.0) 
+     &              delf2 = 0.0
 c
                delf3 =     min(abs(fbar - work(i  , j  , k+1)),
      &                         abs(fbar - work(i+1, j+1, k  )) )*
      &                  sign(one, (fbar - work(i  , j  , k+1)))
                if ((work(i+1, j+1, k  ) - fbar) *
-     &             (fbar - work(i  , j  , k+1)  ) .le. 0._RKIND) 
-     &              delf3 = 0._RKIND
+     &             (fbar - work(i  , j  , k+1)  ) .le. 0.0) 
+     &              delf3 = 0.0
 c
 c              Determine s, the resulting scaled value of delf0 and contain
 c                sprime within the range 0 to 1
 c
-               if (delf0 .eq. 0._RKIND) then
-                  delf0 = 1.e-5_RKIND*sign(REAL(tiny,RKIND),
-     &                                     delf1+delf2+delf3)
+               if (delf0 .eq. 0.0) then
+                  delf0 = 1.e-5_RKIND*sign(tiny, delf1+delf2+delf3)
                   sprime = 1._RKIND
                else
                   s = (delf1 + delf2 + delf3) / delf0
-                  sprime = min(max(s, 0._RKIND), 1._RKIND)
+                  sprime = min(max(s, 0.0), 1._RKIND)
                endif
 c
 c              Compute the chi# flags which are 1 if delf# can contribute
                chi1 = 1._RKIND
                chi2 = 1._RKIND
                chi3 = 1._RKIND
-               if (delf1/delf0 .gt. 0._RKIND) chi1 = 0._RKIND
-               if (delf2/delf0 .gt. 0._RKIND) chi2 = 0._RKIND
-               if (delf3/delf0 .gt. 0._RKIND) chi3 = 0._RKIND
+               if (delf1/delf0 .gt. 0.0) chi1 = 0.0
+               if (delf2/delf0 .gt. 0.0) chi2 = 0.0
+               if (delf3/delf0 .gt. 0.0) chi3 = 0.0
 c
 c              If sprime is one (i.e. implied delf0 is too high) reverse chi#.
 c
 c              If sprime is not 0 or 1 (i.e. we do not have to adjust delf#) 
 c                   then set chi# to zero.
 c
-               if (sprime .ne. 0._RKIND .and. sprime .ne. 1._RKIND) then
-                  chi1 = 0._RKIND
-                  chi2 = 0._RKIND
-                  chi3 = 0._RKIND
+               if (sprime .ne. 0.0 .and. sprime .ne. 1._RKIND) then
+                  chi1 = 0.0
+                  chi2 = 0.0
+                  chi3 = 0.0
                endif
 c
 c              Compute frac, the adjustment fraction.
      &           (chi1*delf1 + chi2*delf2 + chi3*delf3 + 1.d-35)
 c
                frac = min(frac, 1._RKIND)
-               if (chi1+chi2+chi3 .eq. 0._RKIND) frac = 0._RKIND
+               if (chi1+chi2+chi3 .eq. 0.0) frac = 0.0
 c
-               frac = max(frac, 0._RKIND)
-               if (frac .lt. 0._RKIND) then
+               frac = max(frac, 0.0)
+               if (frac .lt. 0.0) then
                   write(6,*) "INTERP3D: frac = ", frac
                   write(6,*) chi1,chi2,chi3
                   write(6,*) delf0,delf1,delf2,delf3
 c     &               delf1new,delf2new,delf3new,s
                s = delf1new+delf2new+delf3new
                if (nneg .eq. 0 .and. 
-     &             (fbar+s.le.0._RKIND .or. fbar-s.le.0._RKIND)) then
+     &             (fbar+s .le. 0.0 .or. fbar-s .le. 0.0)) then
                    write(6,*) 'abc',delf0,sprime,chi1,chi2,chi3,
      &               delf1,delf2,delf3,fbar,delf1new+delf2new+delf3new,
      &               delf1new,delf2new,delf3new,s,work(i,j,k),
                         grid(gstart1+(i-1)*refine1+i1,
      &                       gstart2+(j-1)*refine2+j1,
      &                       gstart3+(k-1)*refine3+k1) = (fbar_save(i) +
-     &                       (REAL(i1,RKIND) + 0.5_RKIND - 
-     &                       0.5_RKIND*REAL(refine1,RKIND))
-     &                       / REAL(refine1,RKIND)*fx(i) +
-     &                       (REAL(j1,RKIND) + 0.5_RKIND - 
-     &                       0.5_RKIND*REAL(refine2,RKIND)) 
-     &                       / REAL(refine2,RKIND)*fy(i) +
-     &                       (REAL(k1,RKIND) + 0.5_RKIND - 
-     &                       0.5_RKIND*REAL(refine3,RKIND))
-     &                       / REAL(refine3,RKIND)*fz(i) )
+     &                       (REAL(i1) + 0.5_RKIND - 
+     &                       0.5_RKIND*REAL(refine1)) 
+     &                          / REAL(refine1)*fx(i) +
+     &                       (REAL(j1) + 0.5_RKIND - 
+     &                       0.5_RKIND*REAL(refine2)) 
+     &                          / REAL(refine2)*fy(i) +
+     &                       (REAL(k1) + 0.5_RKIND - 
+     &                       0.5_RKIND*REAL(refine3)) 
+     &                          / REAL(refine3)*fz(i) )
                      enddo
                   enddo
                enddo
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.