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/domain.cpp

    r2203 r2206  
    7979   CATCH 
    8080 
    81    CDomain* CDomain::get(const string& id) 
     81   CDomain* CDomain::get(const string& id, bool noError) 
    8282   { 
    8383     const regex r("::"); 
     
    8989        if (fieldId.empty()) ERROR("CDomain* CDomain::get(string& id)", <<" id = "<<id<< "  -> bad format id, field name is empty"); 
    9090        string suffix=m.suffix() ; 
     91        if (!CField::has(fieldId))  
     92          if (noError)  return nullptr ; 
     93          else ERROR("CDomain* CDomain::get(string& id)", <<" id = "<<id<< "  -> field Id : < "<<fieldId<<" > doesn't exist"); 
    9194        CField* field=CField::get(fieldId) ; 
    92         return field->getAssociatedDomain(suffix) ; 
    93      } 
    94      else return CObjectFactory::GetObject<CDomain>(id).get(); 
    95    } 
    96  
     95        return field->getAssociatedDomain(suffix, noError) ; 
     96     } 
     97     else  
     98     { 
     99       if (noError) if(!CObjectFactory::HasObject<CDomain>(id)) return nullptr ; 
     100       return CObjectFactory::GetObject<CDomain>(id).get(); 
     101     } 
     102   } 
     103 
     104   bool CDomain::has(const string& id) 
     105   { 
     106     if (CDomain::get(id,true)==nullptr) return false ; 
     107     else return true ; 
     108   } 
     109    
     110   CField* CDomain::getFieldFromId(const string& id) 
     111   { 
     112     const regex r("::"); 
     113     smatch m; 
     114     if (regex_search(id, m, r)) 
     115     { 
     116        if (m.size()!=1) ERROR("CField* CDomain::getFieldFromId(const string& id)", <<" id = "<<id<< "  -> bad format id, separator :: append more than one time"); 
     117        string fieldId=m.prefix() ; 
     118        if (fieldId.empty()) ERROR("CField* CDomain::getFieldFromId(const string& id)", <<" id = "<<id<< "  -> bad format id, field name is empty"); 
     119        string suffix=m.suffix() ; 
     120        CField* field=CField::get(fieldId) ; 
     121        return field ; 
     122     } 
     123     else return nullptr; 
     124   } 
    97125 
    98126   const std::set<StdString> & CDomain::getRelFiles(void) const 
     
    23372365  CATCH_DUMP_ATTR 
    23382366   
     2367 
     2368  bool CDomain::activateFieldWorkflow(CGarbageCollector& gc) 
     2369  TRY 
     2370  { 
     2371    if (!domain_ref.isEmpty()) 
     2372    { 
     2373      CField* field=getFieldFromId(domain_ref) ; 
     2374      if (field!=nullptr) 
     2375      { 
     2376        bool ret = field->buildWorkflowGraph(gc) ; 
     2377        if (!ret) return false ; // cannot build workflow graph at this state 
     2378      } 
     2379      else  
     2380      { 
     2381        CDomain* domain = get(domain_ref) ; 
     2382        bool ret = domain->activateFieldWorkflow(gc) ; 
     2383        if (!ret) return false ; // cannot build workflow graph at this state 
     2384        domain_ref=domain->getId() ; // replace domain_ref by solved reference 
     2385      } 
     2386    } 
     2387    activateFieldWorkflow_done_=true ; 
     2388    return true ; 
     2389  } 
     2390  CATCH_DUMP_ATTR 
    23392391///////////////////////////////////////////////////////////////////////////////////////////// 
    23402392/////////////////////////////////////////////////////////////////////////////////////////////  
Note: See TracChangeset for help on using the changeset viewer.