get_grids_details.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 !
00006   SUBROUTINE get_grids_details ( id_XML_doc,         &
00007                                  id_nb_grids,        &
00008                                  cda_app_name,       &
00009                                  cda_comp_name,      &
00010                                  sda_smioc_grids,    &
00011                                  id_error )     
00012 
00013 ! !DESCRIPTION
00014 ! This routines gives extracts the grids informations for all the grids
00015 ! of one smioc
00016 !
00017 !----------------------------------------------------------------------
00018 !
00019     USE PSMILe_smioc
00020     IMPLICIT NONE
00021 !
00022 ! !REVISED HISTORY
00023 !   Date        Programmer     Description
00024 ! ----------    ----------     -----------
00025 ! 20/10/2003    S. Valcke      Creation
00026 ! 30/12/2003    D. Declat      Implemented as a module
00027 ! 30/10/2010   JM Epitalon     Adapted to CIM (Common Info Model)
00028 !
00029 !EOP
00030 !----------------------------------------------------------------------
00031 ! $Id: psmile_smioc.F90 1793 2008-11-25 14:58:31Z valcke $
00032 ! $Author: valcke $
00033 !----------------------------------------------------------------------
00034 !
00035 ! 0. Declaration
00036 !
00037 ! handle of XML content of the smioc file
00038     INTEGER, INTENT(In) :: id_XML_doc
00039 
00040 ! number of grids for the component
00041     INTEGER, INTENT(In) :: id_nb_grids  
00042 
00043 ! Names of application and component
00044     CHARACTER(len=*), INTENT(In)  :: cda_app_name
00045     CHARACTER(len=*), INTENT(In)  :: cda_comp_name
00046 
00047 ! grids structure for the component
00048     TYPE (smioc_grid), DIMENSION(id_nb_grids), INTENT(Out) :: sda_smioc_grids 
00049 !
00050 ! returned error code
00051    INTEGER, INTENT(Out) :: id_error  
00052 !
00053 #if CIM
00054     INTEGER :: sasa_c_get_element_7th_level_c
00055     CHARACTER(len=max_name+44) :: cla_model_appli
00056     CHARACTER(len=max_name+44) :: cla_model_comp
00057 #else
00058     INTEGER :: sasa_c_convert_char2int
00059     INTEGER :: sasa_c_get_attri_2nd_level, sasa_c_get_attri_3rd_level
00060     INTEGER :: sasa_c_get_attri_4th_level, sasa_c_get_attri_5th_level
00061     INTEGER :: sasa_c_get_element_5th_level_i
00062     INTEGER :: sasa_c_get_element_5th_level_d
00063     INTEGER :: sasa_c_get_number_3rd_level
00064 #endif
00065 !
00066     CHARACTER(LEN=max_name) :: cla_char
00067     INTEGER :: ib, ib_bis, ib_ind, il_index
00068 !
00069     INTEGER :: il_length
00070 !
00071 !-----------------------------------------------------------------------
00072 !
00073 #if CIM
00074     ! Prepare two predicates for the search in the XML documents :
00075     !   based on application and model shortNames
00076     cla_model_appli = 'modelComponent[normalize-space(shortName)="'//TRIM(cda_app_name)//'"]'
00077     cla_model_comp  = 'modelComponent[normalize-space(shortName)="'//TRIM(cda_comp_name)//'"]'
00078 #endif
00079         
00080     DO ib =1, id_nb_grids
00081 
00082 #if CIM
00083     ! Configuration data are in one CIM file
00084     ! --------------------------------------
00085      
00086     ! get the grid local name
00087     sda_smioc_grids(ib)%cg_grid_name = ' '
00088     id_error = &
00089         sasa_c_get_element_7th_level_c (id_XML_doc, &
00090         "simulationComposite/child/simulationRun/model/modelComponent", 0,  &
00091         "childComponent", 0, TRIM(cla_model_appli), 0, "childComponent", 0, &
00092         TRIM(cla_model_comp), 0, "grid", ib, "reference", 0, "name", 0,     &
00093         sda_smioc_grids(ib)%cg_grid_name, il_length )
00094 
00095       ! TEMPORARY        
00096       ! Set the "periodic" attribute for first dimension equaly for all grids
00097       ! for test with Toyoa4 example model
00098       sda_smioc_grids(ib)%iga_periodic(1) = .true.
00099 
00100 #else
00101     ! Configuration data are in a SMIOC file
00102     ! --------------------------------------
00103     
00104       ! get the grid local name
00105       id_error = &
00106          sasa_c_get_attri_2nd_level (id_XML_doc,          &
00107          'component', 0, 'grid', ib, 'local_name',   &
00108          sda_smioc_grids(ib)%cg_grid_name, il_length)
00109 
00110       ! get the indexing_dimension elements
00111       id_error = &
00112          sasa_c_get_number_3rd_level(id_XML_doc,               &
00113          'component', 0, 'grid', ib, 'indexing_dimension',&
00114          ib_ind)
00115       
00116       IF (ib_ind > 0) THEN
00117           DO ib_bis = 1, ib_ind
00118             id_error = &
00119                sasa_c_get_attri_3rd_level (id_XML_doc,                &
00120                'component', 0, 'grid', ib, 'indexing_dimension', &
00121                ib_bis, 'index', cla_char, il_length)
00122 
00123             IF (id_error .EQ. 0) THEN
00124                 READ (cla_char, *) il_index
00125             ELSE
00126                 PRINT *, '****************************************************'
00127                 PRINT *, 'Problem in reading index in indexing_dimension      '
00128                 PRINT *, '****************************************************'
00129                 CALL PSMILe_Flushstd
00130                 CALL MPI_Abort(MPI_COMM_WORLD, 1, id_error)
00131             ENDIF
00132 
00133             id_error = &
00134                sasa_c_get_attri_3rd_level (id_XML_doc,                &
00135                'component', 0, 'grid', ib, 'indexing_dimension', &
00136                ib_bis, 'periodic', cla_char, il_length)
00137             IF (id_error .EQ. 0) THEN
00138                 sda_smioc_grids(ib)%iga_periodic(il_index) =               &
00139                    sasa_c_convert_char2int(cla_char(1:il_length))
00140             ENDIF
00141         
00142           END DO
00143       ENDIF
00144 #endif
00145     
00146     END DO
00147 
00148   END SUBROUTINE get_grids_details
00149 
00150 !
00151 !======================================================================

Generated on 1 Dec 2011 for Oasis4 by  doxygen 1.6.1