Changeset 2315 for XIOS/dev


Ignore:
Timestamp:
03/22/22 15:52:41 (3 years ago)
Author:
ymipsl
Message:

fix missing workflow dependcy when using grid_ref with field Id.
YM

Location:
XIOS/dev/dev_ym/XIOS_COUPLING/src/node
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/node/field.cpp

    r2311 r2315  
    12981298    else 
    12991299    { 
     1300      CField* field=CGrid::getFieldFromId(grid_ref) ; 
     1301      if (field!=nullptr) field->solveGridReference() ; 
    13001302      if (CGrid::has(grid_ref)) this->grid_ = CGrid::get(grid_ref); 
    13011303      else  ERROR("CField::solveGridReference(void)", 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/node/grid.cpp

    r2311 r2315  
    212212     if (CGrid::get(id,true)==nullptr) return false ; 
    213213     else return true ; 
     214   } 
     215    
     216   CField* CGrid::getFieldFromId(const string& id) 
     217   { 
     218     const regex r("::"); 
     219     smatch m; 
     220     if (regex_search(id, m, r)) 
     221     { 
     222        if (m.size()!=1) ERROR("CField* CGrid::getFieldFromId(const string& id)", <<" id = "<<id<< "  -> bad format id, separator :: append more than one time"); 
     223        string fieldId=m.prefix() ; 
     224        if (fieldId.empty()) ERROR("CField* CGrid::getFieldFromId(const string& id)", <<" id = "<<id<< "  -> bad format id, field name is empty"); 
     225        string suffix=m.suffix() ; 
     226        if (!suffix.empty()) ERROR("CField* CGrid::getFieldFromId(const string& id)", <<" id = "<<id<< "  -> bad format id, suffix is not empty"); 
     227        if (!CField::has(fieldId)) ERROR("CField* CGrid::getFieldFromId(const string& id)", <<" id = "<<id<< "  -> field Id : < "<<fieldId<<" > doesn't exist"); 
     228        return CField::get(fieldId) ; 
     229     }  
     230     else return nullptr ; 
    214231   } 
    215232 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/node/grid.hpp

    r2311 r2315  
    144144         static CGrid* get(const string& id, bool noError=false) ; //<! return grid pointer using id 
    145145         static bool has(const string& id) ; //<! return if grid exist using id 
     146         static CField* getFieldFromId(const string& id) ; //<! return field id if used in grid reference 
    146147         static StdString generateId(const std::vector<CDomain*>& domains, const std::vector<CAxis*>& axis, 
    147148                                     const std::vector<CScalar*>& scalars, const CArray<int,1>& axisDomainOrder = CArray<int,1>()); 
Note: See TracChangeset for help on using the changeset viewer.