Changeset 790


Ignore:
Timestamp:
11/16/15 16:21:45 (5 years ago)
Author:
rlacroix
Message:

Add a new field attribute grid_path to allow chaining spatial transformations.

Intermediate grids must be separated by comma and the source/destination grids must not be listed.

Location:
XIOS/trunk/src
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • XIOS/trunk/src/config/field_attribute.conf

    r711 r790  
    2020DECLARE_ATTRIBUTE(StdString, grid_ref) 
    2121DECLARE_ATTRIBUTE(StdString, field_ref) 
     22DECLARE_ATTRIBUTE(StdString, grid_path) 
    2223 
    2324DECLARE_ATTRIBUTE(double,    default_value) 
  • XIOS/trunk/src/filter/spatial_transform_filter.cpp

    r709 r790  
    1818            "Impossible to build the filter graph if either the source or the destination grid are null."); 
    1919 
    20     // TODO: Implement the real path finding algorithm after a solution has been found 
    21     //       to support initializing grid transformations during parsing. 
    22     CSpatialTransformFilterEngine* engine = CSpatialTransformFilterEngine::get(destGrid->getTransformations()); 
    23     boost::shared_ptr<CSpatialTransformFilter> filter(new CSpatialTransformFilter(gc, engine)); 
     20    boost::shared_ptr<CSpatialTransformFilter> firstFilter, lastFilter; 
     21    // Note that this loop goes from the last transformation to the first transformation 
     22    do 
     23    { 
     24      CGridTransformation* gridTransformation = destGrid->getTransformations(); 
     25      CSpatialTransformFilterEngine* engine = CSpatialTransformFilterEngine::get(destGrid->getTransformations()); 
     26      boost::shared_ptr<CSpatialTransformFilter> filter(new CSpatialTransformFilter(gc, engine)); 
    2427 
    25     return std::make_pair(filter, filter); 
     28      if (!lastFilter) 
     29        lastFilter = filter; 
     30      else 
     31        filter->connectOutput(firstFilter, 0); 
     32 
     33      firstFilter = filter; 
     34      destGrid = gridTransformation->getGridSource(); 
     35    } 
     36    while (destGrid != srcGrid); 
     37 
     38    return std::make_pair(firstFilter, lastFilter); 
    2639  } 
    2740 
  • XIOS/trunk/src/interface/c_attr/icfield_attr.cpp

    r711 r790  
    287287 
    288288 
     289  void cxios_set_field_grid_path(field_Ptr field_hdl, const char * grid_path, int grid_path_size) 
     290  { 
     291    std::string grid_path_str; 
     292    if (!cstr2string(grid_path, grid_path_size, grid_path_str)) return; 
     293    CTimer::get("XIOS").resume(); 
     294    field_hdl->grid_path.setValue(grid_path_str); 
     295    CTimer::get("XIOS").suspend(); 
     296  } 
     297 
     298  void cxios_get_field_grid_path(field_Ptr field_hdl, char * grid_path, int grid_path_size) 
     299  { 
     300    CTimer::get("XIOS").resume(); 
     301    if (!string_copy(field_hdl->grid_path.getInheritedValue(), grid_path, grid_path_size)) 
     302      ERROR("void cxios_get_field_grid_path(field_Ptr field_hdl, char * grid_path, int grid_path_size)", << "Input string is too short"); 
     303    CTimer::get("XIOS").suspend(); 
     304  } 
     305 
     306  bool cxios_is_defined_field_grid_path(field_Ptr field_hdl) 
     307  { 
     308     CTimer::get("XIOS").resume(); 
     309     bool isDefined = field_hdl->grid_path.hasInheritedValue(); 
     310     CTimer::get("XIOS").suspend(); 
     311     return isDefined; 
     312  } 
     313 
     314 
    289315  void cxios_set_field_grid_ref(field_Ptr field_hdl, const char * grid_ref, int grid_ref_size) 
    290316  { 
  • XIOS/trunk/src/interface/c_attr/icfieldgroup_attr.cpp

    r711 r790  
    287287 
    288288 
     289  void cxios_set_fieldgroup_grid_path(fieldgroup_Ptr fieldgroup_hdl, const char * grid_path, int grid_path_size) 
     290  { 
     291    std::string grid_path_str; 
     292    if (!cstr2string(grid_path, grid_path_size, grid_path_str)) return; 
     293    CTimer::get("XIOS").resume(); 
     294    fieldgroup_hdl->grid_path.setValue(grid_path_str); 
     295    CTimer::get("XIOS").suspend(); 
     296  } 
     297 
     298  void cxios_get_fieldgroup_grid_path(fieldgroup_Ptr fieldgroup_hdl, char * grid_path, int grid_path_size) 
     299  { 
     300    CTimer::get("XIOS").resume(); 
     301    if (!string_copy(fieldgroup_hdl->grid_path.getInheritedValue(), grid_path, grid_path_size)) 
     302      ERROR("void cxios_get_fieldgroup_grid_path(fieldgroup_Ptr fieldgroup_hdl, char * grid_path, int grid_path_size)", << "Input string is too short"); 
     303    CTimer::get("XIOS").suspend(); 
     304  } 
     305 
     306  bool cxios_is_defined_fieldgroup_grid_path(fieldgroup_Ptr fieldgroup_hdl) 
     307  { 
     308     CTimer::get("XIOS").resume(); 
     309     bool isDefined = fieldgroup_hdl->grid_path.hasInheritedValue(); 
     310     CTimer::get("XIOS").suspend(); 
     311     return isDefined; 
     312  } 
     313 
     314 
    289315  void cxios_set_fieldgroup_grid_ref(fieldgroup_Ptr fieldgroup_hdl, const char * grid_ref, int grid_ref_size) 
    290316  { 
  • XIOS/trunk/src/interface/fortran_attr/field_interface_attr.F90

    r711 r790  
    210210 
    211211 
     212    SUBROUTINE cxios_set_field_grid_path(field_hdl, grid_path, grid_path_size) BIND(C) 
     213      USE ISO_C_BINDING 
     214      INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl 
     215      CHARACTER(kind = C_CHAR)    , DIMENSION(*) :: grid_path 
     216      INTEGER  (kind = C_INT)     , VALUE        :: grid_path_size 
     217    END SUBROUTINE cxios_set_field_grid_path 
     218 
     219    SUBROUTINE cxios_get_field_grid_path(field_hdl, grid_path, grid_path_size) BIND(C) 
     220      USE ISO_C_BINDING 
     221      INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl 
     222      CHARACTER(kind = C_CHAR)    , DIMENSION(*) :: grid_path 
     223      INTEGER  (kind = C_INT)     , VALUE        :: grid_path_size 
     224    END SUBROUTINE cxios_get_field_grid_path 
     225 
     226    FUNCTION cxios_is_defined_field_grid_path(field_hdl) BIND(C) 
     227      USE ISO_C_BINDING 
     228      LOGICAL(kind=C_BOOL) :: cxios_is_defined_field_grid_path 
     229      INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl 
     230    END FUNCTION cxios_is_defined_field_grid_path 
     231 
     232 
    212233    SUBROUTINE cxios_set_field_grid_ref(field_hdl, grid_ref, grid_ref_size) BIND(C) 
    213234      USE ISO_C_BINDING 
  • XIOS/trunk/src/interface/fortran_attr/fieldgroup_interface_attr.F90

    r711 r790  
    210210 
    211211 
     212    SUBROUTINE cxios_set_fieldgroup_grid_path(fieldgroup_hdl, grid_path, grid_path_size) BIND(C) 
     213      USE ISO_C_BINDING 
     214      INTEGER (kind = C_INTPTR_T), VALUE :: fieldgroup_hdl 
     215      CHARACTER(kind = C_CHAR)    , DIMENSION(*) :: grid_path 
     216      INTEGER  (kind = C_INT)     , VALUE        :: grid_path_size 
     217    END SUBROUTINE cxios_set_fieldgroup_grid_path 
     218 
     219    SUBROUTINE cxios_get_fieldgroup_grid_path(fieldgroup_hdl, grid_path, grid_path_size) BIND(C) 
     220      USE ISO_C_BINDING 
     221      INTEGER (kind = C_INTPTR_T), VALUE :: fieldgroup_hdl 
     222      CHARACTER(kind = C_CHAR)    , DIMENSION(*) :: grid_path 
     223      INTEGER  (kind = C_INT)     , VALUE        :: grid_path_size 
     224    END SUBROUTINE cxios_get_fieldgroup_grid_path 
     225 
     226    FUNCTION cxios_is_defined_fieldgroup_grid_path(fieldgroup_hdl) BIND(C) 
     227      USE ISO_C_BINDING 
     228      LOGICAL(kind=C_BOOL) :: cxios_is_defined_fieldgroup_grid_path 
     229      INTEGER (kind = C_INTPTR_T), VALUE :: fieldgroup_hdl 
     230    END FUNCTION cxios_is_defined_fieldgroup_grid_path 
     231 
     232 
    212233    SUBROUTINE cxios_set_fieldgroup_grid_ref(fieldgroup_hdl, grid_ref, grid_ref_size) BIND(C) 
    213234      USE ISO_C_BINDING 
  • XIOS/trunk/src/interface/fortran_attr/ifield_attr.F90

    r711 r790  
    1313  SUBROUTINE xios(set_field_attr)  & 
    1414    ( field_id, add_offset, axis_ref, compression_level, default_value, detect_missing_value, domain_ref  & 
    15     , enabled, field_ref, freq_offset, freq_op, grid_ref, indexed_output, level, long_name, name  & 
    16     , operation, prec, read_access, scale_factor, standard_name, ts_enabled, ts_split_freq, unit  & 
    17     , valid_max, valid_min ) 
     15    , enabled, field_ref, freq_offset, freq_op, grid_path, grid_ref, indexed_output, level, long_name  & 
     16    , name, operation, prec, read_access, scale_factor, standard_name, ts_enabled, ts_split_freq  & 
     17    , unit, valid_max, valid_min ) 
    1818 
    1919    IMPLICIT NONE 
     
    3232      TYPE(txios(duration))  , OPTIONAL, INTENT(IN) :: freq_offset 
    3333      TYPE(txios(duration))  , OPTIONAL, INTENT(IN) :: freq_op 
     34      CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: grid_path 
    3435      CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: grid_ref 
    3536      LOGICAL  , OPTIONAL, INTENT(IN) :: indexed_output 
     
    5455      CALL xios(set_field_attr_hdl_)   & 
    5556      ( field_hdl, add_offset, axis_ref, compression_level, default_value, detect_missing_value, domain_ref  & 
    56       , enabled, field_ref, freq_offset, freq_op, grid_ref, indexed_output, level, long_name, name  & 
    57       , operation, prec, read_access, scale_factor, standard_name, ts_enabled, ts_split_freq, unit  & 
    58       , valid_max, valid_min ) 
     57      , enabled, field_ref, freq_offset, freq_op, grid_path, grid_ref, indexed_output, level, long_name  & 
     58      , name, operation, prec, read_access, scale_factor, standard_name, ts_enabled, ts_split_freq  & 
     59      , unit, valid_max, valid_min ) 
    5960 
    6061  END SUBROUTINE xios(set_field_attr) 
     
    6263  SUBROUTINE xios(set_field_attr_hdl)  & 
    6364    ( field_hdl, add_offset, axis_ref, compression_level, default_value, detect_missing_value, domain_ref  & 
    64     , enabled, field_ref, freq_offset, freq_op, grid_ref, indexed_output, level, long_name, name  & 
    65     , operation, prec, read_access, scale_factor, standard_name, ts_enabled, ts_split_freq, unit  & 
    66     , valid_max, valid_min ) 
     65    , enabled, field_ref, freq_offset, freq_op, grid_path, grid_ref, indexed_output, level, long_name  & 
     66    , name, operation, prec, read_access, scale_factor, standard_name, ts_enabled, ts_split_freq  & 
     67    , unit, valid_max, valid_min ) 
    6768 
    6869    IMPLICIT NONE 
     
    8081      TYPE(txios(duration))  , OPTIONAL, INTENT(IN) :: freq_offset 
    8182      TYPE(txios(duration))  , OPTIONAL, INTENT(IN) :: freq_op 
     83      CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: grid_path 
    8284      CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: grid_ref 
    8385      LOGICAL  , OPTIONAL, INTENT(IN) :: indexed_output 
     
    101103      CALL xios(set_field_attr_hdl_)  & 
    102104      ( field_hdl, add_offset, axis_ref, compression_level, default_value, detect_missing_value, domain_ref  & 
    103       , enabled, field_ref, freq_offset, freq_op, grid_ref, indexed_output, level, long_name, name  & 
    104       , operation, prec, read_access, scale_factor, standard_name, ts_enabled, ts_split_freq, unit  & 
    105       , valid_max, valid_min ) 
     105      , enabled, field_ref, freq_offset, freq_op, grid_path, grid_ref, indexed_output, level, long_name  & 
     106      , name, operation, prec, read_access, scale_factor, standard_name, ts_enabled, ts_split_freq  & 
     107      , unit, valid_max, valid_min ) 
    106108 
    107109  END SUBROUTINE xios(set_field_attr_hdl) 
     
    109111  SUBROUTINE xios(set_field_attr_hdl_)   & 
    110112    ( field_hdl, add_offset_, axis_ref_, compression_level_, default_value_, detect_missing_value_  & 
    111     , domain_ref_, enabled_, field_ref_, freq_offset_, freq_op_, grid_ref_, indexed_output_, level_  & 
    112     , long_name_, name_, operation_, prec_, read_access_, scale_factor_, standard_name_, ts_enabled_  & 
    113     , ts_split_freq_, unit_, valid_max_, valid_min_ ) 
     113    , domain_ref_, enabled_, field_ref_, freq_offset_, freq_op_, grid_path_, grid_ref_, indexed_output_  & 
     114    , level_, long_name_, name_, operation_, prec_, read_access_, scale_factor_, standard_name_  & 
     115    , ts_enabled_, ts_split_freq_, unit_, valid_max_, valid_min_ ) 
    114116 
    115117    IMPLICIT NONE 
     
    127129      TYPE(txios(duration))  , OPTIONAL, INTENT(IN) :: freq_offset_ 
    128130      TYPE(txios(duration))  , OPTIONAL, INTENT(IN) :: freq_op_ 
     131      CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: grid_path_ 
    129132      CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: grid_ref_ 
    130133      LOGICAL  , OPTIONAL, INTENT(IN) :: indexed_output_ 
     
    188191      ENDIF 
    189192 
     193      IF (PRESENT(grid_path_)) THEN 
     194        CALL cxios_set_field_grid_path(field_hdl%daddr, grid_path_, len(grid_path_)) 
     195      ENDIF 
     196 
    190197      IF (PRESENT(grid_ref_)) THEN 
    191198        CALL cxios_set_field_grid_ref(field_hdl%daddr, grid_ref_, len(grid_ref_)) 
     
    255262  SUBROUTINE xios(get_field_attr)  & 
    256263    ( field_id, add_offset, axis_ref, compression_level, default_value, detect_missing_value, domain_ref  & 
    257     , enabled, field_ref, freq_offset, freq_op, grid_ref, indexed_output, level, long_name, name  & 
    258     , operation, prec, read_access, scale_factor, standard_name, ts_enabled, ts_split_freq, unit  & 
    259     , valid_max, valid_min ) 
     264    , enabled, field_ref, freq_offset, freq_op, grid_path, grid_ref, indexed_output, level, long_name  & 
     265    , name, operation, prec, read_access, scale_factor, standard_name, ts_enabled, ts_split_freq  & 
     266    , unit, valid_max, valid_min ) 
    260267 
    261268    IMPLICIT NONE 
     
    274281      TYPE(txios(duration))  , OPTIONAL, INTENT(OUT) :: freq_offset 
    275282      TYPE(txios(duration))  , OPTIONAL, INTENT(OUT) :: freq_op 
     283      CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: grid_path 
    276284      CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: grid_ref 
    277285      LOGICAL  , OPTIONAL, INTENT(OUT) :: indexed_output 
     
    296304      CALL xios(get_field_attr_hdl_)   & 
    297305      ( field_hdl, add_offset, axis_ref, compression_level, default_value, detect_missing_value, domain_ref  & 
    298       , enabled, field_ref, freq_offset, freq_op, grid_ref, indexed_output, level, long_name, name  & 
    299       , operation, prec, read_access, scale_factor, standard_name, ts_enabled, ts_split_freq, unit  & 
    300       , valid_max, valid_min ) 
     306      , enabled, field_ref, freq_offset, freq_op, grid_path, grid_ref, indexed_output, level, long_name  & 
     307      , name, operation, prec, read_access, scale_factor, standard_name, ts_enabled, ts_split_freq  & 
     308      , unit, valid_max, valid_min ) 
    301309 
    302310  END SUBROUTINE xios(get_field_attr) 
     
    304312  SUBROUTINE xios(get_field_attr_hdl)  & 
    305313    ( field_hdl, add_offset, axis_ref, compression_level, default_value, detect_missing_value, domain_ref  & 
    306     , enabled, field_ref, freq_offset, freq_op, grid_ref, indexed_output, level, long_name, name  & 
    307     , operation, prec, read_access, scale_factor, standard_name, ts_enabled, ts_split_freq, unit  & 
    308     , valid_max, valid_min ) 
     314    , enabled, field_ref, freq_offset, freq_op, grid_path, grid_ref, indexed_output, level, long_name  & 
     315    , name, operation, prec, read_access, scale_factor, standard_name, ts_enabled, ts_split_freq  & 
     316    , unit, valid_max, valid_min ) 
    309317 
    310318    IMPLICIT NONE 
     
    322330      TYPE(txios(duration))  , OPTIONAL, INTENT(OUT) :: freq_offset 
    323331      TYPE(txios(duration))  , OPTIONAL, INTENT(OUT) :: freq_op 
     332      CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: grid_path 
    324333      CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: grid_ref 
    325334      LOGICAL  , OPTIONAL, INTENT(OUT) :: indexed_output 
     
    343352      CALL xios(get_field_attr_hdl_)  & 
    344353      ( field_hdl, add_offset, axis_ref, compression_level, default_value, detect_missing_value, domain_ref  & 
    345       , enabled, field_ref, freq_offset, freq_op, grid_ref, indexed_output, level, long_name, name  & 
    346       , operation, prec, read_access, scale_factor, standard_name, ts_enabled, ts_split_freq, unit  & 
    347       , valid_max, valid_min ) 
     354      , enabled, field_ref, freq_offset, freq_op, grid_path, grid_ref, indexed_output, level, long_name  & 
     355      , name, operation, prec, read_access, scale_factor, standard_name, ts_enabled, ts_split_freq  & 
     356      , unit, valid_max, valid_min ) 
    348357 
    349358  END SUBROUTINE xios(get_field_attr_hdl) 
     
    351360  SUBROUTINE xios(get_field_attr_hdl_)   & 
    352361    ( field_hdl, add_offset_, axis_ref_, compression_level_, default_value_, detect_missing_value_  & 
    353     , domain_ref_, enabled_, field_ref_, freq_offset_, freq_op_, grid_ref_, indexed_output_, level_  & 
    354     , long_name_, name_, operation_, prec_, read_access_, scale_factor_, standard_name_, ts_enabled_  & 
    355     , ts_split_freq_, unit_, valid_max_, valid_min_ ) 
     362    , domain_ref_, enabled_, field_ref_, freq_offset_, freq_op_, grid_path_, grid_ref_, indexed_output_  & 
     363    , level_, long_name_, name_, operation_, prec_, read_access_, scale_factor_, standard_name_  & 
     364    , ts_enabled_, ts_split_freq_, unit_, valid_max_, valid_min_ ) 
    356365 
    357366    IMPLICIT NONE 
     
    369378      TYPE(txios(duration))  , OPTIONAL, INTENT(OUT) :: freq_offset_ 
    370379      TYPE(txios(duration))  , OPTIONAL, INTENT(OUT) :: freq_op_ 
     380      CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: grid_path_ 
    371381      CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: grid_ref_ 
    372382      LOGICAL  , OPTIONAL, INTENT(OUT) :: indexed_output_ 
     
    430440      ENDIF 
    431441 
     442      IF (PRESENT(grid_path_)) THEN 
     443        CALL cxios_get_field_grid_path(field_hdl%daddr, grid_path_, len(grid_path_)) 
     444      ENDIF 
     445 
    432446      IF (PRESENT(grid_ref_)) THEN 
    433447        CALL cxios_get_field_grid_ref(field_hdl%daddr, grid_ref_, len(grid_ref_)) 
     
    497511  SUBROUTINE xios(is_defined_field_attr)  & 
    498512    ( field_id, add_offset, axis_ref, compression_level, default_value, detect_missing_value, domain_ref  & 
    499     , enabled, field_ref, freq_offset, freq_op, grid_ref, indexed_output, level, long_name, name  & 
    500     , operation, prec, read_access, scale_factor, standard_name, ts_enabled, ts_split_freq, unit  & 
    501     , valid_max, valid_min ) 
     513    , enabled, field_ref, freq_offset, freq_op, grid_path, grid_ref, indexed_output, level, long_name  & 
     514    , name, operation, prec, read_access, scale_factor, standard_name, ts_enabled, ts_split_freq  & 
     515    , unit, valid_max, valid_min ) 
    502516 
    503517    IMPLICIT NONE 
     
    524538      LOGICAL, OPTIONAL, INTENT(OUT) :: freq_op 
    525539      LOGICAL(KIND=C_BOOL) :: freq_op_tmp 
     540      LOGICAL, OPTIONAL, INTENT(OUT) :: grid_path 
     541      LOGICAL(KIND=C_BOOL) :: grid_path_tmp 
    526542      LOGICAL, OPTIONAL, INTENT(OUT) :: grid_ref 
    527543      LOGICAL(KIND=C_BOOL) :: grid_ref_tmp 
     
    558574      CALL xios(is_defined_field_attr_hdl_)   & 
    559575      ( field_hdl, add_offset, axis_ref, compression_level, default_value, detect_missing_value, domain_ref  & 
    560       , enabled, field_ref, freq_offset, freq_op, grid_ref, indexed_output, level, long_name, name  & 
    561       , operation, prec, read_access, scale_factor, standard_name, ts_enabled, ts_split_freq, unit  & 
    562       , valid_max, valid_min ) 
     576      , enabled, field_ref, freq_offset, freq_op, grid_path, grid_ref, indexed_output, level, long_name  & 
     577      , name, operation, prec, read_access, scale_factor, standard_name, ts_enabled, ts_split_freq  & 
     578      , unit, valid_max, valid_min ) 
    563579 
    564580  END SUBROUTINE xios(is_defined_field_attr) 
     
    566582  SUBROUTINE xios(is_defined_field_attr_hdl)  & 
    567583    ( field_hdl, add_offset, axis_ref, compression_level, default_value, detect_missing_value, domain_ref  & 
    568     , enabled, field_ref, freq_offset, freq_op, grid_ref, indexed_output, level, long_name, name  & 
    569     , operation, prec, read_access, scale_factor, standard_name, ts_enabled, ts_split_freq, unit  & 
    570     , valid_max, valid_min ) 
     584    , enabled, field_ref, freq_offset, freq_op, grid_path, grid_ref, indexed_output, level, long_name  & 
     585    , name, operation, prec, read_access, scale_factor, standard_name, ts_enabled, ts_split_freq  & 
     586    , unit, valid_max, valid_min ) 
    571587 
    572588    IMPLICIT NONE 
     
    592608      LOGICAL, OPTIONAL, INTENT(OUT) :: freq_op 
    593609      LOGICAL(KIND=C_BOOL) :: freq_op_tmp 
     610      LOGICAL, OPTIONAL, INTENT(OUT) :: grid_path 
     611      LOGICAL(KIND=C_BOOL) :: grid_path_tmp 
    594612      LOGICAL, OPTIONAL, INTENT(OUT) :: grid_ref 
    595613      LOGICAL(KIND=C_BOOL) :: grid_ref_tmp 
     
    625643      CALL xios(is_defined_field_attr_hdl_)  & 
    626644      ( field_hdl, add_offset, axis_ref, compression_level, default_value, detect_missing_value, domain_ref  & 
    627       , enabled, field_ref, freq_offset, freq_op, grid_ref, indexed_output, level, long_name, name  & 
    628       , operation, prec, read_access, scale_factor, standard_name, ts_enabled, ts_split_freq, unit  & 
    629       , valid_max, valid_min ) 
     645      , enabled, field_ref, freq_offset, freq_op, grid_path, grid_ref, indexed_output, level, long_name  & 
     646      , name, operation, prec, read_access, scale_factor, standard_name, ts_enabled, ts_split_freq  & 
     647      , unit, valid_max, valid_min ) 
    630648 
    631649  END SUBROUTINE xios(is_defined_field_attr_hdl) 
     
    633651  SUBROUTINE xios(is_defined_field_attr_hdl_)   & 
    634652    ( field_hdl, add_offset_, axis_ref_, compression_level_, default_value_, detect_missing_value_  & 
    635     , domain_ref_, enabled_, field_ref_, freq_offset_, freq_op_, grid_ref_, indexed_output_, level_  & 
    636     , long_name_, name_, operation_, prec_, read_access_, scale_factor_, standard_name_, ts_enabled_  & 
    637     , ts_split_freq_, unit_, valid_max_, valid_min_ ) 
     653    , domain_ref_, enabled_, field_ref_, freq_offset_, freq_op_, grid_path_, grid_ref_, indexed_output_  & 
     654    , level_, long_name_, name_, operation_, prec_, read_access_, scale_factor_, standard_name_  & 
     655    , ts_enabled_, ts_split_freq_, unit_, valid_max_, valid_min_ ) 
    638656 
    639657    IMPLICIT NONE 
     
    659677      LOGICAL, OPTIONAL, INTENT(OUT) :: freq_op_ 
    660678      LOGICAL(KIND=C_BOOL) :: freq_op__tmp 
     679      LOGICAL, OPTIONAL, INTENT(OUT) :: grid_path_ 
     680      LOGICAL(KIND=C_BOOL) :: grid_path__tmp 
    661681      LOGICAL, OPTIONAL, INTENT(OUT) :: grid_ref_ 
    662682      LOGICAL(KIND=C_BOOL) :: grid_ref__tmp 
     
    740760      ENDIF 
    741761 
     762      IF (PRESENT(grid_path_)) THEN 
     763        grid_path__tmp = cxios_is_defined_field_grid_path(field_hdl%daddr) 
     764        grid_path_ = grid_path__tmp 
     765      ENDIF 
     766 
    742767      IF (PRESENT(grid_ref_)) THEN 
    743768        grid_ref__tmp = cxios_is_defined_field_grid_ref(field_hdl%daddr) 
  • XIOS/trunk/src/interface/fortran_attr/ifieldgroup_attr.F90

    r711 r790  
    1313  SUBROUTINE xios(set_fieldgroup_attr)  & 
    1414    ( fieldgroup_id, add_offset, axis_ref, compression_level, default_value, detect_missing_value  & 
    15     , domain_ref, enabled, field_ref, freq_offset, freq_op, grid_ref, group_ref, indexed_output  & 
     15    , domain_ref, enabled, field_ref, freq_offset, freq_op, grid_path, grid_ref, group_ref, indexed_output  & 
    1616    , level, long_name, name, operation, prec, read_access, scale_factor, standard_name, ts_enabled  & 
    1717    , ts_split_freq, unit, valid_max, valid_min ) 
     
    3232      TYPE(txios(duration))  , OPTIONAL, INTENT(IN) :: freq_offset 
    3333      TYPE(txios(duration))  , OPTIONAL, INTENT(IN) :: freq_op 
     34      CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: grid_path 
    3435      CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: grid_ref 
    3536      CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: group_ref 
     
    5556      CALL xios(set_fieldgroup_attr_hdl_)   & 
    5657      ( fieldgroup_hdl, add_offset, axis_ref, compression_level, default_value, detect_missing_value  & 
    57       , domain_ref, enabled, field_ref, freq_offset, freq_op, grid_ref, group_ref, indexed_output  & 
     58      , domain_ref, enabled, field_ref, freq_offset, freq_op, grid_path, grid_ref, group_ref, indexed_output  & 
    5859      , level, long_name, name, operation, prec, read_access, scale_factor, standard_name, ts_enabled  & 
    5960      , ts_split_freq, unit, valid_max, valid_min ) 
     
    6364  SUBROUTINE xios(set_fieldgroup_attr_hdl)  & 
    6465    ( fieldgroup_hdl, add_offset, axis_ref, compression_level, default_value, detect_missing_value  & 
    65     , domain_ref, enabled, field_ref, freq_offset, freq_op, grid_ref, group_ref, indexed_output  & 
     66    , domain_ref, enabled, field_ref, freq_offset, freq_op, grid_path, grid_ref, group_ref, indexed_output  & 
    6667    , level, long_name, name, operation, prec, read_access, scale_factor, standard_name, ts_enabled  & 
    6768    , ts_split_freq, unit, valid_max, valid_min ) 
     
    8182      TYPE(txios(duration))  , OPTIONAL, INTENT(IN) :: freq_offset 
    8283      TYPE(txios(duration))  , OPTIONAL, INTENT(IN) :: freq_op 
     84      CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: grid_path 
    8385      CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: grid_ref 
    8486      CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: group_ref 
     
    103105      CALL xios(set_fieldgroup_attr_hdl_)  & 
    104106      ( fieldgroup_hdl, add_offset, axis_ref, compression_level, default_value, detect_missing_value  & 
    105       , domain_ref, enabled, field_ref, freq_offset, freq_op, grid_ref, group_ref, indexed_output  & 
     107      , domain_ref, enabled, field_ref, freq_offset, freq_op, grid_path, grid_ref, group_ref, indexed_output  & 
    106108      , level, long_name, name, operation, prec, read_access, scale_factor, standard_name, ts_enabled  & 
    107109      , ts_split_freq, unit, valid_max, valid_min ) 
     
    111113  SUBROUTINE xios(set_fieldgroup_attr_hdl_)   & 
    112114    ( fieldgroup_hdl, add_offset_, axis_ref_, compression_level_, default_value_, detect_missing_value_  & 
    113     , domain_ref_, enabled_, field_ref_, freq_offset_, freq_op_, grid_ref_, group_ref_, indexed_output_  & 
    114     , level_, long_name_, name_, operation_, prec_, read_access_, scale_factor_, standard_name_  & 
    115     , ts_enabled_, ts_split_freq_, unit_, valid_max_, valid_min_ ) 
     115    , domain_ref_, enabled_, field_ref_, freq_offset_, freq_op_, grid_path_, grid_ref_, group_ref_  & 
     116    , indexed_output_, level_, long_name_, name_, operation_, prec_, read_access_, scale_factor_  & 
     117    , standard_name_, ts_enabled_, ts_split_freq_, unit_, valid_max_, valid_min_ ) 
    116118 
    117119    IMPLICIT NONE 
     
    129131      TYPE(txios(duration))  , OPTIONAL, INTENT(IN) :: freq_offset_ 
    130132      TYPE(txios(duration))  , OPTIONAL, INTENT(IN) :: freq_op_ 
     133      CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: grid_path_ 
    131134      CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: grid_ref_ 
    132135      CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: group_ref_ 
     
    191194      ENDIF 
    192195 
     196      IF (PRESENT(grid_path_)) THEN 
     197        CALL cxios_set_fieldgroup_grid_path(fieldgroup_hdl%daddr, grid_path_, len(grid_path_)) 
     198      ENDIF 
     199 
    193200      IF (PRESENT(grid_ref_)) THEN 
    194201        CALL cxios_set_fieldgroup_grid_ref(fieldgroup_hdl%daddr, grid_ref_, len(grid_ref_)) 
     
    262269  SUBROUTINE xios(get_fieldgroup_attr)  & 
    263270    ( fieldgroup_id, add_offset, axis_ref, compression_level, default_value, detect_missing_value  & 
    264     , domain_ref, enabled, field_ref, freq_offset, freq_op, grid_ref, group_ref, indexed_output  & 
     271    , domain_ref, enabled, field_ref, freq_offset, freq_op, grid_path, grid_ref, group_ref, indexed_output  & 
    265272    , level, long_name, name, operation, prec, read_access, scale_factor, standard_name, ts_enabled  & 
    266273    , ts_split_freq, unit, valid_max, valid_min ) 
     
    281288      TYPE(txios(duration))  , OPTIONAL, INTENT(OUT) :: freq_offset 
    282289      TYPE(txios(duration))  , OPTIONAL, INTENT(OUT) :: freq_op 
     290      CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: grid_path 
    283291      CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: grid_ref 
    284292      CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: group_ref 
     
    304312      CALL xios(get_fieldgroup_attr_hdl_)   & 
    305313      ( fieldgroup_hdl, add_offset, axis_ref, compression_level, default_value, detect_missing_value  & 
    306       , domain_ref, enabled, field_ref, freq_offset, freq_op, grid_ref, group_ref, indexed_output  & 
     314      , domain_ref, enabled, field_ref, freq_offset, freq_op, grid_path, grid_ref, group_ref, indexed_output  & 
    307315      , level, long_name, name, operation, prec, read_access, scale_factor, standard_name, ts_enabled  & 
    308316      , ts_split_freq, unit, valid_max, valid_min ) 
     
    312320  SUBROUTINE xios(get_fieldgroup_attr_hdl)  & 
    313321    ( fieldgroup_hdl, add_offset, axis_ref, compression_level, default_value, detect_missing_value  & 
    314     , domain_ref, enabled, field_ref, freq_offset, freq_op, grid_ref, group_ref, indexed_output  & 
     322    , domain_ref, enabled, field_ref, freq_offset, freq_op, grid_path, grid_ref, group_ref, indexed_output  & 
    315323    , level, long_name, name, operation, prec, read_access, scale_factor, standard_name, ts_enabled  & 
    316324    , ts_split_freq, unit, valid_max, valid_min ) 
     
    330338      TYPE(txios(duration))  , OPTIONAL, INTENT(OUT) :: freq_offset 
    331339      TYPE(txios(duration))  , OPTIONAL, INTENT(OUT) :: freq_op 
     340      CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: grid_path 
    332341      CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: grid_ref 
    333342      CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: group_ref 
     
    352361      CALL xios(get_fieldgroup_attr_hdl_)  & 
    353362      ( fieldgroup_hdl, add_offset, axis_ref, compression_level, default_value, detect_missing_value  & 
    354       , domain_ref, enabled, field_ref, freq_offset, freq_op, grid_ref, group_ref, indexed_output  & 
     363      , domain_ref, enabled, field_ref, freq_offset, freq_op, grid_path, grid_ref, group_ref, indexed_output  & 
    355364      , level, long_name, name, operation, prec, read_access, scale_factor, standard_name, ts_enabled  & 
    356365      , ts_split_freq, unit, valid_max, valid_min ) 
     
    360369  SUBROUTINE xios(get_fieldgroup_attr_hdl_)   & 
    361370    ( fieldgroup_hdl, add_offset_, axis_ref_, compression_level_, default_value_, detect_missing_value_  & 
    362     , domain_ref_, enabled_, field_ref_, freq_offset_, freq_op_, grid_ref_, group_ref_, indexed_output_  & 
    363     , level_, long_name_, name_, operation_, prec_, read_access_, scale_factor_, standard_name_  & 
    364     , ts_enabled_, ts_split_freq_, unit_, valid_max_, valid_min_ ) 
     371    , domain_ref_, enabled_, field_ref_, freq_offset_, freq_op_, grid_path_, grid_ref_, group_ref_  & 
     372    , indexed_output_, level_, long_name_, name_, operation_, prec_, read_access_, scale_factor_  & 
     373    , standard_name_, ts_enabled_, ts_split_freq_, unit_, valid_max_, valid_min_ ) 
    365374 
    366375    IMPLICIT NONE 
     
    378387      TYPE(txios(duration))  , OPTIONAL, INTENT(OUT) :: freq_offset_ 
    379388      TYPE(txios(duration))  , OPTIONAL, INTENT(OUT) :: freq_op_ 
     389      CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: grid_path_ 
    380390      CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: grid_ref_ 
    381391      CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: group_ref_ 
     
    440450      ENDIF 
    441451 
     452      IF (PRESENT(grid_path_)) THEN 
     453        CALL cxios_get_fieldgroup_grid_path(fieldgroup_hdl%daddr, grid_path_, len(grid_path_)) 
     454      ENDIF 
     455 
    442456      IF (PRESENT(grid_ref_)) THEN 
    443457        CALL cxios_get_fieldgroup_grid_ref(fieldgroup_hdl%daddr, grid_ref_, len(grid_ref_)) 
     
    511525  SUBROUTINE xios(is_defined_fieldgroup_attr)  & 
    512526    ( fieldgroup_id, add_offset, axis_ref, compression_level, default_value, detect_missing_value  & 
    513     , domain_ref, enabled, field_ref, freq_offset, freq_op, grid_ref, group_ref, indexed_output  & 
     527    , domain_ref, enabled, field_ref, freq_offset, freq_op, grid_path, grid_ref, group_ref, indexed_output  & 
    514528    , level, long_name, name, operation, prec, read_access, scale_factor, standard_name, ts_enabled  & 
    515529    , ts_split_freq, unit, valid_max, valid_min ) 
     
    538552      LOGICAL, OPTIONAL, INTENT(OUT) :: freq_op 
    539553      LOGICAL(KIND=C_BOOL) :: freq_op_tmp 
     554      LOGICAL, OPTIONAL, INTENT(OUT) :: grid_path 
     555      LOGICAL(KIND=C_BOOL) :: grid_path_tmp 
    540556      LOGICAL, OPTIONAL, INTENT(OUT) :: grid_ref 
    541557      LOGICAL(KIND=C_BOOL) :: grid_ref_tmp 
     
    574590      CALL xios(is_defined_fieldgroup_attr_hdl_)   & 
    575591      ( fieldgroup_hdl, add_offset, axis_ref, compression_level, default_value, detect_missing_value  & 
    576       , domain_ref, enabled, field_ref, freq_offset, freq_op, grid_ref, group_ref, indexed_output  & 
     592      , domain_ref, enabled, field_ref, freq_offset, freq_op, grid_path, grid_ref, group_ref, indexed_output  & 
    577593      , level, long_name, name, operation, prec, read_access, scale_factor, standard_name, ts_enabled  & 
    578594      , ts_split_freq, unit, valid_max, valid_min ) 
     
    582598  SUBROUTINE xios(is_defined_fieldgroup_attr_hdl)  & 
    583599    ( fieldgroup_hdl, add_offset, axis_ref, compression_level, default_value, detect_missing_value  & 
    584     , domain_ref, enabled, field_ref, freq_offset, freq_op, grid_ref, group_ref, indexed_output  & 
     600    , domain_ref, enabled, field_ref, freq_offset, freq_op, grid_path, grid_ref, group_ref, indexed_output  & 
    585601    , level, long_name, name, operation, prec, read_access, scale_factor, standard_name, ts_enabled  & 
    586602    , ts_split_freq, unit, valid_max, valid_min ) 
     
    608624      LOGICAL, OPTIONAL, INTENT(OUT) :: freq_op 
    609625      LOGICAL(KIND=C_BOOL) :: freq_op_tmp 
     626      LOGICAL, OPTIONAL, INTENT(OUT) :: grid_path 
     627      LOGICAL(KIND=C_BOOL) :: grid_path_tmp 
    610628      LOGICAL, OPTIONAL, INTENT(OUT) :: grid_ref 
    611629      LOGICAL(KIND=C_BOOL) :: grid_ref_tmp 
     
    643661      CALL xios(is_defined_fieldgroup_attr_hdl_)  & 
    644662      ( fieldgroup_hdl, add_offset, axis_ref, compression_level, default_value, detect_missing_value  & 
    645       , domain_ref, enabled, field_ref, freq_offset, freq_op, grid_ref, group_ref, indexed_output  & 
     663      , domain_ref, enabled, field_ref, freq_offset, freq_op, grid_path, grid_ref, group_ref, indexed_output  & 
    646664      , level, long_name, name, operation, prec, read_access, scale_factor, standard_name, ts_enabled  & 
    647665      , ts_split_freq, unit, valid_max, valid_min ) 
     
    651669  SUBROUTINE xios(is_defined_fieldgroup_attr_hdl_)   & 
    652670    ( fieldgroup_hdl, add_offset_, axis_ref_, compression_level_, default_value_, detect_missing_value_  & 
    653     , domain_ref_, enabled_, field_ref_, freq_offset_, freq_op_, grid_ref_, group_ref_, indexed_output_  & 
    654     , level_, long_name_, name_, operation_, prec_, read_access_, scale_factor_, standard_name_  & 
    655     , ts_enabled_, ts_split_freq_, unit_, valid_max_, valid_min_ ) 
     671    , domain_ref_, enabled_, field_ref_, freq_offset_, freq_op_, grid_path_, grid_ref_, group_ref_  & 
     672    , indexed_output_, level_, long_name_, name_, operation_, prec_, read_access_, scale_factor_  & 
     673    , standard_name_, ts_enabled_, ts_split_freq_, unit_, valid_max_, valid_min_ ) 
    656674 
    657675    IMPLICIT NONE 
     
    677695      LOGICAL, OPTIONAL, INTENT(OUT) :: freq_op_ 
    678696      LOGICAL(KIND=C_BOOL) :: freq_op__tmp 
     697      LOGICAL, OPTIONAL, INTENT(OUT) :: grid_path_ 
     698      LOGICAL(KIND=C_BOOL) :: grid_path__tmp 
    679699      LOGICAL, OPTIONAL, INTENT(OUT) :: grid_ref_ 
    680700      LOGICAL(KIND=C_BOOL) :: grid_ref__tmp 
     
    760780      ENDIF 
    761781 
     782      IF (PRESENT(grid_path_)) THEN 
     783        grid_path__tmp = cxios_is_defined_fieldgroup_grid_path(fieldgroup_hdl%daddr) 
     784        grid_path_ = grid_path__tmp 
     785      ENDIF 
     786 
    762787      IF (PRESENT(grid_ref_)) THEN 
    763788        grid_ref__tmp = cxios_is_defined_fieldgroup_grid_ref(fieldgroup_hdl%daddr) 
  • XIOS/trunk/src/node/field.cpp

    r775 r790  
    819819   { 
    820820     if (grid && !grid->isTransformed() && hasDirectFieldReference() && grid != getDirectFieldReference()->grid) 
    821        grid->transformGrid(getDirectFieldReference()->grid); 
     821     { 
     822       std::vector<CGrid*> grids; 
     823       // Source grid 
     824       grids.push_back(getDirectFieldReference()->grid); 
     825       // Intermediate grids 
     826       if (!grid_path.isEmpty()) 
     827       { 
     828         std::string gridId; 
     829         size_t start = 0, end; 
     830 
     831         do 
     832         { 
     833           end = grid_path.getValue().find(',', start); 
     834           if (end != std::string::npos) 
     835           { 
     836             gridId = grid_path.getValue().substr(start, end - start); 
     837             start = end + 1; 
     838           } 
     839           else 
     840             gridId = grid_path.getValue().substr(start); 
     841 
     842           if (!CGrid::has(gridId)) 
     843             ERROR("void CField::solveTransformedGrid()", 
     844                   << "Invalid grid_path, the grid '" << gridId << "' does not exist."); 
     845 
     846           grids.push_back(CGrid::get(gridId)); 
     847         } 
     848         while (end != std::string::npos); 
     849       } 
     850       // Destination grid 
     851       grids.push_back(grid); 
     852 
     853       for (size_t i = 0, count = grids.size() - 1; i < count; ++i) 
     854       { 
     855         CGrid *gridSrc  = grids[i]; 
     856         CGrid *gridDest = grids[i + 1]; 
     857         if (!gridDest->isTransformed()) 
     858           gridDest->transformGrid(gridSrc); 
     859       } 
     860     } 
    822861   } 
    823862 
  • XIOS/trunk/src/transformation/grid_transformation.hpp

    r687 r790  
    4545  const std::map<int, CArray<int,1> >& getLocalIndexToSendFromGridSource() const; 
    4646  const std::map<int, std::vector<std::vector<std::pair<int,double> > > >& getLocalIndexToReceiveOnGridDest() const; 
    47   CGrid* getGridSource() {return gridSource_; } 
     47  CGrid* getGridSource() { return originalGridSource_; } 
    4848  CGrid* getGridDestination() { return gridDestination_; } 
    4949  ListAlgoType getAlgoList() const {return listAlgos_; } 
Note: See TracChangeset for help on using the changeset viewer.