psmile_smioc_interface.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   MODULE psmile_smioc_interface
00007 
00008 ! !PUBLIC TYPES
00009   USE PRISM_Constants
00010   USE PSMILe_Common
00011   IMPLICIT NONE
00012 
00013 ! ----------------------------------------------------------------------------
00014 ! Interfaces of smioc extraction routines
00015 ! ----------------------------------------------------------------------------
00016 !
00017 ! The following routines corresponds to the ones used to extract information
00018 ! from the smioc xml files.
00019 !
00020 
00021   INTERFACE
00022 
00023 !----------------------------------------------------------------------------
00024   SUBROUTINE get_smioc_numbers ( id_XML_doc,         &
00025                                  id_nb_unitsets,     &
00026                                  id_nb_grids,        &
00027                                  id_nb_transi,       &
00028                                  id_nb_persis,       &
00029                                  id_comp,            &
00030                                  cda_app_name,       &
00031                                  cda_comp_name,      &
00032                                  ld_first_details,   &
00033                                  id_error )
00034 ! !DESCRIPTION
00035 ! This routine gives the numbers of Fortran unit sets, grids,
00036 ! transi and persis for one smioc
00037 !
00038 !----------------------------------------------------------------------
00039 !
00040 ! 0. Declaration
00041 !
00042     USE PSMILe_smioc
00043 !
00044 ! handle of XML content of the smioc file
00045     INTEGER, INTENT(In) :: id_XML_doc
00046 
00047 ! number of Fortran unit sets for the component
00048     INTEGER, INTENT(Out) :: id_nb_unitsets
00049 
00050 ! number of grids for the component
00051     INTEGER, INTENT(Out) :: id_nb_grids
00052 
00053 ! number of transi variables for the component
00054     INTEGER, INTENT(Out) :: id_nb_transi
00055 
00056 ! number of persis variables for the component!
00057     INTEGER, INTENT(Out) :: id_nb_persis
00058 
00059 ! id number of component
00060     INTEGER, INTENT(In)  :: id_comp
00061 
00062 ! Names of application and component
00063     CHARACTER(len=*), INTENT(In)  :: cda_app_name
00064     CHARACTER(len=*), INTENT(In)  :: cda_comp_name
00065 
00066 ! logical flag first pass / second pass
00067     LOGICAL, INTENT(In)  :: ld_first_details
00068 
00069 ! returned error code
00070     INTEGER, INTENT(Out) :: id_error
00071 
00072   END SUBROUTINE get_smioc_numbers
00073 !--------------------------------------------------------------------------------
00074   SUBROUTINE get_unitsets_details ( id_XML_doc,         &
00075                                     id_nb_unitsets,     &
00076                                     ida_smioc_unitsets, &
00077                                     id_error)
00078 
00079 ! !DESCRIPTION
00080 ! This routines extracts the Fortran units sets for one smioc
00081 !
00082 !----------------------------------------------------------------------
00083 !
00084 ! 0. Declaration
00085 !
00086     USE PSMILe_smioc
00087 !
00088 ! handle of XML content of the smioc file
00089     INTEGER, INTENT(In) :: id_XML_doc
00090 
00091 ! number of Fortran units sets for the component
00092     INTEGER, INTENT(In) :: id_nb_unitsets
00093 
00094 ! Fortran units sets for the component
00095     INTEGER, DIMENSION(id_nb_unitsets,3), INTENT(Out) :: ida_smioc_unitsets
00096 
00097 ! returned error code
00098     INTEGER, INTENT(Out) :: id_error
00099 
00100   END SUBROUTINE get_unitsets_details
00101 !------------------------------------------------------------------------------
00102   SUBROUTINE get_transi_io_numbers ( id_XML_doc,         &
00103                                      id_nb_transi,       &
00104                                      ida_nb_stand_name,  &
00105                                      ida_nb_transi_in,   &
00106                                      ida_nb_transi_out,  &
00107                                      id_comp,            &
00108                                      cda_app_name,       &
00109                                      cda_comp_name,      &
00110                                      ld_first_details,   &
00111                                      id_error  )
00112 !
00113 ! !DESCRIPTION
00114 ! This routine gives the number of input and output for each transi
00115 ! of one smioc
00116 !
00117 !----------------------------------------------------------------------
00118 !
00119 ! 0. Declaration
00120 !
00121     USE PSMILe_smioc
00122 
00123 ! handle of XML content of the smioc file
00124     INTEGER, INTENT(In) :: id_XML_doc
00125 
00126 ! number of transi variables for the component
00127     INTEGER, INTENT(In) :: id_nb_transi
00128 
00129 ! number of standard name per transi for the component
00130     INTEGER, DIMENSION(id_nb_transi), INTENT(Out) :: ida_nb_stand_name
00131 
00132 ! number of input transi per transi for the component
00133     INTEGER, DIMENSION(id_nb_transi), INTENT(Out) :: ida_nb_transi_in
00134 
00135 ! number of output transi per transi for the component
00136     INTEGER, DIMENSION(id_nb_transi), INTENT(Out) :: ida_nb_transi_out
00137 
00138 ! Component id
00139     INTEGER, INTENT(In) :: id_comp
00140 
00141 ! Names of application and component
00142     CHARACTER(len=*), INTENT(In)  :: cda_app_name
00143     CHARACTER(len=*), INTENT(In)  :: cda_comp_name
00144 
00145 ! logical flag first pass / second pass
00146     LOGICAL, INTENT(In)  :: ld_first_details
00147 
00148 ! returned error code
00149    INTEGER, INTENT(Out) :: id_error
00150 
00151    END SUBROUTINE get_transi_io_numbers
00152 !----------------------------------------------------------------------------
00153 
00154   SUBROUTINE init_grids (id_nb_grids, sda_smioc_grids, id_error)
00155 !
00156     USE PSMILe_smioc
00157 
00158 ! !INPUT PARAMETERS:
00159     INTEGER,INTENT(In):: id_nb_grids ! number of grids
00160 !
00161 ! !RETURN VALUE:
00162 !   grids structure
00163     TYPE (smioc_grid),DIMENSION(id_nb_grids),INTENT(Out):: sda_smioc_grids
00164 !
00165 ! returned error code
00166     INTEGER,INTENT(Out):: id_error
00167 
00168   END SUBROUTINE init_grids
00169 !-------------------------------------------------------------------------------
00170 
00171   SUBROUTINE init_transi (id_nb_transi,                 &
00172                           ida_nb_stand_name,            &
00173                           ida_nb_transi_in,             &
00174                           ida_nb_transi_out,            &
00175                           sda_smioc_transi,             &
00176                           id_error )
00177     USE PSMILe_smioc
00178 
00179 !   number of transient variables
00180     INTEGER,INTENT(In):: id_nb_transi
00181 
00182 !   number of standard names for each transient
00183     INTEGER,DIMENSION(id_nb_transi),INTENT(In):: ida_nb_stand_name
00184 
00185 !   number of input origins for each transient
00186     INTEGER,DIMENSION(id_nb_transi),INTENT(In):: ida_nb_transi_in
00187 
00188 !   number of output for each transient
00189     INTEGER,DIMENSION(id_nb_transi),INTENT(In):: ida_nb_transi_out
00190 !
00191 ! !RETURN VALUE:
00192 !   transients structure
00193     TYPE(transient),DIMENSION(id_nb_transi),INTENT(InOut):: 
00194        sda_smioc_transi
00195 !
00196 ! returned error code
00197    INTEGER,INTENT(Out):: id_error
00198 !
00199   END SUBROUTINE init_transi
00200 !----------------------------------------------------------------------------
00201 !
00202   SUBROUTINE get_transi_details ( id_XML_doc,         &
00203                                   id_nb_transi,       &
00204                                   sda_smioc_transi,   &
00205                                   id_comp,            &
00206                                   cda_app_name,       &
00207                                   cda_comp_name,      &
00208                                   ld_first_details,   &
00209                                   id_error )
00210 
00211     USE PSMILe_smioc
00212 
00213 ! handle of XML content of the smioc file
00214     INTEGER, INTENT(In) :: id_XML_doc
00215 
00216 ! number of transi variables
00217     INTEGER, INTENT(In) :: id_nb_transi
00218 
00219 ! transi structure
00220     TYPE(transient), DIMENSION(id_nb_transi), INTENT(InOut) :: sda_smioc_transi
00221 
00222 ! Component id
00223     INTEGER, INTENT(In) :: id_comp
00224 
00225 ! Names of application and component
00226     CHARACTER(len=*), INTENT(In)  :: cda_app_name
00227     CHARACTER(len=*), INTENT(In)  :: cda_comp_name
00228 
00229 ! logical flag first pass / second pass
00230     LOGICAL, INTENT(In)  :: ld_first_details
00231 
00232 ! returned error code
00233     INTEGER, INTENT(Out):: id_error
00234 
00235   END SUBROUTINE get_transi_details
00236 !---------------------------------------------------------------------------
00237 !
00238   SUBROUTINE get_cnct_source_details ( id_XML_doc,  &
00239      cda_xpath,         &
00240      ld_coupling,       &
00241      sd_source,         &
00242      id_error )
00243     
00244     USE PSMILe_smioc
00245 
00246 ! handle of XML content of the CIM file
00247     INTEGER, INTENT(In) :: id_XML_doc
00248 
00249 ! XPath character string
00250     CHARACTER(len=*), INTENT(In)  :: cda_xpath
00251 
00252 ! Flag for coupling (true) or connection (false)
00253     LOGICAL, INTENT(In) :: ld_coupling
00254 
00255 ! Data structure to fill in
00256     TYPE(transient_out), INTENT(InOut) :: sd_source
00257 
00258 ! returned error code
00259     INTEGER, INTENT(Out):: id_error
00260 
00261   END SUBROUTINE get_cnct_source_details
00262 !---------------------------------------------------------------------------
00263 !
00264   SUBROUTINE get_cnct_target_details ( id_XML_doc,  &
00265      cda_xpath,         &
00266      ld_coupling,       &
00267      ld_source_is_file, &
00268      sd_target,         &
00269      id_error )
00270 
00271     USE PSMILe_smioc
00272 
00273 ! handle of XML content of the CIM file
00274     INTEGER, INTENT(In) :: id_XML_doc
00275 
00276 ! XPath character string
00277     CHARACTER(len=*), INTENT(In)  :: cda_xpath
00278 
00279 ! Flag for coupling (true) or connection (false)
00280     LOGICAL, INTENT(In) :: ld_coupling
00281 
00282 ! Flag for when the source of coupling is a file
00283     LOGICAL, INTENT(In) :: ld_source_is_file
00284 ! Data structure to fill in
00285     TYPE(transient_in), INTENT(InOut) :: sd_target
00286 
00287 ! returned error code
00288     INTEGER, INTENT(Out):: id_error
00289 
00290   END SUBROUTINE get_cnct_target_details
00291 !---------------------------------------------------------------------------
00292 !
00293   SUBROUTINE get_file_details ( id_XML_doc,  &
00294      cda_xpath,         &
00295      cda_var_name,      &
00296      sd_file,           &
00297      id_error )
00298     
00299     USE PSMILe_smioc
00300 
00301 ! handle of XML content of the CIM file
00302     INTEGER, INTENT(In) :: id_XML_doc
00303 
00304 ! XPath character string = where to search in the XML document
00305     CHARACTER(len=*), INTENT(In)  :: cda_xpath
00306 
00307 ! NetCDF variable name we are looking for
00308     CHARACTER(len=*), INTENT(In)  :: cda_var_name
00309 
00310 ! Data structure to fill in
00311     TYPE (PSMILe_file_struct), INTENT(InOut) :: sd_file
00312 
00313 ! returned error code
00314     INTEGER, INTENT(Out):: id_error
00315 
00316   ENDSUBROUTINE get_file_details
00317 !---------------------------------------------------------------------------
00318 !
00319   SUBROUTINE get_regrid_details ( id_XML_doc,  &
00320      cda_xpath,       &
00321      id_nb_regrid,    &
00322      sd_interp,       &
00323      id_error )     
00324 
00325     USE PSMILe_smioc
00326 
00327 ! handle of XML content of the CIM file
00328     INTEGER, INTENT(In) :: id_XML_doc
00329 
00330 ! XPath character string
00331     CHARACTER(len=*), INTENT(In)  :: cda_xpath
00332 
00333 ! Number of <spatialRegridding> elements
00334     INTEGER, INTENT(In) :: id_nb_regrid
00335 
00336 ! Interpolation structure
00337     TYPE(PSMILe_interp), INTENT(InOut) :: sd_interp
00338 
00339 ! returned error code
00340     INTEGER, INTENT(Out):: id_error 
00341 
00342   ENDSUBROUTINE get_regrid_details
00343 !---------------------------------------------------------------------------
00344 !
00345   SUBROUTINE get_persis_details ( id_XML_doc,        &
00346                                   id_nb_persis,      &
00347                                   sda_smioc_persis,  &
00348                                   id_error )
00349     USE PSMILe_smioc
00350 
00351 ! handle of XML content of the smioc file
00352     INTEGER, INTENT(In) :: id_XML_doc
00353 
00354 ! number of persis variables
00355     INTEGER,INTENT(In):: id_nb_persis
00356 
00357 ! persis structure
00358     TYPE(persistent),DIMENSION(id_nb_persis),INTENT (Out):: 
00359        sda_smioc_persis
00360 
00361 ! returned error code
00362     INTEGER,INTENT(Out):: id_error
00363 
00364   END SUBROUTINE get_persis_details 
00365 !-----------------------------------------------------------------------------
00366 !
00367   SUBROUTINE init_comp_udef ( id_nb_transi,                 &
00368                               ida_nb_transi_in,             &
00369                               ida_nb_transi_out,            &
00370                               id_comp,                      &
00371                               id_error )
00372     USE PSMILe_smioc
00373 
00374 !   number of transient variables in XML SMIOC for one component
00375     INTEGER,INTENT(In):: id_nb_transi
00376 
00377 !   number of input origins for each transient
00378     INTEGER,DIMENSION(id_nb_transi),INTENT(In):: ida_nb_transi_in
00379 
00380 !   number of output for each transient
00381     INTEGER,DIMENSION(id_nb_transi),INTENT(In):: ida_nb_transi_out
00382 
00383 !   index of component
00384     INTEGER, INTENT(In) :: id_comp
00385 !
00386 ! !RETURN VALUE:
00387 !   Global structure sga_comp_udef_idx variables are all = .false.
00388 !
00389 ! returned error code
00390    INTEGER,INTENT(Out):: id_error
00391 
00392   END SUBROUTINE init_comp_udef
00393 !------------------------------------------------------------------------------
00394 !
00395   SUBROUTINE create_transi_udef ( id_nb_transi,     &
00396                                   id_xml,           &
00397                                   id_u,             &
00398                                   id_ch,            &
00399                                   id_side,          &
00400                                   sda_smioc_transi, &
00401                                   id_comp,          &
00402                                   id_error )
00403 !
00404     USE PSMILe_smioc
00405 !   Dimensions of array sda_smioc_transi (2nd pass)
00406     Integer, Intent(In)          :: id_nb_transi
00407 
00408 !   Index of transient (geographic) to be copied (defined in the SMIOC XML)
00409     Integer, Intent(In)          :: id_xml
00410 
00411 !   Index of associated transient "udef" to be created for this component
00412     Integer, Intent(In)          :: id_u
00413 
00414 !   Index of channel (In OR Out) of the SMIOC XML (geographic) transient
00415     Integer, Intent(In)          :: id_ch
00416 
00417 !   Side of channel (In) only .XOR. (Out) only of the id_ch channel
00418     Integer, Intent(In)          :: id_side
00419 
00420 !   transients structure (array allocated with dimension id_nb_transi in second pass)
00421     TYPE(transient), Dimension(id_nb_transi), TARGET,  Intent(InOut)  ::  sda_smioc_transi
00422 !
00423 !   Index of component
00424     Integer, Intent(In)          :: id_comp
00425 
00426 !   returned error code
00427     Integer, Intent(Out)         :: id_error
00428 !
00429   END SUBROUTINE create_transi_udef
00430 !-----------------------------------------------------------------------------
00431 !
00432   SUBROUTINE init_persis (id_nb_persis,      &
00433                           sda_smioc_persis, &
00434                           id_error )
00435     USE PSMILe_smioc
00436 
00437 !   number of persistent variables
00438     INTEGER,INTENT(In):: id_nb_persis
00439 !
00440 ! !RETURN VALUE:
00441 !   persistents structure
00442     TYPE(persistent),DIMENSION(id_nb_persis),INTENT(Out):: 
00443        sda_smioc_persis
00444 !
00445 ! returned error code
00446    INTEGER,INTENT(Out):: id_error
00447 
00448   END SUBROUTINE init_persis
00449 !-----------------------------------------------------------------------------
00450 !
00451   SUBROUTINE write_grids_details (id_nb_grids,     &
00452                                   sda_grids,       &
00453                                   id_chanel,       &
00454                                   id_error )
00455     USE PSMILe_smioc
00456 
00457 !   number of grids
00458     INTEGER,INTENT(In):: id_nb_grids
00459 !   grids structure
00460     TYPE (smioc_grid),DIMENSION(id_nb_grids),INTENT (In):: sda_grids
00461 !   channel used for testing smioc infos
00462     INTEGER,INTENT(In):: id_chanel
00463 !
00464 !   returned error code
00465     INTEGER,INTENT(Out):: id_error
00466 
00467   END SUBROUTINE write_grids_details
00468 !------------------------------------------------------------------------------
00469 
00470   SUBROUTINE write_transi_details (id_nb_transi,    &
00471                                    sda_transi,      &
00472                                    id_chanel,       &
00473                                    id_error )
00474     USE PSMILe_smioc
00475 
00476 !   number of transient variables
00477     INTEGER,INTENT(In):: id_nb_transi
00478 !   transients structure
00479     TYPE(transient),DIMENSION(id_nb_transi),INTENT(In):: sda_transi
00480 !   channel used for testing smioc infos
00481     INTEGER,INTENT(In):: id_chanel
00482 !
00483 ! returned error code
00484    INTEGER,INTENT(Out):: id_error
00485 
00486   END SUBROUTINE write_transi_details
00487 !---------------------------------------------------------------------------------
00488 !
00489   SUBROUTINE write_persis_details (id_nb_persis,    &
00490                                    sda_persis,      &
00491                                    id_chanel,       &
00492                                    id_error)
00493     USE PSMILe_smioc
00494 
00495 !   number of persistent variables
00496     INTEGER,INTENT(In):: id_nb_persis
00497 
00498 !   persistents structure
00499     TYPE(persistent),DIMENSION(id_nb_persis),INTENT(In):: sda_persis
00500 
00501 !   channel used for testing smioc infos
00502     INTEGER,INTENT(In):: id_chanel
00503 !
00504 !  returned error code
00505     INTEGER,INTENT(Out):: id_error
00506 
00507   END SUBROUTINE write_persis_details
00508 !----------------------------------------------------------------------------
00509 !
00510   SUBROUTINE get_grids_details ( id_XML_doc,         &
00511                                  id_nb_grids,        &
00512                                  cda_app_name,       &
00513                                  cda_comp_name,      &
00514                                  sda_smioc_grids,    &
00515                                  id_error )
00516     USE PSMILe_smioc
00517 
00518 ! handle of XML content of the smioc file
00519     INTEGER, INTENT(In) :: id_XML_doc
00520 
00521 ! number of grids for the component
00522     INTEGER, INTENT(In) :: id_nb_grids
00523 
00524 ! Names of application and component
00525     CHARACTER(len=*), INTENT(In)  :: cda_app_name
00526     CHARACTER(len=*), INTENT(In)  :: cda_comp_name
00527 
00528 ! grids structure for the component
00529     TYPE (smioc_grid), DIMENSION(id_nb_grids), INTENT(Out) :: sda_smioc_grids
00530 !
00531 ! returned error code
00532    INTEGER, INTENT(Out) :: id_error
00533 
00534   END SUBROUTINE get_grids_details
00535 !-------------------------------------------------------------------------------
00536 !
00537   SUBROUTINE put_udef_suffix ( cd_in, cd_out, id_chan, id_side )
00538 
00539   USE PSMILe_smioc
00540 
00541 ! !Input  argument
00542    Character(len=*),        Intent(In)  :: cd_in
00543 
00544 ! !Output argument
00545    Character(len=max_name), Intent(Out) :: cd_out
00546 !
00547 ! !Input argument
00548    Integer,                  Intent(In) :: id_chan
00549 !
00550 ! !Input argument : 0 = source = "O",       1 = target = "I"
00551    Integer,                  Intent(In) :: id_side
00552 
00553   END SUBROUTINE put_udef_suffix
00554 !-------------------------------------------------------------------------------
00555 !
00556   END INTERFACE
00557 !
00558   END MODULE psmile_smioc_interface

Generated on 1 Dec 2011 for Oasis4 by  doxygen 1.6.1