Changeset 2331 in lmdz_wrf


Ignore:
Timestamp:
Feb 12, 2019, 2:40:16 PM (6 years ago)
Author:
lfita
Message:

Adding:

  • `vectorI_S': Function to transform a vector of integers to a string of characters
  • `vectorR_S': Function to transform a vector of reals to a string of characters
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/module_generic.f90

    r2330 r2331  
    1818! RangeR_K: Function to provide a range of d1 from 'iniv' to 'endv', of real(r_k) values in a vector
    1919! stoprun: Subroutine to stop running and print a message
     20! vectorI_S: Function to transform a vector of integers to a string of characters
     21! vectorR_S: Function to transform a vector of reals to a string of characters
    2022! xzones_homogenization: Subroutine to homogenize 2D contiguous zones along x-axis. Zones might be
    2123!   contiguous, but with different number assigned !
     
    642644  END SUBROUTINE yzones_homogenization
    643645
     646  CHARACTER(len=1000) FUNCTION vectorI_S(d1, vector)
     647  ! Function to transform a vector of integers to a string of characters
     648
     649    IMPLICIT NONE
     650
     651    INTEGER, INTENT(in)                                  :: d1
     652    INTEGER, DIMENSION(d1), INTENT(in)                   :: vector
     653
     654! Local
     655    INTEGER                                              :: iv
     656    CHARACTER(len=50)                                    :: IS
     657
     658!!!!!!! Variables
     659! d1: length of the vector
     660! vector: values to transform
     661
     662    fname = 'vectorI_S'
     663
     664    vectorI_S = ''
     665    DO iv=1, d1
     666      WRITE(IS, '(I50)')vector(iv)
     667      IF (iv == 1) THEN
     668        vectorI_S = TRIM(IS)
     669      ELSE
     670        vectorI_S = TRIM(vectorI_S) // ', ' // TRIM(IS)
     671      END IF
     672    END DO   
     673
     674  END FUNCTION vectorI_S
     675
     676  CHARACTER(len=1000) FUNCTION vectorR_S(d1, vector)
     677  ! Function to transform a vector of reals to a string of characters
     678
     679    IMPLICIT NONE
     680
     681    INTEGER, INTENT(in)                                  :: d1
     682    REAL, DIMENSION(d1), INTENT(in)                      :: vector
     683
     684! Local
     685    INTEGER                                              :: iv
     686    CHARACTER(len=50)                                    :: RS
     687
     688!!!!!!! Variables
     689! d1: length of the vector
     690! vector: values to transform
     691
     692    fname = 'vectorR_S'
     693
     694    vectorR_S = ''
     695    DO iv=1, d1
     696      WRITE(RS, '(F50.25)')vector(iv)
     697      IF (iv == 1) THEN
     698        vectorR_S = TRIM(RS)
     699      ELSE
     700        vectorR_S = TRIM(vectorR_S) // ', ' // TRIM(RS)
     701      END IF
     702    END DO   
     703
     704  END FUNCTION vectorR_S
     705
    644706END MODULE module_generic
Note: See TracChangeset for help on using the changeset viewer.