get_transi_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 !BOP
00006 !
00007 !======================================================================
00008 !
00009   SUBROUTINE get_transi_details ( id_XML_doc,  &
00010      id_nb_transi,       &
00011      sda_smioc_transi,   &
00012      id_comp,            &
00013      cda_app_name,       &
00014      cda_comp_name,      &
00015      ld_userdef_details,   &
00016      id_error )     
00017 
00018 ! !DESCRIPTION
00019 ! This routine extracts the informations about the transi, the input
00020 ! and output transi 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
00039     INTEGER, INTENT(In) :: id_nb_transi
00040 
00041 ! transi structure
00042     TYPE(transient), DIMENSION(id_nb_transi), INTENT(InOut) :: sda_smioc_transi
00043 
00044 ! Component id
00045     INTEGER, INTENT(In) :: id_comp
00046 
00047 ! Names of application and component
00048     CHARACTER(len=*), INTENT(In)  :: cda_app_name
00049     CHARACTER(len=*), INTENT(In)  :: cda_comp_name
00050 
00051 ! logical flag first pass / second pass
00052     LOGICAL, INTENT(In)  :: ld_userdef_details
00053                                                  
00054 ! returned error code
00055     INTEGER, INTENT(Out):: id_error 
00056 
00057 ! Logical to test if PSMILe is asked to ouput some debug or transient info
00058     logical :: ll_debug_io, ll_file_io
00059 ! temporary character string
00060     CHARACTER(LEN=max_name) :: cla_char
00061     INTEGER :: il_test, il_length
00062     DOUBLE PRECISION :: dl_test
00063 !
00064     
00065 #ifdef CIM
00066     
00067     ! Local storage for <Coupling> parameters
00068     TYPE(transient_in)       :: sl_coupling_in
00069     TYPE (PSMILe_interp)     :: sl_coupling_interp
00070     TYPE(transient_out)      :: sl_coupling_out
00071     
00072     ! Predicates for the search in XML path
00073     CHARACTER(len=max_name+44) :: cla_model_appli
00074     CHARACTER(len=max_name+44) :: cla_model_comp
00075     CHARACTER(len=max_name+44) :: cla_ref_comp
00076     ! XPath for the search in XML path
00077     CHARACTER(len=max_name) :: cla_xpath
00078     
00079     ! Loop indexes converted to character strings
00080     CHARACTER(LEN=max_name) :: cla_coupling_index, cla_connection_index
00081     ! Name of the component at (other) end of a coupling
00082     CHARACTER(LEN=max_name) :: cla_coupling_end
00083     ! Name of the transient at (other) end of a connection
00084     CHARACTER(len=max_name) :: cla_connection_end
00085 
00086     ! Index of transient, bundle, connection, output, input
00087     INTEGER :: il_transi, il_bundle, il_connection, il_output, il_input
00088     ! total nb of, index of, couplings
00089     INTEGER :: il_nb_couplings, il_coupling
00090     ! nb of spatial regriddings
00091     INTEGER :: il_nb_regrid
00092     ! Loop end condition
00093     LOGICAL :: ll_more_connections    
00094     INTEGER :: il_exchange_rate, il_source_is_file, il_target_is_file
00095     
00096     !     ... for error handling
00097     INTEGER, PARAMETER  :: nerrp = 2
00098     INTEGER             :: ierrp (nerrp)
00099   
00100     INTEGER :: sasa_c_get_number_3rd_level, sasa_c_get_number_4th_level, sasa_c_get_number_5th_level
00101     INTEGER :: sasa_c_get_number_6th_level, sasa_c_get_number_7th_level, sasa_c_get_number_8th_level
00102     INTEGER :: sasa_c_get_element_5th_level_i
00103     INTEGER :: sasa_c_get_element_5th_level_d
00104     INTEGER :: sasa_c_get_element_5th_level_c, sasa_c_get_element_6th_level_c
00105     INTEGER :: sasa_c_get_element_7th_level_c, sasa_c_get_element_8th_level_c
00106     INTEGER :: sasa_c_get_element_9th_level_c
00107     INTEGER :: sasa_c_get_attri_5th_level, sasa_c_get_attri_6th_level, sasa_c_get_attri_8th_level
00108     INTEGER :: sasa_c_convert_char2int
00109 
00110 #else
00111 
00112 ! Loop indices
00113     INTEGER :: ib, ib_bis, ib_nt, ib_xml, ib_xmlv, ib_xud
00114     INTEGER :: il_nb, il_nb_bis, il_nb_ter, il_nb_terbis
00115     INTEGER :: il_nb_qua, il_nb_cin, il_nb_six, il_nb_hep, il_nb_oct
00116     INTEGER :: il_nb_bisbis
00117     INTEGER :: il_dim_i, il_dim_o, il_ch, il_side
00118 !
00119     INTEGER :: sasa_c_get_attri_1st_level, sasa_c_get_attri_2nd_level
00120     INTEGER :: sasa_c_get_attri_3rd_level, sasa_c_get_attri_4th_level
00121     INTEGER :: sasa_c_get_attri_5th_level
00122     INTEGER :: sasa_c_get_number_3rd_level, sasa_c_get_number_4th_level 
00123     INTEGER :: sasa_c_get_number_5th_level
00124     INTEGER :: sasa_c_get_number_6th_level, sasa_c_get_number_7th_level
00125     INTEGER :: sasa_c_get_number_8th_level, sasa_c_get_number_9th_level
00126     INTEGER :: sasa_c_get_number_10th_level, sasa_c_get_number_11th_level
00127     INTEGER :: sasa_c_get_element_2nd_level_c
00128     INTEGER :: sasa_c_get_element_3rd_level_c 
00129     INTEGER :: sasa_c_get_element_3rd_level_i
00130     INTEGER :: sasa_c_get_element_3rd_level_d
00131     INTEGER :: sasa_c_get_element_4th_level_c, sasa_c_get_element_4th_level_i
00132     INTEGER :: sasa_c_get_element_5th_level_d
00133     INTEGER :: sasa_c_get_element_6th_level_c, sasa_c_get_element_6th_level_i
00134     INTEGER :: sasa_c_get_element_6th_level_d
00135     INTEGER :: sasa_c_get_element_5th_level_c, sasa_c_get_element_5th_level_i
00136     INTEGER :: sasa_c_get_element_7th_level_c, sasa_c_get_element_7th_level_i
00137     INTEGER :: sasa_c_get_element_8th_level_c
00138     INTEGER :: sasa_c_get_element_9th_level_c, sasa_c_get_element_9th_level_i
00139     INTEGER :: sasa_c_get_element_9th_level_d
00140     INTEGER :: sasa_c_get_element_10th_level_c, sasa_c_get_element_10th_level_i
00141     INTEGER :: sasa_c_get_element_10th_level_d
00142     INTEGER :: sasa_c_convert_char2int
00143 #endif
00144 
00145 !
00146 !----------------------------------------------------------------------
00147 !
00148 ! Fill up of the dummy structure
00149 
00150 !  
00151 !  id_nb_transi  = number of transients in XML SMIOC file
00152 #ifdef DEBUG
00153     print *,"get_transi_details : ld_userdef_details = ", ld_userdef_details
00154     print *,"get_transi_details : id_nb_transi     = ", id_nb_transi
00155     print *,"get_transi_details : nb udef transi   = ", iga_comp_nb_udef(id_comp)
00156     print *,"get_transi_details : cda_comp_name = ", cda_comp_name
00157     call psmile_flushstd
00158 #endif
00159     ll_debug_io = .FALSE.
00160     ll_file_io  = .FALSE.
00161 
00162 #ifdef CIM
00163     ! Configuration data are in one CIM file
00164     ! --------------------------------------
00165 
00166     ! Reset number of Input and Output per transi variables
00167     DO il_transi =1, id_nb_transi
00168         sda_smioc_transi(il_transi)%ig_nb_transi_out = 0
00169         sda_smioc_transi(il_transi)%sg_transi_in%ig_nb_in_orig = 0
00170     ENDDO
00171     
00172     ! Prepare two predicates for the search in the XML documents :
00173     !   based on application and model shortNames
00174     cla_model_appli = 'modelComponent[normalize-space(shortName)="'//TRIM(cda_app_name)//'"]'
00175     cla_model_comp  = 'modelComponent[normalize-space(shortName)="'//TRIM(cda_comp_name)//'"]'
00176 
00177     
00178     ! PART 1 :  TRANSIENT FEATURES
00179     ! ============================
00180     
00181     ! For all component's transients
00182     DO il_transi =1, id_nb_transi
00183     
00184       ! Local name
00185       id_error = &
00186           sasa_c_get_element_7th_level_c (id_XML_doc, &
00187           "simulationComposite/child/simulationRun/model/modelComponent", 0,  &
00188           "childComponent", 0, TRIM(cla_model_appli), 0, "childComponent", 0, &
00189           TRIM(cla_model_comp), 0, "componentProperties", 0, "componentProperty", il_transi, &
00190           "shortName", 0, cla_char, il_length)
00191       sda_smioc_transi(il_transi)%cg_local_name = cla_char(1:il_length)
00192     
00193       ! Long name
00194       id_error = &
00195           sasa_c_get_element_7th_level_c (id_XML_doc, &
00196           "simulationComposite/child/simulationRun/model/modelComponent", 0,  &
00197           "childComponent", 0, TRIM(cla_model_appli), 0, "childComponent", 0, &
00198           TRIM(cla_model_comp), 0, "componentProperties", 0, "componentProperty", il_transi, &
00199           "longName", 0, cla_char, il_length)
00200       sda_smioc_transi(il_transi)%cg_long_name = cla_char(1:il_length)
00201 
00202       ! Component name
00203       sda_smioc_transi(il_transi)%cg_comp_name = cda_comp_name
00204 
00205       ! Standard name(s)
00206         
00207       sda_smioc_transi(il_transi)%cga_stand_name(:) = ' '    
00208       
00209       ! Field should have at least one <standardName> sub-element : read it
00210       id_error = &
00211           sasa_c_get_element_8th_level_c (id_XML_doc, &
00212           "simulationComposite/child/simulationRun/model/modelComponent", 0,                  &
00213           "childComponent", 0, TRIM(cla_model_appli), 0, "childComponent", 0,                 &
00214           TRIM(cla_model_comp), 0, "componentProperties", 0, "componentProperty", il_transi,  &
00215           "standardName", 0, "name", 0, sda_smioc_transi(il_transi)%cga_stand_name(1),        &
00216           il_length)
00217       
00218       ! Check if the transient is a bundle :
00219       !   it is so if the <componentProperty> element has itself some <componentProperty> sub-elements
00220       !   nb bundle = nb <componentProperty> sub-elements
00221       id_error = &
00222           sasa_c_get_number_8th_level (id_XML_doc, &
00223           "simulationComposite/child/simulationRun/model/modelComponent", 0,                   &
00224           "childComponent", 0, TRIM(cla_model_appli), 0, "childComponent", 0,                  &
00225           TRIM(cla_model_comp), 0, "componentProperties", 0, "componentProperty", il_transi,   &
00226           "componentProperty", sda_smioc_transi(il_transi)%ig_nb_bndl)
00227       if (sda_smioc_transi(il_transi)%ig_nb_bndl .eq. 0) then
00228           ! transient type
00229           sda_smioc_transi(il_transi)%ig_transi_type = PSMILe_single
00230       else
00231           ! transient type
00232           sda_smioc_transi(il_transi)%ig_transi_type = PSMILe_bundle
00233 
00234           ! Read standard names
00235           DO il_bundle = 1, sda_smioc_transi(il_transi)%ig_nb_bndl
00236             id_error = &
00237                 sasa_c_get_element_9th_level_c (id_XML_doc, &
00238                 "simulationComposite/child/simulationRun/model/modelComponent", 0,                   &
00239                 "childComponent", 0, TRIM(cla_model_appli), 0, "childComponent", 0,                  &
00240                 TRIM(cla_model_comp), 0, "componentProperties", 0, "componentProperty", il_transi,   &
00241                 "componentProperty", il_bundle, "standardName", 0, "name", 0,                        &
00242                 sda_smioc_transi(il_transi)%cga_stand_name(il_bundle+1), il_length)
00243           END DO
00244       endif
00245 
00246       ! Units
00247       sda_smioc_transi(il_transi)%cg_units = ' '
00248       id_error = &
00249           sasa_c_get_attri_8th_level (id_XML_doc, &
00250           "simulationComposite/child/simulationRun/model/modelComponent", 0,                  &
00251           "childComponent", 0, TRIM(cla_model_appli), 0, "childComponent", 0,                 &
00252           TRIM(cla_model_comp), 0, "componentProperties", 0, "componentProperty", il_transi,  &
00253           "units", 0, "value", sda_smioc_transi(il_transi)%cg_units, il_length)
00254 
00255       ! if attribute "value" is not defined or <units> is not standard (Other)
00256       if (     sda_smioc_transi(il_transi)%cg_units .eq. "Other"    &
00257           .or. sda_smioc_transi(il_transi)%cg_units .eq. "other"    &
00258           .or. sda_smioc_transi(il_transi)%cg_units .eq. "OTHER"    &
00259           .or. sda_smioc_transi(il_transi)%cg_units .eq. " "          ) then
00260           
00261           ! Get the value of element <units>
00262           id_error = &
00263               sasa_c_get_element_7th_level_c (id_XML_doc, &
00264               "simulationComposite/child/simulationRun/model/modelComponent", 0,                  &
00265               "childComponent", 0, TRIM(cla_model_appli), 0, "childComponent", 0,                 &
00266               TRIM(cla_model_comp), 0, "componentProperties", 0, "componentProperty", il_transi,  &
00267               "units", 0, cla_char, il_length)
00268           sda_smioc_transi(il_transi)%cg_units = cla_char(1:il_length)
00269       endif
00270 
00271       ! Valid min value
00272       
00273       cla_char = ' '
00274       id_error = &
00275           sasa_c_get_attri_8th_level (id_XML_doc, &
00276           "simulationComposite/child/simulationRun/model/modelComponent", 0,                  &
00277           "childComponent", 0, TRIM(cla_model_appli), 0, "childComponent", 0,                 &
00278           TRIM(cla_model_comp), 0, "componentProperties", 0, "componentProperty", il_transi,  &
00279           "value", 0, "validMin", cla_char, il_length)
00280       if (il_length > 0) then
00281           ! Decode numeric value
00282           READ (cla_char, *, err=900) sda_smioc_transi(il_transi)%dg_transi_min
00283       else
00284    900    sda_smioc_transi(il_transi)%dg_transi_min = PSMILe_dundef
00285       endif
00286 
00287       ! Valid max value
00288       cla_char = ' '
00289       id_error = &
00290           sasa_c_get_attri_8th_level (id_XML_doc, &
00291           "simulationComposite/child/simulationRun/model/modelComponent", 0,                  &
00292           "childComponent", 0, TRIM(cla_model_appli), 0, "childComponent", 0,                 &
00293           TRIM(cla_model_comp), 0, "componentProperties", 0, "componentProperty", il_transi,  &
00294           "value", 0, "validMax", cla_char, il_length)
00295       if (il_length > 0) then
00296           ! Decode numeric value
00297           READ (cla_char, *, err=901) sda_smioc_transi(il_transi)%dg_transi_max
00298       else
00299    901    sda_smioc_transi(il_transi)%dg_transi_max = PSMILe_dundef
00300       endif
00301 
00302       ! Numerical type
00303       id_error = &
00304           sasa_c_get_attri_8th_level (id_XML_doc, &
00305           "simulationComposite/child/simulationRun/model/modelComponent", 0,                  &
00306           "childComponent", 0, TRIM(cla_model_appli), 0, "childComponent", 0,                 &
00307           TRIM(cla_model_comp), 0, "componentProperties", 0, "componentProperty", il_transi,  &
00308           "value", 0, "numericalType", cla_char, il_length)
00309     
00310       if (il_length > 0) then
00311           sda_smioc_transi(il_transi)%ig_datatype =                        &
00312             sasa_c_convert_char2int("xs:"//cla_char(1:il_length))
00313       else
00314           sda_smioc_transi(il_transi)%ig_datatype = PSMILe_undef
00315       endif
00316     ENDDO
00317 
00318     
00319     ! PART 2 :  CONNECTION FEATURES
00320     ! =============================
00321     
00322     ! Get the number of couplings
00323     id_error = &
00324         sasa_c_get_number_3rd_level (id_XML_doc, &
00325         "simulationComposite/child/simulationRun/model/modelComponent", 0,     &
00326         "composition", 0, "coupling", il_nb_couplings)
00327 
00328     ! Browse the couplings and connections involving this component
00329     ! -------------------------------------------------------------
00330     
00331     ! Prepare a predicate for the search of a <reference>-<name> element equal to component name
00332     cla_ref_comp = 'reference[normalize-space(name)="'//TRIM(cda_comp_name)//'"]'
00333     
00334     ! For all couplings
00335     DO il_coupling =1, il_nb_couplings
00336         
00337         ! Derive a character string from the coupling index
00338         WRITE (cla_coupling_index, *) il_coupling
00339         cla_coupling_index = ADJUSTL(cla_coupling_index)
00340         ! Build the XPath to the <coupling> XML element
00341         cla_xpath =      &
00342           "simulationComposite/child/simulationRun/model/modelComponent/composition/" // &
00343           "coupling[" //  TRIM(cla_coupling_index) // "]"
00344 
00345         
00346         ! PART 2A : OUT CONNECTION FEATURES
00347         ! ---------------------------------
00348         
00349         ! Test if this coupling involves the component as the source
00350         id_error = &
00351             sasa_c_get_number_6th_level (id_XML_doc, &
00352             "simulationComposite/child/simulationRun/model/modelComponent", 0,   &
00353             "composition", 0, "coupling", il_coupling, "couplingSource", 0,      &
00354             "dataSource", 0, TRIM(cla_ref_comp), il_test)
00355             
00356         ! if this coupling involves the component as the source
00357         ! "il_test" is 0 or 1
00358         if (il_test > 0) then
00359         
00360 #ifdef DEBUG
00361     print *,"component ", cda_comp_name, " is source"
00362     call psmile_flushstd
00363 #endif
00364 
00365             ! Check if the target of the coupling is a FILE (dataObject)
00366             id_error = &
00367                 sasa_c_get_number_7th_level (id_XML_doc, &
00368                 "simulationComposite/child/simulationRun/model/modelComponent", 0,   &
00369                 "composition", 0, "coupling", il_coupling, "couplingTarget", 0,      &
00370                 "dataSource", 0, "dataSource", 0, "dataObject", il_target_is_file)
00371 
00372             ! if it is a component (not a file) --  "il_target_is_file" is 1 or 0
00373             if (il_target_is_file == 0) then
00374                 ! Get target component name
00375                 cla_coupling_end = ' '
00376                 id_error = &
00377                     sasa_c_get_element_6th_level_c (id_XML_doc, &
00378                     "simulationComposite/child/simulationRun/model/modelComponent", 0,   &
00379                     "composition", 0, "coupling", il_coupling, "couplingTarget", 0,      &
00380                     "dataSource", 0, "reference", 0, "name", 0, cla_coupling_end, il_length)
00381                 
00382                 if (il_length .eq. 0) then
00383                     PRINT *, '************************************************'
00384                     PRINT *, 'Missing couplingTarget in XML <coupling> element'
00385                     PRINT *, '************************************************'
00386                     CALL PSMILe_Flushstd
00387 
00388                     CALL MPI_Abort(MPI_COMM_WORLD, 1, id_error)
00389                 endif
00390             endif 
00391 
00392             ! PART 2A.1 : OUT Connection features defined at <COUPLING> level
00393             ! ---------------------------------------------------------------
00394             
00395             ! Initialise <coupling> parameters
00396             
00397             ! Source exchange dates
00398             sl_coupling_out%ig_exch_date_type = PSMILe_undef
00399             sl_coupling_out%sg_exch_date%sg_period%second = PSMILe_dundef 
00400             sl_coupling_out%sg_exch_date%sg_period%minute = PSMILe_undef 
00401             sl_coupling_out%sg_exch_date%sg_period%hour = PSMILe_undef
00402             sl_coupling_out%sg_exch_date%sg_period%day = PSMILe_undef
00403             sl_coupling_out%sg_exch_date%sg_period%month = PSMILe_undef
00404             sl_coupling_out%sg_exch_date%sg_period%year = PSMILe_undef
00405             ! source lag
00406             sl_coupling_out%ig_lag = PSMILe_undef
00407             ! Source time operation
00408             sl_coupling_out%ig_src_timeop = PSMILe_undef
00409             ! Source statistics
00410             sl_coupling_out%iga_stats(:) = PSMILe_false
00411             ! source local transformations
00412             sl_coupling_out%sg_src_local_trans%ig_scatter = PSMILe_undef
00413             sl_coupling_out%sg_src_local_trans%dg_add_scalar = PSMILe_dundef
00414             sl_coupling_out%sg_src_local_trans%dg_mult_scalar = PSMILe_dundef
00415             ! Source debug mode
00416             sl_coupling_out%ig_debugmode = PSMILe_undef 
00417     
00418             ! Read coupling source parameters
00419             call get_cnct_source_details (id_XML_doc, TRIM(cla_xpath), .true., sl_coupling_out, id_error)
00420     
00421             
00422             ! PART 2A.2 : OUT Connection features defined at <CONNECTION> level
00423             ! -----------------------------------------------------------------
00424             
00425             ! For all connections of that coupling
00426             il_connection = 1
00427             ll_more_connections = .true.
00428             DO WHILE (ll_more_connections)
00429               ! Get name of connection source : it is a transient name
00430               cla_connection_end = ' '
00431               id_error = &
00432                   sasa_c_get_element_7th_level_c (id_XML_doc, &
00433                   "simulationComposite/child/simulationRun/model/modelComponent", 0,       &
00434                   "composition", 0, "coupling", il_coupling, "connection", il_connection,  &
00435                   "connectionSource", 0, "dataSource", 0, "reference", 0, "name", 0,       &
00436                   cla_connection_end, il_length)
00437 
00438               IF (il_length .eq. 0) then
00439                 ll_more_connections = .false.
00440               ELSE
00441                 ! Derive a character string from the connection index
00442                 WRITE (cla_connection_index, *) il_connection
00443                 cla_connection_index = ADJUSTL(cla_connection_index)
00444                 
00445                 ! Look for transient index "il_transi" based on transient's name
00446                 ! For all component's transients
00447                 DO il_transi =1, id_nb_transi
00448                   IF (cla_connection_end .eq. sda_smioc_transi(il_transi)%cg_local_name) then
00449                     exit
00450                   ENDIF
00451                 ENDDO
00452 
00453                 ! if transient name not defined in component
00454                 IF (il_transi .eq. id_nb_transi + 1) THEN
00455                     PRINT *, '*******************************************************************'
00456                     PRINT *, ' transient ', cla_connection_end, 'is referenced to '
00457                     PRINT *, ' as the source of a connection but not defined in component !'
00458                     PRINT *, '   application:', cda_app_name, 'component:', cda_comp_name
00459                     PRINT *, '*******************************************************************'
00460                     CALL PSMILe_Flushstd
00461                     CALL MPI_Abort(MPI_COMM_WORLD, 1, id_error)
00462                 ENDIF
00463 
00464                 ! Nb of output from this transient
00465                 sda_smioc_transi(il_transi)%ig_nb_transi_out =   &
00466                     sda_smioc_transi(il_transi)%ig_nb_transi_out + 1
00467                 il_output = sda_smioc_transi(il_transi)%ig_nb_transi_out
00468 
00469                 ! Copy parameters defined at Coupling level
00470                 sda_smioc_transi(il_transi)%sga_transi_out(il_output) = sl_coupling_out
00471 
00472                 ! Build the XPath to the <connection> XML element
00473                 cla_xpath =      &
00474                   "simulationComposite/child/simulationRun/model/modelComponent/composition/" // &
00475                   "coupling["//TRIM(cla_coupling_index) // "]/" //                            &
00476                   "connection["//TRIM(cla_connection_index) // "]"
00477 
00478                 ! Read connection source parameters
00479                 ! They supersede the parameters defined at coupling level
00480                 call get_cnct_source_details (id_XML_doc, TRIM(cla_xpath), .false.,        &
00481                     sda_smioc_transi(il_transi)%sga_transi_out(il_output), id_error)
00482 
00483                 ! Check if exchange rate is defined at some level
00484                 IF (sda_smioc_transi(il_transi)%sga_transi_out(il_output)%ig_exch_date_type  &
00485                     == PSMILe_undef) THEN
00486                     PRINT *, '*******************************************************************'
00487                     PRINT *, 'timeProfile missing for connection of transient ', cla_connection_end
00488                     PRINT *, '   application:', cda_app_name, 'component:', cda_comp_name
00489                     PRINT *, '*******************************************************************'
00490                     CALL PSMILe_Flushstd
00491 
00492                     CALL MPI_Abort(MPI_COMM_WORLD, 1, id_error)
00493                 ENDIF
00494 
00495                 ! If target is a file
00496                 if (il_target_is_file .eq. 1) then
00497                 
00498                     ll_file_io = .TRUE.        
00499                     sda_smioc_transi(il_transi)%sga_transi_out(il_output)% &
00500                         ig_dest_type = PSMILe_file
00501 
00502                     ! Read the name of the file variable = the connection target
00503                     id_error = &
00504                         sasa_c_get_element_7th_level_c (id_XML_doc, &
00505                         "simulationComposite/child/simulationRun/model/modelComponent", 0,       &
00506                         "composition", 0, "coupling", il_coupling, "connection", il_connection,  &
00507                         "connectionTarget", 0, "dataSource", 0, "reference", 0, "name", 0,       &
00508                         cla_char, il_length)
00509                     IF (il_length == 0) THEN
00510                         PRINT *, '*******************************************************************'
00511                         PRINT *, 'File variable name missing for connection of transient ', cla_connection_end
00512                         PRINT *, '   application:', cda_app_name, 'component:', cda_comp_name
00513                         PRINT *, '*******************************************************************'
00514                         CALL PSMILe_Flushstd
00515 
00516                         CALL MPI_Abort(MPI_COMM_WORLD, 1, id_error)
00517                     ELSE
00518                         sda_smioc_transi(il_transi)%sga_transi_out(il_output)%cg_dest_transi =  &
00519                           cla_char(1:il_length)
00520                         sda_smioc_transi(il_transi)%sga_transi_out(il_output)%cg_transi_out_name =  &
00521                           cla_char(1:il_length)
00522                     ENDIF
00523 
00524                     ! Build the XPath to the <dataObject> XML element
00525                     cla_xpath =      &
00526                       "simulationComposite/child/simulationRun/model/modelComponent/composition/" // &
00527                       "coupling["//TRIM(cla_coupling_index) //                                       &
00528                       "]/couplingTarget/dataSource/dataSource/dataObject"
00529     
00530                     ! Read file parameters
00531                     call get_file_details (id_XML_doc, TRIM(cla_xpath),                              &
00532                         TRIM(sda_smioc_transi(il_transi)%sga_transi_out(il_output)%cg_dest_transi),  &
00533                         sda_smioc_transi(il_transi)%sga_transi_out(il_output)%sg_dest_file,          &
00534                         id_error)
00535 
00536                     ! Check io_mode
00537                     IF (sda_smioc_transi(il_transi)%sga_transi_out(il_output)%    &
00538                         sg_dest_file%ig_file_iomode == PSMILe_undef) THEN
00539 #ifdef VERBOSE
00540                         PRINT *, '************************************************************'
00541                         PRINT *, 'no io_mode for file:',  &
00542                             sda_smioc_transi(il_transi)%sga_transi_out(il_output)%sg_dest_file%cg_file_name
00543                         PRINT *, '   default value iosingle will be used    '
00544                         PRINT *, '************************************************************'
00545 #endif
00546                         sda_smioc_transi(il_transi)%sga_transi_out(il_output)% &
00547                           sg_dest_file%ig_file_iomode = PSMILe_iosingle
00548                     ENDIF
00549 
00550                 else    ! target is a component
00551                 
00552                     sda_smioc_transi(il_transi)%sga_transi_out(il_output)% &
00553                         ig_dest_type = PSMILe_comp
00554                      
00555                     ! target component name
00556                     sda_smioc_transi(il_transi)%sga_transi_out(il_output)%  &
00557                         cg_dest_comp_name = cla_coupling_end
00558                     
00559                     ! Create a unique label, assigned to each connection end
00560                     ! in order to rebuild the connection from these labels
00561                     ! All this stuff is necessary for compatibility with SCC configuration data
00562                      
00563                     ! label : concatenation OF  coupling index  and  connection index
00564                     cla_char = TRIM(cla_coupling_index) // '-' // TRIM(cla_connection_index)
00565 
00566                     ! local label at source
00567                     sda_smioc_transi(il_transi)%sga_transi_out(il_output)%  &
00568                         cg_transi_out_name = cla_char 
00569                     ! distant label at source
00570                     sda_smioc_transi(il_transi)%sga_transi_out(il_output)%  &
00571                         cg_dest_transi = cla_char
00572                 endif
00573               
00574 
00575               ENDIF
00576 
00577               ! Go to next connection
00578               il_connection = il_connection + 1
00579             ENDDO
00580         endif
00581     
00582         
00583         ! PART 2B : IN CONNECTION FEATURES
00584         ! --------------------------------
00585         
00586         ! Test if this coupling involves the component as the target
00587         id_error = &
00588             sasa_c_get_number_6th_level (id_XML_doc, &
00589             "simulationComposite/child/simulationRun/model/modelComponent", 0,   &
00590             "composition", 0, "coupling", il_coupling, "couplingTarget", 0,      &
00591             "dataSource", 0, TRIM(cla_ref_comp), il_test)
00592             
00593         ! if this coupling involves the component as the target
00594         ! "il_test" is 0 or 1
00595         if (il_test > 0) then
00596         
00597 #ifdef DEBUG
00598     print *,"component ", cda_comp_name, " is target"
00599     call psmile_flushstd
00600 #endif
00601             ! Check if the source of the coupling is a FILE (dataObject)
00602             id_error = &
00603                 sasa_c_get_number_7th_level (id_XML_doc, &
00604                 "simulationComposite/child/simulationRun/model/modelComponent", 0,   &
00605                 "composition", 0, "coupling", il_coupling, "couplingSource", 0,      &
00606                 "dataSource", 0, "dataSource", 0, "dataObject", il_source_is_file)
00607 
00608             ! if it is a component (not a file) --  "il_source_is_file" is 1 or 0
00609             if (il_source_is_file == 0) then
00610                 ! Get source component name
00611                 cla_coupling_end = ' '
00612                 id_error = &
00613                     sasa_c_get_element_6th_level_c (id_XML_doc, &
00614                     "simulationComposite/child/simulationRun/model/modelComponent", 0,   &
00615                     "composition", 0, "coupling", il_coupling, "couplingSource", 0,      &
00616                     "dataSource", 0, "reference", 0, "name", 0, cla_coupling_end, il_length)
00617                 
00618                 if (il_length .eq. 0) then
00619                     PRINT *, '************************************************'
00620                     PRINT *, 'Missing couplingSource in XML <coupling> element'
00621                     PRINT *, '************************************************'
00622                     CALL PSMILe_Flushstd
00623 
00624                     CALL MPI_Abort(MPI_COMM_WORLD, 1, id_error)
00625                 endif
00626             endif 
00627 
00628             ! PART 2B.1 : IN Connection features defined at <COUPLING> level
00629             ! --------------------------------------------------------------
00630 
00631             ! Initialise <coupling> parameters
00632 
00633             ! exchange dates
00634             sl_coupling_in%ig_exch_date_type = PSMILe_undef
00635             sl_coupling_in%sg_exch_date%sg_period%second = PSMILe_dundef 
00636             sl_coupling_in%sg_exch_date%sg_period%minute = PSMILe_undef 
00637             sl_coupling_in%sg_exch_date%sg_period%hour = PSMILe_undef
00638             sl_coupling_in%sg_exch_date%sg_period%day = PSMILe_undef
00639             sl_coupling_in%sg_exch_date%sg_period%month = PSMILe_undef
00640             sl_coupling_in%sg_exch_date%sg_period%year = PSMILe_undef
00641             ! target local transformations
00642             sl_coupling_in%sg_tgt_local_trans%ig_gather = PSMILe_undef
00643             sl_coupling_in%sg_tgt_local_trans%dg_add_scalar = PSMILe_dundef
00644             sl_coupling_in%sg_tgt_local_trans%dg_mult_scalar = PSMILe_dundef
00645             ! target time operation
00646             sl_coupling_in%ig_tgt_timeop = PSMILe_undef
00647             ! target statistics
00648             sl_coupling_in%iga_stats(:) = PSMILe_false
00649             ! target debug mode
00650             sl_coupling_in%ig_debugmode = PSMILe_undef 
00651 
00652             ! Spatial interpolations
00653             sl_coupling_interp%ig_interp_type = PSMILe_undef
00654             sl_coupling_interp%iga_interp_meth(:) = PSMILe_undef
00655             sl_coupling_interp%iga_arg1(:) = PSMILe_undef
00656             sl_coupling_interp%iga_arg2(:) = PSMILe_undef
00657             sl_coupling_interp%iga_arg3(:) = PSMILe_global
00658             sl_coupling_interp%iga_arg4(:) = PSMILe_undef
00659             sl_coupling_interp%iga_arg5(:) = PSMILe_undef
00660             sl_coupling_interp%iga_arg6(:) = PSMILe_undef
00661             sl_coupling_interp%iga_arg7(:) = PSMILe_undef
00662             sl_coupling_interp%dg_arg8 = PSMILe_dundef
00663             sl_coupling_interp%cg_arg9 = '    '
00664             sl_coupling_interp%sg_arg10%cg_file_name = '    '               
00665             sl_coupling_interp%sg_arg10%ig_suffix = PSMILe_false 
00666             sl_coupling_interp%sg_arg10%ig_file_format = PSMILe_undef         
00667             sl_coupling_interp%sg_arg10%ig_file_set = PSMILe_undef         
00668             sl_coupling_interp%sg_arg10%ig_file_iomode = PSMILe_undef         
00669             sl_coupling_interp%sg_arg10%ig_file_pack = PSMILe_undef         
00670             sl_coupling_interp%sg_arg10%dg_file_scal = PSMILe_dundef
00671             sl_coupling_interp%sg_arg10%dg_file_add = PSMILe_dundef
00672             sl_coupling_interp%sg_arg10%dg_fill_val = PSMILe_dundef
00673 
00674             ! Read coupling target parameters
00675             call get_cnct_target_details (id_XML_doc, TRIM(cla_xpath), .true., il_source_is_file /= 0, &
00676                 sl_coupling_in, id_error)
00677 
00678             ! ***** Check if Spatial regridding is defined at Coupling level
00679             id_error = &
00680                 sasa_c_get_number_4th_level (id_XML_doc, &
00681                 "simulationComposite/child/simulationRun/model/modelComponent", 0,    &
00682                 "composition", 0, "coupling", il_coupling,                            &
00683                 'spatialRegridding', il_nb_regrid)
00684     
00685             if (il_nb_regrid .ne. 0) then
00686                 ! Read the regridding details
00687                 call get_regrid_details (id_XML_doc, TRIM(cla_xpath), il_nb_regrid,                 &
00688                     sl_coupling_interp, id_error)
00689             endif
00690     
00691 
00692             ! PART 2B.2 : IN Connection features defined at <CONNECTION> level
00693             ! ----------------------------------------------------------------
00694 
00695             ! For all connections of that coupling
00696             il_connection = 1
00697             ll_more_connections = .true.
00698             DO WHILE (ll_more_connections)
00699               ! Get target name of next connection : it is a transient name
00700               cla_connection_end = ' '
00701               id_error = &
00702                   sasa_c_get_element_7th_level_c (id_XML_doc, &
00703                   "simulationComposite/child/simulationRun/model/modelComponent", 0,       &
00704                   "composition", 0, "coupling", il_coupling, "connection", il_connection,  &
00705                   "connectionTarget", 0, "dataSource", 0, "reference", 0, "name", 0,       &
00706                   cla_connection_end, il_length)
00707 
00708               IF (il_length .eq. 0) then
00709                 ll_more_connections = .false.
00710               ELSE
00711 
00712 #ifdef DEBUG
00713     print *,"connection, cla_connection_end", il_connection, cla_connection_end
00714     call psmile_flushstd
00715 #endif
00716                 ! Derive a character string from the connection index
00717                 WRITE (cla_connection_index, *) il_connection
00718                 cla_connection_index = ADJUSTL(cla_connection_index)
00719                 
00720                 ! Look for transient index based on target transient name
00721                 ! For all component's transients
00722                 DO il_transi =1, id_nb_transi
00723                   IF (cla_connection_end .eq. sda_smioc_transi(il_transi)%cg_local_name) then
00724                     exit
00725                   ENDIF
00726                 ENDDO
00727 
00728                 ! if transient name not defined in component
00729                 IF (il_transi .eq. id_nb_transi + 1) THEN
00730                     PRINT *, '*******************************************************************'
00731                     PRINT *, ' transient ', cla_connection_end, 'is referenced to '
00732                     PRINT *, ' as the target of a connection but not defined in component !'
00733                     PRINT *, '   application:', cda_app_name, 'component:', cda_comp_name
00734                     PRINT *, '*******************************************************************'
00735                     CALL PSMILe_Flushstd
00736                     CALL MPI_Abort(MPI_COMM_WORLD, 1, id_error)
00737                 ENDIF
00738 
00739                 ! Nb of input to this transient
00740                 sda_smioc_transi(il_transi)%sg_transi_in%ig_nb_in_orig =   &
00741                     sda_smioc_transi(il_transi)%sg_transi_in%ig_nb_in_orig + 1
00742                 il_input = sda_smioc_transi(il_transi)%sg_transi_in%ig_nb_in_orig
00743 
00744                 ! Copy parameters defined at Coupling level
00745                 ! -----------------------------------------
00746             
00747                 ! exchange dates
00748                 sda_smioc_transi(il_transi)%sg_transi_in%ig_exch_date_type =  &
00749                     sl_coupling_in%ig_exch_date_type
00750                 sda_smioc_transi(il_transi)%sg_transi_in%sg_exch_date =       &
00751                     sl_coupling_in%sg_exch_date
00752                 ! target local transformations
00753                 sda_smioc_transi(il_transi)%sg_transi_in%sg_tgt_local_trans = &
00754                     sl_coupling_in%sg_tgt_local_trans
00755                 ! target time operation
00756                 sda_smioc_transi(il_transi)%sg_transi_in%ig_tgt_timeop =   &
00757                     sl_coupling_in%ig_tgt_timeop
00758                 ! target statistics
00759                 sda_smioc_transi(il_transi)%sg_transi_in%iga_stats(:) =    &
00760                     sl_coupling_in%iga_stats(:)
00761                 ! target debug mode
00762                 sda_smioc_transi(il_transi)%sg_transi_in%ig_debugmode =    &
00763                     sl_coupling_in%ig_debugmode
00764                 ! Regridding parameters
00765                 sda_smioc_transi(il_transi)%sg_transi_in%sga_in_orig(il_input)%sg_interp = &
00766                     sl_coupling_interp
00767                     
00768                 ! Build the XPath to the <connection> XML element
00769                 cla_xpath =      &
00770                   "simulationComposite/child/simulationRun/model/modelComponent/composition/" // &
00771                   "coupling["//TRIM(cla_coupling_index) // "]/" //                            &
00772                   "connection["//TRIM(cla_connection_index) // "]"
00773                 
00774                 ! Read connection target parameters
00775                 ! They supersede the parameters defined at coupling level
00776                 call get_cnct_target_details (id_XML_doc, TRIM(cla_xpath), .false., il_source_is_file /= 0, &
00777                     sda_smioc_transi(il_transi)%sg_transi_in, id_error)
00778 
00779                 ! Check if exchange rate is defined at some level
00780                 IF (sda_smioc_transi(il_transi)%sg_transi_in%ig_exch_date_type == PSMILe_undef) THEN
00781                     PRINT *, '*******************************************************************'
00782                     PRINT *, 'timeProfile missing for connection of transient ', cla_connection_end
00783                     PRINT *, '   application:', cda_app_name, 'component:', cda_comp_name
00784                     PRINT *, '*******************************************************************'
00785                     CALL PSMILe_Flushstd
00786       
00787                     CALL MPI_Abort(MPI_COMM_WORLD, 1, id_error)
00788                 ENDIF
00789 
00790                 ! *** Check if target debug mode
00791                 IF (sda_smioc_transi(il_transi)%sg_transi_in%ig_debugmode .EQ. PSMILe_true) THEN
00792                     ll_debug_io = .TRUE.
00793                 ENDIF
00794 
00795                 ! ***** Check if Spatial regridding is defined at Connection level
00796                 id_error = &
00797                     sasa_c_get_number_5th_level (id_XML_doc, &
00798                     "simulationComposite/child/simulationRun/model/modelComponent", 0,        &
00799                     "composition", 0, "coupling", il_coupling, "connection", il_connection,   &
00800                     'spatialRegridding', il_nb_regrid)
00801 
00802                 if (il_nb_regrid .ne. 0) then
00803                     ! Read the regridding element details
00804                     ! That regridding supersede the regridding defined at coupling level
00805                     call get_regrid_details (id_XML_doc, TRIM(cla_xpath), il_nb_regrid,                 &
00806                        sda_smioc_transi(il_transi)%sg_transi_in%sga_in_orig(il_input)%sg_interp,  &
00807                        id_error)
00808                     ! if user defined interpolation
00809                     IF (sda_smioc_transi(il_transi)%sg_transi_in%sga_in_orig(il_input)%   &
00810                         sg_interp%iga_interp_meth(1) == PSMILe_user3D) THEN
00811                         !  gather info on User-defined interpolation during first pass
00812                         IF ( ld_userdef_details ) THEN
00813                             !  flag true for this origin
00814                             sga_comp_udef_idx(id_comp)%sla_driver_udef(il_transi)%    &
00815                                 lga_trin_orig(il_input) = .true.
00816                             !  flag true for this XML transient 
00817                             sga_comp_udef_idx(id_comp)%sla_driver_udef(il_transi)%    &
00818                                 lg_trans_ud = .true.
00819                             !  store name of transient for gridless grid name generation
00820                             sga_comp_udef_idx(id_comp)%sla_driver_udef(il_transi)%    &
00821                                 cg_local_name = sda_smioc_transi(il_transi)%cg_local_name
00822                         ENDIF
00823                     ENDIF
00824                 endif
00825 
00826                 ! If source is a file
00827                 if (il_source_is_file .eq. 1) then
00828                 
00829                     ll_file_io = .TRUE.        
00830                     sda_smioc_transi(il_transi)%sg_transi_in%             &
00831                       sga_in_orig(il_input)%ig_orig_type = PSMILe_file
00832                 
00833                     ! Read the name of the file variable = the connection source
00834                     id_error = &
00835                         sasa_c_get_element_7th_level_c (id_XML_doc, &
00836                         "simulationComposite/child/simulationRun/model/modelComponent", 0,       &
00837                         "composition", 0, "coupling", il_coupling, "connection", il_connection,  &
00838                         "connectionSource", 0, "dataSource", 0, "reference", 0, "name", 0,       &
00839                         cla_char, il_length)
00840 
00841                     IF (il_length == 0) THEN
00842                         PRINT *, '*******************************************************************'
00843                         PRINT *, 'File variable name missing for connection of transient ', cla_connection_end
00844                         PRINT *, '   application:', cda_app_name, 'component:', cda_comp_name
00845                         PRINT *, '*******************************************************************'
00846                         CALL PSMILe_Flushstd
00847 
00848                         CALL MPI_Abort(MPI_COMM_WORLD, 1, id_error)
00849                     ELSE
00850                         sda_smioc_transi(il_transi)%sg_transi_in%sga_in_orig(il_input)%cg_orig_transi =  &
00851                           cla_char(1:il_length)
00852                     ENDIF
00853 
00854                     ! Build the XPath to the <dataObject> XML element
00855                     cla_xpath =      &
00856                       "simulationComposite/child/simulationRun/model/modelComponent/composition/" // &
00857                       "coupling[" // TRIM(cla_coupling_index) //                                     &
00858                       "]/couplingSource/dataSource/dataSource/dataObject"
00859     
00860                     ! Read file parameters
00861                     call get_file_details (id_XML_doc, TRIM(cla_xpath),                               &
00862                         TRIM(sda_smioc_transi(il_transi)%sg_transi_in%sga_in_orig(il_input)%          &
00863                         cg_orig_transi),                                                              &
00864                         sda_smioc_transi(il_transi)%sg_transi_in%sga_in_orig(il_input)%sg_orig_file,  &
00865                         id_error)
00866 
00867                     ! Check io_mode
00868                     IF (sda_smioc_transi(il_transi)%sg_transi_in%sga_in_orig(il_input)%    &
00869                         sg_orig_file%ig_file_iomode == PSMILe_undef) THEN
00870 #ifdef VERBOSE
00871                         PRINT *, '************************************************************'
00872                         PRINT *, 'no io_mode for file:',  &
00873                             sda_smioc_transi(il_transi)%sg_transi_in%sga_in_orig(il_input)%sg_orig_file%cg_file_name
00874                         PRINT *, '   default value iosingle will be used    '
00875                         PRINT *, '************************************************************'
00876 #endif
00877                         sda_smioc_transi(il_transi)%sg_transi_in%sga_in_orig(il_input)% &
00878                           sg_orig_file%ig_file_iomode = PSMILe_iosingle
00879                     ENDIF
00880 
00881                 else    ! source is a component
00882                 
00883                     sda_smioc_transi(il_transi)%sg_transi_in%             &
00884                       sga_in_orig(il_input)%ig_orig_type = PSMILe_comp
00885                      
00886                     ! Source component name              
00887                     sda_smioc_transi(il_transi)%sg_transi_in%sga_in_orig(il_input)%  &
00888                         cg_orig_comp_name = cla_coupling_end
00889                     
00890                     ! Create a unique label, assigned to each connection end
00891                     ! in order to rebuild the connection from these labels
00892                     ! All this stuff is necessary for compatibility with SCC configuration data
00893                      
00894                     ! label : concatenation OF  coupling index  and  connection index
00895                     cla_char = TRIM(cla_coupling_index) // '-' // TRIM(cla_connection_index)
00896 
00897                     ! local label at target
00898                     sda_smioc_transi(il_transi)%sg_transi_in%sga_in_orig(il_input)%  &
00899                         cg_transi_in_name = cla_char 
00900                     ! distant label at target
00901                     sda_smioc_transi(il_transi)%sg_transi_in%sga_in_orig(il_input)%  &
00902                         cg_orig_transi = cla_char
00903   
00904                 endif
00905                  
00906               ENDIF
00907 
00908               ! Go to next connection
00909               il_connection = il_connection + 1
00910             ENDDO
00911         endif
00912     
00913     ENDDO
00914     
00915 #else
00916 
00917     ! Configuration data are in a SMIOC file
00918     ! --------------------------------------
00919 
00920 ! For all the transient_in of the component
00921     DO ib =1, id_nb_transi
00922 
00923 ! * get the transient level informations
00924       id_error = &
00925          sasa_c_get_attri_2nd_level (id_XML_doc,                     &
00926          'component', 0, 'transient', ib, 'local_name',         &
00927          sda_smioc_transi(ib)%cg_local_name, il_length)
00928 
00929       id_error = &
00930          sasa_c_get_attri_2nd_level (id_XML_doc,                     &
00931          'component', 0, 'transient', ib, 'long_name',          &
00932          sda_smioc_transi(ib)%cg_long_name, il_length)
00933 
00934       id_error = &
00935          sasa_c_get_attri_1st_level (id_XML_doc,                     &
00936          'component', 0, 'local_name',                          &
00937          sda_smioc_transi(ib)%cg_comp_name, il_length)
00938 
00939       id_error = &
00940          sasa_c_get_number_3rd_level(id_XML_doc,                             &
00941          'component', 0, 'transient', ib, 'transient_standard_name',    &
00942          il_nb)
00943 
00944       DO ib_bis = 1, il_nb
00945 
00946         id_error = &
00947            sasa_c_get_element_2nd_level_c (id_XML_doc,                        &
00948            'component', 0, 'transient', ib, 'transient_standard_name',   &
00949            ib_bis, sda_smioc_transi(ib)%cga_stand_name(ib_bis), il_length)
00950 
00951       END DO
00952 
00953       id_error = &
00954          sasa_c_get_attri_3rd_level (id_XML_doc,                     &
00955          'component', 0, 'transient', ib, 'physics', 0,         &
00956          'transient_type', cla_char, il_length)
00957       sda_smioc_transi(ib)%ig_transi_type =                     &
00958          sasa_c_convert_char2int(cla_char(1:il_length))
00959 
00960       id_error = &
00961          sasa_c_get_element_3rd_level_c (id_XML_doc,                 &
00962          'component', 0, 'transient', ib, 'physics', 0,         &
00963          'physical_units', 0, sda_smioc_transi(ib)%cg_units, il_length)
00964 
00965       id_error = &
00966          sasa_c_get_element_3rd_level_d (id_XML_doc,                 &
00967          'component', 0, 'transient', ib, 'physics', 0,         &
00968          'valid_min', 0, sda_smioc_transi(ib)%dg_transi_min)
00969 
00970       id_error = &
00971          sasa_c_get_element_3rd_level_d (id_XML_doc,                 &
00972          'component', 0, 'transient', ib, 'physics', 0,         &
00973          'valid_max', 0, sda_smioc_transi(ib)%dg_transi_max)
00974 
00975       id_error = &
00976          sasa_c_get_element_3rd_level_i (id_XML_doc,                 &
00977          'component', 0, 'transient', ib, 'physics', 0,         &
00978          'nbr_bundles', 0, sda_smioc_transi(ib)%ig_nb_bndl)
00979       IF (sda_smioc_transi(ib)%ig_nb_bndl .eq. -280177) THEN
00980           sda_smioc_transi(ib)%ig_nb_bndl = 0
00981       END IF
00982 
00983       id_error = &
00984          sasa_c_get_attri_3rd_level (id_XML_doc,                     &
00985          'component', 0, 'transient', ib, 'numerics', 0,        &
00986          'datatype', cla_char, il_length)
00987       sda_smioc_transi(ib)%ig_datatype =                        &
00988          sasa_c_convert_char2int(cla_char(1:il_length))
00989 
00990 ! ** Get the transient_in informations
00991 
00992 !!$! *** Get the shortest period of exchange
00993 !!$      id_error = &
00994 !!$         sasa_c_get_element_5th_level_i (id_XML_doc,         &
00995 !!$         'component', 0, 'transient', ib, 'intent', 0,  &
00996 !!$         'input', 0, 'minimal_period', 0, 'nbr_secs', 0,     &
00997 !!$         il_test)
00998 !!$      sda_smioc_transi(ib)%sg_transi_in%sg_min_period%second = il_test
00999 !!$
01000 !!$      id_error = &
01001 !!$         sasa_c_get_element_5th_level_i (id_XML_doc,         &
01002 !!$         'component', 0, 'transient', ib, 'intent', 0,  &
01003 !!$         'input', 0, 'minimal_period', 0,                    &
01004 !!$         'nbr_mins', 0, sda_smioc_transi(ib)%sg_transi_in%sg_min_period%minute)
01005 !!$
01006 !!$      id_error = &
01007 !!$         sasa_c_get_element_5th_level_i (id_XML_doc,         &
01008 !!$         'component', 0, 'transient', ib, 'intent', 0,  &
01009 !!$         'input', 0, 'minimal_period', 0,                    &
01010 !!$         'nbr_hours', 0, sda_smioc_transi(ib)%sg_transi_in%sg_min_period%hour)
01011 !!$
01012 !!$      id_error = &
01013 !!$         sasa_c_get_element_5th_level_i (id_XML_doc,         &
01014 !!$         'component', 0, 'transient', ib, 'intent', 0,  &
01015 !!$         'input', 0, 'minimal_period', 0,                    &
01016 !!$         'nbr_days', 0, sda_smioc_transi(ib)%sg_transi_in%sg_min_period%day)
01017 !!$
01018 !!$      id_error = &
01019 !!$         sasa_c_get_element_5th_level_i (id_XML_doc,         &
01020 !!$         'component', 0, 'transient', ib, 'intent', 0,  &
01021 !!$         'input', 0, 'minimal_period', 0,                    &
01022 !!$         'nbr_months', 0,sda_smioc_transi(ib)%sg_transi_in%sg_min_period%month)
01023 !!$
01024 !!$      id_error = &
01025 !!$         sasa_c_get_element_5th_level_i (id_XML_doc,         &
01026 !!$         'component', 0, 'transient', ib, 'intent', 0,  &
01027 !!$         'input', 0, 'minimal_period', 0,                    &
01028 !!$         'nbr_years', 0, sda_smioc_transi(ib)%sg_transi_in%sg_min_period%year)
01029 
01030 ! *** Get the exchange date format (is it the period format)
01031       id_error = &
01032          sasa_c_get_number_6th_level(id_XML_doc,             &
01033          'component', 0, 'transient', ib, 'intent', 0,  &
01034          'input', 0, 'exchange_date', 0, 'period',           &
01035          il_nb)
01036 
01037 ! **** Get the exchange date if it is the period format)
01038       IF (il_nb .eq. 1) THEN
01039 
01040           sda_smioc_transi(ib)%sg_transi_in%ig_exch_date_type = PSMILe_period
01041 
01042           id_error = &
01043              sasa_c_get_element_6th_level_d (id_XML_doc,         &
01044              'component', 0, 'transient', ib, 'intent', 0,  &
01045              'input', 0, 'exchange_date', 0, 'period', 0,        &
01046              'second', 0, dl_test)
01047           sda_smioc_transi(ib)%sg_transi_in%sg_exch_date%sg_period%second= &
01048              dl_test
01049           id_error = &
01050              sasa_c_get_element_6th_level_i (id_XML_doc,         &
01051              'component', 0, 'transient', ib, 'intent', 0,  &
01052              'input', 0, 'exchange_date', 0, 'period', 0,        &
01053              'minute', 0,                                        &
01054              sda_smioc_transi(ib)%sg_transi_in%sg_exch_date%sg_period%minute)
01055 
01056           id_error = &
01057              sasa_c_get_element_6th_level_i (id_XML_doc,         &
01058              'component', 0, 'transient', ib, 'intent', 0,  &
01059              'input', 0, 'exchange_date', 0, 'period', 0,        &
01060              'hour', 0,                                          &
01061              sda_smioc_transi(ib)%sg_transi_in%sg_exch_date%sg_period%hour)
01062 
01063           id_error = &
01064              sasa_c_get_element_6th_level_i (id_XML_doc,         &
01065              'component', 0, 'transient', ib, 'intent', 0,  &
01066              'input', 0, 'exchange_date', 0, 'period', 0,        &
01067              'day', 0,                                           &
01068              sda_smioc_transi(ib)%sg_transi_in%sg_exch_date%sg_period%day)
01069 
01070           id_error = &
01071              sasa_c_get_element_6th_level_i (id_XML_doc,         &
01072              'component', 0, 'transient', ib, 'intent', 0,  &
01073              'input', 0, 'exchange_date', 0, 'period', 0,        &
01074              'month', 0,                                         &
01075              sda_smioc_transi(ib)%sg_transi_in%sg_exch_date%sg_period%month)
01076 
01077           id_error = &
01078              sasa_c_get_element_6th_level_i (id_XML_doc,         &
01079              'component', 0, 'transient', ib, 'intent', 0,  &
01080              'input', 0, 'exchange_date', 0, 'period', 0,        &
01081              'year', 0,                                          &
01082              sda_smioc_transi(ib)%sg_transi_in%sg_exch_date%sg_period%year)
01083 
01084       END IF
01085 
01086 ! *** Get the exchange date format (is it the once format)
01087       id_error = &
01088          sasa_c_get_number_6th_level(id_XML_doc,             &
01089          'component', 0, 'transient', ib, 'intent', 0,  &
01090          'input', 0, 'exchange_date', 0, 'once',             & 
01091          il_nb)
01092 
01093 ! **** Get the exchange date if it is the precise format)
01094       IF (il_nb .eq. 1) THEN
01095 
01096           sda_smioc_transi(ib)%sg_transi_in%ig_exch_date_type = &
01097              PSMILe_once
01098 
01099           PRINT *, '******************************************************'
01100           PRINT *, 'The once format for exchange date is not yet supported'
01101           PRINT *, '******************************************************'
01102           CALL PSMILe_Flushstd
01103 
01104           CALL MPI_Abort(MPI_COMM_WORLD, 1, id_error)
01105 
01106       END IF
01107 
01108 ! *** Get the exchange date format (is it the precise_list format)
01109       id_error = &
01110          sasa_c_get_number_6th_level(id_XML_doc,             &
01111          'component', 0, 'transient', ib, 'intent', 0,  &
01112          'input', 0, 'exchange_date', 0, 'precise_list',     & 
01113          il_nb)
01114 
01115 ! **** Get the exchange date if it is the precise_list format)
01116       IF (il_nb .eq. 1) THEN
01117 
01118           sda_smioc_transi(ib)%sg_transi_in%ig_exch_date_type = &
01119              PSMILe_preciseday
01120 
01121           PRINT *, '**************************************************************'
01122           PRINT *, 'The precise_list format for exchange date is not yet supported'
01123           PRINT *, '**************************************************************'
01124           CALL PSMILe_Flushstd
01125 
01126           CALL MPI_Abort(MPI_COMM_WORLD, 1, id_error)
01127 
01128       END IF
01129 
01130 ! *** Get the exchange date format (is it the date_list format)
01131       id_error = &
01132          sasa_c_get_number_6th_level(id_XML_doc,             &
01133          'component', 0, 'transient', ib, 'intent', 0,  &
01134          'input', 0, 'exchange_date', 0, 'date_list',        & 
01135          il_nb)
01136 
01137 ! **** Get the exchange date if it is the date_list format)
01138       IF (il_nb .eq. 1) THEN
01139 
01140           sda_smioc_transi(ib)%sg_transi_in%ig_exch_date_type = &
01141              PSMILe_list
01142 
01143           PRINT *, '******************************************************'
01144           PRINT *, 'The date_list format for exchange date is not yet supported'
01145           PRINT *, '******************************************************'
01146           CALL PSMILe_Flushstd
01147 
01148           CALL MPI_Abort(MPI_COMM_WORLD, 1, id_error)
01149 
01150       END IF
01151 
01152 ! *** Get the exchange date format (is it the lastdayinmonth format)
01153       id_error = &
01154          sasa_c_get_number_6th_level(id_XML_doc,                &
01155          'component', 0, 'transient', ib, 'intent', 0,     &
01156          'input', 0, 'exchange_date', 0, 'lastdayinmonth',      &
01157          il_nb)
01158 
01159 ! **** Get the exchange date if it is the lastdayinmonth format)
01160       IF (il_nb .eq. 1) THEN
01161 
01162           sda_smioc_transi(ib)%sg_transi_in%ig_exch_date_type = &
01163              PSMILe_lastdayinmo
01164 
01165           PRINT *, '****************************************************************'
01166           PRINT *, 'The lastdayinmonth format for exchange date is not yet supported'
01167           PRINT *, '****************************************************************'
01168           CALL PSMILe_Flushstd
01169 
01170           CALL MPI_Abort(MPI_COMM_WORLD, 1, id_error)
01171 
01172       END IF
01173 
01174 ! *** Get the debug mode
01175       id_error = &
01176          sasa_c_get_element_4th_level_c (id_XML_doc,         &
01177          'component', 0, 'transient', ib, 'intent', 0,  &
01178          'input', 0, 'debug_mode', 0, cla_char, il_length)
01179       sda_smioc_transi(ib)%sg_transi_in%ig_debugmode = &
01180          sasa_c_convert_char2int(cla_char(1:il_length))
01181 
01182       IF (sda_smioc_transi(ib)%sg_transi_in%ig_debugmode .EQ. PSMILe_true) THEN
01183           ll_debug_io = .TRUE.
01184       ENDIF
01185 ! *** Get the target time operation
01186       id_error = &
01187          sasa_c_get_element_5th_level_c (id_XML_doc,         &
01188          'component', 0, 'transient', ib, 'intent', 0,  &
01189          'input', 0, 'target_transformation', 0,             &
01190          'target_time_operation', 0, cla_char, il_length)
01191       sda_smioc_transi(ib)%sg_transi_in%ig_tgt_timeop = &
01192          sasa_c_convert_char2int(cla_char(1:il_length))
01193 
01194 ! *** Get the target local transformations informations
01195       id_error = &
01196          sasa_c_get_number_6th_level(id_XML_doc,                         &
01197          'component', 0, 'transient', ib, 'intent', 0, 'input', 0,  &
01198          'target_transformation', 0, 'target_local_transformation',      &
01199          il_nb)
01200 
01201       IF (il_nb .eq. 1) THEN
01202 
01203           id_error = &
01204              sasa_c_get_element_6th_level_d (id_XML_doc,                      &
01205              'component', 0, 'transient', ib, 'intent', 0, 'input', 0,   &
01206              'target_transformation', 0, 'target_local_transformation', 0,    &
01207              'mult_scalar', 0, dl_test)
01208           if ( dl_test /= PSMILe_dundef ) then
01209               sda_smioc_transi(ib)%sg_transi_in%sg_tgt_local_trans% &
01210                  dg_mult_scalar=dl_test
01211           endif
01212 
01213           id_error = &
01214              sasa_c_get_element_6th_level_d (id_XML_doc,                    &
01215              'component', 0, 'transient', ib, 'intent', 0, 'input', 0, &
01216              'target_transformation', 0, 'target_local_transformation', 0,  &
01217              'add_scalar', 0, dl_test)
01218           if ( dl_test /= PSMILe_dundef ) then
01219               sda_smioc_transi(ib)%sg_transi_in%sg_tgt_local_trans% &
01220                  dg_add_scalar = dl_test
01221           endif
01222 
01223           id_error = &
01224              sasa_c_get_element_6th_level_c (id_XML_doc,                    &
01225              'component', 0, 'transient', ib, 'intent', 0, 'input', 0, &
01226              'target_transformation', 0, 'target_local_transformation', 0,  &
01227              'gathering', 0, cla_char, il_length)
01228           sda_smioc_transi(ib)%sg_transi_in%sg_tgt_local_trans%ig_gather = &
01229              sasa_c_convert_char2int(cla_char(1:il_length))
01230 
01231       END IF
01232 
01233 ! *** Set to one the integer that indicates if the stat is used or not
01234       sda_smioc_transi(ib)%sg_transi_in%iga_stats = 0
01235       id_error = &
01236          sasa_c_get_number_6th_level (id_XML_doc,                           &
01237          'component', 0, 'transient', ib, 'intent', 0, 'input', 0,     &
01238          'target_transformation', 0, 'statistics', il_nb)
01239 
01240       IF (il_nb .eq. 1) THEN
01241 
01242           id_error = &
01243              sasa_c_get_number_7th_level (id_XML_doc,                        &
01244              'component', 0, 'transient', ib, 'intent', 0, 'input', 0,  &
01245              'target_transformation', 0, 'statistics', 0,                    &
01246              'masked_points', il_nb_bis)
01247 
01248           IF (il_nb_bis .eq. 1) THEN
01249               id_error = &
01250               sasa_c_get_element_6th_level_c (id_XML_doc,                    &
01251              'component', 0, 'transient', ib, 'intent', 0, 'input', 0,  &
01252              'target_transformation', 0, 'statistics', 0,                    &
01253              'masked_points', 0, cla_char, il_length)
01254              sda_smioc_transi(ib)%sg_transi_in%iga_stats(1) = &
01255              sasa_c_convert_char2int(cla_char(1:il_length))
01256           END IF
01257 
01258           id_error = &
01259              sasa_c_get_number_7th_level (id_XML_doc,                        &
01260              'component', 0, 'transient', ib, 'intent', 0, 'input', 0,  &
01261              'target_transformation', 0, 'statistics', 0,                    &
01262              'notmasked_points', il_nb_bis)
01263 
01264           IF (il_nb_bis .eq. 1) THEN
01265               id_error = &
01266               sasa_c_get_element_6th_level_c (id_XML_doc,                    &
01267              'component', 0, 'transient', ib, 'intent', 0, 'input', 0,  &
01268              'target_transformation', 0, 'statistics', 0,                    &
01269              'notmasked_points', 0, cla_char, il_length)
01270              sda_smioc_transi(ib)%sg_transi_in%iga_stats(2) = &
01271              sasa_c_convert_char2int(cla_char(1:il_length))
01272           END IF
01273 
01274           id_error = &
01275              sasa_c_get_number_7th_level (id_XML_doc,                        &
01276              'component', 0, 'transient', ib, 'intent', 0, 'input', 0,  &
01277              'target_transformation', 0, 'statistics', 0,                    &
01278              'all_points', il_nb_bis)
01279 
01280           IF (il_nb_bis .eq. 1) THEN
01281               id_error = &
01282               sasa_c_get_element_6th_level_c (id_XML_doc,                    &
01283              'component', 0, 'transient', ib, 'intent', 0, 'input', 0,  &
01284              'target_transformation', 0, 'statistics', 0,                    &
01285              'all_points', 0, cla_char, il_length)
01286              sda_smioc_transi(ib)%sg_transi_in%iga_stats(3) = &
01287              sasa_c_convert_char2int(cla_char(1:il_length))
01288           END IF
01289 
01290       END IF
01291 
01292 ! *** Get the number of origins
01293       id_error = &
01294          sasa_c_get_number_5th_level(id_XML_doc,             &
01295          'component', 0, 'transient', ib, 'intent', 0,  &
01296          'input', 0, 'origin',                               &
01297          sda_smioc_transi(ib)%sg_transi_in%ig_nb_in_orig)
01298 
01299 ! **** Get the origins' informations for each origin
01300       DO ib_bis = 1, sda_smioc_transi(ib)%sg_transi_in%ig_nb_in_orig
01301 
01302         id_error = &
01303            sasa_c_get_attri_5th_level (id_XML_doc,             &
01304            'component', 0, 'transient', ib, 'intent', 0,  &
01305            'input', 0, 'origin', ib_bis, 'transi_in_name',     &
01306            sda_smioc_transi(ib)%sg_transi_in%                  &
01307            sga_in_orig(ib_bis)%cg_transi_in_name, il_length)
01308 
01309         id_error = &
01310            sasa_c_get_element_5th_level_c (id_XML_doc,                  &
01311            'component', 0, 'transient', ib, 'intent', 0,           &
01312            'input', 0, 'origin', ib_bis, 'corresp_transi_out_name', 0,  &
01313            sda_smioc_transi(ib)%sg_transi_in%                           &
01314            sga_in_orig(ib_bis)%cg_orig_transi, il_length)
01315 
01316 ! ***** Check if the file is coming from a comp or a file
01317         id_error = &
01318            sasa_c_get_number_6th_level(id_XML_doc,                    &
01319            'component', 0, 'transient', ib, 'intent', 0    ,     &
01320            'input', 0, 'origin', ib_bis, 'component_name', il_nb_bis)
01321 
01322         id_error = &
01323            sasa_c_get_number_6th_level(id_XML_doc,              &
01324            'component', 0, 'transient', ib, 'intent', 0,   &
01325            'input', 0, 'origin', ib_bis, 'file', il_nb_ter)
01326 
01327         IF ((il_nb_bis .eq. 1) .and. (il_nb_ter .eq. 1)) THEN
01328 
01329             PRINT *, '**********************************************'
01330             PRINT *, 'The origin can not be a component and a file !'
01331             PRINT *, '**********************************************'
01332             CALL PSMILe_Flushstd
01333 
01334             CALL MPI_Abort(MPI_COMM_WORLD, 1, id_error)
01335 
01336         ELSE IF (il_nb_bis .eq. 1) THEN
01337 
01338             sda_smioc_transi(ib)%sg_transi_in%             &
01339                sga_in_orig(ib_bis)%ig_orig_type = PSMILe_comp
01340 
01341             id_error = &
01342                sasa_c_get_element_5th_level_c (id_XML_doc,        &
01343                'component', 0, 'transient', ib, 'intent', 0, &
01344                'input', 0, 'origin', ib_bis, 'component_name', 0, &
01345                sda_smioc_transi(ib)%sg_transi_in%                 &
01346                sga_in_orig(ib_bis)%cg_orig_comp_name, il_length)
01347 
01348         ELSE IF (il_nb_ter .eq. 1) THEN
01349 
01350             ll_file_io = .TRUE.        
01351             sda_smioc_transi(ib)%sg_transi_in%             &
01352                sga_in_orig(ib_bis)%ig_orig_type = PSMILe_file
01353 
01354             il_length = 0
01355             id_error = &
01356                sasa_c_get_element_6th_level_c (id_XML_doc,         &
01357                'component', 0, 'transient', ib, 'intent', 0,  &
01358                'input', 0, 'origin', ib_bis, 'file', 0,            &
01359                'name', 0, sda_smioc_transi(ib)%sg_transi_in%       &
01360                sga_in_orig(ib_bis)%sg_orig_file%cg_file_name, il_length)  
01361             IF (il_length == 0) THEN
01362                 PRINT *, '*******************************************'
01363                 PRINT *, 'a name must be specified for each file     '
01364                 PRINT *, '*******************************************'
01365                 CALL PSMILe_Flushstd
01366                 CALL MPI_Abort(MPI_COMM_WORLD, 1, id_error)
01367             ENDIF
01368 
01369             il_length = 0
01370             id_error = &
01371                sasa_c_get_element_6th_level_c (id_XML_doc,         &
01372                'component', 0, 'transient', ib, 'intent', 0,  &
01373                'input', 0, 'origin', ib_bis, 'file', 0,            &
01374                'format', 0, cla_char, il_length)
01375             IF (il_length == 0) THEN
01376                 PRINT *, '*******************************************'
01377                 PRINT *, 'a format must be specified for each file     '
01378                 PRINT *, '*******************************************'
01379                 CALL PSMILe_Flushstd
01380                 CALL MPI_Abort(MPI_COMM_WORLD, 1, id_error)
01381             ENDIF
01382             sda_smioc_transi(ib)%sg_transi_in%                   &
01383                sga_in_orig(ib_bis)%sg_orig_file%ig_file_format = &
01384                sasa_c_convert_char2int(cla_char(1:il_length))          
01385 
01386             id_error = &
01387                sasa_c_get_element_6th_level_c (id_XML_doc,         &
01388                'component', 0, 'transient', ib, 'intent', 0,  &
01389                'input', 0, 'origin', ib_bis, 'file', 0,            &
01390                'suffix', 0, cla_char, il_length)
01391             sda_smioc_transi(ib)%sg_transi_in%sga_in_orig(ib_bis)% &
01392                sg_orig_file%ig_suffix = sasa_c_convert_char2int(cla_char(1:il_length))
01393             IF (sda_smioc_transi(ib)%sg_transi_in%sga_in_orig(ib_bis)% &
01394                sg_orig_file%ig_suffix .eq. -280177)                         &
01395                sda_smioc_transi(ib)%sg_transi_in%sga_in_orig(ib_bis)%  &
01396                sg_orig_file%ig_suffix = 0
01397 
01398             il_length = 0
01399             id_error = &
01400                sasa_c_get_element_6th_level_c (id_XML_doc,         &
01401                'component', 0, 'transient', ib, 'intent', 0,  &
01402                'input', 0, 'origin', ib_bis, 'file', 0,            &
01403                'io_mode', 0, cla_char, il_length)
01404             IF (il_length == 0) THEN
01405 #ifdef VERBOSE
01406                 PRINT *, '************************************************************'
01407                 PRINT *, 'no io_mode for file; default value iosingle will be used    '
01408                 PRINT *, '************************************************************'
01409 #endif
01410                 sda_smioc_transi(ib)%sg_transi_in%sga_in_orig(ib_bis)% &
01411                    sg_orig_file%ig_file_iomode = 3825
01412             ELSE
01413                 sda_smioc_transi(ib)%sg_transi_in%sga_in_orig(ib_bis)% &
01414                    sg_orig_file%ig_file_iomode = &
01415                    sasa_c_convert_char2int(cla_char(1:il_length))
01416             ENDIF
01417             id_error = &
01418                sasa_c_get_element_6th_level_i (id_XML_doc,         &
01419                'component', 0, 'transient', ib, 'intent', 0,  &
01420                'input', 0, 'origin', ib_bis, 'file', 0,            &
01421                'packing', 0,                                    &
01422                sda_smioc_transi(ib)%sg_transi_in%sga_in_orig(ib_bis)% &
01423                sg_orig_file%ig_file_pack)  
01424 
01425             id_error = &
01426                sasa_c_get_element_6th_level_d (id_XML_doc,         &
01427                'component', 0, 'transient', ib, 'intent', 0,       &
01428                'input', 0, 'origin', ib_bis, 'file', 0,            &
01429                'scaling', 0, sda_smioc_transi(ib)%sg_transi_in%    &
01430                sga_in_orig(ib_bis)%sg_orig_file%dg_file_scal)
01431   
01432             id_error = &
01433                sasa_c_get_element_6th_level_d (id_XML_doc,         &
01434                'component', 0, 'transient', ib, 'intent', 0,       &
01435                'input', 0, 'origin', ib_bis, 'file', 0,            &
01436                'adding', 0, sda_smioc_transi(ib)%sg_transi_in%     &
01437                sga_in_orig(ib_bis)%sg_orig_file%dg_file_add)
01438 
01439             id_error = &
01440                sasa_c_get_element_6th_level_d (id_XML_doc,         &
01441                'component', 0, 'transient', ib, 'intent', 0,       &
01442                'input', 0, 'origin', ib_bis, 'file', 0,            &
01443                'fill_value', 0, sda_smioc_transi(ib)%sg_transi_in% &
01444                sga_in_orig(ib_bis)%sg_orig_file%dg_fill_val) 
01445 
01446         ELSE
01447 
01448             PRINT *, '******************************************'
01449             PRINT *, 'The origin must be a component or a file !'
01450             PRINT *, '******************************************'
01451             CALL PSMILe_Flushstd
01452 
01453             CALL MPI_Abort(MPI_COMM_WORLD, 1, id_error)
01454 
01455         END IF
01456 
01457 !!$! ***** Get the coupling restart file informations
01458 !!$
01459 !!$        id_error = &
01460 !!$           sasa_c_get_number_6th_level(id_XML_doc,                      &
01461 !!$           'component', 0, 'transient', ib, 'intent', 0,           &
01462 !!$           'input', 0, 'origin', ib_bis, 'cpl_rst_file', il_nb)
01463 !!$
01464 !!$        IF (il_nb .EQ. 1) THEN
01465 !!$
01466 !!$            il_length = 0
01467 !!$            id_error = &
01468 !!$               sasa_c_get_element_7th_level_c (id_XML_doc,              &
01469 !!$               'component', 0, 'transient', ib, 'intent', 0,       &
01470 !!$               'input', 0, 'origin', ib_bis, 'cpl_rst_file', 0,         &
01471 !!$               'file', 0,                                               &
01472 !!$               'name', 0, sda_smioc_transi(ib)%sg_transi_in%            &
01473 !!$               sga_in_orig(ib_bis)%sg_cpl_rst_file%cg_file_name, il_length)  
01474 !!$            IF (il_length == 0) THEN
01475 !!$                PRINT *, '*******************************************'
01476 !!$                PRINT *, 'a name must be specified for each file     '
01477 !!$                PRINT *, '*******************************************'
01478 !!$                CALL PSMILe_Flushstd
01479 !!$                CALL MPI_Abort(MPI_COMM_WORLD, 1, id_error)
01480 !!$            ENDIF
01481 !!$
01482 !!$            il_length = 0
01483 !!$            id_error = &
01484 !!$               sasa_c_get_element_7th_level_c (id_XML_doc,              &
01485 !!$               'component', 0, 'transient', ib, 'intent', 0,       &
01486 !!$               'input', 0, 'origin', ib_bis, 'cpl_rst_file', 0,         &
01487 !!$               'file', 0,                                               &
01488 !!$               'format', 0, cla_char, il_length)
01489 !!$            IF (il_length == 0) THEN
01490 !!$                PRINT *, '*******************************************'
01491 !!$                PRINT *, 'a format must be specified for each file     '
01492 !!$                PRINT *, '*******************************************'
01493 !!$                CALL PSMILe_Flushstd
01494 !!$                CALL MPI_Abort(MPI_COMM_WORLD, 1, id_error)
01495 !!$            ENDIF
01496 !!$
01497 !!$            sda_smioc_transi(ib)%sg_transi_in%                          &
01498 !!$               sga_in_orig(ib_bis)%sg_cpl_rst_file%ig_file_format =     &
01499 !!$               sasa_c_convert_char2int(cla_char(1:il_length))          
01500 !!$
01501 !!$            id_error = &
01502 !!$               sasa_c_get_element_7th_level_c (id_XML_doc,              &
01503 !!$               'component', 0, 'transient', ib, 'intent', 0,       &
01504 !!$               'input', 0, 'origin', ib_bis, 'cpl_rst_file', 0,         &
01505 !!$               'file', 0,                                               &
01506 !!$               'suffix', 0, cla_char, il_length)
01507 !!$            sda_smioc_transi(ib)%sg_transi_in%sga_in_orig(ib_bis)%      &
01508 !!$               sg_cpl_rst_file%ig_suffix = sasa_c_convert_char2int(cla_char(1:il_length))
01509 !!$            IF (sda_smioc_transi(ib)%sg_transi_in%sga_in_orig(ib_bis)%  &
01510 !!$               sg_cpl_rst_file%ig_suffix .eq. -280177)                  &
01511 !!$               sda_smioc_transi(ib)%sg_transi_in%sga_in_orig(ib_bis)%   &
01512 !!$               sg_cpl_rst_file%ig_suffix  = 0
01513 !!$
01514 !!$            il_length = 0
01515 !!$            id_error = &
01516 !!$               sasa_c_get_element_7th_level_c (id_XML_doc,              &
01517 !!$               'component', 0, 'transient', ib, 'intent', 0,       &
01518 !!$               'input', 0, 'origin', ib_bis, 'cpl_rst_file', 0,         &
01519 !!$               'file', 0,                                               &
01520 !!$               'io_mode', 0, cla_char, il_length)
01521 !!$            IF (il_length == 0) THEN
01522 !!$#ifdef VERBOSE
01523 !!$                PRINT *, '************************************************************'
01524 !!$                PRINT *, 'no io_mode for file; default value iosingle will be used    '
01525 !!$                PRINT *, '************************************************************'
01526 !!$#endif
01527 !!$                sda_smioc_transi(ib)%sg_transi_in%sga_in_orig(ib_bis)% &
01528 !!$                   sg_orig_file%ig_file_iomode = 3825
01529 !!$            ELSE
01530 !!$                sda_smioc_transi(ib)%sg_transi_in%sga_in_orig(ib_bis)% &
01531 !!$                   sg_cpl_rst_file%ig_file_iomode = &
01532 !!$                   sasa_c_convert_char2int(cla_char(1:il_length))
01533 !!$            ENDIF
01534 !!$
01535 !!$            id_error = &
01536 !!$               sasa_c_get_element_7th_level_c (id_XML_doc,              &
01537 !!$               'component', 0, 'transient', ib, 'intent', 0,       &
01538 !!$               'input', 0, 'origin', ib_bis, 'cpl_rst_file', 0,         &
01539 !!$               'file', 0,                                               &
01540 !!$               'packing', 0,                                            &
01541 !!$               sda_smioc_transi(ib)%sg_transi_in%sga_in_orig(ib_bis)%   &
01542 !!$               sg_cpl_rst_file%ig_file_pack)  
01543 !!$
01544 !!$            id_error = &
01545 !!$               sasa_c_get_element_7th_level_i (id_XML_doc,              &
01546 !!$               'component', 0, 'transient', ib, 'intent', 0,       &
01547 !!$               'input', 0, 'origin', ib_bis, 'cpl_rst_file', 0,         &
01548 !!$               'file', 0,                                               &
01549 !!$               'scaling', 0, il_test)
01550 !!$            sda_smioc_transi(ib)%sg_transi_in%sga_in_orig(ib_bis)%      &
01551 !!$               sg_cpl_rst_file%dg_file_scal = il_test
01552 !!$
01553 !!$            id_error = &
01554 !!$               sasa_c_get_element_7th_level_i (id_XML_doc,              &
01555 !!$               'component', 0, 'transient', ib, 'intent', 0,       &
01556 !!$               'input', 0, 'origin', ib_bis, 'cpl_rst_file', 0,         &
01557 !!$               'file', 0,                                               &
01558 !!$               'adding', 0, il_test)
01559 !!$            sda_smioc_transi(ib)%sg_transi_in%sga_in_orig(ib_bis)%      &
01560 !!$               sg_cpl_rst_file%dg_file_add = il_test
01561 !!$
01562 !!$            id_error = &
01563 !!$               sasa_c_get_element_7th_level_i (id_XML_doc,              &
01564 !!$               'component', 0, 'transient', ib, 'intent', 0,       &
01565 !!$               'input', 0, 'origin', ib_bis, 'cpl_rst_file', 0,         &
01566 !!$               'file', 0,                                               &
01567 !!$               'fill_value', 0, il_test)
01568 !!$            sda_smioc_transi(ib)%sg_transi_in%sga_in_orig(ib_bis)%      &
01569 !!$               sg_cpl_rst_file%dg_fill_val = il_test
01570 !!$        ENDIF
01571 
01572 ! ***** Get the conservation type, if there is conservation
01573         id_error = &
01574            sasa_c_get_number_7th_level(id_XML_doc,                    &
01575            'component', 0, 'transient', ib, 'intent', 0,         &
01576            'input', 0, 'origin', ib_bis, 'middle_transformation', 0,  &
01577            'conservation', il_nb_bis)
01578 
01579         IF (il_nb_bis .EQ. 1) THEN
01580             id_error = &
01581                sasa_c_get_element_6th_level_c (id_XML_doc,                  &
01582                'component', 0, 'transient', ib, 'intent', 0,           &
01583                'input', 0, 'origin', ib_bis, 'middle_transformation', 0,    &
01584                'conservation', 0, cla_char, il_length)
01585             sda_smioc_transi(ib)%sg_transi_in%sga_in_orig(ib_bis)%ig_conserv = &
01586                sasa_c_convert_char2int(cla_char(1:il_length))
01587         ENDIF
01588 
01589 ! *****Gget the algebraic combination informations, if there is algebraic combination
01590         id_error = &
01591            sasa_c_get_number_7th_level(id_XML_doc,                    &
01592            'component', 0, 'transient', ib, 'intent', 0,         &
01593            'input', 0, 'origin', ib_bis, 'middle_transformation', 0,  &
01594            'algebraic_combination', il_nb_bis)
01595 
01596         IF (il_nb_bis .eq. 1) THEN
01597 
01598             id_error = &
01599                sasa_c_get_element_7th_level_c (id_XML_doc,                &
01600                'component', 0, 'transient', ib, 'intent', 0,         &
01601                'input', 0, 'origin', ib_bis, 'middle_transformation', 0,  &
01602                'algebraic_combination', 0,                                &
01603                'name', 0, sda_smioc_transi(ib)%sg_transi_in%              &
01604                sga_in_orig(ib_bis)%sg_combi%cg_combi_name, il_length)          
01605 
01606             id_error = &
01607                sasa_c_get_element_7th_level_i (id_XML_doc,                &
01608                'component', 0, 'transient', ib, 'intent', 0,         &
01609                'input', 0, 'origin', ib_bis, 'middle_transformation', 0,  &
01610                'algebraic_combination', 0,                                &
01611                'comb_parameter', 0, il_test)
01612             sda_smioc_transi(ib)%sg_transi_in%             &
01613                sga_in_orig(ib_bis)%sg_combi%dg_combi_param = il_test
01614 
01615             id_error = &
01616                sasa_c_get_element_7th_level_c (id_XML_doc,                &
01617                'component', 0, 'transient', ib, 'intent', 0,         &
01618                'input', 0, 'origin', ib_bis, 'middle_transformation', 0,  &
01619                'algebraic_combination', 0,                                &
01620                'comb_method', 0,  cla_char, il_length)
01621             sda_smioc_transi(ib)%sg_transi_in%                &
01622                sga_in_orig(ib_bis)%sg_combi%ig_combi_meth =   &
01623                sasa_c_convert_char2int(cla_char(1:il_length))
01624 
01625             id_error = &
01626                sasa_c_get_element_7th_level_c (id_XML_doc,                &
01627                'component', 0, 'transient', ib, 'intent', 0,         &
01628                'input', 0, 'origin', ib_bis, 'middle_transformation', 0,  &
01629                'algebraic_combination', 0,                                &
01630                'operand', 0,  cla_char, il_length)
01631             sda_smioc_transi(ib)%sg_transi_in%                &
01632                sga_in_orig(ib_bis)%sg_combi%ig_operand =      &
01633                sasa_c_convert_char2int(cla_char(1:il_length))
01634 
01635             id_error = &
01636                sasa_c_get_element_7th_level_i (id_XML_doc,                &
01637                'component', 0, 'transient', ib, 'intent', 0,         &
01638                'input', 0, 'origin', ib_bis, 'middle_transformation', 0,  &
01639                'algebraic_combination', 0,                                &
01640                'scalar', 0, il_test)
01641             sda_smioc_transi(ib)%sg_transi_in%             &
01642                sga_in_orig(ib_bis)%sg_combi%dg_scalar = il_test
01643 
01644 ! ****** Check if the mask is external or source_variable_mask or none
01645 !        Set first to none
01646             sda_smioc_transi(ib)%sg_transi_in%             &
01647                sga_in_orig(ib_bis)%sg_combi%ig_mask_type = -280177
01648 
01649             id_error = &
01650                sasa_c_get_number_8th_level(id_XML_doc,                    &
01651                'component', 0, 'transient', ib, 'intent', 0,         &
01652                'input', 0, 'origin', ib_bis, 'middle_transformation', 0,  &
01653                'algebraic_combination', 0, 'source_variable_mask', il_nb_ter)
01654 
01655             id_error = &
01656                sasa_c_get_number_8th_level(id_XML_doc,                    &
01657                'component', 0, 'transient', ib, 'intent', 0,         &
01658                'input', 0, 'origin', ib_bis, 'middle_transformation', 0,  &
01659                'algebraic_combination', 0, 'external_mask', il_nb_qua)
01660 
01661             IF ((il_nb_ter .eq. 1) .and. (il_nb_qua .eq. 1)) THEN
01662 
01663                 PRINT *, '**********************************************************'
01664                 PRINT *, 'The mask can not be external_mask and source_variable_mask'
01665                 PRINT *, '**********************************************************'
01666                 CALL PSMILe_Flushstd
01667 
01668                 CALL MPI_Abort(MPI_COMM_WORLD, 1, id_error)
01669 
01670 
01671             ELSE IF (il_nb_ter .eq. 1) THEN
01672 
01673                 sda_smioc_transi(ib)%sg_transi_in%             &
01674                    sga_in_orig(ib_bis)%sg_combi%ig_mask_type = 3610
01675 
01676 
01677             ELSE IF (il_nb_qua .eq. 1) THEN
01678 
01679                 sda_smioc_transi(ib)%sg_transi_in%             &
01680                    sga_in_orig(ib_bis)%sg_combi%ig_mask_type = 3611
01681 
01682                 id_error = &
01683                    sasa_c_get_element_8th_level_c (id_XML_doc,      &
01684                    'component', 0, 'transient', ib, 'intent', 0,    &
01685                    'input', 0, 'origin', ib_bis,                    &
01686                    'middle_transformation', 0,                      &
01687                    'algebraic_combination', 0, 'external_mask', 0,  &
01688                    'name', 0, sda_smioc_transi(ib)%sg_transi_in%    &
01689                    sga_in_orig(ib_bis)%sg_combi%cg_ext_mask_name, il_length)
01690 
01691 ! ******* Get the external mask file informations
01692                 il_length = 0
01693                 id_error = &
01694                    sasa_c_get_element_8th_level_c (id_XML_doc,      &
01695                    'component', 0, 'transient', ib, 'intent', 0,    &
01696                    'input', 0, 'origin', ib_bis,                    &
01697                    'middle_transformation', 0,                      &
01698                    'algebraic_combination', 0, 'external_mask', 0,  &
01699                    'file', 0,                                       &
01700                    'name', 0, sda_smioc_transi(ib)%sg_transi_in%    &
01701                    sga_in_orig(ib_bis)%sg_combi%sg_ext_mask_file%cg_file_name,&
01702                    il_length)
01703                 IF (il_length == 0) THEN
01704                     PRINT *, '*******************************************'
01705                     PRINT *, 'a name must be specified for each file     '
01706                     PRINT *, '*******************************************'
01707                     CALL PSMILe_Flushstd
01708                     CALL MPI_Abort(MPI_COMM_WORLD, 1, id_error)
01709                 ENDIF
01710 
01711                 il_length = 0
01712                 id_error = &
01713                    sasa_c_get_element_9th_level_c (id_XML_doc,      &
01714                    'component', 0, 'transient', ib, 'intent', 0,    &
01715                    'input', 0, 'origin', ib_bis,                    &
01716                    'middle_transformation', 0,                      &
01717                    'algebraic_combination', 0, 'external_mask', 0,  &
01718                    'file', 0,                                       &
01719                    'format', 0, cla_char, il_length)
01720                 IF (il_length == 0) THEN
01721                     PRINT *, '*******************************************'
01722                     PRINT *, 'a format must be specified for each file     '
01723                     PRINT *, '*******************************************'
01724                     CALL PSMILe_Flushstd
01725                     CALL MPI_Abort(MPI_COMM_WORLD, 1, id_error)
01726                 ENDIF
01727                 sda_smioc_transi(ib)%sg_transi_in%       &
01728                    sga_in_orig(ib_bis)%sg_combi%         &
01729                    sg_ext_mask_file%ig_file_format =     &
01730                    sasa_c_convert_char2int(cla_char(1:il_length))          
01731 
01732                 id_error = &
01733                    sasa_c_get_element_9th_level_c (id_XML_doc,      &
01734                    'component', 0, 'transient', ib, 'intent', 0,    &
01735                    'input', 0, 'origin', ib_bis,                    &
01736                    'middle_transformation', 0,                      &
01737                    'algebraic_combination', 0, 'external_mask', 0,  &
01738                    'file', 0,                                       &
01739                    'suffix', 0, cla_char, il_length)
01740                 sda_smioc_transi(ib)%sg_transi_in%                         &
01741                    sga_in_orig(ib_bis)%sg_combi%sg_ext_mask_file%          &
01742                    ig_suffix = sasa_c_convert_char2int(cla_char(1:il_length))
01743                 IF (sda_smioc_transi(ib)%sg_transi_in%sga_in_orig(ib_bis)% &
01744                    sg_combi%sg_ext_mask_file%ig_suffix .eq. -280177)            &
01745                    sda_smioc_transi(ib)%sg_transi_in%sga_in_orig(ib_bis)%  &
01746                    sg_combi%sg_ext_mask_file%ig_suffix = 0
01747 
01748                 il_length = 0
01749                 id_error = &
01750                    sasa_c_get_element_9th_level_c (id_XML_doc,      &
01751                    'component', 0, 'transient', ib, 'intent', 0,    &
01752                    'input', 0, 'origin', ib_bis,                    &
01753                    'middle_transformation', 0,                      &
01754                    'algebraic_combination', 0, 'external_mask', 0,  &
01755                    'file', 0,                                       &
01756                    'io_mode', 0, cla_char, il_length)
01757                 IF (il_length == 0) THEN
01758 #ifdef VERBOSE
01759                     PRINT *, '************************************************************'
01760                     PRINT *, 'no io_mode for file; default value iosingle will be used    '
01761                     PRINT *, '************************************************************'
01762 #endif
01763                     sda_smioc_transi(ib)%sg_transi_in%                         &
01764                        sga_in_orig(ib_bis)%sg_combi%sg_ext_mask_file%          &
01765                        ig_file_iomode = 3825
01766                 ELSE
01767                     sda_smioc_transi(ib)%sg_transi_in%                         &
01768                        sga_in_orig(ib_bis)%sg_combi%sg_ext_mask_file%          &
01769                        ig_file_iomode = &
01770                        sasa_c_convert_char2int(cla_char(1:il_length))
01771                 ENDIF
01772 
01773                 id_error = &
01774                    sasa_c_get_element_9th_level_i (id_XML_doc,      &
01775                    'component', 0, 'transient', ib, 'intent', 0,    &
01776                    'input', 0, 'origin', ib_bis,                    &
01777                    'middle_transformation', 0,                      &
01778                    'algebraic_combination', 0, 'external_mask', 0,  &
01779                    'file', 0,                                       &
01780                    'packing', 0, sda_smioc_transi(ib)%sg_transi_in% &
01781                    sga_in_orig(ib_bis)%sg_combi%sg_ext_mask_file%   &
01782                    ig_file_pack)  
01783 
01784                 id_error = &
01785                    sasa_c_get_element_9th_level_i (id_XML_doc,      &
01786                    'component', 0, 'transient', ib, 'intent', 0,    &
01787                    'input', 0, 'origin', ib_bis,                    &
01788                    'middle_transformation', 0,                      &
01789                    'algebraic_combination', 0, 'external_mask', 0,  &
01790                    'file', 0,                                       &
01791                    'scaling', 0, il_test)
01792                 sda_smioc_transi(ib)%sg_transi_in%                  &
01793                    sga_in_orig(ib_bis)%sg_combi%sg_ext_mask_file%   &
01794                    dg_file_scal = il_test 
01795 
01796                 id_error = &
01797                    sasa_c_get_element_9th_level_i (id_XML_doc,      &
01798                    'component', 0, 'transient', ib, 'intent', 0,    &
01799                    'input', 0, 'origin', ib_bis,                    &
01800                    'middle_transformation', 0,                      &
01801                    'algebraic_combination', 0, 'external_mask', 0,  &
01802                    'file', 0,                                       &
01803                    'adding', 0, il_test)
01804                 sda_smioc_transi(ib)%sg_transi_in%                  &
01805                    sga_in_orig(ib_bis)%sg_combi%sg_ext_mask_file%   &
01806                    dg_file_add = il_test
01807 
01808                 id_error = &
01809                    sasa_c_get_element_9th_level_i (id_XML_doc,      &
01810                    'component', 0, 'transient', ib, 'intent', 0,    &
01811                    'input', 0, 'origin', ib_bis,                    &
01812                    'middle_transformation', 0,                      &
01813                    'algebraic_combination', 0, 'external_mask', 0,  &
01814                    'file', 0,                                       &
01815                    'fill_value', 0, il_test)
01816                 sda_smioc_transi(ib)%sg_transi_in%                  &
01817                    sga_in_orig(ib_bis)%sg_combi%sg_ext_mask_file%   &
01818                    dg_fill_val = il_test
01819 
01820             END IF
01821 
01822         END IF
01823 
01824 ! ***** Check if the transient_in took part of an interpolation
01825         id_error = &
01826            sasa_c_get_number_7th_level(id_XML_doc,                    &
01827            'component', 0, 'transient', ib, 'intent', 0,         &
01828            'input', 0, 'origin', ib_bis, 'middle_transformation', 0,  &
01829            'interpolation', il_nb_bis)
01830 
01831         IF (il_nb_bis .eq. 1) THEN
01832 ! ****** Check if the interpolation is 3d
01833             id_error = &
01834                sasa_c_get_number_8th_level(id_XML_doc,                    &
01835                'component', 0, 'transient', ib, 'intent', 0,         &
01836                'input', 0, 'origin', ib_bis, 'middle_transformation', 0,  &
01837                'interpolation', 0, 'interp3D', il_nb_ter)
01838 
01839 ! ****** Check if the interpolation is 2d1d
01840             id_error = &
01841                sasa_c_get_number_8th_level(id_XML_doc,                    &
01842                'component', 0, 'transient', ib, 'intent', 0,         &
01843                'input', 0, 'origin', ib_bis, 'middle_transformation', 0,  &
01844                'interpolation', 0, 'interp2D', il_nb_terbis)
01845 
01846 !!$! ****** Check if the interpolation is 1d1d1d
01847 !!$            id_error = &
01848 !!$               sasa_c_get_number_8th_level(id_XML_doc,                    &
01849 !!$               'component', 0, 'transient', ib, 'intent', 0,         &
01850 !!$               'input', 0, 'origin', ib_bis, 'middle_transformation', 0,  &
01851 !!$               'interpolation', 0, 'interp1D_i', il_nb_terter)
01852 !!$
01853 !!$! Check that the interpolation is 3D or 2D1D or 1D1D1D 
01854 !!$            IF (il_nb_ter + il_nb_terbis + il_nb_terter .GT. 1) THEN
01855 
01856 ! ******* Check that the interpolation is 3D or 2D1D 
01857             IF (il_nb_ter + il_nb_terbis .GT. 1) THEN
01858                 PRINT *, '********************************************'
01859                 PRINT *, 'Interpolation must be 3D or 2D1D !'
01860                 PRINT *, '********************************************'
01861                 CALL PSMILe_Flushstd
01862 
01863                 CALL MPI_Abort(MPI_COMM_WORLD, 1, id_error)
01864 
01865             END IF
01866 
01867 ! ****** If the interpolation is 3D
01868             IF (il_nb_ter .eq. 1) THEN
01869 
01870                 sda_smioc_transi(ib)%sg_transi_in%sga_in_orig(ib_bis)% &
01871                    sg_interp%ig_interp_type = PSMILe_3D
01872 
01873 ! ****** Check if the interpolation is nneighbour3d
01874                 id_error = &
01875                    sasa_c_get_number_9th_level(id_XML_doc,                   &
01876                    'component', 0, 'transient', ib, 'intent', 0,        &
01877                    'input', 0, 'origin', ib_bis, 'middle_transformation', 0, &
01878                    'interpolation', 0, 'interp3D', 0, 'nneighbour3D',        &
01879                    il_nb_qua)
01880 
01881 ! ****** Check if the interpolation is trilinear
01882                 id_error = &
01883                    sasa_c_get_number_9th_level(id_XML_doc,                   &
01884                    'component', 0, 'transient', ib, 'intent', 0,        &
01885                    'input', 0, 'origin', ib_bis, 'middle_transformation', 0, &
01886                    'interpolation', 0, 'interp3D', 0, 'trilinear', il_nb_cin)
01887 
01888 ! ****** Check if the interpolation is conservative 3D
01889                 id_error = &
01890                    sasa_c_get_number_9th_level(id_XML_doc,                   &
01891                    'component', 0, 'transient', ib, 'intent', 0,        &
01892                    'input', 0, 'origin', ib_bis, 'middle_transformation', 0, &
01893                    'interpolation', 0, 'interp3D', 0, 'conservativ3D', il_nb_six)
01894 
01895 ! ****** Check if the interpolation is user defined 3D
01896                 id_error = &
01897                    sasa_c_get_number_9th_level(id_XML_doc,                   &
01898                    'component', 0, 'transient', ib, 'intent', 0,        &
01899                    'input', 0, 'origin', ib_bis, 'middle_transformation', 0, &
01900                    'interpolation', 0, 'interp3D', 0, 'user3D', il_nb_hep)
01901 
01902 ! ****** Check that there is only one 3D interpolation method
01903 
01904                 IF (il_nb_qua + il_nb_cin + il_nb_six + il_nb_hep .gt. 1) THEN
01905 
01906                     PRINT *, '*************************************************'
01907                     PRINT *, 'Only one 3D interpolation method can be chosen ! '
01908                     PRINT *, '*************************************************'
01909                     CALL PSMILe_Flushstd
01910 
01911                     CALL MPI_Abort(MPI_COMM_WORLD, 1, id_error)
01912 
01913                 END IF
01914 
01915 ! ******* if the interpolation is nneighbour3d get the informations
01916                 IF (il_nb_qua .EQ. 1) THEN
01917 
01918                     sda_smioc_transi(ib)%sg_transi_in%sga_in_orig(ib_bis)% &
01919                        sg_interp%iga_interp_meth(1) = PSMILe_nnghbr3D
01920                     il_length = 0
01921                     id_error = &
01922                        sasa_c_get_element_9th_level_c (id_XML_doc,      &
01923                        'component', 0, 'transient', ib, 'intent', 0,    &
01924                        'input', 0, 'origin', ib_bis,                    &
01925                        'middle_transformation', 0, 'interpolation', 0,  &
01926                        'interp3D', 0, 'nneighbour3D', 0,                &
01927                        'para_search', 0, cla_char, il_length)
01928                     IF (il_length == 0) THEN
01929 #ifdef VERBOSE
01930                         PRINT *, '*******************************************'
01931                         PRINT *, 'Type of search for nneighbour3D  missing '
01932                         PRINT *, 'Default value PSMILe_global will be used   '
01933                         PRINT *, '*******************************************'
01934 #endif
01935                         sda_smioc_transi(ib)%sg_transi_in%sga_in_orig(ib_bis)% &
01936                            sg_interp%iga_arg3(1)=PSMILe_global
01937                     ELSE
01938                         sda_smioc_transi(ib)%sg_transi_in%sga_in_orig(ib_bis)% &
01939                            sg_interp%iga_arg3(1)= &
01940                            sasa_c_convert_char2int(cla_char(1:il_length))
01941                     ENDIF
01942                     id_error = &
01943                        sasa_c_get_number_10th_level(id_XML_doc,      &
01944                        'component', 0, 'transient', ib, 'intent', 0,    &
01945                        'input', 0, 'origin', ib_bis,                    &
01946                        'middle_transformation', 0, 'interpolation', 0,  &
01947                        'interp3D', 0, 'nneighbour3D', 0,                &
01948                        'nbr_neighbours', il_nb)
01949                     IF (il_nb == 0) THEN
01950                         PRINT *, '*******************************************'
01951                         PRINT *, 'nbr_neighbours must be specified' 
01952                         PRINT *, 'for nneighbour3D interpolation'
01953                         PRINT *, '*******************************************'
01954                         CALL PSMILe_Flushstd
01955                         CALL MPI_Abort(MPI_COMM_WORLD, 1, id_error)
01956                     ENDIF
01957                     id_error = &
01958                        sasa_c_get_element_9th_level_i (id_XML_doc,      &
01959                        'component', 0, 'transient', ib, 'intent', 0,    &
01960                        'input', 0, 'origin', ib_bis,                    &
01961                        'middle_transformation', 0, 'interpolation', 0,  &
01962                        'interp3D', 0, 'nneighbour3D', 0,                &
01963                        'nbr_neighbours', 0,                             &
01964                        sda_smioc_transi(ib)%sg_transi_in%sga_in_orig(ib_bis)% &
01965                        sg_interp%iga_arg2(1))
01966                     id_error = &
01967                        sasa_c_get_element_9th_level_d (id_XML_doc,      &
01968                        'component', 0, 'transient', ib, 'intent', 0,    &
01969                        'input', 0, 'origin', ib_bis,                    &
01970                        'middle_transformation', 0, 'interpolation', 0,  &
01971                        'interp3D', 0, 'nneighbour3D', 0,                &
01972                        'gaussian_variance', 0, sda_smioc_transi(ib)%    &
01973                        sg_transi_in%sga_in_orig(ib_bis)%sg_interp%dg_arg8)
01974                     il_length = 0
01975                     id_error = &
01976                        sasa_c_get_element_9th_level_c (id_XML_doc,      &
01977                        'component', 0, 'transient', ib, 'intent', 0,    &
01978                        'input', 0, 'origin', ib_bis,                    &
01979                        'middle_transformation', 0, 'interpolation', 0,  &
01980                        'interp3D', 0, 'nneighbour3D', 0,                &
01981                        'if_masked', 0,                                  &
01982                        cla_char, il_length)
01983 !!$                    IF (il_length == 0) THEN
01984 !!$                        PRINT *, '********************************************'
01985 !!$                        PRINT *, 'if_masked must be specified'
01986 !!$                        PRINT *, 'for nneighbour3D interpolation'
01987 !!$                        PRINT *, '********************************************'
01988 !!$                        CALL PSMILe_Flushstd
01989 !!$
01990 !!$                        CALL MPI_Abort(MPI_COMM_WORLD, 1, id_error)
01991 !!$                    ENDIF
01992                     IF (il_length /= 0) THEN
01993                         sda_smioc_transi(ib)%sg_transi_in%sga_in_orig(ib_bis)% &
01994                            sg_interp%iga_arg4(1)= &
01995                            sasa_c_convert_char2int(cla_char(1:il_length))
01996                         IF (sda_smioc_transi(ib)%sg_transi_in%sga_in_orig(ib_bis)% &
01997                            sg_interp%iga_arg4(1) /= PSMILE_novalue) THEN
01998                             PRINT *, '********************************************'
01999                             PRINT *, 'Only novalue is implemented for if_masked'
02000                             PRINT *, 'for nneighbour3D interpolation'
02001                             PRINT *, '********************************************'
02002                             CALL PSMILe_Flushstd
02003                             CALL MPI_Abort(MPI_COMM_WORLD, 1, id_error)
02004                         END IF
02005                     ENDIF
02006                 ENDIF
02007 ! ******* if the interpolation is trilinear get the informations
02008                 IF (il_nb_cin .eq. 1) THEN
02009 
02010                     sda_smioc_transi(ib)%sg_transi_in%sga_in_orig(ib_bis)% &
02011                        sg_interp%iga_interp_meth(1) = PSMILe_trilinear
02012                     il_length = 0
02013                     id_error = &
02014                        sasa_c_get_element_9th_level_c (id_XML_doc,      &
02015                        'component', 0, 'transient', ib, 'intent', 0,    &
02016                        'input', 0, 'origin', ib_bis,                    &
02017                        'middle_transformation', 0, 'interpolation', 0,  &
02018                        'interp3D', 0, 'trilinear', 0,                   &
02019                        'para_search', 0,                                &
02020                        cla_char, il_length)
02021                     IF (il_length == 0) THEN
02022 #ifdef VERBOSE
02023                         PRINT *, '*******************************************'
02024                         PRINT *, 'Type of search for trilinear missing '
02025                         PRINT *, 'Default value PSMILe_global will be used   '
02026                         PRINT *, '*******************************************'
02027 #endif
02028                         sda_smioc_transi(ib)%sg_transi_in%sga_in_orig(ib_bis)% &
02029                            sg_interp%iga_arg3(1)=PSMILe_global
02030                     ELSE
02031                         sda_smioc_transi(ib)%sg_transi_in%sga_in_orig(ib_bis)% &
02032                            sg_interp%iga_arg3(1)= &
02033                            sasa_c_convert_char2int(cla_char(1:il_length))
02034                     ENDIF
02035 !rr
02036                     il_length = 0
02037                     id_error = &
02038                        sasa_c_get_element_9th_level_c (id_XML_doc,      &
02039                        'component', 0, 'transient', ib, 'intent', 0,    &
02040                        'input', 0, 'origin', ib_bis,                    &
02041                        'middle_transformation', 0, 'interpolation', 0,  &
02042                        'interp3D', 0, 'trilinear', 0,                   &
02043                        'if_masked', 0,                                  &
02044                        cla_char, il_length)
02045                     IF (il_length == 0) THEN
02046                         PRINT *, '********************************************'
02047                         PRINT *, 'if_masked must be specified'
02048                         PRINT *, 'for trilinear interpolation'
02049                         PRINT *, '********************************************'
02050                         CALL PSMILe_Flushstd
02051 
02052                         CALL MPI_Abort(MPI_COMM_WORLD, 1, id_error)
02053                     ENDIF
02054                     sda_smioc_transi(ib)%sg_transi_in%sga_in_orig(ib_bis)% &
02055                        sg_interp%iga_arg4(1)= &
02056                        sasa_c_convert_char2int(cla_char(1:il_length))
02057 
02058                 END IF
02059 
02060 ! ******* if the interpolation is conserv3D get the informations
02061                 IF (il_nb_six .eq. 1) THEN
02062 
02063                     sda_smioc_transi(ib)%sg_transi_in%sga_in_orig(ib_bis)% &
02064                        sg_interp%iga_interp_meth(1) = PSMILe_conserv3D
02065 
02066                     PRINT *, '******************************************************'
02067                     PRINT *, 'The 3D conservative interpolation is not yet supported'
02068                     PRINT *, '******************************************************'
02069                     CALL PSMILe_Flushstd
02070 
02071                             CALL MPI_Abort(MPI_COMM_WORLD, 1, id_error)
02072 
02073                 END IF
02074 
02075 ! ******* if the interpolation is user3D get the informations
02076                 IF (il_nb_hep .eq. 1) THEN
02077 
02078                     sda_smioc_transi(ib)%sg_transi_in%sga_in_orig(ib_bis)% &
02079                        sg_interp%iga_interp_meth(1) = PSMILe_user3D
02080 !* 
02081 ! ************** check that the name of the file is given or abort
02082 !*
02083                    il_length = 0
02084                    id_error = &
02085                       sasa_c_get_element_10th_level_c (id_XML_doc,        &
02086                       'component', 0, 'transient', ib, 'intent', 0,  &
02087                       'input', 0, 'origin', ib_bis,                       &
02088                       'middle_transformation', 0, 'interpolation', 0,     &
02089                       'interp3D', 0, 'user3D', 0,                         &
02090                       'file', 0,                                          &
02091                       'name', 0, sda_smioc_transi(ib)%sg_transi_in%       &
02092                       sga_in_orig(ib_bis)%sg_interp%sg_arg10%cg_file_name,&
02093                       il_length)
02094                    IF (il_length == 0) THEN
02095                        PRINT *, '*********************************************'
02096                        PRINT *, 'user3D interpolation needs a file for'
02097                        PRINT *, 'the definition of the weights and addresses'
02098                        PRINT *, '*********************************************'
02099                        CALL PSMILe_Flushstd
02100                        CALL MPI_Abort(MPI_COMM_WORLD, 1, id_error)
02101                    ENDIF
02102                     
02103                    il_length = 0
02104                    id_error = &
02105                        sasa_c_get_element_10th_level_c (id_XML_doc,            &
02106                        'component', 0, 'transient', ib, 'intent', 0,      &
02107                        'input', 0, 'origin', ib_bis,                           &
02108                        'middle_transformation', 0, 'interpolation', 0,         &
02109                        'interp3D', 0, 'user3D', 0,                             &
02110                        'file', 0,                                              &
02111                        'format', 0, cla_char, il_length)
02112                    IF (il_length == 0) THEN
02113                        PRINT *, '*******************************************'
02114                        PRINT *, 'a format must be specified for each file     '
02115                        PRINT *, '*******************************************'
02116                        CALL PSMILe_Flushstd
02117                        CALL MPI_Abort(MPI_COMM_WORLD, 1, id_error)
02118                    ENDIF
02119                     sda_smioc_transi(ib)%sg_transi_in%                         &
02120                        sga_in_orig(ib_bis)%sg_interp%sg_arg10%ig_file_format = &
02121                        sasa_c_convert_char2int(cla_char(1:il_length))
02122 
02123                     id_error = &
02124                        sasa_c_get_element_10th_level_c (id_XML_doc,            &
02125                        'component', 0, 'transient', ib, 'intent', 0,      &
02126                        'input', 0, 'origin', ib_bis,                           &
02127                        'middle_transformation', 0, 'interpolation', 0,         &
02128                        'interp3D', 0, 'user3D', 0,                             &
02129                        'file', 0,                                              &
02130                        'suffix', 0, cla_char, il_length)
02131                     sda_smioc_transi(ib)%sg_transi_in%                         &
02132                        sga_in_orig(ib_bis)%sg_interp%sg_arg10%          &
02133                        ig_suffix = sasa_c_convert_char2int(cla_char(1:il_length))
02134                     IF (sda_smioc_transi(ib)%sg_transi_in%sga_in_orig(ib_bis)% &
02135                        sg_interp%sg_arg10%ig_suffix .eq. -280177)            &
02136                        sda_smioc_transi(ib)%sg_transi_in%sga_in_orig(ib_bis)%  &
02137                        sg_interp%sg_arg10%ig_suffix = 0
02138 
02139                     il_length = 0
02140                     id_error = &
02141                        sasa_c_get_element_10th_level_c (id_XML_doc,            &
02142                        'component', 0, 'transient', ib, 'intent', 0,      &
02143                        'input', 0, 'origin', ib_bis,                           &
02144                        'middle_transformation', 0, 'interpolation', 0,         &
02145                        'interp3D', 0, 'user3D', 0,                             &
02146                        'file', 0,                                              &
02147                        'io_mode', 0, cla_char, il_length)
02148                     IF (il_length == 0) THEN
02149 #ifdef VERBOSE
02150                         PRINT *, '************************************************************'
02151                         PRINT *, 'no io_mode for file; default value iosingle will be used    '
02152                         PRINT *, '************************************************************'
02153 #endif
02154                         sda_smioc_transi(ib)%sg_transi_in%                     &
02155                            sga_in_orig(ib_bis)%sg_interp%sg_arg10%             &
02156                            ig_file_iomode = 3825
02157                     ELSE
02158                         sda_smioc_transi(ib)%sg_transi_in%                     &
02159                            sga_in_orig(ib_bis)%sg_interp%sg_arg10%             &
02160                            ig_file_iomode =                                    &
02161                            sasa_c_convert_char2int(cla_char(1:il_length))
02162                     ENDIF
02163 
02164                     id_error = &
02165                        sasa_c_get_element_10th_level_i (id_XML_doc,            &
02166                        'component', 0, 'transient', ib, 'intent', 0,      &
02167                        'input', 0, 'origin', ib_bis,                           &
02168                        'middle_transformation', 0, 'interpolation', 0,         &
02169                        'interp3D', 0, 'user3D', 0,                             &
02170                        'file', 0,                                              &
02171                        'packing', 0, sda_smioc_transi(ib)%sg_transi_in%        &
02172                        sga_in_orig(ib_bis)%sg_interp%sg_arg10%                 &
02173                        ig_file_pack)
02174       
02175                     id_error = &
02176                         sasa_c_get_element_10th_level_d (id_XML_doc,            &
02177                         'component', 0, 'transient', ib, 'intent', 0,      &
02178                         'input', 0, 'origin', ib_bis,                           &
02179                         'middle_transformation', 0, 'interpolation', 0,         &
02180                         'interp3D', 0, 'user3D', 0,                             &
02181                         'file', 0,                                              &
02182                         'scaling', 0, sda_smioc_transi(ib)%sg_transi_in%        &
02183                         sga_in_orig(ib_bis)%sg_interp%sg_arg10%dg_file_scal)
02184       
02185       
02186                     id_error = &
02187                         sasa_c_get_element_10th_level_d (id_XML_doc,            &
02188                         'component', 0, 'transient', ib, 'intent', 0,      &
02189                         'input', 0, 'origin', ib_bis,                           &
02190                         'middle_transformation', 0, 'interpolation', 0,         &
02191                         'interp3D', 0, 'user3D', 0,                             &
02192                         'file', 0,                                              &
02193                         'adding', 0, sda_smioc_transi(ib)%sg_transi_in%         &
02194                         sga_in_orig(ib_bis)%sg_interp%sg_arg10%dg_file_add)
02195       
02196                     id_error = &
02197                         sasa_c_get_element_10th_level_d (id_XML_doc,            &
02198                         'component', 0, 'transient', ib, 'intent', 0,      &
02199                         'input', 0, 'origin', ib_bis,                           &
02200                         'middle_transformation', 0, 'interpolation', 0,         &
02201                         'interp3D', 0, 'user3D', 0,                             &
02202                         'file', 0,                                              &
02203                         'fill_value', 0, sda_smioc_transi(ib)%sg_transi_in%     &
02204                         sga_in_orig(ib_bis)%sg_interp%sg_arg10%dg_fill_val)
02205 
02206 !  gather info on User-defined interpolation during first pass
02207                     IF ( ld_userdef_details ) THEN
02208 !  flag true for this origin
02209                        sga_comp_udef_idx(id_comp)%sla_driver_udef(ib)%    &
02210                                         lga_trin_orig(ib_bis) = .true.
02211 !  flag true for this XML transient 
02212                        sga_comp_udef_idx(id_comp)%sla_driver_udef(ib)%    &
02213                                         lg_trans_ud = .true.
02214 !  store name of transient for gridless grid name generation
02215                        sga_comp_udef_idx(id_comp)%sla_driver_udef(ib)%    &
02216                        cg_local_name = sda_smioc_transi(ib)%cg_local_name
02217                     ENDIF
02218 
02219                 END IF           !! il_nb_hep == 1
02220    
02221             END IF         !! 3D interpolations
02222 
02223 ! ****** If the interpolation is 2D
02224             IF (il_nb_terbis .EQ. 1) THEN
02225 
02226                 sda_smioc_transi(ib)%sg_transi_in%sga_in_orig(ib_bis)% &
02227                    sg_interp%ig_interp_type = PSMILe_2D1D
02228 
02229 ! ****** Check if the 2D interpolation is nneighbour2d
02230                 id_error = &
02231                    sasa_c_get_number_9th_level(id_XML_doc,                &
02232                    'component', 0, 'transient', ib, 'intent', 0,     &
02233                    'input', 0, 'origin', ib_bis, 'middle_transformation', &
02234                    0, 'interpolation', 0, 'interp2D', 0, 'nneighbour2D',  &
02235                    il_nb_qua)
02236 
02237 ! ****** Check if the 2D interpolation is bilinear
02238                 id_error = &
02239                    sasa_c_get_number_9th_level(id_XML_doc,          &
02240                    'component', 0, 'transient', ib, 'intent', 0,    &
02241                    'input', 0, 'origin', ib_bis,                    &
02242                    'middle_transformation', 0, 'interpolation', 0,  &
02243                    'interp2D', 0, 'bilinear', il_nb_cin)
02244 
02245 ! ****** Check if the 2D interpolation is bicubic
02246                 id_error = &
02247                    sasa_c_get_number_9th_level(id_XML_doc,          &
02248                    'component', 0, 'transient', ib, 'intent', 0,    &
02249                    'input', 0, 'origin', ib_bis,                    &
02250                    'middle_transformation', 0, 'interpolation', 0,  &
02251                    'interp2D', 0, 'bicubic', il_nb_six)
02252 
02253 ! ****** Check if the 2D interpolation is conservative
02254                 id_error = &
02255                    sasa_c_get_number_9th_level(id_XML_doc,          &
02256                    'component', 0, 'transient', ib, 'intent', 0,    &
02257                    'input', 0, 'origin', ib_bis,                    &
02258                    'middle_transformation', 0, 'interpolation', 0,  &
02259                    'interp2D', 0, 'conservativ2D', il_nb_hep)
02260 
02261 ! ****** Check if the 2D interpolation is user defined
02262                 id_error = &
02263                    sasa_c_get_number_9th_level(id_XML_doc,          &
02264                    'component', 0, 'transient', ib, 'intent', 0,    &
02265                    'input', 0, 'origin', ib_bis,                    &
02266                    'middle_transformation', 0, 'interpolation', 0,  &
02267                    'interp2D', 0, 'user2D', il_nb_oct)
02268 
02269 ! ****** Check that there is only one 2D interpolation method
02270 
02271                 IF (il_nb_qua + il_nb_cin + il_nb_six + il_nb_hep + il_nb_oct .gt. 1) THEN
02272 
02273                     PRINT *, '*************************************************'
02274                     PRINT *, 'Only one 2D interpolation method can be chosen ! '
02275                     PRINT *, '*************************************************'
02276                     CALL PSMILe_Flushstd
02277 
02278                     CALL MPI_Abort(MPI_COMM_WORLD, 1, id_error)
02279 
02280                 END IF
02281 
02282 ! ******* if the interpolation is nneighbour2d get the informations
02283                 IF (il_nb_qua .eq. 1) THEN
02284 
02285                     sda_smioc_transi(ib)%sg_transi_in%sga_in_orig(ib_bis)% &
02286                        sg_interp%iga_interp_meth(1) = PSMILe_nnghbr2D
02287                     il_length = 0
02288                     id_error = &
02289                        sasa_c_get_element_9th_level_c (id_XML_doc,      &
02290                        'component', 0, 'transient', ib, 'intent', 0,    &
02291                        'input', 0, 'origin', ib_bis,                    &
02292                        'middle_transformation', 0, 'interpolation', 0,  &
02293                        'interp2D', 0, 'nneighbour2D', 0, 'para_search', &
02294                        0, cla_char, il_length)
02295                     IF (il_length == 0) THEN
02296 #ifdef VERBOSE
02297                         PRINT *, '*******************************************'
02298                         PRINT *, 'Type of search for nneighbour2D missing '
02299                         PRINT *, 'Default value PSMILe_global will be used   '
02300                         PRINT *, '*******************************************'
02301 #endif
02302                         sda_smioc_transi(ib)%sg_transi_in%sga_in_orig(ib_bis)% &
02303                            sg_interp%iga_arg3(1)=PSMILe_global
02304                     ELSE
02305                         sda_smioc_transi(ib)%sg_transi_in%sga_in_orig(ib_bis)% &
02306                            sg_interp%iga_arg3(1)= &
02307                            sasa_c_convert_char2int(cla_char(1:il_length))
02308                     ENDIF
02309 
02310                     id_error = &
02311                        sasa_c_get_number_10th_level(id_XML_doc,      &
02312                        'component', 0, 'transient', ib, 'intent', 0,    &
02313                        'input', 0, 'origin', ib_bis,                    &
02314                        'middle_transformation', 0, 'interpolation', 0,  &
02315                        'interp2D', 0, 'nneighbour2D', 0,                &
02316                        'nbr_neighbours', il_nb)
02317                     IF (il_nb == 0) THEN
02318                         PRINT *, '*******************************************'
02319                         PRINT *, 'nbr_neighbours must be specified' 
02320                         PRINT *, 'for nneighbour2D interpolation'
02321                         PRINT *, '*******************************************'
02322                         CALL PSMILe_Flushstd
02323                         CALL MPI_Abort(MPI_COMM_WORLD, 1, id_error)
02324                     ENDIF
02325                     id_error = &
02326                        sasa_c_get_element_9th_level_i (id_XML_doc,      &
02327                        'component', 0, 'transient', ib, 'intent', 0,    &
02328                        'input', 0, 'origin', ib_bis,                    &
02329                        'middle_transformation', 0, 'interpolation', 0,  &
02330                        'interp2D', 0, 'nneighbour2D', 0,                &
02331                        'nbr_neighbours', 0,                             &
02332                        sda_smioc_transi(ib)%sg_transi_in%sga_in_orig(ib_bis)% &
02333                        sg_interp%iga_arg2(1))
02334 
02335                     id_error = &
02336                        sasa_c_get_element_9th_level_d (id_XML_doc,      &
02337                        'component', 0, 'transient', ib, 'intent', 0,    &
02338                        'input', 0, 'origin', ib_bis,                    &
02339                        'middle_transformation', 0, 'interpolation', 0,  &
02340                        'interp2D', 0, 'nneighbour2D', 0,                &
02341                        'gaussian_variance', 0, sda_smioc_transi(ib)%    &
02342                        sg_transi_in%sga_in_orig(ib_bis)%sg_interp%dg_arg8)
02343 
02344                     il_length = 0
02345                     id_error = &
02346                        sasa_c_get_element_9th_level_c (id_XML_doc,      &
02347                        'component', 0, 'transient', ib, 'intent', 0,    &
02348                        'input', 0, 'origin', ib_bis,                    &
02349                        'middle_transformation', 0, 'interpolation', 0,  &
02350                        'interp2D', 0,                                   &
02351                        'nneighbour2D', 0, 'if_masked', 0,              &
02352                        cla_char, il_length)
02353 !!$                    IF (il_length == 0) THEN
02354 !!$                        PRINT *, '********************************************'
02355 !!$                        PRINT *, 'if_masked must be specified'
02356 !!$                        PRINT *, 'for nneighbour2D interpolation'
02357 !!$                        PRINT *, '********************************************'
02358 !!$                        CALL PSMILe_Flushstd
02359 !!$
02360 !!$                        CALL MPI_Abort(MPI_COMM_WORLD, 1, id_error)
02361 !!$                    ENDIF
02362                     IF (il_length /= 0) THEN
02363                         sda_smioc_transi(ib)%sg_transi_in%sga_in_orig(ib_bis)% &
02364                            sg_interp%iga_arg4(1)= &
02365                            sasa_c_convert_char2int(cla_char(1:il_length))
02366                         if (sda_smioc_transi(ib)%sg_transi_in%sga_in_orig(ib_bis)% &
02367                            sg_interp%iga_arg4(1)/= PSMILE_novalue) THEN
02368                             PRINT *, '********************************************'
02369                             PRINT *, 'Only novalue is implemented for if_masked'
02370                             PRINT *, 'for nneighbour2D interpolation'
02371                             PRINT *, '********************************************'
02372                             CALL PSMILe_Flushstd
02373                             CALL MPI_Abort(MPI_COMM_WORLD, 1, id_error)
02374                         END IF
02375                     ENDIF
02376 
02377                 END IF
02378 
02379 ! ******* if the interpolation is bilinear get the informations
02380                 IF (il_nb_cin .eq. 1) THEN
02381 
02382                     sda_smioc_transi(ib)%sg_transi_in%sga_in_orig(ib_bis)% &
02383                        sg_interp%iga_interp_meth(1) = PSMILe_bilinear
02384                     il_length = 0
02385                     id_error = &
02386                        sasa_c_get_element_9th_level_c (id_XML_doc,      &
02387                        'component', 0, 'transient', ib, 'intent', 0,    &
02388                        'input', 0, 'origin', ib_bis,                    &
02389                        'middle_transformation', 0, 'interpolation', 0,  &
02390                        'interp2D', 0, 'bilinear', 0,                    &
02391                        'para_search', 0, cla_char, il_length)
02392                     IF (il_length == 0) THEN
02393 #ifdef VERBOSE
02394                         PRINT *, '*******************************************'
02395                         PRINT *, 'Type of search for bilinear missing '
02396                         PRINT *, 'Default value PSMILe_global will be used   '
02397                         PRINT *, '*******************************************'
02398 #endif
02399                         sda_smioc_transi(ib)%sg_transi_in%sga_in_orig(ib_bis)% &
02400                            sg_interp%iga_arg3(1)=PSMILe_global
02401                     ELSE
02402                         sda_smioc_transi(ib)%sg_transi_in%sga_in_orig(ib_bis)% &
02403                            sg_interp%iga_arg3(1)= &
02404                            sasa_c_convert_char2int(cla_char(1:il_length))
02405                     ENDIF
02406 !rr
02407                     il_length = 0
02408                     id_error = &
02409                        sasa_c_get_element_9th_level_c (id_XML_doc,      &
02410                        'component', 0, 'transient', ib, 'intent', 0,    &
02411                        'input', 0, 'origin', ib_bis,                    &
02412                        'middle_transformation', 0, 'interpolation', 0,  &
02413                        'interp2D', 0, 'bilinear', 0,                    &
02414                        'if_masked', 0,                                  &
02415                        cla_char, il_length)
02416                     IF (il_length == 0) THEN
02417                         PRINT *, '********************************************'
02418                         PRINT *, 'if_masked must be specified'
02419                         PRINT *, 'for bilinear interpolation'
02420                         PRINT *, '********************************************'
02421                         CALL PSMILe_Flushstd
02422 
02423                         CALL MPI_Abort(MPI_COMM_WORLD, 1, id_error)
02424                     ENDIF                    
02425                     sda_smioc_transi(ib)%sg_transi_in%sga_in_orig(ib_bis)% &
02426                        sg_interp%iga_arg4(1)= &
02427                        sasa_c_convert_char2int(cla_char(1:il_length))
02428                 END IF
02429 
02430 ! ******* if the interpolation is bicubic get the informations
02431                 IF (il_nb_six .eq. 1) THEN
02432 
02433                     sda_smioc_transi(ib)%sg_transi_in%sga_in_orig(ib_bis)% &
02434                        sg_interp%iga_interp_meth(1) = PSMILe_bicubic
02435                     il_length = 0
02436                     id_error = &
02437                        sasa_c_get_element_9th_level_c (id_XML_doc,      &
02438                        'component', 0, 'transient', ib, 'intent', 0,    &
02439                        'input', 0, 'origin', ib_bis,                    &
02440                        'middle_transformation', 0, 'interpolation', 0,  &
02441                        'interp2D', 0, 'bicubic', 0,                     &
02442                        'para_search', 0, cla_char, il_length)
02443                     IF (il_length == 0) THEN
02444 #ifdef VERBOSE
02445                         PRINT *, '*******************************************'
02446                         PRINT *, 'Type of search for bicubic missing '
02447                         PRINT *, 'Default value PSMILe_global will be used   '
02448                         PRINT *, '*******************************************'
02449 #endif
02450                         sda_smioc_transi(ib)%sg_transi_in%sga_in_orig(ib_bis)% &
02451                            sg_interp%iga_arg3(1)=PSMILe_global
02452                     ELSE
02453                         sda_smioc_transi(ib)%sg_transi_in%sga_in_orig(ib_bis)% &
02454                            sg_interp%iga_arg3(1)= &
02455                            sasa_c_convert_char2int(cla_char(1:il_length))
02456                     ENDIF
02457 
02458                     il_length = 0
02459                     id_error = &
02460                        sasa_c_get_element_9th_level_c (id_XML_doc,      &
02461                        'component', 0, 'transient', ib, 'intent', 0,    &
02462                        'input', 0, 'origin', ib_bis,                    &
02463                        'middle_transformation', 0, 'interpolation', 0,  &
02464                        'interp2D', 0, 'bicubic', 0,                     &
02465                        'if_masked', 0,                                  &
02466                        cla_char, il_length)
02467                     IF (il_length == 0) THEN
02468                         PRINT *, '********************************************'
02469                         PRINT *, 'if_masked must be specified'
02470                         PRINT *, 'for bicubic interpolation'
02471                         PRINT *, '********************************************'
02472                         CALL PSMILe_Flushstd
02473 
02474                         CALL MPI_Abort(MPI_COMM_WORLD, 1, id_error)
02475                     ENDIF
02476                     sda_smioc_transi(ib)%sg_transi_in%sga_in_orig(ib_bis)% &
02477                        sg_interp%iga_arg4(1)= &
02478                        sasa_c_convert_char2int(cla_char(1:il_length))
02479 
02480                     il_length = 0
02481                     id_error = &
02482                        sasa_c_get_element_9th_level_c (id_XML_doc,      &
02483                        'component', 0, 'transient', ib, 'intent', 0,    &
02484                        'input', 0, 'origin', ib_bis,                    &
02485                        'middle_transformation', 0, 'interpolation', 0,  &
02486                        'interp2D', 0, 'bicubic', 0,                     &
02487                        'bicubic_method', 0,                             &
02488                        cla_char, il_length)
02489 
02490                     IF (il_length == 0) THEN
02491                         PRINT *, '********************************************'
02492                         PRINT *, 'bicubic_method must be specified'
02493                         PRINT *, 'for bicubic interpolation'
02494                         PRINT *, '********************************************'
02495                         CALL PSMILe_Flushstd
02496                         CALL MPI_Abort(MPI_COMM_WORLD, 1, id_error)
02497                     ENDIF
02498 
02499                     sda_smioc_transi(ib)%sg_transi_in%sga_in_orig(ib_bis)% &
02500                        sg_interp%iga_arg5(1)= &
02501                        sasa_c_convert_char2int(cla_char(1:il_length))
02502 
02503                 END IF
02504 
02505 ! ******* if the interpolation is conservative get the informations
02506 
02507                 IF (il_nb_hep .EQ. 1) THEN
02508                     sda_smioc_transi(ib)%sg_transi_in%sga_in_orig(ib_bis)% &
02509                        sg_interp%iga_interp_meth(1) = PSMILe_conserv2D
02510 
02511             ! Get order of conservativ2D
02512                     id_error = &
02513                        sasa_c_get_number_10th_level(id_XML_doc,         &
02514                        'component', 0, 'transient', ib, 'intent', 0,    &
02515                        'input', 0, 'origin', ib_bis,                    &
02516                        'middle_transformation', 0, 'interpolation', 0,  &
02517                        'interp2D', 0, 'conservativ2D', 0, 'order', il_nb)
02518                     IF (il_nb == 0) THEN
02519 #ifdef VERBOSE
02520                         PRINT *, '*************************************'
02521                         PRINT *, 'Order for conservative 2D is missing '
02522                         PRINT *, 'First order will be used by default '
02523                         PRINT *, '*************************************'
02524 #endif
02525                         sda_smioc_transi(ib)%sg_transi_in%sga_in_orig(ib_bis)% &
02526                            sg_interp%iga_arg2(1)= PSMILe_first
02527                     ELSE
02528                         id_error = &
02529                            sasa_c_get_element_9th_level_c (id_XML_doc,      &
02530                            'component', 0, 'transient', ib, 'intent', 0,    &
02531                            'input', 0, 'origin', ib_bis,                    &
02532                            'middle_transformation', 0, 'interpolation', 0,  &
02533                            'interp2D', 0, 'conservativ2D', 0, 'order',      &
02534                            0, cla_char, il_length)
02535                         id_error = sasa_c_convert_char2int(cla_char(1:il_length))
02536                         IF (id_error == 1) THEN
02537                             sda_smioc_transi(ib)%sg_transi_in%sga_in_orig(ib_bis)% &
02538                                sg_interp%iga_arg2(1)= PSMILe_first
02539                         ELSE IF (id_error == 2) THEN
02540                             sda_smioc_transi(ib)%sg_transi_in%sga_in_orig(ib_bis)% &
02541                                sg_interp%iga_arg2(1)= PSMILe_second
02542                             PRINT *, '**********************************************'
02543                             PRINT *, '2nd order of conservative 2D not supported yet'
02544                             PRINT *, '**********************************************'
02545                             CALL PSMILe_Flushstd
02546                             CALL MPI_Abort(MPI_COMM_WORLD, 1, id_error)
02547                         ELSE
02548                             PRINT *, '*****************************************'
02549                             PRINT *, 'Order of conservative 2D is not known'
02550                             PRINT *, '*****************************************'
02551                             CALL PSMILe_Flushstd
02552                             CALL MPI_Abort(MPI_COMM_WORLD, 1, id_error)                  
02553                         ENDIF
02554                     ENDIF
02555                     !
02556             ! Get type of parallel search
02557                     il_nb = 0
02558                     id_error = &
02559                        sasa_c_get_number_10th_level(id_XML_doc,         &
02560                        'component',0, 'transient',ib, 'intent', 0, &
02561                        'input', 0, 'origin', ib_bis,                    &
02562                        'middle_transformation', 0, 'interpolation', 0,  &
02563                        'interp2D', 0, 'conservativ2D', 0, 'para_search', il_nb)
02564                     IF (il_nb == 0) THEN
02565 #ifdef VERBOSE
02566                         PRINT *, '*******************************************'
02567                         PRINT *, 'Type of search for conservative 2D missing '
02568                         PRINT *, 'Default value PSMILe_global will be used   '
02569                         PRINT *, '*******************************************'
02570 #endif
02571                         sda_smioc_transi(ib)%sg_transi_in%sga_in_orig(ib_bis)% &
02572                            sg_interp%iga_arg3(1)= PSMILe_global
02573                     ELSE
02574                         id_error = &
02575                            sasa_c_get_element_9th_level_c (id_XML_doc,      &
02576                            'component',0, 'transient',ib, 'intent', 0, &
02577                            'input', 0, 'origin', ib_bis,                    &
02578                            'middle_transformation', 0, 'interpolation', 0,  &
02579                            'interp2D', 0, 'conservativ2D', 0, 'para_search',&
02580                            0, cla_char, il_length)
02581                         id_error = sasa_c_convert_char2int(cla_char(1:il_length))
02582                         IF (id_error == PSMILe_global) THEN
02583                             sda_smioc_transi(ib)%sg_transi_in%sga_in_orig(ib_bis)% &
02584                                sg_interp%iga_arg3(1)= PSMILe_global
02585                         ELSE IF (id_error == PSMILe_local) THEN
02586                             sda_smioc_transi(ib)%sg_transi_in%sga_in_orig(ib_bis)% &
02587                                sg_interp%iga_arg3(1)= PSMILe_local
02588                         ELSE
02589                             PRINT *, '***********************************************'
02590                             PRINT *, 'Type of search for conservative 2D is not known'
02591                             PRINT *, '***********************************************'
02592                             CALL PSMILe_Flushstd
02593                             CALL MPI_Abort(MPI_COMM_WORLD, 1, id_error) 
02594                         ENDIF
02595                         !
02596 
02597                     ENDIF
02598                     !
02599             ! Get normalisation option of conservativ2D
02600                     id_error = &
02601                        sasa_c_get_number_10th_level(id_XML_doc,         &
02602                        'component', 0, 'transient', ib, 'intent', 0,    &
02603                        'input', 0, 'origin', ib_bis,                    &
02604                        'middle_transformation', 0, 'interpolation', 0,  &
02605                        'interp2D', 0, 'conservativ2D', 0, 'normalisation2D', il_nb)
02606                     IF (il_nb == 0) THEN
02607                         PRINT *, '********************************************'
02608                         PRINT *, 'No normalisation options for conservative 2D '
02609                         PRINT *, 'By default, no normalisation will be applied '
02610                         PRINT *, '********************************************'
02611                         sda_smioc_transi(ib)%sg_transi_in%sga_in_orig(ib_bis)% &
02612                                    sg_interp%iga_arg4(1) = PSMILe_none
02613                         sda_smioc_transi(ib)%sg_transi_in%sga_in_orig(ib_bis)% &
02614                                    sg_interp%iga_arg5(1) = PSMILe_false
02615                 ELSE
02616                         id_error = &
02617                            sasa_c_get_number_11th_level(id_XML_doc,              &
02618                            'component', 0, 'transient', ib, 'intent', 0,    &
02619                            'input', 0, 'origin', ib_bis,                         &
02620                            'middle_transformation', 0, 'interpolation', 0,       &
02621                            'interp2D', 0, 'conservativ2D', 0, 'normalisation2D', &
02622                            0, 'methodnorm2D', il_nb_bisbis)
02623                         IF (il_nb_bisbis == 0) THEN
02624                             PRINT *, '************************************'
02625                             PRINT *, 'No methodnorm2D for conservative 2D '
02626                             PRINT *, 'Default values will be used: '
02627                             PRINT *, '=> no normalisation'
02628                             PRINT *, '************************************'
02629                             sda_smioc_transi(ib)%sg_transi_in%sga_in_orig(ib_bis)% &
02630                                sg_interp%iga_arg4(1) = PSMILe_none
02631                         ELSE
02632                             id_error = &
02633                                sasa_c_get_element_10th_level_c (id_XML_doc,         &
02634                                'component', 0, 'transient', ib, 'intent', 0,   &
02635                                'input', 0, 'origin', ib_bis,                        &
02636                                'middle_transformation', 0, 'interpolation', 0,      &
02637                                'interp2D', 0, 'conservativ2D', 0, 'normalisation2D',&
02638                                0, 'methodnorm2D', 0, cla_char, il_length)
02639                             id_error = sasa_c_convert_char2int(cla_char(1:il_length))
02640                             IF (id_error == PSMILe_fracarea .OR. id_error == PSMILe_destarea &
02641                                .OR. id_error == PSMILe_none) THEN
02642                                 sda_smioc_transi(ib)%sg_transi_in%sga_in_orig(ib_bis)% &
02643                                    sg_interp%iga_arg4(1) = id_error
02644                             ELSE
02645                                 PRINT *, '*****************************************************'
02646                                 PRINT *, 'Normalisation method for conservative 2D is not known'
02647                                 PRINT *, '*****************************************************'
02648                                 CALL PSMILe_Flushstd
02649                                 CALL MPI_Abort(MPI_COMM_WORLD, 1, id_error)
02650                             ENDIF
02651                         ENDIF
02652                         id_error = &
02653                            sasa_c_get_number_11th_level(id_XML_doc,              &
02654                            'component', 0, 'transient', ib, 'intent', 0,    &
02655                            'input', 0, 'origin', ib_bis,                         &
02656                            'middle_transformation', 0, 'interpolation', 0,       &
02657                            'interp2D', 0, 'conservativ2D', 0, 'normalisation2D', &
02658                            0, 'nearnei', il_nb_bisbis)
02659                         IF (il_nb_bisbis == 0) THEN
02660                             PRINT *, '************************************'
02661                             PRINT *, 'No nearnei for conservative 2D '
02662                             PRINT *, 'Default values will be used: '
02663                             PRINT *, '=> nearnei = false' 
02664                             PRINT *, '************************************'
02665                             sda_smioc_transi(ib)%sg_transi_in%sga_in_orig(ib_bis)% &
02666                                sg_interp%iga_arg5(1) = PSMILe_false                           
02667                         ELSE
02668                             id_error = &
02669                                sasa_c_get_element_10th_level_c (id_XML_doc,         &
02670                                'component', 0, 'transient', ib, 'intent', 0,   &
02671                                'input', 0, 'origin', ib_bis,                        &
02672                                'middle_transformation', 0, 'interpolation', 0,      &
02673                                'interp2D', 0, 'conservativ2D', 0, 'normalisation2D',&
02674                                0, 'nearnei', 0, cla_char, il_length)
02675                             id_error = sasa_c_convert_char2int(cla_char(1:il_length))
02676                             IF (id_error == PSMILe_true) THEN
02677                                 PRINT *, '**********************************************'
02678                                 PRINT *, 'nearnei = true not supported yet'
02679                                 PRINT *, '**********************************************'
02680                                 CALL PSMILe_Flushstd
02681                                 CALL MPI_Abort(MPI_COMM_WORLD, 1, id_error)
02682                             ELSE IF (id_error == PSMILE_false) THEN
02683                                 sda_smioc_transi(ib)%sg_transi_in%sga_in_orig(ib_bis)% &
02684                                    sg_interp%iga_arg5(1) = id_error
02685                             ELSE
02686                                 PRINT *, '**********************************************'
02687                                 PRINT *, 'Nearnei value for conservative 2D is not known'
02688                                 PRINT *, '**********************************************'
02689                                 CALL PSMILe_Flushstd
02690                                 CALL MPI_Abort(MPI_COMM_WORLD, 1, id_error)
02691                             ENDIF
02692                         ENDIF
02693                     END IF
02694                 ENDIF
02695 
02696 ! ******* if the interpolation is user defined get the informations
02697                 IF (il_nb_oct .eq. 1) THEN
02698 
02699                     sda_smioc_transi(ib)%sg_transi_in%sga_in_orig(ib_bis)% &
02700                        sg_interp%iga_interp_meth(1) = PSMILe_user2D
02701 
02702                     PRINT *, '**********************************************'
02703                     PRINT *, 'The user 2D interpolation is not yet supported'
02704                     PRINT *, '**********************************************'
02705                     CALL PSMILe_Flushstd
02706 
02707                     CALL MPI_Abort(MPI_COMM_WORLD, 1, id_error)
02708 
02709                 END IF
02710 
02711 ! ****** Check if the 1D interpolation is defined
02712                 id_error = &
02713                    sasa_c_get_number_8th_level(id_XML_doc,         &
02714                    'component', 0, 'transient', ib, 'intent', 0,   &
02715                    'input', 0, 'origin', ib_bis,                   &
02716                    'middle_transformation', 0,                     &
02717                    'interpolation', 0, 'interp1D', il_nb_qua)
02718 
02719                 IF (il_nb_qua .NE. 1) THEN
02720 
02721                     PRINT *, '**********************************************'
02722                     PRINT *, 'One 1D interpolation must be defined for 2D1D '
02723                     PRINT *, '**********************************************'
02724                     CALL PSMILe_Flushstd
02725 
02726             CALL MPI_Abort(MPI_COMM_WORLD, 1, id_error)
02727 
02728                 ELSE
02729 
02730                     il_nb_qua = 0
02731 
02732 ! ****** Check if the 1D interpolation is none
02733                     id_error = &
02734                        sasa_c_get_number_9th_level(id_XML_doc,         &
02735                        'component', 0, 'transient', ib, 'intent', 0,   &
02736                        'input', 0, 'origin', ib_bis,                   &
02737                        'middle_transformation', 0,                     &
02738                        'interpolation', 0, 'interp1D', 0,              &
02739                        'none', il_nb_qua)
02740 
02741                     IF (il_nb_qua == 1) THEN
02742 
02743                         sda_smioc_transi(ib)%sg_transi_in%sga_in_orig(ib_bis)%&
02744                            sg_interp%iga_interp_meth(2) = PSMILe_none
02745                     ENDIF
02746 
02747 ! ****** Check if the 1D interpolation is linear
02748                     id_error = &
02749                        sasa_c_get_number_9th_level(id_XML_doc,         &
02750                        'component', 0, 'transient', ib, 'intent', 0,   &
02751                        'input', 0, 'origin', ib_bis,                   &
02752                        'middle_transformation', 0,                     &
02753                        'interpolation', 0, 'interp1D', 0,              &
02754                        'linear', il_nb_cin)
02755 
02756                     IF (il_nb_cin == 1) THEN
02757 
02758                         sda_smioc_transi(ib)%sg_transi_in%sga_in_orig(ib_bis)%&
02759                            sg_interp%iga_interp_meth(2) = PSMILe_linear
02760                     ENDIF
02761                     IF (il_nb_qua == 0 .AND. il_nb_cin == 0) THEN
02762                         PRINT *, '**************************************************'
02763                         PRINT *, '1D interpolation none or linear must be specified '
02764                         PRINT *, '**************************************************'
02765                         CALL PSMILe_Flushstd
02766 
02767                         CALL MPI_Abort(MPI_COMM_WORLD, 1, id_error)
02768 
02769                     END IF
02770 
02771                 END IF
02772                 
02773             END IF
02774 
02775 !!$! ****** If the interpolation is 1D
02776 !!$            IF (il_nb_terter .gt. 1) THEN
02777 !!$
02778 !!$                PRINT *, '********************************************'
02779 !!$                PRINT *, '1D1D1D interpolation not supported for now !'
02780 !!$                PRINT *, '********************************************'
02781 !!$                CALL PSMILe_Flushstd
02782 !!$
02783 !!$                CALL MPI_Abort(MPI_COMM_WORLD, 1, id_error)
02784 !!$
02785 !!$            END IF
02786 
02787         END IF
02788 
02789       END DO
02790 
02791 
02792 ! ** Get the number of transient out
02793       id_error = &
02794          sasa_c_get_number_4th_level(id_XML_doc,             &
02795          'component', 0, 'transient', ib, 'intent', 0,  &
02796          'output', sda_smioc_transi(ib)%ig_nb_transi_out)
02797 
02798 ! *** Set the transient out informations for all the transient out
02799       DO ib_bis = 1, sda_smioc_transi(ib)%ig_nb_transi_out
02800 
02801         id_error = &
02802            sasa_c_get_attri_4th_level (id_XML_doc,                         &
02803            'component', 0, 'transient', ib, 'intent', 0,              &
02804            'output', ib_bis, 'transi_out_name',                            &
02805            sda_smioc_transi(ib)%sga_transi_out(ib_bis)%cg_transi_out_name, &
02806            il_length)
02807 
02808         id_error = &
02809            sasa_c_get_element_4th_level_c (id_XML_doc,                 &
02810            'component', 0, 'transient', ib, 'intent', 0,          &
02811            'output', ib_bis, 'corresp_transi_in_name', 0,              &
02812            sda_smioc_transi(ib)%sga_transi_out(ib_bis)%cg_dest_transi, &
02813            il_length)
02814 
02815 ! **** Get the shortest period of exchange
02816         id_error = &
02817            sasa_c_get_element_5th_level_i (id_XML_doc,          &
02818            'component', 0, 'transient', ib, 'intent', 0,   &
02819            'output', ib_bis, 'minimal_period', 0,               &
02820            'nbr_secs', 0, il_test)
02821         sda_smioc_transi(ib)%sga_transi_out(ib_bis)%sg_min_period%second= &
02822            il_test
02823 
02824         id_error = &
02825            sasa_c_get_element_5th_level_i (id_XML_doc,          &
02826            'component', 0, 'transient', ib, 'intent', 0,   &
02827            'output', ib_bis, 'minimal_period', 0,               &
02828            'nbr_mins', 0,                                       &
02829            sda_smioc_transi(ib)%sga_transi_out(ib_bis)%sg_min_period%minute)
02830 
02831         id_error = &
02832            sasa_c_get_element_5th_level_i (id_XML_doc,          &
02833            'component', 0, 'transient', ib, 'intent', 0,   &
02834            'output', ib_bis, 'minimal_period', 0,               &
02835            'nbr_hours', 0,                                      &
02836            sda_smioc_transi(ib)%sga_transi_out(ib_bis)%sg_min_period%hour)
02837 
02838         id_error = &
02839            sasa_c_get_element_5th_level_i (id_XML_doc,          &
02840            'component', 0, 'transient', ib, 'intent', 0,   &
02841            'output', ib_bis, 'minimal_period', 0,               &
02842            'nbr_days', 0,                                       &
02843            sda_smioc_transi(ib)%sga_transi_out(ib_bis)%sg_min_period%day)
02844 
02845         id_error = &
02846            sasa_c_get_element_5th_level_i (id_XML_doc,          &
02847            'component', 0, 'transient', ib, 'intent', 0,   &
02848            'output', ib_bis, 'minimal_period', 0,               &
02849            'nbr_months', 0,                                     &
02850            sda_smioc_transi(ib)%sga_transi_out(ib_bis)%sg_min_period%month)
02851 
02852         id_error = & 
02853            sasa_c_get_element_5th_level_i (id_XML_doc,          &
02854            'component', 0, 'transient', ib, 'intent', 0,   &
02855            'output', ib_bis, 'minimal_period', 0,               &
02856            'nbr_years', 0,                                      &
02857            sda_smioc_transi(ib)%sga_transi_out(ib_bis)%sg_min_period%year)
02858 
02859 ! *** Get the exchange date format (is it the period format)
02860         id_error = &
02861            sasa_c_get_number_6th_level(id_XML_doc,                              &
02862            'component', 0, 'transient', ib, 'intent', 0, 'output', ib_bis, &
02863            'exchange_date', 0, 'period', il_nb)
02864 
02865 ! **** Get the exchange date if it is the period format)
02866         IF (il_nb .eq. 1) THEN
02867 
02868             sda_smioc_transi(ib)%sga_transi_out(ib_bis)%ig_exch_date_type = &
02869                PSMILe_period
02870 
02871             id_error = &
02872                sasa_c_get_element_6th_level_d (id_XML_doc,        &
02873                'component', 0, 'transient', ib, 'intent', 0, &
02874                'output', ib_bis, 'exchange_date', 0, 'period', 0, &
02875                'second', 0, dl_test)
02876             sda_smioc_transi(ib)%sga_transi_out(ib_bis)%sg_exch_date% &
02877                sg_period%second = dl_test
02878 
02879             id_error = &
02880                sasa_c_get_element_6th_level_i (id_XML_doc,        &
02881                'component', 0, 'transient', ib, 'intent', 0, &
02882                'output', ib_bis, 'exchange_date', 0, 'period', 0, &
02883                'minute', 0,                                       &
02884                sda_smioc_transi(ib)%sga_transi_out(ib_bis)%       &
02885                sg_exch_date%sg_period%minute)
02886 
02887             id_error = &
02888                sasa_c_get_element_6th_level_i (id_XML_doc,        &
02889                'component', 0, 'transient', ib, 'intent', 0, &
02890                'output', ib_bis, 'exchange_date', 0, 'period', 0, &
02891                'hour', 0,                                         &
02892                sda_smioc_transi(ib)%sga_transi_out(ib_bis)%       &
02893                sg_exch_date%sg_period%hour)
02894 
02895             id_error = &
02896                sasa_c_get_element_6th_level_i (id_XML_doc,        &
02897                'component', 0, 'transient', ib, 'intent', 0, &
02898                'output', ib_bis, 'exchange_date', 0, 'period', 0, &
02899                'day', 0,                                          &
02900                sda_smioc_transi(ib)%sga_transi_out(ib_bis)%       &
02901                sg_exch_date%sg_period%day)
02902 
02903             id_error = &
02904                sasa_c_get_element_6th_level_i (id_XML_doc,        &
02905                'component', 0, 'transient', ib, 'intent', 0, &
02906                'output', ib_bis, 'exchange_date', 0, 'period', 0, &
02907                'month', 0,                                        &
02908                sda_smioc_transi(ib)%sga_transi_out(ib_bis)%       &
02909                sg_exch_date%sg_period%month)
02910 
02911             id_error = &
02912                sasa_c_get_element_6th_level_i (id_XML_doc,        &
02913                'component', 0, 'transient', ib, 'intent', 0, &
02914                'output', ib_bis, 'exchange_date', 0, 'period', 0, &
02915                'year', 0,                                         &
02916                sda_smioc_transi(ib)%sga_transi_out(ib_bis)%       &
02917                sg_exch_date%sg_period%year)
02918 
02919         END IF
02920 
02921 ! *** Get the exchange date format (is it the once format)
02922         id_error = &
02923            sasa_c_get_number_6th_level(id_XML_doc,                               &
02924            'component', 0, 'transient', ib, 'intent', 0, 'output', ib_bis,  &
02925            'exchange_date', 0, 'once', il_nb)
02926 
02927 ! **** Get the exchange date if it is the once format
02928         IF (il_nb .eq. 1) THEN
02929 
02930             sda_smioc_transi(ib)%sga_transi_out(ib_bis)%ig_exch_date_type = &
02931                PSMILe_once
02932 
02933             PRINT *, '******************************************************'
02934             PRINT *, 'The once format for exchange date is not yet supported'
02935             PRINT *, '******************************************************'
02936             CALL PSMILe_Flushstd
02937 
02938             CALL MPI_Abort(MPI_COMM_WORLD, 1, id_error)
02939 
02940         END IF
02941 
02942 ! *** Get the exchange date format (is it the precise_list format)
02943         id_error = &
02944            sasa_c_get_number_6th_level(id_XML_doc,                               &
02945            'component', 0, 'transient', ib, 'intent', 0, 'output', ib_bis,  &
02946            'exchange_date', 0, 'precise_list', il_nb)
02947 
02948 ! **** Get the exchange date if it is the precise_list format
02949         IF (il_nb .eq. 1) THEN
02950 
02951             sda_smioc_transi(ib)%sga_transi_out(ib_bis)%ig_exch_date_type = &
02952                PSMILe_preciseday
02953 
02954             PRINT *, '**************************************************************'
02955             PRINT *, 'The precise_list format for exchange date is not yet supported'
02956             PRINT *, '**************************************************************'
02957             CALL PSMILe_Flushstd
02958 
02959             CALL MPI_Abort(MPI_COMM_WORLD, 1, id_error)
02960 
02961         END IF
02962 
02963 ! *** Get the exchange date format (is it the date_list format)
02964         id_error = &
02965            sasa_c_get_number_6th_level(id_XML_doc,                               &
02966            'component', 0, 'transient', ib, 'intent', 0, 'output', ib_bis,  &
02967            'exchange_date', 0, 'date_list', il_nb)
02968 
02969 ! **** Get the exchange date if it is the date_list format
02970         IF (il_nb .eq. 1) THEN
02971 
02972             sda_smioc_transi(ib)%sga_transi_out(ib_bis)%ig_exch_date_type = &
02973                PSMILe_list
02974 
02975             PRINT *, '***********************************************************'
02976             PRINT *, 'The date_list format for exchange date is not yet supported'
02977             PRINT *, '***********************************************************'
02978             CALL PSMILe_Flushstd
02979 
02980             CALL MPI_Abort(MPI_COMM_WORLD, 1, id_error)
02981 
02982         END IF
02983 
02984 ! *** Get the exchange date format (is it the lastdayinmonth format)
02985         id_error = &
02986            sasa_c_get_number_6th_level(id_XML_doc,                              &
02987            'component', 0, 'transient', ib, 'intent', 0, 'output', ib_bis, &
02988            'exchange_date', 0, 'lastdayinmonth', il_nb)
02989 
02990 ! **** Get the exchange date if it is the lastdayinmonth format
02991         IF (il_nb .eq. 1) THEN
02992 
02993             sda_smioc_transi(ib)%sga_transi_out(ib_bis)%ig_exch_date_type = &
02994                PSMILe_lastdayinmo
02995 
02996             PRINT *, '****************************************************************'
02997             PRINT *, 'The lastdayinmonth format for exchange date is not yet supported'
02998             PRINT *, '****************************************************************'
02999             CALL PSMILe_Flushstd
03000 
03001             CALL MPI_Abort(MPI_COMM_WORLD, 1, id_error)
03002 
03003         END IF
03004 
03005 ! *** Get the lag
03006         id_error = &
03007            sasa_c_get_element_4th_level_i (id_XML_doc,            &
03008            'component', 0, 'transient', ib,'intent', 0,      &
03009            'output', ib_bis, 'lag', 0, il_test)
03010            if ( il_test /= -280177 ) &
03011               sda_smioc_transi(ib)%sga_transi_out(ib_bis)%ig_lag = il_test
03012 
03013 ! *** Get the debug mode
03014         id_error = &
03015            sasa_c_get_element_4th_level_c (id_XML_doc,                &
03016            'component', 0, 'transient', ib, 'intent', 0,         &
03017            'output', ib_bis, 'debug_mode', 0, cla_char, il_length)
03018         sda_smioc_transi(ib)%sga_transi_out(ib_bis)%ig_debugmode = &
03019            sasa_c_convert_char2int(cla_char(1:il_length))
03020 
03021         IF (sda_smioc_transi(ib)%sga_transi_out(ib_bis)%ig_debugmode  &
03022            .EQ. PSMILe_true) THEN
03023             ll_debug_io = .TRUE.
03024         ENDIF
03025 ! *** Get the source time operation
03026         id_error = &
03027            sasa_c_get_element_5th_level_c (id_XML_doc,         &
03028            'component', 0, 'transient', ib, 'intent', 0,  &
03029            'output', ib_bis, 'source_transformation', 0,       &
03030            'source_time_operation', 0, cla_char, il_length)
03031         sda_smioc_transi(ib)%sga_transi_out(ib_bis)%ig_src_timeop = &
03032            sasa_c_convert_char2int(cla_char(1:il_length))
03033 
03034 ! *** Set to one the integer that indicates if the stat is used or not
03035         sda_smioc_transi(ib)%sga_transi_out(ib_bis)%iga_stats = 0
03036         id_error = &
03037            sasa_c_get_number_6th_level(id_XML_doc,                              &
03038            'component', 0, 'transient', ib, 'intent', 0, 'output', ib_bis, &
03039            'source_transformation', 0, 'statistics', il_nb)
03040 
03041         IF (il_nb .eq. 1) THEN
03042 
03043             id_error = &
03044                sasa_c_get_number_7th_level(id_XML_doc,                              &
03045                'component', 0, 'transient', ib, 'intent', 0, 'output', ib_bis, &
03046                'source_transformation', 0, 'statistics', 0,                         &
03047                'masked_points', il_nb_bis)
03048 
03049             IF (il_nb_bis .eq. 1) THEN
03050                 id_error = &
03051                 sasa_c_get_element_6th_level_c (id_XML_doc,                        &
03052                'component', 0, 'transient', ib, 'intent', 0, 'output', 0,     &
03053                'source_transformation', 0, 'statistics', 0,                        &
03054                'masked_points', 0, cla_char, il_length)
03055                sda_smioc_transi(ib)%sga_transi_out(ib_bis)%iga_stats(1) = &
03056                sasa_c_convert_char2int(cla_char(1:il_length))
03057             END IF
03058 
03059             id_error = &
03060                sasa_c_get_number_7th_level(id_XML_doc,                              &
03061                'component', 0, 'transient', ib, 'intent', 0, 'output', ib_bis, &
03062                'source_transformation', 0, 'statistics', 0,                         &
03063                'notmasked_points', il_nb_bis)
03064 
03065             IF (il_nb_bis .eq. 1) THEN
03066                 id_error = &
03067                 sasa_c_get_element_6th_level_c (id_XML_doc,                        &
03068                'component', 0, 'transient', ib, 'intent', 0, 'output', 0,     &
03069                'source_transformation', 0, 'statistics', 0,                        &
03070                'notmasked_points', 0, cla_char, il_length)
03071                sda_smioc_transi(ib)%sga_transi_out(ib_bis)%iga_stats(2) = &
03072                sasa_c_convert_char2int(cla_char(1:il_length))
03073             END IF
03074 
03075             id_error = &
03076                sasa_c_get_number_7th_level(id_XML_doc,                              &
03077                'component', 0, 'transient', ib, 'intent', 0, 'output', ib_bis, &
03078                'source_transformation', 0, 'statistics', 0,                         &
03079                'all_points', il_nb_bis)
03080 
03081             IF (il_nb_bis .eq. 1) THEN
03082                 id_error = &
03083                 sasa_c_get_element_6th_level_c (id_XML_doc,                        &
03084                'component', 0, 'transient', ib, 'intent', 0, 'output', 0,     &
03085                'source_transformation', 0, 'statistics', 0,                        &
03086                'all_points', 0, cla_char, il_length)
03087                sda_smioc_transi(ib)%sga_transi_out(ib_bis)%iga_stats(3) = &
03088                sasa_c_convert_char2int(cla_char(1:il_length))
03089             END IF
03090 
03091         END IF
03092 
03093 ! *** Get the source local transformation for add and mult scalar
03094 
03095         id_error = &
03096            sasa_c_get_element_6th_level_d (id_XML_doc,    &
03097            'component', 0, 'transient', ib, 'intent', 0,  &
03098            'output', ib_bis, 'source_transformation', 0,  &
03099            'source_local_transformation', 0,              &
03100            'mult_scalar', 0, dl_test)
03101         IF ( dl_test /= PSMILe_dundef ) THEN
03102             sda_smioc_transi(ib)%sga_transi_out(ib_bis)% &
03103                sg_src_local_trans%dg_mult_scalar = dl_test
03104         ENDIF
03105 
03106         id_error = &
03107            sasa_c_get_element_6th_level_d (id_XML_doc,    &
03108            'component', 0, 'transient', ib, 'intent', 0,  &
03109            'output', ib_bis, 'source_transformation', 0,  &
03110            'source_local_transformation', 0,              &
03111            'add_scalar', 0, dl_test)
03112         IF ( dl_test /= PSMILe_dundef ) THEN
03113             sda_smioc_transi(ib)%sga_transi_out(ib_bis)% &
03114                sg_src_local_trans%dg_add_scalar = dl_test
03115         ENDIF
03116 
03117 ! *** Get the source local transformation for scattering
03118         id_error = &
03119            sasa_c_get_element_6th_level_c (id_XML_doc,    &
03120            'component', 0, 'transient', ib, 'intent', 0,  &
03121            'output', ib_bis, 'source_transformation', 0,  &
03122            'source_local_transformation', 0,              &
03123            'scattering', 0, cla_char, il_length)
03124         sda_smioc_transi(ib)%sga_transi_out(ib_bis)%      &
03125            sg_src_local_trans%ig_scatter =                &
03126            sasa_c_convert_char2int(cla_char(1:il_length))
03127 
03128 ! *** Get the source local transformation for reduction
03129         id_error = &
03130            sasa_c_get_number_7th_level(id_XML_doc,                              &
03131            'component', 0, 'transient', ib, 'intent', 0, 'output', ib_bis, &
03132            'source_transformation', 0, 'source_local_transformation', 0,        &
03133            'reduction', il_test)
03134         IF (il_test .eq. 1) THEN
03135             PRINT *, '*********************************'
03136             PRINT *, 'Reduction not supported for now !'
03137             PRINT *, '*********************************'
03138             CALL PSMILe_Flushstd
03139             CALL MPI_Abort(MPI_COMM_WORLD, 1, id_error)
03140         END IF
03141 
03142 ! ***** Check if the transient is sending to a comp or a file 
03143         id_error = &
03144            sasa_c_get_number_5th_level(id_XML_doc,              &
03145            'component', 0, 'transient', ib, 'intent', 0,   &
03146            'output', ib_bis, 'component_name', il_nb_bis)
03147 
03148         id_error = &
03149            sasa_c_get_number_5th_level(id_XML_doc,              &
03150            'component', 0, 'transient', ib, 'intent', 0,   &
03151            'output', ib_bis, 'file', il_nb_ter)
03152 
03153         IF ((il_nb_bis .eq. 1) .and. (il_nb_ter .eq. 1)) THEN
03154 
03155             PRINT *, '**********************************************'
03156             PRINT *, 'The target can not be a component and a file !'
03157             PRINT *, '**********************************************'
03158             CALL PSMILe_Flushstd
03159 
03160             CALL MPI_Abort(MPI_COMM_WORLD, 1, id_error)
03161 
03162         ELSE IF (il_nb_bis .eq. 1) THEN
03163 
03164 ! ***** Set the destination type to comp
03165             sda_smioc_transi(ib)%sga_transi_out(ib_bis)%ig_dest_type = &
03166                PSMILe_comp
03167 
03168             id_error = &
03169                sasa_c_get_element_4th_level_c (id_XML_doc,                    &
03170                'component', 0, 'transient', ib, 'intent', 0,             &
03171                'output', ib_bis, 'component_name', 0,                         &
03172                sda_smioc_transi(ib)%sga_transi_out(ib_bis)%cg_dest_comp_name, &
03173                il_length)
03174 
03175         ELSE IF (il_nb_ter .eq. 1) THEN
03176             ll_file_io = .TRUE.        
03177 ! ***** Set the destination type to file
03178             sda_smioc_transi(ib)%sga_transi_out(ib_bis)%ig_dest_type = &
03179                PSMILe_file
03180 
03181             il_length = 0
03182             id_error = &
03183                sasa_c_get_element_5th_level_c (id_XML_doc,    &
03184                'component', 0, 'transient', ib, 'intent', 0,  &
03185                'output', ib_bis, 'file', 0, 'name', 0,        &
03186                sda_smioc_transi(ib)%sga_transi_out(ib_bis)%   &
03187                sg_dest_file%cg_file_name, il_length)  
03188             IF (il_length == 0) THEN
03189                 PRINT *, '*******************************************'
03190                 PRINT *, 'a name must be specified for each file     '
03191                 PRINT *, '*******************************************'
03192                 CALL PSMILe_Flushstd
03193                 CALL MPI_Abort(MPI_COMM_WORLD, 1, id_error)
03194             ENDIF
03195 
03196             il_length = 0
03197             id_error = &
03198                sasa_c_get_element_5th_level_c (id_XML_doc,    &
03199                'component', 0, 'transient', ib, 'intent', 0,  &
03200                'output', ib_bis, 'file', 0, 'format', 0,      &
03201                cla_char, il_length)
03202             IF (il_length == 0) THEN
03203                 PRINT *, '*******************************************'
03204                 PRINT *, 'a format must be specified for each file     '
03205                 PRINT *, '*******************************************'
03206                 CALL PSMILe_Flushstd
03207                 CALL MPI_Abort(MPI_COMM_WORLD, 1, id_error)
03208             ENDIF
03209             sda_smioc_transi(ib)%sga_transi_out(ib_bis)%      &
03210                sg_dest_file%ig_file_format =                  &
03211                sasa_c_convert_char2int(cla_char(1:il_length))
03212 
03213             id_error = &
03214                sasa_c_get_element_5th_level_c (id_XML_doc,    &
03215                'component', 0, 'transient', ib, 'intent', 0,  &
03216                'output', ib_bis, 'file', 0, 'suffix', 0,      &
03217                cla_char, il_length)
03218             sda_smioc_transi(ib)%sga_transi_out(ib_bis)%sg_dest_file% &
03219                ig_suffix = sasa_c_convert_char2int(cla_char(1:il_length))
03220             IF (sda_smioc_transi(ib)%sga_transi_out(ib_bis)%sg_dest_file% &
03221                ig_suffix .eq. -280177) sda_smioc_transi(ib)%              &
03222                sga_transi_out(ib_bis)%sg_dest_file%ig_suffix = 0
03223 
03224             il_length = 0
03225             id_error = &
03226                sasa_c_get_element_5th_level_c (id_XML_doc,    &
03227                'component', 0, 'transient', ib, 'intent', 0,  &
03228                'output', ib_bis, 'file', 0, 'io_mode', 0,   &
03229                cla_char, il_length)
03230             IF (il_length == 0) THEN
03231 #ifdef VERBOSE
03232                 PRINT *, '************************************************************'
03233                 PRINT *, 'no io_mode for file; default value iosingle will be used    '
03234                 PRINT *, '************************************************************'
03235 #endif
03236                 sda_smioc_transi(ib)%sga_transi_out(ib_bis)%sg_dest_file% &
03237                    ig_file_iomode = 3825
03238             ELSE
03239                 sda_smioc_transi(ib)%sga_transi_out(ib_bis)%sg_dest_file% &
03240                    ig_file_iomode =                                    &
03241                    sasa_c_convert_char2int(cla_char(1:il_length))
03242             ENDIF
03243 
03244             id_error = &
03245                sasa_c_get_element_5th_level_i (id_XML_doc,    &
03246                'component', 0, 'transient', ib, 'intent', 0,  &
03247                'output', ib_bis, 'file', 0, 'packing', 0,     &
03248                sda_smioc_transi(ib)%sga_transi_out(ib_bis)%sg_dest_file% &
03249                ig_file_pack)  
03250 
03251             id_error = &
03252                sasa_c_get_element_5th_level_d (id_XML_doc,    &
03253                'component', 0, 'transient', ib, 'intent', 0,  &
03254                'output', ib_bis, 'file', 0, 'scaling', 0,     &
03255                sda_smioc_transi(ib)%sga_transi_out(ib_bis)%   &
03256                sg_dest_file%dg_file_scal)
03257 
03258             id_error = &
03259                sasa_c_get_element_5th_level_d (id_XML_doc,    &
03260                'component', 0, 'transient', ib, 'intent', 0,  &
03261                'output', ib_bis, 'file', 0, 'adding', 0,      &
03262                sda_smioc_transi(ib)%sga_transi_out(ib_bis)%   &
03263                sg_dest_file%dg_file_add)
03264 
03265             id_error = &
03266                sasa_c_get_element_5th_level_d (id_XML_doc,    &
03267                'component', 0, 'transient', ib, 'intent', 0,  &
03268                'output', ib_bis, 'file', 0, 'fill_value', 0,  &
03269                sda_smioc_transi(ib)%sga_transi_out(ib_bis)%   &
03270                sg_dest_file%dg_fill_val) 
03271 
03272         END IF
03273 
03274       END DO
03275 
03276     END DO
03277 #endif
03278 
03279 #ifndef __PSMILE_WITH_IO
03280     IF (ll_debug_io)
03281         PRINT *, '***************************************************'
03282         PRINT *, 'The PSMILe is asked to perform I/O for debug mode'
03283         PRINT *, 'but it is compiled without __PSMILE_WITH_IO CPP key'
03284         PRINT *, 'Calling MPI_Abort'
03285         PRINT *, '***************************************************'
03286         CALL PSMILe_Flushstd
03287         
03288         CALL MPI_Abort(MPI_COMM_WORLD, 1, id_error)
03289     ENDIF
03290 
03291     IF (ll_file_io)
03292         PRINT *, '***************************************************'
03293         PRINT *, 'The PSMILe is asked to perform Input from file'
03294         PRINT *, 'but it is compiled without __PSMILE_WITH_IO CPP key'
03295         PRINT *, 'Calling MPI_Abort'
03296         PRINT *, '***************************************************'
03297         CALL PSMILe_Flushstd
03298 
03299         CALL MPI_Abort(MPI_COMM_WORLD, 1, id_error)
03300     ENDIF
03301 #endif
03302 
03303   END SUBROUTINE get_transi_details
03304 
03305 !
03306 !======================================================================

Generated on 1 Dec 2011 for Oasis4 by  doxygen 1.6.1