prismdrv_create_transi_udef.F90

Go to the documentation of this file.
00001 !------------------------------------------------------------------------
00002 ! Copyright 2006, CERFACS, Toulouse, France.
00003 ! All rights reserved. Use is subject to license terms.
00004 !------------------------------------------------------------------------
00005 !BOP
00006 ! !INTERFACE
00007   SUBROUTINE prismdrv_create_transi_udef ( id_nb_transi,     &
00008                                   id_xml,           &
00009                                   id_u,             &
00010                                   id_ch,            &
00011                                   id_side,          &
00012                                   sda_smioc_transi, &
00013                                   id_comp,          &
00014                                   id_error )
00015 !
00016     USE psmile_smioc
00017     USE psmile_smioc_interface
00018     IMPLICIT NONE
00019 !
00020 !EOP
00021 !----------------------------------------------------------------------
00022 ! $Id: psmile_smioc.F90 1793 2008-11-25 14:58:31Z valcke $
00023 ! $Author: valcke $
00024 !----------------------------------------------------------------------
00025 !
00026 ! !INPUT / OUTPUT PARAMETERS:
00027 
00028 !   Dimensions of array sda_smioc_transi (2nd pass)
00029     Integer, Intent(In)          :: id_nb_transi
00030 
00031 !   Index of transient (geographic) to be copied (defined in the SMIOC XML)
00032     Integer, Intent(In)          :: id_xml
00033 
00034 !   Index of associated transient "udef" to be created for this component
00035     Integer, Intent(In)          :: id_u
00036 
00037 !   Index of channel (In OR Out) of the SMIOC XML (geographic) transient
00038     Integer, Intent(In)          :: id_ch
00039 
00040 !   Side of channel (In) only .XOR. (Out) only of the id_ch channel
00041     Integer, Intent(In)          :: id_side
00042 
00043 !   transients structure (array allocated with dimension id_nb_transi in second pass)
00044     TYPE(transient), Dimension(id_nb_transi), TARGET,  Intent(InOut)  ::  sda_smioc_transi
00045 !
00046 !   Index of component 
00047     Integer, Intent(In)          :: id_comp
00048 
00049 !   returned error code
00050     Integer, Intent(Out)         :: id_error
00051 !
00052 ! Global structure sga_comp_udef_idx is used to detect which input origin
00053 ! transient or which output transient uses a User-Defined Interpolation :
00054 ! in flag : sga_comp_udef_idx(ib_c)%sla_driver_udef(ib)%lga_trin_orig(ib_nin)
00055 ! out flag : sga_comp_udef_idx(ib_c)%sla_driver_udef(ib)%lga_trout(ib_nout)
00056 !
00057 ! !LOCAL VARIABLES
00058 !   Loop indices
00059     Integer :: ib_tr, ib_st, ib_o, ib_i, ib_c
00060     Integer :: il_nb_stand_name
00061     Integer :: il_nb_in_orig
00062     Integer :: il_nb_transi_out
00063 !
00064 !   Local pointers on transients "input" (from)  and destination
00065     TYPE(transient), pointer :: ti, td
00066 !
00067 !   character buffers
00068     Character(len=max_name)  :: cl_in,  cl_out   
00069 !
00070 !   parameter for channel bypass in suffix
00071     Integer, parameter  :: il_cc = -1
00072 
00073 ! !DESCRIPTION
00074 ! This routine copies the id_xml transient structure into the id_u transient 
00075 ! Only non-modified parts are copied
00076 ! Modifed parts (character names) are new variables created in this routine
00077 ! The associated transient do not take part in interpolation.
00078 !
00079 ! !REVISION HISTORY:
00080 !   Date        Programmer     Description
00081 ! ----------    ----------     -----------
00082 ! 18/11/2009      Latour        Creation
00083 !
00084 !EOP
00085 !-----------------------------------------------------------------------
00086 !
00087 !  Define pointers
00088    ti => sda_smioc_transi(id_xml)
00089    td => sda_smioc_transi(id_u)
00090 
00091 !  Transient level variables
00092 !
00093    il_nb_stand_name = ti%ig_nb_stand_name 
00094 !
00095    td%ig_nb_stand_name = il_nb_stand_name
00096 !  td%ig_comp_id       = ti%ig_comp_id
00097 !  td%ig_transi_id     = ti%ig_transi_id
00098    td%ig_transi_type   = ti%ig_transi_type
00099    td%ig_nb_bndl       = ti%ig_nb_bndl
00100    td%ig_datatype      = ti%ig_datatype
00101 
00102 !  Add suffixe "_gl" to names
00103 !  Transient local name
00104     cl_in = ti%cg_local_name   
00105     call put_udef_suffix ( cl_in, cl_out, id_ch, id_side )
00106     td%cg_local_name = trim(adjustl(cl_out))
00107 !
00108    td%cg_long_name     = ti%cg_long_name
00109    td%cg_comp_name     = ti%cg_comp_name
00110    td%cg_units         = ti%cg_units
00111 !
00112 !  Transient standard names : NO change ( array dimension = ig_nb_stand_name )
00113     DO ib_st = 1, il_nb_stand_name
00114        td%cga_stand_name(ib_st) = ti%cga_stand_name(ib_st)
00115     ENDDO
00116 !
00117 !!     ti%dg_transi_min   NOT copied
00118 !!     ti%dg_transi_max   NOT copied
00119 !
00120 !   Gridless transient_in for a channel IN in the geographic transient
00121     IF ( id_side == 1 ) THEN
00122 
00123 !      Gridless transient has only 1 Input or Output channel
00124        td%sg_transi_in%ig_nb_in_orig      = 1
00125 !
00126        td%sg_transi_in%ig_exch_date_type  = ti%sg_transi_in%ig_exch_date_type
00127        td%sg_transi_in%ig_debugmode       = ti%sg_transi_in%ig_debugmode
00128        td%sg_transi_in%ig_tgt_timeop      = ti%sg_transi_in%ig_tgt_timeop
00129        td%sg_transi_in%iga_stats          = ti%sg_transi_in%iga_stats
00130        td%sg_transi_in%sg_min_period      = ti%sg_transi_in%sg_min_period
00131        td%sg_transi_in%sg_tgt_local_trans = ti%sg_transi_in%sg_tgt_local_trans
00132        td%sg_transi_in%sg_exch_date       = ti%sg_transi_in%sg_exch_date
00133 !
00134 !  Transient_in origin  is the origin number of the "XML" transient
00135 !  Global component id is id_comp
00136        ib_i = id_ch
00137 !       td%sg_transi_in%sga_in_orig(1)%ig_transi_in_id   =  &
00138 !       ti%sg_transi_in%sga_in_orig(ib_i)%ig_transi_in_id
00139 
00140        td%sg_transi_in%sga_in_orig(1)%ig_orig_type      =  &
00141        ti%sg_transi_in%sga_in_orig(ib_i)%ig_orig_type
00142 
00143 #ifdef DEBUG
00144   print *,' ig_orig_type geographique = ',ti%sg_transi_in%sga_in_orig(ib_i)%ig_orig_type
00145   print *,' ig_orig_type gridless = ',td%sg_transi_in%sga_in_orig(1)%ig_orig_type
00146 #endif
00147 !       td%sg_transi_in%sga_in_orig(1)%ig_orig_transi_id =  &
00148 !       ti%sg_transi_in%sga_in_orig(ib_i)%ig_orig_transi_id
00149 
00150        td%sg_transi_in%sga_in_orig(1)%ig_orig_comp_id   =  &
00151        ti%sg_transi_in%sga_in_orig(ib_i)%ig_orig_comp_id 
00152  
00153        td%sg_transi_in%sga_in_orig(1)%ig_conserv        =  &
00154        ti%sg_transi_in%sga_in_orig(ib_i)%ig_conserv
00155 
00156 !  Transient_in names in the origin component : add suffix with I and ch number
00157 
00158        cl_in = ti%sg_transi_in%sga_in_orig(ib_i)%cg_transi_in_name
00159        call put_udef_suffix ( cl_in, cl_out, il_cc, il_cc  )
00160        td%sg_transi_in%sga_in_orig(1)%cg_transi_in_name = trim(adjustl(cl_out))
00161 ! 
00162        cl_in = ti%sg_transi_in%sga_in_orig(ib_i)%cg_orig_transi
00163        call put_udef_suffix ( cl_in, cl_out, il_cc, il_cc  )
00164        td%sg_transi_in%sga_in_orig(1)%cg_orig_transi    = trim(adjustl(cl_out))
00165 !
00166        td%sg_transi_in%sga_in_orig(1)%cg_orig_comp_name =  &
00167        ti%sg_transi_in%sga_in_orig(ib_i)%cg_orig_comp_name
00168 !
00169        td%sg_transi_in%sga_in_orig(1)%sg_orig_file =  &
00170        ti%sg_transi_in%sga_in_orig(ib_i)%sg_orig_file
00171 !
00172        td%sg_transi_in%sga_in_orig(1)%sg_cpl_rst_file   =  &
00173        ti%sg_transi_in%sga_in_orig(ib_i)%sg_cpl_rst_file
00174 !       
00175 !  Interpolation structure is NOT copied in the gridless auxilliary transient
00176 #ifdef DEBUG
00177    print *,' ig_interp_type geographique = ',   &
00178              ti%sg_transi_in%sga_in_orig(ib_i)%sg_interp%ig_interp_type
00179 #endif
00180 
00181 !
00182        td%sg_transi_in%sga_in_orig(1)%sg_combi          =  &
00183        ti%sg_transi_in%sga_in_orig(ib_i)%sg_combi
00184 
00185     ENDIF
00186 !
00187 !   Gridless transient_out for a channel OUT in the geographic transient
00188     IF ( id_side == 0 ) THEN
00189 
00190 !      Gridless transient has only 1 Input or Output channel
00191        td%ig_nb_transi_out = 1
00192        ib_o = id_ch
00193 !  
00194 !       td%sga_transi_out(1)%ig_transi_out_id  =  &
00195 !       ti%sga_transi_out(ib_o)%ig_transi_out_id
00196 !
00197        td%sga_transi_out(1)%ig_dest_type      =  &
00198        ti%sga_transi_out(ib_o)%ig_dest_type
00199 !
00200 !       td%sga_transi_out(1)%ig_dest_transi_id =  &
00201 !       ti%sga_transi_out(ib_o)%ig_dest_transi_id
00202 !
00203        td%sga_transi_out(1)%ig_dest_comp_id   =  &
00204        ti%sga_transi_out(ib_o)%ig_dest_comp_id
00205 !
00206        td%sga_transi_out(1)%ig_exch_date_type =  &
00207        ti%sga_transi_out(ib_o)%ig_exch_date_type
00208 !
00209        td%sga_transi_out(1)%ig_debugmode      =  &
00210        ti%sga_transi_out(ib_o)%ig_debugmode
00211 !
00212        td%sga_transi_out(1)%ig_lag            =  &
00213        ti%sga_transi_out(ib_o)%ig_lag
00214 !
00215        td%sga_transi_out(1)%ig_src_timeop     =  &
00216        ti%sga_transi_out(ib_o)%ig_src_timeop
00217 !
00218        td%sga_transi_out(1)%ig_conserv        =  &
00219        ti%sga_transi_out(ib_o)%ig_conserv
00220 !
00221        td%sga_transi_out(1)%iga_stats         =  &
00222        ti%sga_transi_out(ib_o)%iga_stats
00223 !
00224        cl_in = ti%sga_transi_out(ib_o)%cg_transi_out_name
00225        call put_udef_suffix ( cl_in, cl_out, il_cc, il_cc )
00226        td%sga_transi_out(1)%cg_transi_out_name = trim(adjustl(cl_out))
00227 !
00228        cl_in = ti%sga_transi_out(ib_o)%cg_dest_transi
00229        call put_udef_suffix ( cl_in, cl_out, il_cc, il_cc  )
00230        td%sga_transi_out(1)%cg_dest_transi = trim(adjustl(cl_out))
00231 !
00232        td%sga_transi_out(1)%cg_dest_comp_name =  &
00233        ti%sga_transi_out(ib_o)%cg_dest_comp_name
00234 !
00235        td%sga_transi_out(1)%sg_dest_file       =  &
00236        ti%sga_transi_out(ib_o)%sg_dest_file
00237 !
00238        td%sga_transi_out(1)%sg_cpl_rst_file    =  &
00239        ti%sga_transi_out(ib_o)%sg_cpl_rst_file
00240 !
00241        td%sga_transi_out(1)%sg_min_period      =  &
00242        ti%sga_transi_out(ib_o)%sg_min_period
00243 !
00244        td%sga_transi_out(1)%sg_exch_date       =  &
00245        ti%sga_transi_out(ib_o)%sg_exch_date
00246 !
00247        td%sga_transi_out(1)%sg_src_local_trans =  &
00248        ti%sga_transi_out(ib_o)%sg_src_local_trans
00249 !
00250        td%sga_transi_out(1)%sg_combi           =  &
00251        ti%sga_transi_out(ib_o)%sg_combi
00252 
00253     ENDIF
00254 !
00255     Nullify ( ti )
00256     Nullify ( td )
00257 
00258     id_error = 0
00259  
00260     RETURN
00261 
00262   END SUBROUTINE prismdrv_create_transi_udef
00263 !
00264 !-----------------------------------------------------------------------

Generated on 18 Mar 2011 for Oasis4 by  doxygen 1.6.1