Ignore:
Timestamp:
08/20/21 14:38:23 (3 years ago)
Author:
ymipsl
Message:

New functionnality : domain, axis and scalar can now be retrieve with new syntax id :
ex. for domain :

id="domainId" : old syntax, working as before
id="fieldId::domainId" : get the domain related to "domainId" associated to the field "fieldId", work if only 1 domain related to domainId is associated to the field.
id="fieldId::domainId[n]" : get the nth domain related to "domainId" associated to the field "fieldId"
id="fieldId::" : get the domain associated the the field "fieldId, work if grid associated to th field is composed with exactly 1 domain (and possibly other components axis or scalars)
id="fieldId::[n] : get the nth domain composing the grid associated to the field

YM

File:
1 edited

Legend:

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

    r2196 r2203  
    1313#include "client_server_mapping_distributed.hpp" 
    1414#include "distribution_client.hpp" 
     15 
     16#include <algorithm> 
     17#include <regex> 
    1518 
    1619namespace xios { 
     
    217220   } 
    218221   CATCH 
     222 
     223   CAxis* CAxis::get(const string& id) 
     224   { 
     225     const regex r("::"); 
     226     smatch m; 
     227     if (regex_search(id, m, r)) 
     228     { 
     229        if (m.size()!=1) ERROR("CAxis* CAxis::get(string& id)", <<" id = "<<id<< "  -> bad format id, separator :: append more than one time"); 
     230        string fieldId=m.prefix() ; 
     231        if (fieldId.empty()) ERROR("CAxis* CAxis::get(string& id)", <<" id = "<<id<< "  -> bad format id, field name is empty"); 
     232        string suffix=m.suffix() ; 
     233        CField* field=CField::get(fieldId) ; 
     234        return field->getAssociatedAxis(suffix) ; 
     235     } 
     236     else return CObjectFactory::GetObject<CAxis>(id).get(); 
     237   } 
    219238 
    220239   /*! 
Note: See TracChangeset for help on using the changeset viewer.