Changeset 742 for XIOS/trunk/src/node


Ignore:
Timestamp:
10/15/15 15:46:40 (9 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/src/node
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • 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); 
Note: See TracChangeset for help on using the changeset viewer.