psmile_def_var.F90

Go to the documentation of this file.
00001 !-----------------------------------------------------------------------
00002 ! Copyright 2006-2010, CERFACS, Toulouse, France.
00003 ! Copyright 2006-2010, SGI Germany, Munich, Germany.
00004 ! Copyright 2006-2010, NEC Europe Ltd., London, UK.
00005 ! All rights reserved. Use is subject to OASIS4 license terms.
00006 !-----------------------------------------------------------------------
00007 !BOP
00008 !
00009 ! !ROUTINE: psmile_def_var
00010 !
00011 ! !INTERFACE:
00012 !
00013       subroutine psmile_def_var ( var_id, name, grid_id, method_id, mask_id, &
00014                                  var_nodims, var_actual_shape, var_type, ierror )
00015 !
00016 ! !USES:
00017 !
00018       use PRISM
00019 !
00020       use PSMILe, dummy => psmile_def_var
00021       use PSMILe_SMIOC, only : sga_smioc_comp, transient, transient_out, PSMILe_in_origin
00022 !
00023       implicit none
00024 !
00025 ! !INPUT PARAMETERS:
00026 !
00027       character (len=*), intent (In)      :: name
00028 
00029 !     character identifier for the variable for identification in the SMIOC/SCC:
00030 
00031       integer, intent (In)                :: mask_id
00032 
00033 !     Specifies handle to the mask information created by routine
00034 !     prism_def_mask:
00035 !     May be PRISM_UNDEFINED if a mask is not available.
00036 
00037       integer, intent (In)                :: method_id
00038 
00039 !     Specifies handle to the grid information created by routine
00040 !     prism_set_point:
00041 
00042       integer, intent (In)                :: grid_id
00043 
00044 !     Specifies handle to the grid information created by routine
00045 !     prism_def_grid:
00046 
00047       integer, intent (In)                :: var_nodims(2)
00048 
00049 !     var_nodims(1): the overall number of dimensions of array that is going
00050 !                    to be transferred with var_id, i.e. same than grid_nodims
00051 !                    except for bundle variables for which it is one more.
00052 !     var_nodims(2): number of bundles. Since var_nodims(2) may be specified as 0
00053 !                    the maximum of var_nodims(2) and 1 is used internally to
00054 !                    set sizes and shapes.
00055 
00056       integer, intent (in) :: var_actual_shape(1:2,1:var_nodims(1))
00057 
00058 !     Dimension of the block
00059 
00060 !     var_actual_shape (1,        1) = Lowest  first   index of block
00061 !     var_actual_shape (2,        1) = Highest first   index of block
00062 !     var_actual_shape (1,        2) = Lowest  second  index of block
00063 !     var_actual_shape (2,        2) = Highest second  index of block
00064 !        ...
00065 !     var_actual_shape (1,        i) = Lowest  i-th    index of block
00066 !     var_actual_shape (2,        i) = Highest i-th    index of block
00067 !     var_actual_shape (1, var_nodims(1)) = Lowest  ndim-th index of block
00068 !     var_actual_shape (2, var_nodims(1)) = Highest ndim-th index of block
00069 
00070       integer, intent (In)                :: var_type
00071 
00072 !     type of array PRISM_INT, PRISM_REAL or PRISM_DOUBLE, needed since
00073 !     we will not overload prism_put and prism_get for performance reasons.
00074 !
00075 ! !OUTPUT PARAMETERS:
00076 !
00077       integer, intent (Out)               :: var_id
00078 
00079 !     Returns the handle to the variable information created.
00080 
00081       integer, intent (Out)               :: ierror
00082 
00083 !     Returns the error code of PRISM_DefineBlock;
00084 !             ierror = 0 : No error
00085 !             ierror > 0 : Severe error
00086 !
00087 ! !LOCAL VARIABLES
00088 !
00089       integer            :: i, ii, point_id, length
00090 
00091       integer            :: bundle_field
00092       integer            :: vector_field
00093       integer            :: test_dim
00094       integer            :: nodims(2)
00095 
00096       type (Grid),         pointer :: gp
00097       type (GridFunction), pointer :: fp
00098       type (Coords_Block), pointer :: coords_pointer
00099 !
00100 !  ... SMIOC info
00101 !
00102       integer            :: nb_transi_out
00103       integer            :: nb_transi_in
00104       integer            :: s_ptr
00105       integer            :: smioc_loc
00106 !
00107       type (PSMILe_in_origin), pointer :: sga_in_orig (:)
00108       type (transient),        pointer :: sga_smioc_transi (:)
00109       type (transient_out),    pointer :: sga_transi_out(:)
00110 !
00111 !  ... Error parameters
00112 !
00113       integer, parameter :: nerrp = 2
00114       integer            :: ierrp (nerrp)
00115 !
00116 ! !DESCRIPTION:
00117 !
00118 ! Subroutine "psmile_def_var" defines a n-dimensional variable.
00119 !     Currently it is assumed that the grid is 3-d. var_nodims(1)
00120 !     therefore must be ndim_3d for ordinary variables or ndim_3d+1
00121 !     for vectors and bundles.
00122 !
00123 !
00124 ! !REVISION HISTORY:
00125 !
00126 !   Date      Programmer   Description
00127 ! ----------  ----------   -----------
00128 ! 02.09.02    R. Redler    created
00129 ! 09.01.03    R. Vogelsang added the call of psmile_def_metadata
00130 ! 19.11.03    R. Redler    major revision, several checks added
00131 !
00132 !EOP
00133 !----------------------------------------------------------------------
00134 !
00135 ! $Id: psmile_def_var.F90 2803 2010-12-06 17:28:25Z hanke $
00136 ! $Author: hanke $
00137 !
00138   character(len=len_cvs_string), save :: mycvs = 
00139       '$Id: psmile_def_var.F90 2803 2010-12-06 17:28:25Z hanke $'
00140 !
00141 !----------------------------------------------------------------------
00142 
00143 #ifdef VERBOSE
00144       print *, trim(ch_id), ': psmile_def_var: start'
00145       print *, trim(ch_id), ': psmile_def_var: grid_id =', grid_id,   &
00146                                           'method_id = ', method_id, &
00147                                           'mask_id = ', mask_id
00148 
00149       call psmile_flushstd
00150 #endif /* VERBOSE */
00151 
00152 !-----------------------------------------------------------------------
00153 !  1st   Control Grid id
00154 !-----------------------------------------------------------------------
00155 
00156       if (grid_id < 1 .or. &
00157           grid_id > Number_of_Grids_allocated) then
00158 
00159          ierrp (1) = grid_id
00160          ierrp (2) = Number_of_Grids_allocated
00161 
00162          ierror = PRISM_Error_Arg
00163 
00164          call psmile_error ( ierror, 'grid_id', &
00165                              ierrp, 2, __FILE__, __LINE__ )
00166          return
00167       endif
00168 !
00169       if (Grids(grid_id)%status == PSMILe_status_free) then
00170 
00171          ierrp (1) = grid_id
00172 
00173          ierror = PRISM_Error_Arg
00174 
00175          call psmile_error ( PRISM_Error_Arg, 'grid_id (not active)', &
00176                              ierrp, 1, __FILE__, __LINE__ )
00177          return
00178       endif
00179 
00180 !-----------------------------------------------------------------------
00181 !  2nd)  Initialization
00182 !-----------------------------------------------------------------------
00183 
00184       ierror        = 0
00185 
00186       test_dim      = 0
00187       nb_transi_out = 0
00188       nb_transi_in  = 0
00189 
00190       nodims        = var_nodims
00191 #ifdef DEBUG
00192             print *, trim(ch_id), ': var_nodims = ',nodims
00193 #endif
00194 
00195       gp            => Grids(grid_id)
00196       sga_smioc_transi => sga_smioc_comp(gp%comp_id)%sga_smioc_transi
00197 
00198 !-----------------------------------------------------------------------
00199 !  3rd)  Check whether the field name was specified in the XML file
00200 !-----------------------------------------------------------------------
00201 
00202 !
00203 ! ... check whether the field name was specified in the XML file
00204 !
00205       do smioc_loc = 1, size(sga_smioc_transi)
00206          if ( trim(sga_smioc_transi(smioc_loc)%cg_local_name) == trim(adjustl(name)) ) then
00207 #ifdef DEBUG
00208             print *, trim(ch_id), ': psmile_def_var compared name   ', &
00209                                      trim(adjustl(name))
00210             print *, trim(ch_id), ': psmile_def_var with smioc name ', &
00211                                      trim(sga_smioc_transi(smioc_loc)%cg_local_name)
00212 #endif
00213             exit
00214          endif
00215       enddo
00216 
00217 !-----------------------------------------------------------------------
00218 !  4th)  Control other input arguments
00219 !-----------------------------------------------------------------------
00220 
00221 #ifdef DEBUG
00222       print *, trim(ch_id), ': psmile_def_var called with name            ', &
00223                                trim(adjustl(name))
00224       print *, trim(ch_id), ': psmile_def_var associated sga_smioc_transi ', &
00225                                associated(sga_smioc_transi)
00226       print *, trim(ch_id), ': psmile_def_var size of sga_smioc_transi    ', &
00227                                size(sga_smioc_transi)
00228 #endif
00229 
00230 !-----------------------------------------------------------------------
00231 !  a)   Control Method id
00232 !-----------------------------------------------------------------------
00233 
00234       if ( method_id == PRISM_UNDEFINED ) then
00235 
00236              ierrp (1) = method_id
00237 
00238              ierror = PRISM_Error_Arg
00239 
00240              call psmile_error ( PRISM_Error_Arg, 'method_id (is not defined)', &
00241                              ierrp, 1, __FILE__, __LINE__ )
00242              return
00243       else
00244 
00245           if (method_id < 1 .or. &
00246               method_id > Number_of_Methods_allocated ) then
00247 
00248              ierrp (1) = method_id
00249              ierrp (2) = Number_of_Methods_allocated
00250 
00251              ierror = PRISM_Error_Arg
00252 
00253              call psmile_error ( ierror, 'method_id', &
00254                                  ierrp, 2, __FILE__, __LINE__ )
00255              return
00256           endif
00257 !
00258           if (Methods(method_id)%status == PSMILe_status_free) then
00259 
00260              ierrp (1) = method_id
00261 
00262              ierror = PRISM_Error_Arg
00263 
00264              call psmile_error ( PRISM_Error_Arg, 'method_id (not active)', &
00265                              ierrp, 1, __FILE__, __LINE__ )
00266              return
00267           endif
00268 
00269           if (Methods(method_id)%grid_id /= grid_id) then
00270 
00271              ierrp (1) = method_id
00272 
00273              ierror = PRISM_Error_Arg
00274 
00275              call psmile_error ( PRISM_Error_Arg, 'method has wrong grid_id', &
00276                              ierrp, 1, __FILE__, __LINE__ )
00277              return
00278           endif
00279 
00280       endif
00281 
00282 !-----------------------------------------------------------------------
00283 !  b)   Control Grid id for vector fields 
00284 !-----------------------------------------------------------------------
00285 
00286       if ( Associated(Methods(method_id)%vector_pointer) ) then
00287          do i = 1, 3
00288             point_id=Methods(method_id)%vector_pointer%array_of_point_ids(i)
00289             if ( Methods(point_id)%grid_id /= grid_id ) then 
00290  
00291               ierrp (1) = grid_id
00292               ierrp (2) = Methods(point_id)%grid_id
00293 
00294               ierror = PRISM_Error_Arg
00295 
00296               call psmile_error ( ierror, 'inconsistent grid_ids for vector component', &
00297                                   ierrp, 2, __FILE__, __LINE__ )
00298               return
00299             endif
00300           enddo
00301       endif
00302 
00303 !-----------------------------------------------------------------------
00304 !  c)   Control Mask Id
00305 !-----------------------------------------------------------------------
00306 
00307       if ( mask_id /= PRISM_UNDEFINED ) then
00308          if ( mask_id < 0 .or. &
00309               mask_id > Number_of_Masks_allocated ) then
00310             ierrp (1) = mask_id
00311             ierrp (2) = Number_of_Masks_allocated
00312 
00313             ierror = PRISM_Error_Arg
00314 
00315             call psmile_error ( ierror, 'mask_id', &
00316                  ierrp, 2, __FILE__, __LINE__ )
00317             return
00318          endif
00319 
00320          if (Masks(mask_id)%status == PSMILe_status_free ) then
00321             ierrp (1) = mask_id
00322 
00323             ierror = PRISM_Error_Arg
00324 
00325             call psmile_error ( PRISM_Error_Arg, 'mask_id (not active)', &
00326                  ierrp, 1, __FILE__, __LINE__ )
00327             return
00328          endif
00329 
00330          if (Masks(mask_id)%grid_id /= grid_id ) then
00331             ierrp (1) = mask_id
00332 
00333             ierror = PRISM_Error_Arg
00334 
00335             call psmile_error ( PRISM_Error_Arg, 'mask has wrong grid_id', &
00336                  ierrp, 1, __FILE__, __LINE__ )
00337             return
00338          endif
00339 
00340       endif
00341 
00342 !-----------------------------------------------------------------------
00343 !  d)   Control dimensions
00344 !-----------------------------------------------------------------------
00345 
00346       if (nodims(1) < 1 .or. nodims(1) > max_dim) then
00347          ierror = PRISM_Error_Arg
00348          ierrp (1) = nodims(1)
00349          ierrp (2) = max_dim
00350 
00351          call psmile_error ( ierror, 'nodims (1)', &
00352                              ierrp, 2, __FILE__, __LINE__ )
00353          return
00354       endif
00355 !
00356       do i = 1, nodims(1)
00357          if (var_actual_shape(1,i) > var_actual_shape(2,i)) exit
00358       enddo
00359 !
00360       if (i <= nodims(1)) then
00361          ierror = PRISM_Error_Arg
00362          ierrp (1) = var_actual_shape(1,i)
00363          ierrp (2) = var_actual_shape(2,i)
00364 
00365          call psmile_error ( ierror, 'var_actual_shape', &
00366                              ierrp, 2, __FILE__, __LINE__ )
00367          return
00368       endif
00369 
00370 !-----------------------------------------------------------------------
00371 !  5th  Get handle Id and Nullify the pointer
00372 !-----------------------------------------------------------------------
00373 
00374       call psmile_get_field_handle (var_id, ierror)
00375       if (ierror > 0) return
00376 !
00377       fp => Fields(var_id)
00378 
00379 !-----------------------------------------------------------------------
00380 !  6th  Detect whether the field was activated by the user.
00381 !       Set the location to undefined when nothing was found.
00382 !       Else determine whether it was activated for any output
00383 !       or input and set it to undefined when no action was 
00384 !       activated.
00385 !-----------------------------------------------------------------------
00386 
00387 !
00388       fp%global_var_id = sga_smioc_transi(smioc_loc)%ig_transi_id
00389 
00390       fp%smioc_loc     = PRISM_UNDEFINED
00391 
00392       do ii = 1, sga_smioc_transi(smioc_loc)%ig_nb_transi_out
00393          if ( sga_smioc_transi(smioc_loc)%sga_transi_out(ii)%ig_dest_type > 0 ) exit
00394       enddo
00395 
00396       if ( ii > sga_smioc_transi(smioc_loc)%ig_nb_transi_out .and. &
00397            sga_smioc_transi(smioc_loc)%sg_transi_in%ig_nb_in_orig < 1 ) then
00398          fp%smioc_loc = PRISM_UNDEFINED
00399       else if ( smioc_loc <= size(sga_smioc_transi) ) then
00400          fp%smioc_loc = smioc_loc
00401          s_ptr                    = smioc_loc
00402       endif
00403 
00404 !-----------------------------------------------------------------------
00405 ! ... in case  fp%smioc_loc == PRISM_UNDEFINED we have to
00406 !     return here since the field has not been activated by the user 
00407 !     and s_ptr would point to nowhere and the following actions will
00408 !     not be well defined.
00409 !-----------------------------------------------------------------------
00410 
00411       fp%local_name = trim(adjustl(name))
00412 
00413       if ( fp%smioc_loc == PRISM_UNDEFINED ) then
00414          ierrp (1) = var_id
00415          call psmile_warning ( PRISM_UNDEFINED, 'Field name is not activated. We return', &
00416                       ierrp, 1, __FILE__, __LINE__ )
00417          return
00418       endif
00419 
00420 #ifdef DEBUG
00421       print *, trim(ch_id), ': We point to ', fp%smioc_loc, ' in SMIOC struct.'
00422 #endif
00423 
00424 
00425 !-----------------------------------------------------------------------
00426 !  7th  Check whether it is a vector, bundle or scalar field
00427 !-----------------------------------------------------------------------
00428 
00429       select case ( sga_smioc_transi(s_ptr)%ig_transi_type )
00430 
00431       case ( PSMILe_bunvec )
00432           bundle_field = 1
00433           vector_field = 1
00434           fp%transi_type = PSMILe_bunvec
00435           if ( .not. Associated(Methods(method_id)%vector_pointer) ) then
00436             ierror = PRISM_Error_Arg
00437             ierrp (1) = method_id
00438             ierrp (2) = sga_smioc_transi(s_ptr)%ig_transi_type
00439             call psmile_error ( ierror, 'Variable not declared as vector', &
00440                                 ierrp, 1, __FILE__, __LINE__ )
00441             return
00442           endif
00443           if ( nodims(2) < 1 ) then
00444             ierror = PRISM_Error_Arg
00445             ierrp (1) = nodims(2)
00446             ierrp (2) = sga_smioc_transi(s_ptr)%ig_transi_type
00447             call psmile_error ( ierror, 'Bundle dim must be > 0', &
00448                                 ierrp, 1, __FILE__, __LINE__ )
00449             return
00450           endif
00451 
00452       case ( PSMILe_bundle )
00453           bundle_field = 1
00454           vector_field = 0
00455           fp%transi_type = PSMILe_bundle
00456           if ( nodims(2) < 1 ) then
00457             ierror = PRISM_Error_Arg
00458             ierrp (1) = nodims(2)
00459             ierrp (2) = sga_smioc_transi(s_ptr)%ig_transi_type
00460             call psmile_error ( ierror, 'Bundle dim must be > 0', &
00461                                 ierrp, 1, __FILE__, __LINE__ )
00462             return
00463           endif
00464 
00465       case ( PSMILe_vector )
00466           nodims(2) = 3
00467           bundle_field  = 0
00468           vector_field  = 1
00469           fp%transi_type = PSMILe_vector
00470           if ( .not. Associated(Methods(method_id)%vector_pointer) ) then
00471             ierror = PRISM_Error_Arg
00472             ierrp (1) = method_id
00473             ierrp (2) = sga_smioc_transi(s_ptr)%ig_transi_type
00474             call psmile_error ( ierror, 'Variable not declared as vector', &
00475                                 ierrp, 1, __FILE__, __LINE__ )
00476             return
00477           endif
00478 
00479       case ( PSMILe_single )
00480           nodims(2) = 0
00481           bundle_field  = 0
00482           vector_field  = 0
00483           fp%transi_type = PSMILe_single
00484 
00485       case DEFAULT
00486           ! PSMILe_single
00487           ! Since this argument will become mandatory in the SMIOC
00488           ! the default should be replaced by an error handling in future.
00489           nodims(2) = 0
00490           bundle_field  = 0
00491           vector_field  = 0
00492           fp%transi_type = PSMILe_single
00493 
00494       end select
00495 
00496 !-----------------------------------------------------------------------
00497 !  8th  Check for correct nodims(1) depending on grid_type
00498 !-----------------------------------------------------------------------
00499 
00500       select case ( gp%grid_type )
00501 
00502       case ( PRISM_Unstructlonlatvrt )
00503          if ( nodims(1) /= 1+bundle_field+vector_field ) then
00504             ierror = PRISM_Error_Arg
00505             ierrp (1) = nodims(1)
00506             ierrp (2) = 1+bundle_field+vector_field
00507 
00508             call psmile_error ( ierror, 'nodims(1)', &
00509                                 ierrp, 2, __FILE__, __LINE__ )
00510             return
00511          endif
00512 
00513       case ( PRISM_Unstructlonlat_regvrt )
00514          if ( nodims(1) /= 2+bundle_field+vector_field ) then
00515             ierror = PRISM_Error_Arg
00516             ierrp (1) = nodims(1)
00517             ierrp (2) = 1+bundle_field+vector_field
00518 
00519             call psmile_error ( ierror, 'nodims(1)', &
00520                                 ierrp, 2, __FILE__, __LINE__ )
00521             return
00522          endif
00523 
00524       case ( PRISM_Gaussreduced_regvrt )
00525  
00526          if ( nodims(1) /= 2+bundle_field+vector_field ) then
00527             ierror = PRISM_Error_Arg
00528             ierrp (1) = nodims(1)
00529             ierrp (2) = 1+bundle_field+vector_field
00530 
00531             call psmile_error ( ierror, 'nodims(1)', &
00532                                 ierrp, 2, __FILE__, __LINE__ )
00533             return
00534          endif
00535 
00536       case ( PRISM_Unstructlonlat_sigmavrt )
00537          if ( nodims(1) /= 2+bundle_field+vector_field ) then
00538             ierror = PRISM_Error_Arg
00539             ierrp (1) = nodims(1)
00540             ierrp (2) = 1+bundle_field+vector_field
00541 
00542             call psmile_error ( ierror, 'nodims(1)', &
00543                                 ierrp, 2, __FILE__, __LINE__ )
00544             return
00545          endif
00546 
00547       case DEFAULT
00548          if ( nodims(1) /= 3+bundle_field+vector_field ) then
00549             ierror = PRISM_Error_Arg
00550             ierrp (1) = nodims(1)
00551             ierrp (2) = 1+bundle_field+vector_field
00552 
00553             call psmile_error ( ierror, 'nodims(1)', &
00554                                 ierrp, 2, __FILE__, __LINE__ )
00555             return
00556          endif
00557 
00558       end select
00559 
00560 #ifdef VERBOSE
00561       print '(" ",a,a,i8,a1,a,a)', trim(ch_id), ': psmile_def_var: var_id ', &
00562                       var_id, ' ', trim(name), ' specified as '
00563       if ( bundle_field == 1 ) print *, trim(ch_id), ':   - bundle'
00564       if ( vector_field == 1 ) print *, trim(ch_id), ':   - vector'
00565       if ( bundle_field == 0 .and. &
00566            vector_field == 0 ) print *, trim(ch_id), ':   - scalar'
00567 
00568       call psmile_flushstd
00569 #endif /* VERBOSE */
00570 
00571 !-----------------------------------------------------------------------
00572 !  9th  Check whether the vector part has the appropriate shape. Only
00573 !       full 3-d vector components are supported. One component for
00574 !       each of the three dimensions is required.
00575 !-----------------------------------------------------------------------
00576 
00577       if ( vector_field == 1 .and. &
00578          ( var_actual_shape(1,nodims(1)-bundle_field) /= 1 .or. &
00579          ( var_actual_shape(2,nodims(1)-bundle_field) /= 3 ))) then
00580 
00581          ierror = PRISM_Error_Arg
00582          ierrp (1) = var_actual_shape(1,nodims(1)-bundle_field)
00583          ierrp (2) = var_actual_shape(2,nodims(1)-bundle_field)
00584 
00585          call psmile_error ( ierror, 'var_actual_shape', &
00586                              ierrp, 2, __FILE__, __LINE__ )
00587          return
00588       endif
00589 
00590 !-----------------------------------------------------------------------
00591 !  10th  Initialize and store shapes (see also prism_def_partition)
00592 !-----------------------------------------------------------------------
00593 
00594       fp%var_shape = 1
00595 
00596       select case ( gp%grid_type )
00597 
00598       case ( PRISM_Unstructlonlatvrt )
00599          fp%var_shape(1:2,1:1) = var_actual_shape (1:2,1:1)
00600          if ( bundle_field == 1 ) &
00601          fp%var_shape(2,nodims(1)) = max(nodims(2),1) ! nbr of bundles
00602 
00603       case ( PRISM_Unstructlonlat_regvrt )
00604          fp%var_shape(1:2,1:2) = var_actual_shape (1:2,1:2)
00605          if ( bundle_field == 1 ) &
00606          fp%var_shape(2,nodims(1)) = max(nodims(2),1) ! nbr of bundles
00607 
00608       case ( PRISM_Unstructlonlat_sigmavrt )
00609          fp%var_shape(1:2,1:2) = var_actual_shape (1:2,1:2)
00610          if ( bundle_field == 1 ) &
00611          fp%var_shape(2,nodims(1)) = max(nodims(2),1) ! nbr of bundles
00612 
00613       case ( PRISM_Gaussreduced_regvrt )
00614          nodims(1) = nodims(1) + 1
00615          fp%var_shape(1:2,1) = var_actual_shape (1:2,1)
00616          fp%var_shape(1:2,2) = 1
00617          fp%var_shape(1:2,3) = var_actual_shape (1:2,2)
00618          if ( bundle_field == 1 ) &
00619          fp%var_shape(2,nodims(1)) = max(nodims(2),1) ! nbr of bundles
00620 
00621       case DEFAULT
00622          fp%var_shape(1:2,1:ndim_3d) = var_actual_shape (1:2,1:ndim_3d)
00623          if ( bundle_field == 1 ) &
00624          fp%var_shape(2,nodims(1)) = max(nodims(2),1) ! nbr of bundles
00625 
00626       end select
00627 
00628 !-----------------------------------------------------------------------
00629 !  11th  Determine the total length of input data 
00630 !-----------------------------------------------------------------------
00631 
00632       length = 1
00633       do i = 1, nodims(1)
00634          length = length * ( fp%var_shape(2,i) - &
00635                              fp%var_shape(1,i) + 1 )
00636       enddo
00637 
00638 #ifdef VERBOSE
00639   print *, trim(ch_id), ': psmile_def_var: ndim_3d = ',ndim_3d
00640   print *, '    : psmile_def_var: size var_shape dim 1 = ',size(var_actual_shape(:,:),DIM=1)
00641   print *, '    : psmile_def_var: size var_shape dim 2 = ',size(var_actual_shape(:,:),DIM=2)
00642   print *, '    : psmile_def_var: var_shape = ',var_actual_shape
00643   print *, '    : psmile_def_var: length = ',length
00644   print *, '    : psmile_def_var: var_type = ',var_type
00645 #endif
00646 !-----------------------------------------------------------------------
00647 !  12th Store other field data
00648 !-----------------------------------------------------------------------
00649 
00650       fp%status      = PSMILe_status_defined
00651       fp%comp_id     = gp%comp_id
00652       fp%method_id   = method_id
00653       fp%mask_id     = mask_id
00654       fp%size        = length
00655       fp%dataType    = var_type
00656 
00657 !-----------------------------------------------------------------------
00658 !  a)   Transient in 
00659 !-----------------------------------------------------------------------
00660 
00661       fp%Taskin%Judate_Lbnd%days = huge(fp%Taskin%Judate_Ubnd%days)
00662       fp%Taskin%Judate_Lbnd%secs = huge(fp%Taskin%Judate_Ubnd%days)
00663 
00664       fp%Taskin%Judate_Ubnd%days = huge(fp%Taskin%Judate_Ubnd%days)
00665       fp%Taskin%Judate_Ubnd%secs = huge(fp%Taskin%Judate_Ubnd%days)
00666 
00667       if ( sga_smioc_transi(s_ptr)%ig_datatype /= var_type ) then
00668 
00669             ierror    = PRISM_Error_Arglist
00670             ierrp (1) = sga_smioc_transi(s_ptr)%ig_datatype
00671             ierrp (2) = var_type
00672 
00673             call psmile_error ( ierror, &
00674                  "var_type in SMIOC does not match var_type given by component.", &
00675                  ierrp, 2, __FILE__, __LINE__ )
00676       endif
00677 
00678       nb_transi_in = sga_smioc_transi(s_ptr)%sg_transi_in%ig_nb_in_orig
00679 
00680       fp%Taskin%nbr_inchannels = nb_transi_in
00681 
00682       if ( nb_transi_in > 0 ) then
00683 
00684          Allocate (fp%Taskin%In_channel(nb_transi_in))
00685          if ( ierror /= 0 ) then
00686             ierrp (1) = nb_transi_in
00687             ierror = PRISM_Error_Alloc
00688             call psmile_error ( ierror, 'Fields(var_id)%Taskin%In_channel', &
00689                  ierrp, 1, __FILE__, __LINE__ )
00690             return
00691          endif
00692 
00693          sga_in_orig => sga_smioc_transi(s_ptr)%sg_transi_in%sga_in_orig
00694 
00695          do i = 1, nb_transi_in
00696 
00697 !-----------------------------------------------------------------------
00698 ! ... ids concerning the input channels
00699 !-----------------------------------------------------------------------
00700 
00701             fp%Taskin%In_channel(i)%origin_type = &
00702                sga_in_orig(i)%ig_orig_type
00703 
00704             fp%Taskin%In_channel(i)%remote_transi_id = &
00705                sga_in_orig(i)%ig_orig_transi_id
00706 
00707             fp%Taskin%In_channel(i)%global_transi_id = &
00708                sga_in_orig(i)%ig_transi_in_id
00709 
00710             fp%Taskin%In_channel(i)%remote_comp_id = &
00711                sga_in_orig(i)%ig_orig_comp_id
00712 
00713             fp%Taskin%In_channel(i)%assoc_var_id = PSMILe_undef
00714 
00715             fp%Taskin%In_channel(i)%userdef_id = PSMILe_undef
00716 
00717 !-----------------------------------------------------------------------
00718 ! ... information on interpolation
00719 !-----------------------------------------------------------------------
00720 
00721             fp%Taskin%In_channel(i)%interp%interp_type = &
00722                sga_in_orig(i)%sg_interp%ig_interp_type
00723 
00724             fp%Taskin%In_channel(i)%interp%interp_meth = &
00725                sga_in_orig(i)%sg_interp%iga_interp_meth
00726 
00727             fp%Taskin%In_channel(i)%interp%arg1 = &
00728                sga_in_orig(i)%sg_interp%iga_arg1
00729 
00730             fp%Taskin%In_channel(i)%interp%arg2 = &
00731                sga_in_orig(i)%sg_interp%iga_arg2
00732 
00733             fp%Taskin%In_channel(i)%interp%arg3 = &
00734                sga_in_orig(i)%sg_interp%iga_arg3
00735 
00736             fp%Taskin%In_channel(i)%interp%arg4 = &
00737                sga_in_orig(i)%sg_interp%iga_arg4
00738 
00739             fp%Taskin%In_channel(i)%interp%arg5 = &
00740                sga_in_orig(i)%sg_interp%iga_arg5
00741 
00742             fp%Taskin%In_channel(i)%interp%arg6 = &
00743                sga_in_orig(i)%sg_interp%iga_arg6
00744 
00745             fp%Taskin%In_channel(i)%interp%arg7 = &
00746                sga_in_orig(i)%sg_interp%iga_arg7
00747 
00748             fp%Taskin%In_channel(i)%interp%arg8 = &
00749                sga_in_orig(i)%sg_interp%dg_arg8
00750 
00751             fp%Taskin%In_channel(i)%interp%arg9 = &
00752                sga_in_orig(i)%sg_interp%cg_arg9
00753 
00754             fp%Taskin%In_channel(i)%interp%arg10 = &
00755                sga_in_orig(i)%sg_interp%sg_arg10
00756 
00757 !-----------------------------------------------------------------------
00758 ! ... information on combination
00759 !-----------------------------------------------------------------------
00760 
00761             fp%Taskin%In_channel(i)%combi%combi_name = &
00762                sga_in_orig(i)%sg_combi%cg_combi_name
00763 
00764             fp%Taskin%In_channel(i)%combi%ext_mask_name = &
00765                sga_in_orig(i)%sg_combi%cg_ext_mask_name
00766 
00767 !!$            fp%Taskin%In_channel(i)%combi%ext_mask_file = &
00768 !!$               sga_in_orig(i)%sg_combi%sg_ext_mask_file 
00769 
00770             fp%Taskin%In_channel(i)%combi%combi_param = &
00771                sga_in_orig(i)%sg_combi%dg_combi_param
00772 
00773             fp%Taskin%In_channel(i)%combi%scalar = &
00774                sga_in_orig(i)%sg_combi%dg_scalar
00775 
00776             fp%Taskin%In_channel(i)%combi%location = &
00777                sga_in_orig(i)%sg_combi%ig_location
00778 
00779             fp%Taskin%In_channel(i)%combi%operand = &
00780                sga_in_orig(i)%sg_combi%ig_operand
00781 
00782             fp%Taskin%In_channel(i)%combi%mask_type = &
00783                sga_in_orig(i)%sg_combi%ig_mask_type
00784 
00785             fp%Taskin%In_channel(i)%combi%combi_meth = &
00786                sga_in_orig(i)%sg_combi%ig_combi_meth
00787 #ifdef DEBUG
00788             print '(" ",a,a)', trim(ch_id), ': psmile_def_var: transient IN:'
00789             print '(" ",a,a,2i8)', trim(ch_id), ': psmile_def_var: local varid, global varid:    ', &
00790                            var_id, fp%global_var_id
00791             print '(" ",a,a,2i8)', trim(ch_id), ': psmile_def_var: local varid, global varid in: ', &
00792                            var_id, fp%Taskin%In_channel(i)%global_transi_id
00793             print '(" ",a,a,2i8)', trim(ch_id), ': psmile_def_var: local varid, remote varid in: ', &
00794                            var_id, fp%Taskin%In_channel(i)%remote_transi_id
00795             print '(" ",a,a,2i8)', trim(ch_id), ': psmile_def_var: local varid, origin type in:  ', &
00796                            var_id, fp%Taskin%In_channel(i)%origin_type
00797             print '(" ",a,a,2i8)', trim(ch_id), ': psmile_def_var: local varid, remote compid in:', &
00798                            var_id, fp%Taskin%In_channel(i)%remote_comp_id
00799             print '(a,a,i5,a40)', trim(ch_id), ': psmile_def_var: local varid, weights and add file: ', &
00800                            var_id, trim(fp%Taskin%In_channel(i)%interp%arg10%cg_file_name)
00801             print '(a,a,i5,i10)', trim(ch_id), ': psmile_def_var: local varid, file format: ', &
00802                            var_id, fp%Taskin%In_channel(i)%interp%arg10%ig_file_format
00803 #endif
00804          enddo
00805 
00806       else
00807 
00808          nullify (fp%Taskin%In_channel)
00809 
00810       endif
00811 
00812 !-----------------------------------------------------------------------
00813 !  b)   Transient out
00814 !-----------------------------------------------------------------------
00815 
00816       nb_transi_out = sga_smioc_transi(s_ptr)%ig_nb_transi_out
00817 
00818       if ( nb_transi_out > 0 ) then
00819          Allocate (fp%Taskout(nb_transi_out), STAT=ierror )
00820          if ( ierror /= 0 ) then
00821             ierrp (1) = nb_transi_out
00822 
00823             ierror = PRISM_Error_Alloc
00824 
00825             call psmile_error ( ierror, 'Fields(var_id)%Taskout', &
00826                  ierrp, 1, __FILE__, __LINE__ )
00827             return
00828          endif
00829 
00830          do i = 1, nb_transi_out
00831            fp%Taskout(i)%n_send_direct        = 0
00832            fp%Taskout(i)%n_send_coupler       = 0
00833            fp%Taskout(i)%n_send_appl          = 0
00834            fp%Taskout(i)%n_alloc_send_direct  = 0
00835            fp%Taskout(i)%n_alloc_send_coupler = 0
00836            fp%Taskout(i)%n_alloc_send_appl    = 0
00837          end do
00838 
00839          do i = 1, nb_transi_out
00840            nullify ( fp%Taskout(i)%send_coupler)
00841            nullify ( fp%Taskout(i)%send_direct )
00842            nullify ( fp%Taskout(i)%send_appl   )
00843            nullify ( fp%Taskout(i)%buffer_int  )
00844            nullify ( fp%Taskout(i)%buffer_real )
00845            nullify ( fp%Taskout(i)%buffer_dble )
00846 #if defined ( PRISM_QUAD_TYPE )
00847            nullify ( fp%Taskout(i)%buffer_quad )
00848 #endif
00849            nullify ( fp%Taskout(i)%Judate_Axis )
00850          end do
00851 
00852 !-----------------------------------------------------------------------
00853 ! ... ids concerning the output channels
00854 !-----------------------------------------------------------------------
00855 
00856          sga_transi_out => sga_smioc_transi(s_ptr)%sga_transi_out
00857 
00858          do i = 1, nb_transi_out
00859            fp%Taskout(i)%origin_type = &
00860            sga_transi_out(i)%ig_dest_type
00861 
00862            fp%Taskout(i)%remote_transi_id = &
00863            sga_transi_out(i)%ig_dest_transi_id
00864 
00865            fp%Taskout(i)%global_transi_id = &
00866            sga_transi_out(i)%ig_transi_out_id
00867 
00868            fp%Taskout(i)%remote_comp_id = &
00869            sga_transi_out(i)%ig_dest_comp_id
00870 
00871            fp%Taskout(i)%assoc_var_id = PSMILe_undef
00872 
00873            fp%Taskout(i)%userdef_id = PSMILe_undef
00874 
00875 !-----------------------------------------------------------------------
00876 ! ... information on interpolation
00877 !-----------------------------------------------------------------------
00878 
00879            fp%Taskout(i)%interp%interp_type = &
00880            sga_transi_out(i)%sg_interp%ig_interp_type
00881 
00882            fp%Taskout(i)%interp%interp_meth = &
00883            sga_transi_out(i)%sg_interp%iga_interp_meth
00884 
00885            fp%Taskout(i)%interp%arg1 = &
00886            sga_transi_out(i)%sg_interp%iga_arg1
00887 
00888            fp%Taskout(i)%interp%arg2 = &
00889            sga_transi_out(i)%sg_interp%iga_arg2
00890 
00891            fp%Taskout(i)%interp%arg3 = &
00892            sga_transi_out(i)%sg_interp%iga_arg3
00893 
00894            fp%Taskout(i)%interp%arg4 = &
00895            sga_transi_out(i)%sg_interp%iga_arg4
00896 
00897            fp%Taskout(i)%interp%arg5 = &
00898            sga_transi_out(i)%sg_interp%iga_arg5
00899 
00900            fp%Taskout(i)%interp%arg6 = &
00901            sga_transi_out(i)%sg_interp%iga_arg6
00902 
00903            fp%Taskout(i)%interp%arg7 = &
00904            sga_transi_out(i)%sg_interp%iga_arg7
00905 
00906            fp%Taskout(i)%interp%arg8 = &
00907            sga_transi_out(i)%sg_interp%dg_arg8
00908 
00909            fp%Taskout(i)%interp%arg9 = &
00910            sga_transi_out(i)%sg_interp%cg_arg9
00911 
00912            fp%Taskout(i)%interp%arg10 = &
00913            sga_transi_out(i)%sg_interp%sg_arg10
00914 
00915 !-----------------------------------------------------------------------
00916 ! ... information on combination
00917 !-----------------------------------------------------------------------
00918 
00919            fp%Taskout(i)%combi%combi_name = &
00920            sga_transi_out(i)%sg_combi%cg_combi_name
00921 
00922            fp%Taskout(i)%combi%ext_mask_name = &
00923            sga_transi_out(i)%sg_combi%cg_ext_mask_name
00924 
00925 !!$           fp%Taskout(i)%combi%ext_mask_file = &
00926 !!$           sga_transi_out(i)%sg_combi%sg_ext_mask_file
00927 
00928            fp%Taskout(i)%combi%combi_param = &
00929            sga_transi_out(i)%sg_combi%dg_combi_param
00930 
00931            fp%Taskout(i)%combi%scalar = &
00932            sga_transi_out(i)%sg_combi%dg_scalar
00933 
00934            fp%Taskout(i)%combi%location = &
00935            sga_transi_out(i)%sg_combi%ig_location
00936 
00937            fp%Taskout(i)%combi%operand = &
00938            sga_transi_out(i)%sg_combi%ig_operand
00939 
00940            fp%Taskout(i)%combi%mask_type = &
00941            sga_transi_out(i)%sg_combi%ig_mask_type
00942 
00943            fp%Taskout(i)%combi%combi_meth = &
00944            sga_transi_out(i)%sg_combi%ig_combi_meth
00945 
00946 #ifdef DEBUG
00947             print '(" ",a,a)', trim(ch_id), ': psmile_def_var: transient OUT: '
00948             print '(" ",a,a,2i8)', trim(ch_id), ': psmile_def_var: local varid, global varid:     ', &
00949                            var_id, fp%global_var_id
00950             print '(" ",a,a,2i8)', trim(ch_id), ': psmile_def_var: local varid, global varid out: ', &
00951                            var_id, fp%Taskout(i)%global_transi_id
00952 
00953             print '(" ",a,a,2i8)', trim(ch_id), ': psmile_def_var: local varid, remote varid out: ', &
00954                            var_id, fp%Taskout(i)%remote_transi_id
00955 
00956             print '(" ",a,a,2i8)', trim(ch_id), ': psmile_def_var: local varid, origin type out:  ', &
00957                            var_id, fp%Taskout(i)%origin_type
00958 
00959             print '(" ",a,a,2i8)', trim(ch_id), ': psmile_def_var: local varid, remote compid out:', &
00960                            var_id, fp%Taskout(i)%remote_comp_id
00961             print '(a,a,i5,a)', trim(ch_id), ': psmile_def_var: local varid, weights and add file: ', &
00962                            var_id, trim(fp%Taskout(i)%interp%arg10%cg_file_name)
00963             print '(a,a,i5,i10)', trim(ch_id), ': psmile_def_var: local varid, file format: ', &
00964                            var_id, fp%Taskout(i)%interp%arg10%ig_file_format
00965 #endif
00966          enddo
00967 
00968          do i = 1, nb_transi_out
00969             fp%Taskout(i)%Judate_Lbnd%days = huge(fp%Taskin%Judate_Ubnd%days)
00970             fp%Taskout(i)%Judate_Lbnd%secs = huge(fp%Taskin%Judate_Ubnd%days)
00971             fp%Taskout(i)%Judate_Ubnd%days = huge(fp%Taskin%Judate_Ubnd%days)
00972             fp%Taskout(i)%Judate_Ubnd%secs = huge(fp%Taskin%Judate_Ubnd%days)
00973          enddo
00974       endif
00975 
00976 !-----------------------------------------------------------------------
00977 !  13th Check whether this field is used for coupling and set flags
00978 !-----------------------------------------------------------------------
00979 
00980       fp%used_for_coupling     = .false.
00981       fp%used_for_io           = .false.
00982 
00983       do i = 1, nb_transi_out
00984          if ( sga_transi_out(i)%ig_dest_type == PSMILe_comp ) exit
00985       enddo
00986 
00987       if (i <= nb_transi_out) then
00988          gp%used_for_coupling     = .true.
00989          fp%used_for_coupling     = .true.
00990          Methods(method_id)%used_for_coupling = .true.
00991       endif
00992 
00993       do i = 1, nb_transi_in
00994          if ( sga_in_orig(i)%ig_orig_type == PSMILe_comp ) exit
00995       enddo
00996 
00997       if (i <= nb_transi_in) then
00998          gp%used_for_coupling     = .true.
00999          fp%used_for_coupling     = .true.
01000          Methods(method_id)%used_for_coupling = .true.
01001       endif
01002 
01003 
01004       do i = 1, nb_transi_out
01005         if ( sga_transi_out(i)%ig_dest_type == PSMILe_file ) exit
01006       enddo
01007 
01008       if (i <= nb_transi_out) then
01009 #ifdef DEBUG
01010           print*, 'Component sends data in a file'
01011           call psmile_flushstd
01012 #endif
01013           gp%used_for_io     = .true.
01014           fp%used_for_io     = .true.
01015       endif
01016 
01017       do i = 1, nb_transi_in
01018         if ( sga_in_orig(i)%ig_orig_type == PSMILe_file ) exit
01019       enddo
01020 
01021       if (i <= nb_transi_in) then
01022 #ifdef DEBUG
01023           print*, 'Component receives data from a file'
01024           call psmile_flushstd
01025 #endif
01026           gp%used_for_io     = .true.
01027           fp%used_for_io     = .true.
01028       endif
01029 
01030 !-----------------------------------------------------------------------
01031 !  14th Check whether this field is a candidate for gathering/scattering
01032 !       In case that field does not match shape of points specified we test
01033 !       whether the given mask allows for scattering or gathering, else we
01034 !       are lost. 
01035 !-----------------------------------------------------------------------
01036 
01037       test_dim = nodims(1) - bundle_field - vector_field
01038 
01039       length = 1
01040 
01041       do i = 1, test_dim
01042          length = length * ( fp%var_shape(2,i) - &
01043                              fp%var_shape(1,i) + 1 )
01044       enddo
01045 
01046       if ( test_dim < gp%n_dim ) then
01047 
01048          !-----------------------------------------------------------------
01049          !  ... candidate for scattering or gathering
01050          !-----------------------------------------------------------------
01051 
01052          if ( length /= count(Masks(mask_id)%mask_array) ) then
01053 
01054             ierror = PRISM_Error_Arglist
01055 
01056             ierrp (1) = mask_id
01057             ierrp (2) = method_id
01058 
01059             call psmile_error ( ierror, &
01060                  "Specified shape and mask does not allow scatter or gather", &
01061                  ierrp, 2, __FILE__, __LINE__ )
01062          endif
01063 
01064          !-----------------------------------------------------------------
01065          !  ... Check whether gathering is specified for input
01066          !           fields in the SMIOC file
01067          !-----------------------------------------------------------------
01068 
01069          i = 0
01070 
01071          do i = 1, nb_transi_in
01072            if ( sga_smioc_transi(s_ptr)%sg_transi_in%sg_tgt_local_trans%ig_gather == PSMILe_true ) exit
01073          enddo
01074 
01075          if ( i > nb_transi_in ) then
01076 
01077             ierror = PRISM_Error_Arglist
01078 
01079             ierrp (1) = var_id
01080             ierrp (2) = method_id
01081 
01082             call psmile_error ( ierror, &
01083                  "Gathering is required but not specified in smioc for input", &
01084                  ierrp, 2, __FILE__, __LINE__ )
01085          endif
01086          
01087          !-----------------------------------------------------------------
01088          !  ... Check whether scattering is specified for output
01089          !           fields in the SMIOC file
01090          !-----------------------------------------------------------------
01091 
01092          i = 0
01093 
01094          do i = 1, nb_transi_out
01095            if ( sga_transi_out(i)%sg_src_local_trans%ig_scatter == PSMILe_true ) exit
01096          enddo
01097 
01098          if ( i > nb_transi_out ) then
01099 
01100             ierror = PRISM_Error_Arglist
01101 
01102             ierrp (1) = var_id
01103             ierrp (2) = method_id
01104 
01105             call psmile_error ( ierror, &
01106                  "Scattering is required but not specified in smioc for out", &
01107                  ierrp, 2, __FILE__, __LINE__ )
01108          endif
01109 
01110       endif
01111 
01112 !-----------------------------------------------------------------------
01113 !  15th Finally test whether shapes are the same
01114 !-----------------------------------------------------------------------
01115 
01116       if ( Associated(Methods(method_id)%vector_pointer) ) then
01117 
01118          do i = 1, 3
01119 
01120             point_id = Methods(method_id)%vector_pointer%array_of_point_ids(i)
01121 
01122             coords_pointer => Methods(point_id)%coords_pointer
01123 !
01124 #ifdef PRISM_ASSERTION
01125             if (.not. Associated(coords_pointer) ) then
01126                print *, 'i, point_id, method_id', i, point_id, method_id
01127                call psmile_assert ( __FILE__, __LINE__, &
01128                                    'coords_pointer is not associated for method')
01129             endif
01130 #endif /* PRISM_ASSERTION */
01131 
01132             do ii = 1, gp%n_dim
01133                if (fp%var_shape(1,ii) > coords_pointer%actual_shape(1,ii) .and. &
01134                    fp%var_shape(2,ii) < coords_pointer%actual_shape(2,ii)) exit
01135             enddo
01136 
01137             if ( ii <= gp%n_dim ) then
01138 
01139                ierror = PRISM_Error_Arglist
01140 
01141                call psmile_error ( PRISM_Error_Arglist, &
01142                     'fp%var_shape for vector too small', &
01143                      fp%var_shape, nodims(1)*2, &
01144                     __FILE__, __LINE__ )
01145                return
01146             endif
01147 
01148          enddo
01149 
01150       else
01151 
01152          coords_pointer => Methods(method_id)%coords_pointer
01153 !
01154 #ifdef PRISM_ASSERTION
01155         if (.not. Associated(coords_pointer) ) then
01156             print *, 'i, method_id', i, method_id
01157             call psmile_assert ( __FILE__, __LINE__, &
01158                                 'coords_pointer is not associated for method')
01159          endif
01160 #endif /* PRISM_ASSERTION */
01161 
01162          do i = 1, gp%n_dim
01163 #if 1
01164 ! Die Variables muessen nur im grid_shape definiert sein
01165 ! Oder wird fuer overlap regions noch etwas beseonderes gemacht ?
01166             if (fp%var_shape(1,i) > gp%grid_shape(1, i) .and. &
01167                 fp%var_shape(2,i) < gp%grid_shape(2, i)) exit
01168 #else
01169             if (fp%var_shape(1,i) > coords_pointer%actual_shape(1,i) .and. &
01170                 fp%var_shape(2,i) < coords_pointer%actual_shape(2,i)) exit
01171 #endif
01172          enddo
01173 
01174          if ( i <= gp%n_dim ) then
01175 
01176             ierror = PRISM_Error_Arglist
01177 
01178             call psmile_error ( PRISM_Error_Arglist, &
01179                  'fp%var_shape too small', &
01180                  fp%var_shape, nodims(1)*2, &
01181                  __FILE__, __LINE__ )
01182             return
01183          endif
01184 
01185       endif
01186 
01187 !-----------------------------------------------------------------------
01188 !  16th Create time axis arrays for I/O and coupling actions
01189 !-----------------------------------------------------------------------
01190 
01191       call psmile_create_timeaxis ( var_id, ierror )
01192 
01193       if ( ierror == PRISM_Error_Date ) then
01194          ierrp(1) = var_id
01195          call psmile_error ( ierror, ' comming from XML file ', &
01196          ierrp, 1, __FILE__, __LINE__ )
01197       endif
01198 
01199 #ifdef  __PSMILE_WITH_IO
01200 
01201 !-----------------------------------------------------------------------
01202 !  17th Define metadata for I/O
01203 !-----------------------------------------------------------------------
01204    
01205       call psmile_def_metadata(var_id,ierror)
01206 #endif
01207 
01208 !-----------------------------------------------------------------------
01209 !  18th Epilogue
01210 !-----------------------------------------------------------------------
01211 
01212 #ifdef VERBOSE
01213       print *, trim(ch_id), ': psmile_def_var: eof ierror =', &
01214                ierror, '; grid_id =', grid_id, ', var_id', var_id
01215 
01216       call psmile_flushstd
01217 #endif /* VERBOSE */
01218 
01219       end subroutine psmile_def_var

Generated on 18 Mar 2011 for Oasis4 by  doxygen 1.6.1