Changeset 824


Ignore:
Timestamp:
02/16/16 10:14:30 (8 years ago)
Author:
mhnguyen
Message:

Correcting the behavior of field_ref

+) If a field refers to another one via field_ref and there is no transformation between
grid of this field and one of refered field, this field will inherit attributes from field_ref.

Test
+) On Curie
+) All tests pass

Location:
XIOS/trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • XIOS/trunk/inputs/REMAP/iodef.xml

    r823 r824  
    88   <field_definition level="1" > 
    99     <field id="src_field" operation="instant" domain_ref="src_domain"/> 
     10     <field id="src_field_clone" operation="instant" field_ref="src_field" domain_ref="src_domain_clone"/> 
    1011     <field id="dst_field" operation="instant" field_ref="src_field" domain_ref="dst_domain"/> 
    1112     <field id="tmp_field" operation="instant" domain_ref="src_domain_regular_tmp"/> 
     
    2122     <file id="output" name="output"> 
    2223        <field field_ref="src_field" name="field" /> 
     24     </file> 
     25     <file id="output_clone" name="output_clone"> 
     26        <field field_ref="src_field_clone" name="field" /> 
    2327     </file> 
    2428     <file id="output_dst" name="output_dst" type="one_file"> 
     
    6165   <domain_definition> 
    6266     <domain id="src_domain" /> 
     67     <domain id="src_domain_clone" /> 
    6368     <domain id="dst_domain"> 
    6469       <interpolate_domain/> 
  • XIOS/trunk/src/node/field.cpp

    r823 r824  
    770770     std::pair<boost::shared_ptr<CFilter>, boost::shared_ptr<CFilter> > filters; 
    771771     // Check if a spatial transformation is needed 
    772      if (grid && grid != fieldRef->grid) 
     772     if (grid && grid != fieldRef->grid && grid->hasTransform()) 
    773773       filters = CSpatialTransformFilter::buildFilterGraph(gc, fieldRef->grid, grid); 
    774774     else 
  • XIOS/trunk/src/node/grid.cpp

    r823 r824  
    3232      , transformations_(0), isTransformed_(false) 
    3333      , axisPositionInGrid_(), positionDimensionDistributed_(1), hasDomainAxisBaseRef_(false) 
    34       , gridSrc_() 
     34      , gridSrc_(), hasTransform_(false) 
    3535   { 
    3636     setVirtualDomainGroup(); 
     
    4747      , transformations_(0), isTransformed_(false) 
    4848      , axisPositionInGrid_(), positionDimensionDistributed_(1), hasDomainAxisBaseRef_(false) 
    49       , gridSrc_() 
     49      , gridSrc_(), hasTransform_(false) 
    5050   { 
    5151     setVirtualDomainGroup(); 
     
    14081408    transformations_ = new CGridTransformation(this, transformGridSrc); 
    14091409    transformations_->computeAll(); 
     1410    if (0 < transformations_->getNbAlgo()) hasTransform_ = true; 
    14101411 
    14111412    // Ok, now need to compute index of grid source 
    14121413    transformGridSrc->checkMaskIndex(false); 
     1414  } 
     1415 
     1416  bool CGrid::hasTransform() 
     1417  { 
     1418    return hasTransform_; 
    14131419  } 
    14141420 
  • XIOS/trunk/src/node/grid.hpp

    r823 r824  
    195195         void addTransGridSource(CGrid* gridSrc); 
    196196         std::map<CGrid*, std::pair<bool,StdString> >& getTransGridSource(); 
     197         bool hasTransform(); 
    197198 
    198199      public: 
     
    273274        std::vector<int> globalDim_; 
    274275        std::map<CGrid*, std::pair<bool,StdString> > gridSrc_; 
     276        bool hasTransform_; 
    275277   }; // class CGrid 
    276278 
  • XIOS/trunk/src/test/test_remap.f90

    r820 r824  
    116116                            bounds_lon_1D=src_boundslon, bounds_lat_1D=src_boundslat, nvertex=src_nvertex) 
    117117 
     118  CALL xios_set_domain_attr("src_domain_clone", ni_glo=src_ni_glo, ibegin=src_ibegin, ni=src_ni, type="unstructured") 
     119  CALL xios_set_domain_attr("src_domain_clone", lonvalue_1D=src_lon, latvalue_1D=src_lat, & 
     120                            bounds_lon_1D=src_boundslon, bounds_lat_1D=src_boundslat, nvertex=src_nvertex) 
     121 
    118122  CALL xios_set_domain_attr("dst_domain", ni_glo=dst_ni_glo, ibegin=dst_ibegin, ni=dst_ni, type="unstructured") 
    119123  CALL xios_set_domain_attr("dst_domain", lonvalue_1D=dst_lon, latvalue_1D=dst_lat, & 
  • XIOS/trunk/src/transformation/grid_transformation.cpp

    r823 r824  
    355355void CGridTransformation::computeAll() 
    356356{ 
     357  if (nbAlgos_ < 1) return; 
     358 
    357359  CContext* context = CContext::getCurrent(); 
    358360  CContextClient* client = context->client; 
  • XIOS/trunk/src/transformation/grid_transformation.hpp

    r821 r824  
    4848  CGrid* getGridDestination() { return gridDestination_; } 
    4949  ListAlgoType getAlgoList() const {return listAlgos_; } 
     50  int getNbAlgo() { return nbAlgos_; } 
    5051 
    5152protected: 
Note: See TracChangeset for help on using the changeset viewer.