Changeset 742


Ignore:
Timestamp:
10/15/15 15:46:40 (5 years ago)
Author:
mhnguyen
Message:

Implement direct transformation with domain_ref and axis_ref

+) Add a new case in which transformations among fields can be done via domain_ref and axis_ref (not only grid_ref)
+) Fix a minor bug relating to baseFieldReference

Test
+) On Curie
+) all standard tests (client, complete) pass
+) test_remap pass and the results are correct

Location:
XIOS/trunk
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • XIOS/trunk/inputs/COMPLETE/context_atmosphere.xml

    r636 r742  
    55  <field_definition level="1" enabled=".FALSE." default_value="9.96921e+36"> 
    66    <field id="field_A_atm"  name="field_A_atm_origin" operation="average" freq_op="1ts" grid_ref="grid_A_atm" /> 
    7     <field id="field_A_atm_zoom"  name="field_A_atm" operation="average" freq_op="1ts" field_ref="field_A_atm" grid_ref="grid_A_atm_zoom" /> 
     7    <field id="field_A_atm_zoom"  name="field_A_atm" operation="average" freq_op="1ts" field_ref="field_A_atm" domain_ref="domain_atm_zoom" axis_ref="axis_atm" /> 
    88  </field_definition> 
    99 
     
    3636     <axis axis_ref="axis_atm" /> 
    3737   </grid> 
    38    <grid id="grid_A_atm_zoom"> 
    39      <domain domain_ref="domain_atm_zoom" /> 
    40      <axis axis_ref="axis_atm_zoom" /> 
    41    </grid> 
    4238  </grid_definition> 
    4339 
  • XIOS/trunk/inputs/REMAP/iodef.xml

    • Property svn:executable set to *
    r734 r742  
    77 
    88   <field_definition level="1" > 
    9      <field id="src_field"  operation="instant" grid_ref="src_grid"/> 
    10      <field id="dst_field"  operation="instant" field_ref="src_field" grid_ref="dst_grid"/> 
    11      <field id="dst_field_regular"  operation="instant" field_ref="tmp_field" grid_ref="dst_grid_regular"  read_access="true"/> 
    12      <field id="tmp_field"  operation="instant" grid_ref="src_grid_regular"/> 
     9     <field id="src_field"  operation="instant" domain_ref="src_domain"/> 
     10     <field id="dst_field"  operation="instant" field_ref="src_field" domain_ref="dst_domain"/> 
     11     <field id="tmp_field"  operation="instant" domain_ref="src_domain_regular"/> 
     12     <field id="dst_field_regular_grid"  operation="instant" field_ref="tmp_field" grid_ref="dst_grid_regular"  read_access="true"/> 
     13     <field id="dst_field_regular"  operation="instant" field_ref="tmp_field" domain_ref="dst_domain_regular"  read_access="true"/> 
     14 
    1315   </field_definition> 
    1416 
     
    1820        <field field_ref="src_field" name="field" /> 
    1921     </file> 
    20      <file id="output_dst" name="output_dst"> 
     22     <file id="output_dst" name="output_dst" type="one_file"> 
    2123        <field field_ref="dst_field" name="field" /> 
    2224     </file> 
    2325     <file id="output_dst_regular" name="output_dst_regular" type="one_file"> 
    2426        <field field_ref="dst_field_regular" name="field" /> 
     27        <field field_ref="dst_field_regular_grid" name="field_grid" /> 
    2528     </file> 
    2629     <file id="output_src_regular" name="output_src_regular" mode="read" type="multiple_file"> 
    27         <field id="src_field_regular" name="field" grid_ref="src_grid_regular" operation="instant"/> 
     30        <field id="src_field_regular" name="field" domain_ref="src_domain_regular" operation="instant"/> 
     31     </file> 
     32     <file id="output_src_regular_tmp" name="output_src_regular_tmp"> 
     33        <field field_ref="tmp_field"/> 
    2834     </file> 
    2935   </file_definition> 
     
    3844       <interpolate_domain/> 
    3945     </domain> 
    40      <domain id="dst_domain_regular" domain_src="src_domain_regular" ni_glo="360" nj_glo="180" type="rectilinear"> 
     46     <domain id="dst_domain_regular" domain_src="src_domain_regular" ni_glo="90" nj_glo="45" type="rectilinear"> 
    4147       <generate_rectilinear_domain /> 
    4248       <interpolate_domain/> 
     
    4854 
    4955   <grid_definition> 
    50      <grid id="dst_grid"> 
    51        <domain domain_ref="dst_domain" /> 
    52      </grid> 
    5356     <grid id="dst_grid_regular"> 
    5457       <domain domain_ref="dst_domain_regular" /> 
    55      </grid> 
    56      <grid id="src_grid"> 
    57        <domain domain_ref="src_domain" /> 
    58      </grid> 
    59      <grid id="src_grid_regular"> 
    60        <domain domain_ref="src_domain_regular" /> 
    6158     </grid> 
    6259   </grid_definition> 
     
    6966            <variable id="optimal_buffer_size" type="string">performance</variable> 
    7067            <variable id="buffer_size_factor" type="double">30.0</variable> 
    71             <variable id="buffer_size_min" type="double">800000</variable> 
     68            <variable id="min_buffer_size" type="double">800000</variable> 
    7269         </variable_group> 
    7370 
  • XIOS/trunk/src/declare_ref_func.hpp

    r540 r742  
    7979     sset.insert(refer_ptr);                                                       \ 
    8080  }                                                                                \ 
     81  baseRefObject = refer_ptr;                                                      \ 
     82  baseRefObject->addReference(this) ;               \ 
    8183                                                                                   \ 
    82   if (hasDirect##type##Reference()) baseRefObject->addReference(this) ;               \ 
     84 /* if (hasDirect##type##Reference()) baseRefObject->addReference(this) ;*/               \ 
    8385}                                                                                  \ 
    8486                                                                                   \ 
  • XIOS/trunk/src/node/axis.cpp

    r731 r742  
    6666   /*! 
    6767    * Test whether the data defined on the axis can be outputted in a compressed way. 
    68     *  
     68    * 
    6969    * \return true if and only if a mask was defined for this axis 
    7070    */ 
     
    326326   } 
    327327 
    328    void CAxis::checkAttributesOnClient(const std::vector<int>& globalDim, int orderPositionInGrid, 
    329                                        CServerDistributionDescription::ServerDistributionType distType) 
     328   void CAxis::checkAttributesOnClient() 
    330329   { 
    331330     if (this->areClientAttributesChecked_) return; 
     
    340339                                     CServerDistributionDescription::ServerDistributionType distType) 
    341340   { 
    342      if (!this->areClientAttributesChecked_) checkAttributesOnClient(globalDim, 
    343                                                                      orderPositionInGrid, 
    344                                                                      distType); 
     341     if (!this->areClientAttributesChecked_) checkAttributesOnClient(); 
    345342     CContext* context = CContext::getCurrent(); 
    346343 
  • XIOS/trunk/src/node/axis.hpp

    r731 r742  
    102102         static void recvServerAttribut(CEventServer& event); 
    103103         void recvServerAttribut(CBufferIn& buffer) ; 
    104          void checkAttributesOnClient(const std::vector<int>& globalDim, int orderPositionInGrid, 
    105                                       CServerDistributionDescription::ServerDistributionType disType = CServerDistributionDescription::BAND_DISTRIBUTION); 
     104         void checkAttributesOnClient(); 
    106105         void sendCheckedAttributes(const std::vector<int>& globalDim, int orderPositionInGrid, 
    107106                                    CServerDistributionDescription::ServerDistributionType disType = CServerDistributionDescription::BAND_DISTRIBUTION); 
  • XIOS/trunk/src/node/field.cpp

    r741 r742  
    755755   void CField::solveGridReference(void) 
    756756   { 
     757      if (grid_ref.isEmpty() && domain_ref.isEmpty() && axis_ref.isEmpty()) 
     758      { 
     759        ERROR("CField::solveGridReference(void)", 
     760              << "At least one dimension must be defined for this field."); 
     761      } 
     762 
    757763      CDomain* domain; 
    758764      CAxis* axis; 
     
    761767      std::vector<std::string> domList, axisList; 
    762768 
     769      // In some cases, domain_ref, axis_ref and grid_ref don't come from the current field but from his direct field_ref 
     770      // To make sure to use the correct *_ref, we need to compare these values to direct field_ref's 
     771      CField* baseFieldRef = this->getBaseFieldReference(); 
     772      bool hasDomainFromFieldRef = false; 
     773      bool hasAxisFromFieldRef = false; 
     774      bool hasGridFromFieldRef = false; 
     775 
    763776      if (!domain_ref.isEmpty()) 
    764777      { 
     778         if (0 != baseFieldRef) 
     779         { 
     780           if ((!baseFieldRef->domain_ref.isEmpty()) && (baseFieldRef->domain_ref.getValue() == domain_ref.getValue())) 
     781            hasDomainFromFieldRef = true; 
     782         } 
     783 
    765784         if (CDomain::has(domain_ref.getValue())) 
    766785         { 
    767786           domain = CDomain::get(domain_ref.getValue()); 
     787           // It's a direct reference, so we use this ref as its name 
     788           domain->name.setValue(domain_ref.getValue()); 
     789 
    768790           vecDom.push_back(domain); 
    769791         } 
     
    776798      if (!axis_ref.isEmpty()) 
    777799      { 
     800         if (0 != baseFieldRef) 
     801         { 
     802           if ((!baseFieldRef->axis_ref.isEmpty()) && (baseFieldRef->axis_ref.getValue() == axis_ref.getValue())) 
     803            hasAxisFromFieldRef = true; 
     804         } 
    778805         if (CAxis::has(axis_ref.getValue())) 
    779806         { 
    780807           axis = CAxis::get(axis_ref.getValue()); 
     808                      // It's a direct reference, so we use this ref as its name 
     809           axis->name.setValue(axis_ref.getValue()); 
     810 
    781811           vecAxis.push_back(axis); 
    782812         } 
     
    789819      if (!grid_ref.isEmpty()) 
    790820      { 
    791          if (CGrid::has(grid_ref.getValue())) 
     821         if (0 != baseFieldRef) 
    792822         { 
    793            this->grid = CGrid::get(grid_ref.getValue()); 
    794            domList = grid->getDomainList(); 
    795            axisList = grid->getAxisList(); 
    796            if (domList.empty() && axisList.empty()) 
     823           if ((!baseFieldRef->grid_ref.isEmpty()) && (baseFieldRef->grid_ref.getValue() == grid_ref.getValue())) 
     824            hasGridFromFieldRef = true; 
     825         } 
     826 
     827        if ((domain_ref.isEmpty() && axis_ref.isEmpty()) || (!hasGridFromFieldRef)) 
     828        { 
     829           if (CGrid::has(grid_ref.getValue())) 
    797830           { 
    798              this->grid = CGrid::createGrid(vecDom, vecAxis); 
     831             this->grid = CGrid::get(grid_ref.getValue()); 
    799832           } 
    800          } 
    801          else 
    802             ERROR("CField::solveGridReference(void)", 
    803                   << "Reference to the grid \'" 
    804                   << grid_ref.getValue() << "\' is wrong"); 
     833           else 
     834              ERROR("CField::solveGridReference(void)", 
     835                    << "Reference to the grid \'" 
     836                    << grid_ref.getValue() << "\' is wrong"); 
     837        } 
     838        else 
     839        { 
     840          this->grid = CGrid::createGrid(vecDom, vecAxis); 
     841          this->grid_ref.setValue(this->grid->getId()); 
     842        } 
    805843      } 
    806844      else 
    807845      { 
    808846         this->grid = CGrid::createGrid(vecDom, vecAxis); 
    809       } 
    810  
    811       if (grid_ref.isEmpty() && domain_ref.isEmpty() && axis_ref.isEmpty()) 
    812       { 
    813             ERROR("CField::solveGridReference(void)", 
    814                   << "At least one dimension must be defined for this field."); 
     847         this->grid_ref.setValue(this->grid->getId()); 
    815848      } 
    816849   } 
  • XIOS/trunk/src/node/grid.cpp

    r739 r742  
    2121namespace xios { 
    2222 
    23    /// ////////////////////// Définitions ////////////////////// /// 
     23   /// ////////////////////// Dfinitions ////////////////////// /// 
    2424 
    2525   CGrid::CGrid(void) 
     
    126126       } 
    127127     } 
    128       
     128 
    129129     return attributesSizes; 
    130130   } 
     
    342342            axisListP[i]->sendCheckedAttributes(globalDim_,axisPositionInGrid_[i]); 
    343343          else 
    344             axisListP[i]->checkAttributesOnClient(globalDim_,axisPositionInGrid_[i]); 
     344            axisListP[i]->checkAttributesOnClient(); 
    345345          ++idx; 
    346346        } 
     
    500500      } 
    501501 
    502       grid->computeGridGlobalDimension(domains, axis, grid->axis_domain_order); 
     502 
     503      grid->solveDomainAxisRefInheritance(true); 
    503504 
    504505      return grid; 
     
    13071308    if (isDomListSet) return; 
    13081309    std::vector<CDomain*> domList = this->getVirtualDomainGroup()->getAllChildren(); 
    1309     if (!domains.empty() && domList.empty()) domList = domains; 
     1310    if (!domains.empty() && domList.empty()) 
     1311    { 
     1312      for (int i = 0; i < domains.size(); ++i) 
     1313        this->getVirtualDomainGroup()->addChild(domains[i]); 
     1314      domList = this->getVirtualDomainGroup()->getAllChildren(); 
     1315    } 
     1316 
    13101317    if (!domList.empty()) 
    13111318    { 
     
    13291336    if (isAxisListSet) return; 
    13301337    std::vector<CAxis*> aList = this->getVirtualAxisGroup()->getAllChildren(); 
    1331     if (!axis.empty() && aList.empty()) aList = axis; 
     1338    if (!axis.empty() && aList.empty()) 
     1339    { 
     1340      for (int i = 0; i < axis.size(); ++i) 
     1341        this->getVirtualAxisGroup()->addChild(axis[i]); 
     1342      aList = this->getVirtualAxisGroup()->getAllChildren(); 
     1343    } 
     1344 
    13321345    if (!aList.empty()) 
    13331346    { 
  • XIOS/trunk/src/node/grid.hpp

    r731 r742  
    202202         void modifyMask(const CArray<int,1>& indexToModify); 
    203203 
     204         void computeGridGlobalDimension(const std::vector<CDomain*>& domains, 
     205                                         const std::vector<CAxis*>& axis, 
     206                                         const CArray<bool,1>& axisDomainOrder); 
     207 
    204208      private: 
    205209       template<int N> 
     
    218222        void setAxisList(const std::vector<CAxis*> axis = std::vector<CAxis*>()); 
    219223        void setDomainList(const std::vector<CDomain*> domains = std::vector<CDomain*>()); 
    220  
    221         void computeGridGlobalDimension(const std::vector<CDomain*>& domains, 
    222                                         const std::vector<CAxis*>& axis, 
    223                                         const CArray<bool,1>& axisDomainOrder); 
    224224 
    225225        CDomain* addDomain(const std::string& id); 
  • XIOS/trunk/src/test/test_remap.f90

    r734 r742  
    119119                            bounds_lon_1D=dst_boundslon, bounds_lat_1D=dst_boundslat, nvertex=dst_nvertex) 
    120120 
    121 !  CALL xios_set_domain_attr("dst_domain_regular", type="rectilinear") 
    122  
    123  
    124121  ALLOCATE(tmp_field(180*90/2)) 
    125122  dtime%second = 3600 
  • XIOS/trunk/src/transformation/grid_transformation.cpp

    r734 r742  
    4646  { 
    4747    CAxis* axis = CAxis::createAxis(); 
    48     axis->setAttributes(axisSrcTmp[idx]); 
     48    axis->axis_ref.setValue(axisSrcTmp[idx]->getId()); 
     49    axis->solveRefInheritance(true); 
     50    axis->solveInheritanceTransformation(); 
     51    axis->checkAttributesOnClient(); 
    4952    axisSrc.push_back(axis); 
    5053  } 
     
    5356  { 
    5457    CDomain* domain = CDomain::createDomain(); 
    55     domain->setAttributes(domainSrcTmp[idx]); 
     58    domain->domain_ref.setValue(domainSrcTmp[idx]->getId()); 
     59    domain->solveRefInheritance(true); 
    5660    domain->solveInheritanceTransformation(); 
    5761    domain->checkAttributesOnClient(); 
     
    6064 
    6165  gridSource_ = CGrid::createGrid(domainSrc, axisSrc, gridDestination_->axis_domain_order); 
     66  gridSource_->computeGridGlobalDimension(domainSrc, axisSrc, gridDestination_->axis_domain_order); 
    6267 
    6368  initializeMappingOfOriginalGridSource(); 
Note: See TracChangeset for help on using the changeset viewer.