Changeset 2206 for XIOS/dev/dev_ym/XIOS_COUPLING/src/node/scalar.cpp
- Timestamp:
- 08/24/21 13:48:12 (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/dev/dev_ym/XIOS_COUPLING/src/node/scalar.cpp
r2203 r2206 53 53 } 54 54 55 CScalar* CScalar::get(const string& id )55 CScalar* CScalar::get(const string& id, bool noError) 56 56 { 57 57 const regex r("::"); … … 63 63 if (fieldId.empty()) ERROR("CScalar* CScalar::get(string& id)", <<" id = "<<id<< " -> bad format id, field name is empty"); 64 64 string suffix=m.suffix() ; 65 if (!CField::has(fieldId)) 66 if (noError) return nullptr ; 67 else ERROR("CScalar* CScalar::get(const string& id, bool noError)", <<" id = "<<id<< " -> field Id : < "<<fieldId<<" > doesn't exist"); 65 68 CField* field=CField::get(fieldId) ; 66 return field->getAssociatedScalar(suffix) ; 67 } 68 else return CObjectFactory::GetObject<CScalar>(id).get(); 69 } 69 return field->getAssociatedScalar(suffix, noError) ; 70 } 71 else 72 { 73 if (noError) if(!CObjectFactory::HasObject<CScalar>(id)) return nullptr ; 74 return CObjectFactory::GetObject<CScalar>(id).get(); 75 } 76 } 77 78 bool CScalar::has(const string& id) 79 { 80 if (CScalar::get(id,true)==nullptr) return false ; 81 else return true ; 82 } 83 84 CField* CScalar::getFieldFromId(const string& id) 85 { 86 const regex r("::"); 87 smatch m; 88 if (regex_search(id, m, r)) 89 { 90 if (m.size()!=1) ERROR("CField* CScalar::getFieldFromId(const string& id)", <<" id = "<<id<< " -> bad format id, separator :: append more than one time"); 91 string fieldId=m.prefix() ; 92 if (fieldId.empty()) ERROR("CField* CScalar::getFieldFromId(const string& id)", <<" id = "<<id<< " -> bad format id, field name is empty"); 93 string suffix=m.suffix() ; 94 CField* field=CField::get(fieldId) ; 95 return field ; 96 } 97 else return nullptr; 98 } 70 99 71 100 bool CScalar::IsWritten(const StdString & filename) const … … 210 239 } 211 240 CATCH_DUMP_ATTR 241 242 bool CScalar::activateFieldWorkflow(CGarbageCollector& gc) 243 TRY 244 { 245 if (!scalar_ref.isEmpty()) 246 { 247 CField* field=getFieldFromId(scalar_ref) ; 248 if (field!=nullptr) 249 { 250 bool ret = field->buildWorkflowGraph(gc) ; 251 if (!ret) return false ; // cannot build workflow graph at this state 252 } 253 else 254 { 255 CScalar* scalar = get(scalar_ref) ; 256 bool ret = scalar->activateFieldWorkflow(gc) ; 257 if (!ret) return false ; // cannot build workflow graph at this state 258 scalar_ref=scalar->getId() ; // replace domain_ref by solved reference 259 } 260 } 261 activateFieldWorkflow_done_=true ; 262 return true ; 263 } 264 CATCH_DUMP_ATTR 265 212 266 213 267 /* obsolete, to remove after reimplementing coupling */
Note: See TracChangeset
for help on using the changeset viewer.