get_transi_io_numbers.F90

Go to the documentation of this file.
00001 !------------------------------------------------------------------------
00002 ! Copyright 2006-2010, CERFACS, Toulouse, France.
00003 ! All rights reserved. Use is subject to license terms.
00004 !------------------------------------------------------------------------
00005 !BOP
00006 !
00007 !======================================================================
00008 !
00009   SUBROUTINE get_transi_io_numbers ( id_XML_doc,  &
00010                                      id_nb_transi,       &
00011                                      ida_nb_stand_name,  &
00012                                      ida_nb_transi_in,   &
00013                                      ida_nb_transi_out,  &
00014                                      id_comp,            &
00015                                      ld_first_details,   &
00016                                      id_error  )
00017 
00018 ! !DESCRIPTION
00019 ! This routine gives the number of input and output for each transi
00020 ! of one smioc
00021 !
00022 !----------------------------------------------------------------------
00023 !
00024     USE PSMILe_smioc
00025     IMPLICIT NONE
00026 !
00027 !EOP
00028 !----------------------------------------------------------------------
00029 ! $Id: psmile_smioc.F90 1793 2008-11-25 14:58:31Z valcke $
00030 ! $Author: valcke $
00031 !----------------------------------------------------------------------
00032 !
00033 ! 0. Declaration
00034 !
00035 ! handle of XML content of the smioc file
00036     INTEGER, INTENT(In) :: id_XML_doc
00037 
00038 ! number of transi variables for the component
00039     INTEGER, INTENT(In) :: id_nb_transi  
00040 
00041 ! number of standard name per transi for the component
00042     INTEGER, DIMENSION(id_nb_transi), INTENT(Out) :: ida_nb_stand_name
00043 
00044 ! number of input transi per transi for the component
00045     INTEGER, DIMENSION(id_nb_transi), INTENT(Out) :: ida_nb_transi_in
00046 
00047 ! number of output transi per transi for the component
00048     INTEGER, DIMENSION(id_nb_transi), INTENT(Out) :: ida_nb_transi_out
00049 
00050 ! Component id
00051     INTEGER, INTENT(In) :: id_comp
00052 
00053 ! logical flag first pass / second pass
00054     LOGICAL, INTENT(In)  :: ld_first_details
00055 
00056 ! returned error code
00057    INTEGER, INTENT(Out) :: id_error 
00058 
00059 ! loop index
00060     INTEGER   :: ib,  ib_nt, ib_xml, ib_u
00061     INTEGER   :: il_xml_transi
00062 !
00063     INTEGER :: sasa_c_get_number_3rd_level, sasa_c_get_number_4th_level
00064     INTEGER :: sasa_c_get_number_5th_level
00065 !
00066 !----------------------------------------------------------------------
00067 !
00068 !  At first pass (called from prismdrv_get_udef_transients) :
00069 !  id_nb_transi = il_xml_transi = number of transients in XML SMIOC file
00070 !  At second pass (called from prismdrv_init_smioc_struct) :
00071 !  id_nb_transi = total number of transients including "udef" transients
00072     IF ( ld_first_details ) THEN
00073        il_xml_transi = id_nb_transi
00074     ELSE
00075        il_xml_transi = id_nb_transi - iga_comp_nb_udef(id_comp)
00076     ENDIF
00077 
00078 ! For all the transient_in of the component
00079     DO ib =1, il_xml_transi
00080          id_error = &
00081          sasa_c_get_number_3rd_level(id_XML_doc,                             &
00082          'component', 0, 'transient', ib, 'transient_standard_name',    &
00083          ida_nb_stand_name(ib))
00084          print *,' get_transi_io_numbers id_error stand_name ib = ',ib, id_error
00085 
00086       id_error = &
00087          sasa_c_get_number_5th_level(id_XML_doc,              &
00088          'component', 0, 'transient', ib, 'intent', 0,   &
00089          'input', 0, 'origin', ida_nb_transi_in(ib))
00090          print *,' get_transi_io_numbers id_error transi_in ib = ',ib, id_error
00091 
00092       id_error = &
00093          sasa_c_get_number_4th_level(id_XML_doc,              &
00094          'component', 0, 'transient', ib, 'intent', 0,   &
00095          'output', ida_nb_transi_out(ib))
00096          print *,' get_transi_io_numbers id_error transi_out ib = ',ib, id_error
00097     END DO
00098 
00099 !  At second pass (called from prismdrv_init_smioc_struct) :
00100 !  we add indexes for userdef transients
00101 !  It is supposed that the number of standard names are the same
00102 !  in the associated "udef" transient
00103 !  These numbers are copied from the geographical transient
00104 !  In associated "gridless" transients, Number of origins = 1
00105 !  and number of outputs = 1
00106 
00107     IF ( .NOT. ld_first_details ) THEN
00108 !  "Udef" transients    
00109        ib_nt = 0
00110        DO ib_u = il_xml_transi + 1, id_nb_transi
00111           ib_nt = ib_nt + 1
00112 !  ib_xml is the transient index in component XML SMIOC file
00113           ib_xml = sga_comp_udef_idx(id_comp)%iga_xml_trindex(ib_nt)
00114 !  Number of standard names is the same in all associated "gridless" transients
00115           ida_nb_stand_name(ib_u) = ida_nb_stand_name(ib_xml)        
00116 !  Number of origins is always 1 or 0 in gridless transients
00117           IF ( ida_nb_transi_in(ib_xml) .NE. 0 ) THEN 
00118              ida_nb_transi_in(ib_u) = 1
00119           ELSE
00120              ida_nb_transi_in(ib_u) = 0
00121           ENDIF
00122 !  Number of outputs is always 1 or 0 in gridless transients
00123           IF ( ida_nb_transi_out(ib_xml) .NE. 0 ) THEN
00124              ida_nb_transi_out(ib_u) = 1
00125           ELSE
00126              ida_nb_transi_out(ib_u) = 0
00127           ENDIF 
00128        ENDDO
00129 
00130     ENDIF
00131 
00132   END SUBROUTINE get_transi_io_numbers
00133 
00134 !
00135 !======================================================================

Generated on 18 Mar 2011 for Oasis4 by  doxygen 1.6.1