prismtrs_set_triple_links.F90

Go to the documentation of this file.
00001 !------------------------------------------------------------------------
00002 ! Copyright 2006-2010, CERFACS, Toulouse, France.
00003 ! Copyright 2006-2010, NEC High Performance Computing, Duesseldorf, Germany.
00004 ! All rights reserved. Use is subject to OASIS4 license terms.
00005 !-----------------------------------------------------------------------
00006 !BOP
00007 !
00008 ! !ROUTINE: PRISMTrs_Set_triple_links
00009 !
00010 ! !INTERFACE
00011 subroutine prismtrs_set_triple_links(id_transient_out_id,     &
00012                                      id_transient_in_id,      &
00013                                      id_epio_id,              &
00014                                      id_err)
00015 
00016 !
00017 ! !USES:
00018 !
00019   USE PRISMDrv, dummy_interface => PRISMTrs_Set_triple_links
00020 
00021   IMPLICIT NONE
00022 
00023 !
00024 ! !PARAMETERS:
00025 !
00026 ! id of the transient out
00027   INTEGER, INTENT (In)        :: id_transient_out_id
00028 
00029 ! id of the transient in
00030   INTEGER, INTENT (In)        :: id_transient_in_id
00031 
00032 ! Epio index
00033   INTEGER, INTENT (IN)        :: id_epio_id
00034 
00035 !
00036 ! ! RETURN VALUE
00037 !
00038   INTEGER, INTENT (Out)       :: id_err   ! error value
00039 
00040 ! !DESCRIPTION
00041 ! Subroutines "PRISMTrs_Set_triple_links" set the epio_id in the exchange
00042 ! structure for a couple (trans_in, trans_out)
00043 !
00044 ! !REVISED HISTORY
00045 !   Date      Programmer   Description
00046 ! ----------  ----------   -----------
00047 ! 03/12/2003  D. Declat    Creation
00048 !
00049 ! EOP
00050 !----------------------------------------------------------------------
00051 ! $Id: prismtrs_set_triple_links.F90 2325 2010-04-21 15:00:07Z valcke $
00052 ! $Author: valcke $
00053 !----------------------------------------------------------------------
00054 !
00055 ! Local declarations
00056 !
00057   CHARACTER(LEN=len_cvs_string), SAVE  :: mycvs = 
00058      '$Id: prismtrs_set_triple_links.F90 2325 2010-04-21 15:00:07Z valcke $'
00059 
00060   INTEGER :: ib
00061 
00062 !     ... for error handling
00063   LOGICAL             :: ll_found
00064   INTEGER             :: il_found
00065   INTEGER, PARAMETER  :: nerrp = 2
00066   INTEGER             :: ierrp (nerrp)
00067   TYPE (Drv_Exchange),Dimension(:), POINTER :: temp_Drv_Exchanges
00068 !
00069 ! ---------------------------------------------------------------------
00070 !
00071 #ifdef VERBOSE
00072   PRINT *, '| | | Enter PRISMTrs_Set_triple_links'
00073   call psmile_flushstd
00074 #endif
00075 
00076   id_err = 0
00077 !
00078 ! 1. Find a place where to put the epio_id
00079 !
00080   il_found = -1
00081   ll_found = .false.
00082   DO ib = 1, Number_of_Exchanges
00083     IF (Drv_Exchanges(ib)%trans_out_id .eq. id_transient_out_id) THEN
00084         IF (Drv_Exchanges(ib)%trans_in_id .eq. id_transient_in_id) THEN
00085             il_found = ib
00086             IF (Drv_Exchanges(ib)%epio_id .eq. PSMILe_trans_unset) THEN
00087                 ll_found = .true.
00088                 EXIT
00089             END IF
00090         END IF
00091     END IF
00092   END DO
00093 
00094   IF ((.NOT. ll_found) .AND. (il_found .eq. -1)) THEN
00095       ierrp(1) = Number_of_Exchanges
00096       ierrp(2) = ib
00097       call psmile_error_common ( id_err, 'PRISMTrs_Set_triple_links', &
00098          ierrp, 2, __FILE__, __LINE__ )
00099   END IF
00100 !
00101 ! 2. Create additional Drv_Exchange instance if necessary
00102 !
00103   IF (.NOT. ll_found) THEN ! can happen if one process 
00104                            ! processes multiple parts of one field
00105       ALLOCATE(temp_Drv_Exchanges(Number_of_Exchanges+1), stat = id_err)
00106       IF (id_err > 0) THEN
00107          ierrp (1) = id_err
00108          ierrp (2) = Number_of_Exchanges
00109          id_err = 13
00110          call psmile_error_common ( id_err, 'Drv_Exchanges', &
00111             ierrp, 2, __FILE__, __LINE__ )
00112          RETURN
00113       ENDIF
00114 
00115       temp_Drv_Exchanges(1:Number_of_Exchanges) = Drv_Exchanges
00116       temp_Drv_Exchanges(Number_of_Exchanges+1) = Drv_Exchanges(il_found)
00117       DEALLOCATE(Drv_Exchanges)
00118       Drv_Exchanges => temp_Drv_Exchanges
00119       CALL prismdrv_init_Drv_Exchange(Number_of_Exchanges+1)
00120       il_found = Number_of_Exchanges + 1
00121       Number_of_Exchanges = Number_of_Exchanges + 1
00122   END IF
00123 !
00124 ! 3. Set the trans_in_field_size and epio_id
00125 !
00126   Drv_Exchanges(il_found)%epio_id = id_epio_id
00127   Drv_Exchanges(il_found)%trans_in_field_size = Drv_Epios(id_epio_id)%tgt_size
00128 !
00129 #ifdef VERBOSE
00130   PRINT *, '| | | Quit PRISMTrs_Set_triple_links'
00131   call psmile_flushstd
00132 #endif
00133 
00134 END SUBROUTINE PRISMTrs_Set_triple_links
00135 
00136 
00137 
00138 
00139 
00140 
00141 

Generated on 18 Mar 2011 for Oasis4 by  doxygen 1.6.1