Changeset 1524


Ignore:
Timestamp:
06/06/18 11:25:32 (2 years ago)
Author:
ymipsl
Message:

Bug fix ;

Virtual grid created from field using domain_ref/axis_ref could be conflicting with other grid using same elements but with an other distribution sent to servers.

YM

Location:
XIOS/dev/XIOS_DEV_CMIP6/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • XIOS/dev/XIOS_DEV_CMIP6/src/config/field_attribute.conf

    r1493 r1524  
    2020DECLARE_ATTRIBUTE(bool,      check_if_active) 
    2121 
    22 DECLARE_ATTRIBUTE(StdString, domain_ref) 
    23 DECLARE_ATTRIBUTE(StdString, axis_ref) 
    24 DECLARE_ATTRIBUTE(StdString, scalar_ref) 
     22DECLARE_ATTRIBUTE(StdString, domain_ref, false) 
     23DECLARE_ATTRIBUTE(StdString, axis_ref, false) 
     24DECLARE_ATTRIBUTE(StdString, scalar_ref, false) 
    2525DECLARE_ATTRIBUTE(StdString, grid_ref) 
    2626DECLARE_ATTRIBUTE(StdString, field_ref) 
  • XIOS/dev/XIOS_DEV_CMIP6/src/node/field.cpp

    r1514 r1524  
    13151315        std::vector<CScalar*> vecScalar; 
    13161316        std::vector<int> axisDomainOrderTmp; 
     1317 
     1318        std::vector<CDomain*> vecDomRef; 
     1319        std::vector<CAxis*> vecAxisRef; 
     1320        std::vector<CScalar*> vecScalarRef; 
     1321 
    13171322         
    13181323        if (!domain_ref.isEmpty()) 
     
    13221327          { 
    13231328            vecDom.push_back(CDomain::get(domain_ref)); 
     1329            vecDomRef.push_back(CDomain::createDomain()); 
     1330            vecDomRef.back()->domain_ref=domain_ref; 
    13241331            axisDomainOrderTmp.push_back(2); 
    13251332          } 
    1326           else 
    1327             ERROR("CField::solveGridReference(void)", 
    1328                   << "Invalid reference to domain '" << domain_ref.getValue() << "'."); 
     1333          else  ERROR("CField::solveGridReference(void)", 
     1334                      << "Invalid reference to domain '" << domain_ref.getValue() << "'."); 
    13291335        } 
    13301336 
     
    13341340          { 
    13351341            vecAxis.push_back(CAxis::get(axis_ref)); 
     1342            vecAxisRef.push_back(CAxis::createAxis()); 
     1343            vecAxisRef.back()->axis_ref=axis_ref; 
    13361344            axisDomainOrderTmp.push_back(1); 
    13371345          } 
    1338           else 
    1339             ERROR("CField::solveGridReference(void)", 
    1340                   << "Invalid reference to axis '" << axis_ref.getValue() << "'."); 
     1346          else  ERROR("CField::solveGridReference(void)", 
     1347                      << "Invalid reference to axis '" << axis_ref.getValue() << "'."); 
    13411348        } 
    13421349 
     
    13461353          { 
    13471354            vecScalar.push_back(CScalar::get(scalar_ref)); 
     1355            vecScalarRef.push_back(CScalar::createScalar()); 
     1356            vecScalarRef.back()->scalar_ref=scalar_ref; 
    13481357            axisDomainOrderTmp.push_back(0); 
    13491358          } 
    1350           else 
    1351             ERROR("CField::solveGridReference(void)", 
    1352                   << "Invalid reference to scalar '" << scalar_ref.getValue() << "'."); 
     1359          else ERROR("CField::solveGridReference(void)", 
     1360                     << "Invalid reference to scalar '" << scalar_ref.getValue() << "'."); 
    13531361        } 
    13541362         
     
    13611369        // Warning: the gridId shouldn't be set as the grid_ref since it could be inherited 
    13621370        StdString gridId = CGrid::generateId(vecDom, vecAxis, vecScalar,axisDomainOrder); 
    1363         if (CGrid::has(gridId)) 
    1364           this->grid = CGrid::get(gridId); 
    1365         else 
    1366           this->grid = CGrid::createGrid(gridId, vecDom, vecAxis, vecScalar,axisDomainOrder); 
     1371        if (CGrid::has(gridId)) this->grid = CGrid::get(gridId); 
     1372        else  this->grid = CGrid::createGrid(gridId, vecDomRef, vecAxisRef, vecScalarRef,axisDomainOrder); 
    13671373      } 
    13681374      else 
    13691375      { 
    1370         if (CGrid::has(grid_ref)) 
    1371           this->grid = CGrid::get(grid_ref); 
    1372         else 
    1373           ERROR("CField::solveGridReference(void)", 
    1374                 << "Invalid reference to grid '" << grid_ref.getValue() << "'."); 
     1376        if (CGrid::has(grid_ref)) this->grid = CGrid::get(grid_ref); 
     1377        else  ERROR("CField::solveGridReference(void)", 
     1378                     << "Invalid reference to grid '" << grid_ref.getValue() << "'."); 
    13751379      } 
    13761380   } 
     
    16171621   } 
    16181622 
     1623 
     1624   /*! 
     1625    * Send all Attributes to server. This method is overloaded, since only grid_ref attribute 
     1626    * must be sent to server and not domain_ref/axis_ref/scalar_ref.  
     1627    */ 
     1628     
     1629   void CField::sendAllAttributesToServer(CContextClient* client) 
     1630   { 
     1631     if (grid_ref.isEmpty()) 
     1632     { 
     1633       grid_ref=grid->getId() ; 
     1634       SuperClass::sendAllAttributesToServer(client) ; 
     1635       grid_ref.reset(); 
     1636     } 
     1637     else SuperClass::sendAllAttributesToServer(client) ; 
     1638   } 
     1639     
    16191640   void CField::sendAddVariable(const string& id, CContextClient* client) 
    16201641   { 
  • XIOS/dev/XIOS_DEV_CMIP6/src/node/field.hpp

    r1417 r1524  
    161161        template <int N> void setData(const CArray<double, N>& _data); 
    162162        static bool dispatchEvent(CEventServer& event); 
     163        void sendAllAttributesToServer(CContextClient* client) ;  
    163164        void sendUpdateData(const CArray<double,1>& data); 
    164165        void sendUpdateData(const CArray<double,1>& data, CContextClient* client); 
Note: See TracChangeset for help on using the changeset viewer.