Initialization Subroutine

public subroutine Initialization()

Arguments

None

Source Code

      subroutine Initialization()
!--------------------------------------------------------------------

        character(ESMF_MAXSTR) :: failMsg
        character(ESMF_MAXSTR) :: name
        integer :: result = 0
        character(ESMF_MAXSTR) :: msg
        integer :: msg_l
        rc = 0

        
        !------------------------------------------------------------------------
        !EX_UTest
        ! Create Config Test
        write(failMsg, *) "Did not return ESMF_SUCCESS"
        write(name, *) "Create Config Test"
        cf = ESMF_ConfigCreate(rc=rc)
        call ESMF_Test((rc.eq.ESMF_SUCCESS), name, failMsg, result, ESMF_SRCLINE)
      
        if ( rc /= ESMF_SUCCESS ) then 
           print *,'ESMF_ConfigCreate: catastrophic error, rc =', rc
           return
        endif

        !------------------------------------------------------------------------
        !EX_UTest
        ! Test ESMF_ConfigAssignment(=)(Config,Config)
        write(failMsg, *) "Did not return ESMF_SUCCESS"
        write(name, *) "Config assignment Test"
        cf_alias = cf
        rc = merge (ESMF_SUCCESS, ESMF_FAILURE, associated (cf%cptr, cf_alias%cptr))
        call ESMF_Test((rc.eq.ESMF_SUCCESS), name, failMsg, result, ESMF_SRCLINE)
       
        !------------------------------------------------------------------------
        !EX_UTest
        ! Test ESMF_ConfigOperator(==)(Config,Config)
        write(failMsg, *) "Did not return ESMF_SUCCESS"
        write(name, *) "Config equality with same Config Test"
        rc = merge (ESMF_SUCCESS, ESMF_FAILURE, cf == cf_alias)
        call ESMF_Test((rc == ESMF_SUCCESS), name, failMsg, result, ESMF_SRCLINE)

        !------------------------------------------------------------------------
        !EX_UTest
        ! Test ESMF_ConfigOperator(==)(Config,Config)
        write(failMsg, *) "Did not return ESMF_SUCCESS"
        write(name, *) "Config equality with different Config Test"
        rc = merge (ESMF_SUCCESS, ESMF_FAILURE, .not. (cf == cf1))
        call ESMF_Test((rc == ESMF_SUCCESS), name, failMsg, result, ESMF_SRCLINE)

        !------------------------------------------------------------------------
        !EX_UTest
        ! Test ESMF_ConfigOperator(/=)(Config,Config)
        write(failMsg, *) "Did not return ESMF_SUCCESS"
        write(name, *) "Config inequality with same Config Test"
        rc = merge (ESMF_SUCCESS, ESMF_FAILURE, .not. (cf /= cf_alias))
        call ESMF_Test((rc == ESMF_SUCCESS), name, failMsg, result, ESMF_SRCLINE)

        !------------------------------------------------------------------------
        !EX_UTest
        ! Test ESMF_ConfigOperator(/=)(Config,Config)
        write(failMsg, *) "Did not return ESMF_SUCCESS"
        write(name, *) "Config inequality with different Config Test"
        rc = merge (ESMF_SUCCESS, ESMF_FAILURE, cf /= cf1)
        call ESMF_Test((rc == ESMF_SUCCESS), name, failMsg, result, ESMF_SRCLINE)

        !------------------------------------------------------------------------
        !EX_UTest
        ! Config Load File Test
        write(failMsg, *) "Did not return ESMF_RC_DUP_NAME"
        write(name, *) "Config Load File Test"
        call ESMF_ConfigLoadFile( cf, fname, unique = .true., rc = rc)
        call ESMF_Test((rc.eq.ESMF_RC_DUP_NAME), name, failMsg, result, ESMF_SRCLINE)

        if (rc == ESMF_RC_MEM) then 
           print *,' ESMF_ConfigLoadFile: Out of memory: exceeded NBUF_MAX'
        endif
        if ( rc /= ESMF_RC_DUP_NAME ) then
           call ESMF_LogRc2Msg (rc, msg=msg, msglen=msg_l)
           print *,' ESMF_ConfigLoadFile:  loading file ', trim (fname), &
                ' catastrophic error, rc = ', msg(:msg_l)
           return
        else
           counter_total =counter_total + 1
           counter_success =counter_success + 1         
           print *,' File contains duplicate labels - check logfile.' 
        endif


        return
        
      end subroutine Initialization