get_smioc_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   SUBROUTINE get_smioc_numbers ( id_XML_doc,         &
00008                                  id_nb_unitsets,     &
00009                                  id_nb_grids,        &
00010                                  id_nb_transi,       &
00011                                  id_nb_persis,       &
00012                                  id_comp,            &
00013                                  cda_app_name,       &
00014                                  cda_comp_name,      &
00015                                  ld_userdef_details,   &
00016                                  id_error )
00017 
00018 ! !DESCRIPTION
00019 ! This routine gives the numbers of Fortran unit sets, grids, transi and persis
00020 ! for one XML 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 Fortran unit sets for the component
00039     INTEGER, INTENT(Out) :: id_nb_unitsets
00040 
00041 ! number of grids for the component
00042     INTEGER, INTENT(Out) :: id_nb_grids       
00043 
00044 ! number of transi variables for the component
00045     INTEGER, INTENT(Out) :: id_nb_transi  
00046 
00047 ! number of persis variables for the component!
00048     INTEGER, INTENT(Out) :: id_nb_persis
00049 
00050 ! id number of component
00051     INTEGER, INTENT(In)  :: id_comp
00052 
00053 ! Names of application and component
00054     CHARACTER(len=*), INTENT(In)  :: cda_app_name
00055     CHARACTER(len=*), INTENT(In)  :: cda_comp_name
00056 
00057 ! logical flag first pass / second pass
00058     LOGICAL, INTENT(In)  :: ld_userdef_details
00059 
00060 ! returned error code
00061     INTEGER, INTENT(Out) :: id_error 
00062 !
00063 #if CIM
00064     INTEGER :: sasa_c_get_number_10th_level, sasa_c_get_number_11th_level
00065     CHARACTER(len=max_name+44) :: cla_model_appli
00066     CHARACTER(len=max_name+44) :: cla_model_comp
00067 #else
00068     INTEGER :: sasa_c_get_number_2nd_level, sasa_c_get_number_3rd_level
00069     INTEGER :: sasa_c_get_number_1st_level, il_nbpc
00070 #endif
00071     
00072 !
00073 !----------------------------------------------------------------------
00074 !
00075 #if CIM
00076     ! Configuration data are in one CIM file
00077     ! --------------------------------------
00078 
00079     ! Prepare two predicates for the search in the XML documents :
00080     !   based on application and model shortNames
00081     cla_model_appli = 'modelComponent[normalize-space(shortName)="'//TRIM(cda_app_name)//'"]'
00082     cla_model_comp  = 'modelComponent[normalize-space(shortName)="'//TRIM(cda_comp_name)//'"]'
00083 
00084     id_error = &
00085         sasa_c_get_number_10th_level (id_XML_doc, &
00086         "simulationComposite", 0, "child", 0, "simulationRun", 0, "model", 0, "modelComponent", 0,  &
00087         "childComponent", 0, TRIM(cla_model_appli), 0, "childComponent", 0, &
00088         TRIM(cla_model_comp), 0, "grid", id_nb_grids)
00089         
00090     id_error = &
00091         sasa_c_get_number_11th_level (id_XML_doc, &
00092         "simulationComposite", 0, "child", 0, "simulationRun", 0, "model", 0, "modelComponent", 0,  &
00093         "childComponent", 0, TRIM(cla_model_appli), 0, "childComponent", 0, &
00094         TRIM(cla_model_comp), 0, "componentProperties", 0, "componentProperty", id_nb_transi)
00095     
00096     id_nb_unitsets = 0
00097     id_nb_persis  = 0
00098     
00099 #else
00100     ! Configuration data are in a SMIOC file
00101     ! --------------------------------------
00102     
00103     il_nbpc = 0
00104     id_error = &
00105        sasa_c_get_number_1st_level(id_XML_doc,    &
00106        'prismcomponent', il_nbpc)
00107     IF (il_nbpc == 1) THEN
00108         PRINT *, '******************************************************'
00109         PRINT *, 'Since SVN revision 2633, "prismcomponent" must be '
00110         PRINT *, 'replaced by "component" in all SMIOC XML file'
00111         PRINT *, '******************************************************'
00112         CALL PSMILe_Flushstd
00113         CALL MPI_Abort(MPI_COMM_WORLD, 1, id_error)
00114     ENDIF
00115 
00116     id_error = &
00117        sasa_c_get_number_3rd_level(id_XML_doc, 'component', 0,   &
00118        'code', 0, 'Fortran_units', id_nb_unitsets)
00119     print *,' get_smioc_numbers id_error units = ',id_error
00120 
00121     id_error = &
00122        sasa_c_get_number_2nd_level(id_XML_doc,    &
00123        'component', 0, 'grid', id_nb_grids)
00124     print *,' get_smioc_numbers id_error grids = ',id_error
00125 
00126     id_error = &
00127        sasa_c_get_number_2nd_level(id_XML_doc,    &
00128        'component', 0, 'transient', id_nb_transi)
00129     print *,' get_smioc_numbers id_error transi = ',id_error
00130 
00131     id_error = &
00132        sasa_c_get_number_2nd_level(id_XML_doc,    &
00133        'component', 0, 'persistent', id_nb_persis)
00134     print *,' get_smioc_numbers id_error persist = ',id_error
00135 #endif
00136 
00137 ! If called by driver, we must include "udef transients" of current component in id_nb_transi
00138 !                      and in id_nb_grids (one implicit "gridless" grid per udef transient)
00139 !
00140     if ( ld_userdef_details ) then
00141          id_nb_transi = id_nb_transi + iga_comp_nb_udef(id_comp)
00142          id_nb_grids  = id_nb_grids  + iga_comp_nb_udef(id_comp)
00143     endif
00144 !
00145   END SUBROUTINE get_smioc_numbers
00146 !
00147 !======================================================================

Generated on 1 Dec 2011 for Oasis4 by  doxygen 1.6.1