Ignore:
Timestamp:
08/24/21 13:48:12 (3 years ago)
Author:
ymipsl
Message:

New feature : when can now use the syntax :
fieldId:domainId[n], in domain reference inside the workflow (XML). Same for axis and scalar.

YM

File:
1 edited

Legend:

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

    r2203 r2206  
    221221   CATCH 
    222222 
    223    CAxis* CAxis::get(const string& id) 
     223   CAxis* CAxis::get(const string& id, bool noError) 
    224224   { 
    225225     const regex r("::"); 
     
    231231        if (fieldId.empty()) ERROR("CAxis* CAxis::get(string& id)", <<" id = "<<id<< "  -> bad format id, field name is empty"); 
    232232        string suffix=m.suffix() ; 
     233        if (!CField::has(fieldId))  
     234          if (noError)  return nullptr ; 
     235          else ERROR("CAxis* CAxis::get(string& id, bool noError)", <<" id = "<<id<< "  -> field Id : < "<<fieldId<<" > doesn't exist"); 
    233236        CField* field=CField::get(fieldId) ; 
    234         return field->getAssociatedAxis(suffix) ; 
     237        return field->getAssociatedAxis(suffix, noError) ; 
    235238     } 
    236      else return CObjectFactory::GetObject<CAxis>(id).get(); 
     239     { 
     240       if (noError) if(!CObjectFactory::HasObject<CAxis>(id)) return nullptr ; 
     241       return CObjectFactory::GetObject<CAxis>(id).get(); 
     242     } 
     243   } 
     244    
     245   bool CAxis::has(const string& id) 
     246   { 
     247     if (CAxis::get(id,true)==nullptr) return false ; 
     248     else return true ; 
     249   } 
     250    
     251   CField* CAxis::getFieldFromId(const string& id) 
     252   { 
     253     const regex r("::"); 
     254     smatch m; 
     255     if (regex_search(id, m, r)) 
     256     { 
     257        if (m.size()!=1) ERROR("CField* CAxis::getFieldFromId(const string& id)", <<" id = "<<id<< "  -> bad format id, separator :: append more than one time"); 
     258        string fieldId=m.prefix() ; 
     259        if (fieldId.empty()) ERROR("CField* CAxis::getFieldFromId(const string& id)", <<" id = "<<id<< "  -> bad format id, field name is empty"); 
     260        string suffix=m.suffix() ; 
     261        CField* field=CField::get(fieldId) ; 
     262        return field ; 
     263     } 
     264     else return nullptr; 
    237265   } 
    238266 
     
    635663  } 
    636664  CATCH_DUMP_ATTR 
     665 
     666  bool CAxis::activateFieldWorkflow(CGarbageCollector& gc) 
     667  TRY 
     668  { 
     669    if (!axis_ref.isEmpty()) 
     670    { 
     671      CField* field=getFieldFromId(axis_ref) ; 
     672      if (field!=nullptr) 
     673      { 
     674        bool ret = field->buildWorkflowGraph(gc) ; 
     675        if (!ret) return false ; // cannot build workflow graph at this state 
     676      } 
     677      else  
     678      { 
     679        CAxis* axis = get(axis_ref) ; 
     680        bool ret = axis->activateFieldWorkflow(gc) ; 
     681        if (!ret) return false ; // cannot build workflow graph at this state 
     682        axis_ref=axis->getId() ; // replace domain_ref by solved reference 
     683      } 
     684    } 
     685    activateFieldWorkflow_done_=true ; 
     686    return true ; 
     687  } 
     688  CATCH_DUMP_ATTR 
     689 
    637690 
    638691  void CAxis::setContextClient(CContextClient* contextClient) 
Note: See TracChangeset for help on using the changeset viewer.