Changeset 7 for readTracFiles_mod.f90


Ignore:
Timestamp:
Jan 28, 2022, 6:37:28 PM (3 years ago)
Author:
dcugnet
Message:
  • Add a function version of the strReduce subroutine.
  • Modify delPhase to accomodate old style names for isotopes and isotopic tagging tarcers.
  • Add 2 funtions to convert old to new and new to old phases.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • readTracFiles_mod.f90

    r6 r7  
    1515
    1616  PUBLIC :: known_phases, old_phases, nphases, phases_names, &       !--- VARIABLES RELATED TO THE PHASES
    17             phases_sep, delPhase, addPhase                           !--- + ROUTINES TO ADD/REMOVE PHASE TO/FROM A NAME
     17            phases_sep, delPhase, addPhase, &                        !--- + ROUTINES TO ADD/REMOVE PHASE TO/FROM A NAME
     18            old2newPhase, new2oldPhase
    1819
    1920  PUBLIC :: tran0, idxAncestor, ancestor                             !--- GENERATION 0 TRACER + TOOLS FOR GENERATIONS
     
    12551256  CHARACTER(LEN=*), INTENT(IN) :: s
    12561257  INTEGER :: l, i, ix
     1258  CHARACTER(LEN=maxlen) :: sh, st
    12571259  out = s
    12581260  IF(s == '') RETURN                                                           !--- Empty string: nothing to do
    12591261
    12601262  !--- Special case: old phases for water, no phases separator
    1261   IF(ANY([('H2O'//old_phases(ix:ix), ix=1, nphases)] == s)) THEN; out='H2O'; RETURN; END IF
     1263  i = INDEX(s,'_'); sh = s; IF(i/=0) sh=s(1:i-1); st='H2O'; IF(i/=0) st='H2O_'//s(i+1:LEN_TRIM(s))
     1264  IF(ANY([('H2O'//old_phases(ix:ix), ix=1, nphases)] == sh)) THEN; out=st; RETURN; END IF
    12621265
    12631266  !--- Index of found phase in "known_phases"
     
    13001303!------------------------------------------------------------------------------------------------------------------------------
    13011304
     1305CHARACTER(LEN=1) FUNCTION old2newPhase(op) RESULT(np)
     1306  CHARACTER(LEN=1), INTENT(IN) :: op
     1307  np = known_phases(INDEX(old_phases,op):INDEX(old_phases,op))
     1308END FUNCTION old2newPhase
     1309
     1310CHARACTER(LEN=1) FUNCTION new2oldPhase(np) RESULT(op)
     1311  CHARACTER(LEN=1), INTENT(IN) :: np
     1312  op = old_phases(INDEX(known_phases,np):INDEX(known_phases,np))
     1313END FUNCTION new2oldPhase
    13021314
    13031315!==============================================================================================================================
     
    13601372
    13611373END MODULE readTracFiles_mod
     1374
Note: See TracChangeset for help on using the changeset viewer.