prismdrv_get_all_transi.F90

Go to the documentation of this file.
00001 
00002   SUBROUTINE prismdrv_get_all_transi ( id_nb_transi,       &
00003                                        sda_smioc_transi,   &
00004                                        id_comp,            &
00005                                        id_error )
00006 
00007 ! !DESCRIPTION
00008 
00009 ! Called from prismdrv_init_smioc_struct for the second pass only 
00010 ! This routine creates all "User-defined" associated gridless transients 
00011 ! for each input or output channel that uses a "user3D" interpolation method
00012 !
00013 !----------------------------------------------------------------------
00014 !
00015 
00016 ! !PUBLIC TYPES
00017   USE PRISM_Constants
00018   USE PSMILe_Common
00019   USE PSMILe_smioc
00020   USE PSMILE_smioc_interface
00021 
00022   IMPLICIT NONE
00023 
00024 ! 0. Declaration
00025 !
00026 ! number of transi variables
00027     INTEGER, INTENT(In) :: id_nb_transi
00028 
00029 ! transi structure
00030     TYPE(transient), DIMENSION(id_nb_transi), INTENT(InOut) :: sda_smioc_transi
00031 
00032 ! Component id
00033     INTEGER, INTENT(In) :: id_comp
00034 
00035 ! returned error code
00036     INTEGER, INTENT(Out):: id_error
00037 
00038 ! Loop indices
00039     INTEGER :: ib, ib_bis, ib_nt, ib_xml, ib_xmlv, ib_xud
00040     INTEGER :: il_nb, il_nb_bis, il_nb_ter, il_nb_terbis, il_nb_terter
00041     INTEGER :: il_nb_qua, il_nb_cin, il_nb_six, il_nb_hep, il_nb_oct
00042     INTEGER :: il_nb_bisbis
00043     INTEGER :: il_xml_transi
00044     INTEGER :: il_dim_i, il_dim_o, il_ch, il_side
00045 !
00046 !  At second pass (called from prismdrv_init_smioc_struct) :
00047 !  id_nb_transi = total number of transients including "udef" transients
00048 
00049     il_xml_transi = id_nb_transi - iga_comp_nb_udef(id_comp)
00050 
00051 #ifdef DEBUG
00052     print *,"get_transi_details : il_xml_transi    = ", il_xml_transi
00053     print *,"get_transi_details : il_xml_transi    = ", iga_xml_comp_nb_transi(id_comp)
00054     print *,"get_transi_details : id_nb_transi     = ", id_nb_transi
00055     print *,"get_transi_details : nb udef transi   = ", iga_comp_nb_udef(id_comp)
00056 #endif
00057 !
00058 !   Return if NO transient with "user3D" interpolation
00059 !
00060     if ( iga_comp_nb_udef(id_comp) == 0 ) RETURN
00061 
00062 !   Second pass only : copy of transients involved with User_defined Interp
00063 !                      into new "gridless" transients.
00064 !                      All names are changed with the suffix "_ud_X"
00065 !                      Interp. method is left "undef" in the "gridless" transients
00066 !
00067 !   Before entering this subroutine, transient data extracted from XML in first pass
00068 !   is copied into the array sla_driver_transi(1:il_xml_transi)
00069 !   (No need to read the XML SMIOC files a second time)
00070 
00071 !   Create structures for the "gridless" transients
00072 !   ib is "global index in component" of the "gridless" additional transients
00073 !      ib values are from il_xml_transi + 1  to id_nb_transi
00074 !
00075 !   Loop on the sga_comp_udef_idx(id_comp)%ig_xml_udef  XML_udef transients
00076     ib = il_xml_transi
00077        DO ib_xud = 1, sga_comp_udef_idx(id_comp)%ig_xml_udef
00078 
00079 !   copy of the (geographic) transient structure into 1 or more "gridless" trans.
00080 
00081 !   Note that for 1 geographic transient, we can have several "gridless" auxilliary
00082 !   transients : 1 for each input origin, or output with user3D interpolation
00083 !   "gl" transient index ib is therefore increased in the loop before each copy.
00084 
00085 !   Simple copy of structures with pointers has for consequentce that
00086 !   any modification in the copy affects ALSO the original
00087 !   i.e. : sda_smioc_transi(ib) = sda_smioc_transi(ib_xml) is forbidden here.
00088 !   Only the non-modified parts of the structure can be copied
00089 !   interpolation structures are not copied (left "undefined")
00090 !   modifed names (add suffix "_ug_XX") are created ; XX is the channel number
00091 
00092 !   ib_xml is the index of the transient in component SMIOC file to be copied
00093     ib_xml = sga_comp_udef_idx(id_comp)%iga_trans_udef(ib_xud)
00094 #ifdef DEBUG
00095    print *, ' get_transi_details : ib, ib_xud, ib_xml = ', ib, ib_xud, ib_xml
00096 #endif
00097 
00098 !   Get real number of channels of ib_xml transient (In  "AND / OR"  Out)
00099     il_dim_i = sga_comp_udef_idx(id_comp)%sla_driver_udef(ib_xml)%ig_dim_orig
00100     il_dim_o = sga_comp_udef_idx(id_comp)%sla_driver_udef(ib_xml)%ig_dim_out
00101 
00102     IF ( il_dim_i .GT. 0 )  THEN
00103 
00104 !   Transient In to be copied  (target side)
00105       DO il_ch = 1, il_dim_i
00106          IF ( sga_comp_udef_idx(id_comp)%sla_driver_udef(ib_xml)%  &
00107                     lga_trin_orig(il_ch) ) THEN
00108 #ifdef DEBUG
00109    print *, ' get_transi_details : In,  ib_xml il_ch ib = ', ib_xml, il_ch, ib
00110 #endif
00111             ib = ib + 1
00112             IF ( ib .GT. id_nb_transi ) THEN
00113                PRINT *, '****************************************************'
00114                PRINT *, 'Index overflow in psmile_smioc : get_transi_details '
00115                PRINT *, '****************************************************'
00116                CALL PSMILe_Flushstd
00117                CALL MPI_Abort(MPI_COMM_WORLD, 1, id_error)
00118             ENDIF
00119 !    Internal check on the value of ib_xml
00120             ib_xmlv = sga_comp_udef_idx(id_comp)%iga_xml_trindex(ib-il_xml_transi)
00121             IF ( ib_xmlv .NE. ib_xml ) THEN
00122                PRINT *, '*************************************************'
00123                PRINT *, 'Index error in psmile_smioc : get_transi_details '
00124                PRINT *, '*************************************************'
00125                CALL PSMILe_Flushstd
00126                CALL MPI_Abort(MPI_COMM_WORLD, 1, id_error)
00127              ENDIF
00128 !    Create gridless transient structures
00129                  il_side = 1
00130                  call prismdrv_create_transi_udef ( id_nb_transi,      &
00131                                            ib_xml,            &
00132                                            ib,                &
00133                                            il_ch,             &
00134                                            il_side,           &
00135                                            sda_smioc_transi,  &
00136                                            id_comp,           &
00137                                            id_error )
00138           ENDIF        ! channel is "udef"
00139         ENDDO       ! loop on all input channels
00140       ENDIF      ! il_dim_i > 0
00141 !
00142 !
00143       IF ( il_dim_o .GT. 0 )  THEN
00144         DO il_ch = 1, il_dim_o
00145           IF ( sga_comp_udef_idx(id_comp)%sla_driver_udef(ib_xml)%  &
00146                     lga_trout(il_ch) ) THEN
00147 #ifdef DEBUG
00148    print *, ' get_transi_details : Out, ib_xml il_ch ib = ', ib_xml, il_ch, ib
00149 #endif
00150             ib = ib + 1
00151             IF ( ib .GT. id_nb_transi ) THEN
00152                PRINT *, '****************************************************'
00153                PRINT *, 'Index overflow in psmile_smioc : get_transi_details '
00154                PRINT *, '****************************************************'
00155                CALL PSMILe_Flushstd
00156                CALL MPI_Abort(MPI_COMM_WORLD, 1, id_error)
00157             ENDIF
00158 !    Internal check on the value of ib_xml
00159             ib_xmlv = sga_comp_udef_idx(id_comp)%iga_xml_trindex(ib-il_xml_transi)
00160             IF ( ib_xmlv .NE. ib_xml ) THEN
00161                PRINT *, '*************************************************'
00162                PRINT *, 'Index error in psmile_smioc : get_transi_details '
00163                PRINT *, '*************************************************'
00164                CALL PSMILe_Flushstd
00165                CALL MPI_Abort(MPI_COMM_WORLD, 1, id_error)
00166              ENDIF
00167 !    Create gridless transient structures
00168                  il_side = 0
00169                  call prismdrv_create_transi_udef ( id_nb_transi,      &
00170                                            ib_xml,            &
00171                                            ib,                &
00172                                            il_ch,             &
00173                                            il_side,           &
00174                                            sda_smioc_transi,  &
00175                                            id_comp,           &
00176                                            id_error )
00177           ENDIF      ! channel is "udef"
00178        ENDDO       ! loop on all output channels
00179      ENDIF      ! il_dim_o > 0
00180 !
00181      ENDDO            !  loop on "xml udef" transients to be copied
00182 
00183 !
00184   END SUBROUTINE prismdrv_get_all_transi
00185 
00186 

Generated on 18 Mar 2011 for Oasis4 by  doxygen 1.6.1