New URL for NEMO forge!   http://forge.nemo-ocean.eu

Since March 2022 along with NEMO 4.2 release, the code development moved to a self-hosted GitLab.
This present forge is now archived and remained online for history.
Changeset 8868 for branches/2017/dev_METO_2017/NEMOGCM/NEMO/OFF_SRC/nemogcm.F90 – NEMO

Ignore:
Timestamp:
2017-12-01T09:43:23+01:00 (6 years ago)
Author:
timgraham
Message:

Merged dev_r8789_sbc into branch

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2017/dev_METO_2017/NEMOGCM/NEMO/OFF_SRC/nemogcm.F90

    r7761 r8868  
    548548 
    549549      ! Find the factors of n. 
    550       IF( kn == 1 )   GOTO 20 
    551  
    552       ! nu holds the unfactorised part of the number. 
    553       ! knfax holds the number of factors found. 
    554       ! l points to the allowed factor list. 
    555       ! ifac holds the current factor. 
    556  
    557       inu   = kn 
    558       knfax = 0 
    559  
    560       DO jl = ntest, 1, -1 
    561          ! 
    562          ifac = ilfax(jl) 
    563          IF( ifac > inu )   CYCLE 
    564  
    565          ! Test whether the factor will divide. 
    566  
    567          IF( MOD(inu,ifac) == 0 ) THEN 
     550      IF( kn .NE. 1 ) THEN 
     551 
     552         ! nu holds the unfactorised part of the number. 
     553         ! knfax holds the number of factors found. 
     554         ! l points to the allowed factor list. 
     555         ! ifac holds the current factor. 
     556    
     557         inu   = kn 
     558         knfax = 0 
     559    
     560         DO jl = ntest, 1, -1 
    568561            ! 
    569             knfax = knfax + 1            ! Add the factor to the list 
    570             IF( knfax > kmaxfax ) THEN 
    571                kerr = 6 
    572                write (*,*) 'FACTOR: insufficient space in factor array ', knfax 
    573                return 
     562            ifac = ilfax(jl) 
     563            IF( ifac > inu )   CYCLE 
     564    
     565            ! Test whether the factor will divide. 
     566    
     567            IF( MOD(inu,ifac) == 0 ) THEN 
     568               ! 
     569               knfax = knfax + 1            ! Add the factor to the list 
     570               IF( knfax > kmaxfax ) THEN 
     571                  kerr = 6 
     572                  write (*,*) 'FACTOR: insufficient space in factor array ', knfax 
     573                  return 
     574               ENDIF 
     575               kfax(knfax) = ifac 
     576               ! Store the other factor that goes with this one 
     577               knfax = knfax + 1 
     578               kfax(knfax) = inu / ifac 
     579               !WRITE (*,*) 'ARPDBG, factors ',knfax-1,' & ',knfax,' are ', kfax(knfax-1),' and ',kfax(knfax) 
    574580            ENDIF 
    575             kfax(knfax) = ifac 
    576             ! Store the other factor that goes with this one 
    577             knfax = knfax + 1 
    578             kfax(knfax) = inu / ifac 
    579             !WRITE (*,*) 'ARPDBG, factors ',knfax-1,' & ',knfax,' are ', kfax(knfax-1),' and ',kfax(knfax) 
    580          ENDIF 
    581          ! 
    582       END DO 
    583  
    584    20 CONTINUE      ! Label 20 is the exit point from the factor search loop. 
     581            ! 
     582         END DO 
     583    
     584      ENDIF 
    585585      ! 
    586586   END SUBROUTINE factorise 
Note: See TracChangeset for help on using the changeset viewer.