00001 
00002   SUBROUTINE prismdrv_get_all_grids ( id_nb_grids,       &
00003                                       id_xml_grids,      &
00004                                       sda_smioc_grids,   &
00005                                       id_comp,           &
00006                                       id_error )
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017   USE PRISM_Constants
00018   USE PSMILe_Common
00019   USE PSMILe_smioc
00020   USE PSMILE_smioc_interface
00021 
00022   IMPLICIT NONE
00023 
00024 
00025 
00026 
00027     INTEGER, INTENT(In) :: id_nb_grids
00028 
00029 
00030     INTEGER, INTENT(In) :: id_xml_grids
00031 
00032 
00033     TYPE(smioc_grid), DIMENSION(id_nb_grids), INTENT(InOut) :: sda_smioc_grids
00034 
00035 
00036     INTEGER, INTENT(In) :: id_comp
00037 
00038 
00039     INTEGER, INTENT(Out):: id_error
00040 
00041 
00042     INTEGER :: ib, ib_bis, ib_nt, ib_xml, ib_xmlv, ib_xud
00043     INTEGER :: il_nb, il_nb_bis, il_nb_ter, il_nb_terbis, il_nb_terter
00044     INTEGER :: il_nb_qua, il_nb_cin, il_nb_six, il_nb_hep, il_nb_oct
00045     INTEGER :: il_nb_bisbis
00046     INTEGER :: il_dim_i, il_dim_o, il_ch, il_side
00047 
00048     CHARACTER(LEN=max_name)  :: cl_name,  cl_out
00049 
00050 #ifdef DEBUG
00051     print *,"get_all_grids : id_xml_grids    = ", id_xml_grids
00052     print *,"get_all_grids : nb udef grids   = ", iga_comp_nb_udef(id_comp)
00053     print *,"get_all_grids : id_nb_grids     = ", id_nb_grids
00054 #endif
00055 
00056 
00057 
00058     if ( iga_comp_nb_udef(id_comp) == 0 ) RETURN
00059 
00060 
00061 
00062 
00063 
00064 
00065 
00066 
00067 
00068 
00069 
00070 
00071 
00072 
00073     ib = id_xml_grids
00074 
00075 
00076     DO ib_xud = 1, sga_comp_udef_idx(id_comp)%ig_xml_udef
00077 
00078 
00079 
00080 
00081 
00082 
00083     ib_xml = sga_comp_udef_idx(id_comp)%iga_trans_udef(ib_xud)
00084 #ifdef DEBUG
00085    print *, ' get_all_grids : ib, ib_xud, ib_xml = ', ib, ib_xud, ib_xml
00086 #endif
00087 
00088 
00089     il_dim_i = sga_comp_udef_idx(id_comp)%sla_driver_udef(ib_xml)%ig_dim_orig
00090     il_dim_o = sga_comp_udef_idx(id_comp)%sla_driver_udef(ib_xml)%ig_dim_out
00091 
00092     IF ( il_dim_i .GT. 0 )  THEN
00093 
00094 
00095       DO il_ch = 1, il_dim_i
00096          IF ( sga_comp_udef_idx(id_comp)%sla_driver_udef(ib_xml)%  &
00097                     lga_trin_orig(il_ch) ) THEN
00098 #ifdef DEBUG
00099    print *, ' get_all_grids : In,  ib_xml il_ch ib = ', ib_xml, il_ch, ib
00100 #endif
00101             ib = ib + 1
00102             IF ( ib .GT. id_nb_grids ) THEN
00103                PRINT *, '********************************************************'
00104                PRINT *, 'Index overflow in psmile_smioc : prismdrv_get_all_grids '
00105                PRINT *, '********************************************************'
00106                CALL PSMILe_Flushstd
00107                CALL MPI_Abort(MPI_COMM_WORLD, 1, id_error)
00108             ENDIF
00109 
00110             ib_xmlv = sga_comp_udef_idx(id_comp)%iga_xml_trindex(ib-id_xml_grids)
00111             IF ( ib_xmlv .NE. ib_xml ) THEN
00112                PRINT *, '*****************************************************'
00113                PRINT *, 'Index error in psmile_smioc : prismdrv_get_all_grids '
00114                PRINT *, '*****************************************************'
00115                CALL PSMILe_Flushstd
00116                CALL MPI_Abort(MPI_COMM_WORLD, 1, id_error)
00117              ENDIF
00118 
00119              il_side = 1
00120 
00121              cl_name = sga_comp_udef_idx(id_comp)%sla_driver_udef(ib_xml)%cg_local_name
00122              call put_udef_suffix ( cl_name, cl_out, il_ch, il_side )
00123              sda_smioc_grids(ib)%cg_grid_name = trim(adjustl(cl_out))
00124 #ifdef VERBOSE
00125   PRINT *, '| | |  '
00126   PRINT *, '| | |  get_all_grids : chan side ib  gridname = ',il_ch, il_side, ib, &
00127                    sda_smioc_grids(ib)%cg_grid_name
00128   CALL PSMILe_Flushstd
00129 #endif
00130 
00131           ENDIF        
00132         ENDDO       
00133       ENDIF      
00134 
00135 
00136       IF ( il_dim_o .GT. 0 )  THEN
00137         DO il_ch = 1, il_dim_o
00138           IF ( sga_comp_udef_idx(id_comp)%sla_driver_udef(ib_xml)%  &
00139                     lga_trout(il_ch) ) THEN
00140 #ifdef DEBUG
00141    print *, ' get_all_grids : Out, ib_xml il_ch ib = ', ib_xml, il_ch, ib
00142 #endif
00143             ib = ib + 1
00144             IF ( ib .GT. id_nb_grids ) THEN
00145                PRINT *, '********************************************************'
00146                PRINT *, 'Index overflow in psmile_smioc : prismdrv_get_all_grids '
00147                PRINT *, '********************************************************'
00148                CALL PSMILe_Flushstd
00149                CALL MPI_Abort(MPI_COMM_WORLD, 1, id_error)
00150             ENDIF
00151 
00152             ib_xmlv = sga_comp_udef_idx(id_comp)%iga_xml_trindex(ib-id_xml_grids)
00153             IF ( ib_xmlv .NE. ib_xml ) THEN
00154                PRINT *, '*****************************************************'
00155                PRINT *, 'Index error in psmile_smioc : prismdrv_get_all_grids '
00156                PRINT *, '*****************************************************'
00157                CALL PSMILe_Flushstd
00158                CALL MPI_Abort(MPI_COMM_WORLD, 1, id_error)
00159              ENDIF
00160 
00161              il_side = 0
00162 
00163              cl_name = sga_comp_udef_idx(id_comp)%sla_driver_udef(ib_xml)%cg_local_name
00164              call put_udef_suffix ( cl_name, cl_out, il_ch, il_side )
00165              sda_smioc_grids(ib)%cg_grid_name = trim(adjustl(cl_out))
00166 #ifdef VERBOSE
00167   PRINT *, '| | |  '
00168   PRINT *, '| | |  get_all_grids : chan side ib  gridname = ',il_ch, il_side, ib, &
00169                    sda_smioc_grids(ib)%cg_grid_name
00170   CALL PSMILe_Flushstd
00171 #endif
00172 
00173           ENDIF      
00174        ENDDO       
00175      ENDIF      
00176 
00177      ENDDO            
00178 
00179 
00180   END SUBROUTINE prismdrv_get_all_grids