Changeset 2311
- Timestamp:
- 03/15/22 19:00:58 (2 years ago)
- Location:
- XIOS/dev/dev_ym/XIOS_COUPLING/src/node
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/dev/dev_ym/XIOS_COUPLING/src/node/field.cpp
r2302 r2311 365 365 else if (hasFileOut()) return this->fileOut_ ; 366 366 else return nullptr ; 367 } 368 CATCH 369 370 CGrid* CField::getAssociatedGrid(void) const 371 TRY 372 { 373 return this->grid_; 367 374 } 368 375 CATCH -
XIOS/dev/dev_ym/XIOS_COUPLING/src/node/field.hpp
r2230 r2311 104 104 CGrid* getRelGrid(void) const; 105 105 CFile* getRelFile(void) const; 106 CGrid* getAssociatedGrid(void) const ; 106 107 CDomain* getAssociatedDomain(const std::string& domainId, bool noError=false) const; 107 108 CAxis* getAssociatedAxis(const std::string& axisId, bool noError=false) const; -
XIOS/dev/dev_ym/XIOS_COUPLING/src/node/grid.cpp
r2305 r2311 182 182 } 183 183 CATCH 184 185 186 CGrid* CGrid::get(const string& id, bool noError) 187 { 188 const regex r("::"); 189 smatch m; 190 if (regex_search(id, m, r)) 191 { 192 if (m.size()!=1) ERROR("CGrid* Cgrid::get(string& id)", <<" id = "<<id<< " -> bad format id, separator :: append more than one time"); 193 string fieldId=m.prefix() ; 194 if (fieldId.empty()) ERROR("CGrid* CGrid::get(string& id)", <<" id = "<<id<< " -> bad format id, field name is empty"); 195 string suffix=m.suffix() ; 196 if (!suffix.empty()) ERROR("CGrid* CGrid::get(string& id)", <<" id = "<<id<< " -> bad format id, suffix is not empty"); 197 if (!CField::has(fieldId)) 198 if (noError) return nullptr ; 199 else ERROR("CGrid* CGrid::get(string& id)", <<" id = "<<id<< " -> field Id : < "<<fieldId<<" > doesn't exist"); 200 CField* field=CField::get(fieldId) ; 201 return field->getAssociatedGrid() ; 202 } 203 else 204 { 205 if (noError) if(!CObjectFactory::HasObject<CGrid>(id)) return nullptr ; 206 return CObjectFactory::GetObject<CGrid>(id).get(); 207 } 208 } 209 210 bool CGrid::has(const string& id) 211 { 212 if (CGrid::get(id,true)==nullptr) return false ; 213 else return true ; 214 } 184 215 185 216 //---------------------------------------------------------------- -
XIOS/dev/dev_ym/XIOS_COUPLING/src/node/grid.hpp
r2270 r2311 142 142 static CGrid* createGrid(const std::vector<CDomain*>& domains, const std::vector<CAxis*>& axis, 143 143 const std::vector<CScalar*>& scalars, const CArray<int,1>& axisDomainOrder); 144 static CGrid* get(const string& id, bool noError=false) ; //<! return grid pointer using id 145 static bool has(const string& id) ; //<! return if grid exist using id 144 146 static StdString generateId(const std::vector<CDomain*>& domains, const std::vector<CAxis*>& axis, 145 147 const std::vector<CScalar*>& scalars, const CArray<int,1>& axisDomainOrder = CArray<int,1>());
Note: See TracChangeset
for help on using the changeset viewer.