- Timestamp:
- 03/22/22 15:52:41 (3 years ago)
- 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 1298 1298 else 1299 1299 { 1300 CField* field=CGrid::getFieldFromId(grid_ref) ; 1301 if (field!=nullptr) field->solveGridReference() ; 1300 1302 if (CGrid::has(grid_ref)) this->grid_ = CGrid::get(grid_ref); 1301 1303 else ERROR("CField::solveGridReference(void)", -
XIOS/dev/dev_ym/XIOS_COUPLING/src/node/grid.cpp
r2311 r2315 212 212 if (CGrid::get(id,true)==nullptr) return false ; 213 213 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 ; 214 231 } 215 232 -
XIOS/dev/dev_ym/XIOS_COUPLING/src/node/grid.hpp
r2311 r2315 144 144 static CGrid* get(const string& id, bool noError=false) ; //<! return grid pointer using id 145 145 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 146 147 static StdString generateId(const std::vector<CDomain*>& domains, const std::vector<CAxis*>& axis, 147 148 const std::vector<CScalar*>& scalars, const CArray<int,1>& axisDomainOrder = CArray<int,1>());
Note: See TracChangeset
for help on using the changeset viewer.