Changeset 2482


Ignore:
Timestamp:
03/28/23 16:42:11 (15 months ago)
Author:
ymipsl
Message:

First guess in supression of attached mode replaced by online reader and write filters

YM

Location:
XIOS3/dev/XIOS_ATTACHED/src
Files:
8 added
39 edited

Legend:

Unmodified
Added
Removed
  • XIOS3/dev/XIOS_ATTACHED/src/config/domain_attribute.conf

    r2395 r2482  
    5959 
    6060DECLARE_ARRAY(double, 2, area, false) 
     61DECLARE_ARRAY(double, 2, area_2d, false) 
     62DECLARE_ARRAY(double, 1, area_1d, false) 
    6163DECLARE_ATTRIBUTE(double, radius) 
    6264 
  • XIOS3/dev/XIOS_ATTACHED/src/config/redistribute_axis_attribute.conf

    r2460 r2482  
     1DECLARE_ARRAY(int,1, index, false) 
     2DECLARE_ARRAY(bool, 1 , mask, false) 
     3DECLARE_ENUM5(type, index, root, bands, column, full) 
  • XIOS3/dev/XIOS_ATTACHED/src/config/redistribute_domain_attribute.conf

    r2460 r2482  
     1DECLARE_ARRAY(int,1, index, false) 
     2DECLARE_ARRAY(bool, 1 , mask, false) 
     3DECLARE_ENUM5(type, index, root, bands, column, full) 
  • XIOS3/dev/XIOS_ATTACHED/src/config/redistribute_scalar_attribute.conf

    r2460 r2482  
     1DECLARE_ARRAY(int,1, index, false) 
     2DECLARE_ARRAY(bool, 1 , mask, false) 
     3DECLARE_ENUM5(type, index, root, bands, column, full) 
  • XIOS3/dev/XIOS_ATTACHED/src/distribution/grid_remote_connector.cpp

    r2397 r2482  
    9999      size_t globalIndexSize = globalIndex.numElements() ; 
    100100       
    101       size_t allEqual ; 
    102       MPI_Allreduce(&globalIndexSize, &allEqual, 1, MPI_SIZE_T, MPI_BXOR, localComm_) ; 
    103       if (allEqual!=0)  
     101      size_t minVal,maxVal ; 
     102      MPI_Allreduce(&globalIndexSize, &minVal, 1, MPI_SIZE_T, MPI_MIN, localComm_) ; 
     103      MPI_Allreduce(&globalIndexSize, &maxVal, 1, MPI_SIZE_T, MPI_MAX, localComm_) ; 
     104      if (minVal!=maxVal)  
    104105      { 
    105106        isSrcViewDistributed_[i]=true ; 
     
    110111      size_t hashValue=0 ; 
    111112      for(size_t ind=0;ind<globalIndexSize;ind++) hashValue += hashGlobalIndex(globalIndex(ind)) ; 
    112       MPI_Allreduce(&hashValue, &allEqual, 1, MPI_SIZE_T, MPI_BXOR, localComm_) ; 
    113       if (allEqual!=0) isSrcViewDistributed_[i]=true ; 
     113      MPI_Allreduce(&hashValue, &minVal, 1, MPI_SIZE_T, MPI_MIN, localComm_) ; 
     114      MPI_Allreduce(&hashValue, &maxVal, 1, MPI_SIZE_T, MPI_MAX, localComm_) ; 
     115      if (minVal!=maxVal) isSrcViewDistributed_[i]=true ; 
    114116      else isSrcViewDistributed_[i]=false ; 
    115117    } 
  • XIOS3/dev/XIOS_ATTACHED/src/distribution/transform_connector.hpp

    r2267 r2482  
    3232    
    3333    public: 
     34       
     35 
    3436      template<typename T>  
    35       void transfer(int repeat, int sizeT, const CArray<T,1>& dataIn, CArray<T,1>& dataOut) 
     37      void transfer(int repeat, int sizeT, const CArray<T,1>& dataIn, CArray<T,1>& dataOut, bool useMissingValue, T missingValue) 
    3638      { 
    3739        map<int,CArray<T,1>> tmpArrayIn ; 
     
    5860        MPI_Waitall(requests.size(), requests.data(),status.data()) ; 
    5961         
    60         const double nanValue = std::numeric_limits<double>::quiet_NaN(); 
    61         gathererConnector_->transfer(repeat, sizeT , tmpArrayOut, dataOut, nanValue) ; 
     62        if (useMissingValue) gathererConnector_->transfer(repeat, sizeT , tmpArrayOut, dataOut, missingValue) ; 
     63        else gathererConnector_->transfer(repeat, sizeT , tmpArrayOut, dataOut) ; 
     64 //       const double nanValue = std::numeric_limits<double>::quiet_NaN(); 
     65 //       gathererConnector_->transfer(repeat, sizeT , tmpArrayOut, dataOut, nanValue) ; 
     66      } 
     67 
     68      template<typename T>  
     69      void transfer(int repeat, int sizeT, const CArray<T,1>& dataIn, CArray<T,1>& dataOut) 
     70      { 
     71        T missingValue ; 
     72        transfer(1, sizeT, dataIn, dataOut, false, missingValue) ; 
     73      } 
     74 
     75      template<typename T>  
     76      void transfer(int repeat, int sizeT, const CArray<T,1>& dataIn, CArray<T,1>& dataOut, T missingValue) 
     77      { 
     78        transfer(1, sizeT, dataIn, dataOut, true, missingValue) ; 
    6279      } 
    6380 
     
    6683      { 
    6784        transfer(1, sizeT, dataIn, dataOut) ; 
     85      } 
     86 
     87      template<typename T>  
     88      void transfer(int sizeT, const CArray<T,1>& dataIn, CArray<T,1>& dataOut, T missingValue) 
     89      { 
     90        transfer(1, sizeT, dataIn, dataOut, missingValue) ; 
    6891      } 
    6992    
     
    7497      } 
    7598 
     99      template<typename T>  
     100      void transfer(const CArray<T,1>& dataIn, CArray<T,1>& dataOut, T missingValue) 
     101      { 
     102        transfer(1, 1, dataIn, dataOut, missingValue) ; 
     103      } 
     104 
    76105  }; 
    77106 
  • XIOS3/dev/XIOS_ATTACHED/src/filter/file_writer_store_filter.cpp

    r2143 r2482  
    2929    if (!field->prec.isEmpty() && field->prec == 2) hasRounding_ = true ; 
    3030    if (!field->default_value.isEmpty()) {hasDefaultValue_=true ; defaultValue_ = field->default_value ;} 
     31    context->registerFileToWrite(file_) ; 
    3132  } 
    3233 
  • XIOS3/dev/XIOS_ATTACHED/src/io/nc4_data_input.cpp

    r2338 r2482  
    8181            if ((domain->type) != CDomain::type_attr::unstructured) 
    8282            { 
    83               start.push_back(domain->jbegin); 
    84               count.push_back(domain->nj); 
     83              start.push_back(domain->jbeginValue_); 
     84              count.push_back(domain->njValue_); 
    8585            } 
    86             start.push_back(domain->ibegin); 
    87             count.push_back(domain->ni); 
     86            start.push_back(domain->ibeginValue_); 
     87            count.push_back(domain->niValue_); 
    8888            --idxDomain; 
    8989          } 
     
    131131    // Verify the compatibility of dimension of declared grid and real grid in file 
    132132    int realGridDim = 1; 
    133     bool isUnstructuredGrid = ((gridDim < 2) ? false :  SuperClassWriter::isUnstructured(fieldId)); 
     133    bool isUnstructuredGrid = ((gridDim < 2 || domainP.size()==0) ? false :  SuperClassWriter::isUnstructured(fieldId)); 
    134134    std::map<StdString, StdSize> dimSizeMap = SuperClassWriter::getDimensions(&fieldId); 
    135135    std::list<StdString> dimList = SuperClassWriter::getDimensionsList(&fieldId); 
  • XIOS3/dev/XIOS_ATTACHED/src/io/nc4_data_output.cpp

    r2436 r2482  
    202202                 else bounds_latid = "bounds_"+latName+appendDomid; 
    203203 
    204                  SuperClassWriter::addDimension(dimXid, domain->ni); 
    205                  SuperClassWriter::addDimension(dimYid, domain->nj); 
     204                 SuperClassWriter::addDimension(dimXid, domain->niValue_); 
     205                 SuperClassWriter::addDimension(dimYid, domain->njValue_); 
    206206 
    207207                 if (domain->hasBounds) 
     
    210210                 if (context->intraCommSize_ > 1) 
    211211                 { 
    212                    this->writeLocalAttributes(domain->ibegin, 
    213                                               domain->ni, 
    214                                               domain->jbegin, 
    215                                               domain->nj, 
     212                   this->writeLocalAttributes(domain->ibeginValue_, 
     213                                              domain->niValue_, 
     214                                              domain->jbeginValue_, 
     215                                              domain->njValue_, 
    216216                                              appendDomid); 
    217217 
    218218                   if (singleDomain) 
    219219                    this->writeLocalAttributes_IOIPSL(dimXid, dimYid, 
    220                                                       domain->ibegin, 
    221                                                       domain->ni, 
    222                                                       domain->jbegin, 
    223                                                       domain->nj, 
     220                                                      domain->ibeginValue_, 
     221                                                      domain->niValue_, 
     222                                                      domain->jbeginValue_, 
     223                                                      domain->njValue_, 
    224224                                                      domain->ni_glo,domain->nj_glo, 
    225225                                                      context->intraCommRank_,context->intraCommSize_); 
     
    373373                     std::vector<StdSize> start(2) ; 
    374374                     std::vector<StdSize> count(2) ; 
    375                      start[1]=domain->ibegin; 
    376                      start[0]=domain->jbegin; 
    377                      count[1]=domain->ni ; count[0]=domain->nj ; 
     375                     start[1]=domain->ibeginValue_; 
     376                     start[0]=domain->jbeginValue_; 
     377                     count[1]=domain->niValue_ ; count[0]=domain->njValue_ ; 
    378378 
    379379                     if (domain->hasLonLat) 
     
    391391                       std::vector<StdSize> count(1) ; 
    392392                        
    393                        start[0]=domain->jbegin; 
    394                        count[0]=domain->nj; 
     393                       start[0]=domain->jbeginValue_; 
     394                       count[0]=domain->njValue_; 
    395395                       CArray<double,1> lat; 
    396                        lat.resize( domain->nj.getValue() ); 
    397                        for (int j=0;j<domain->nj.getValue();j++) lat(j) = domain->latvalue(j*domain->ni.getValue()); 
     396                       lat.resize( domain->njValue_); 
     397                       for (int j=0;j<domain->njValue_;j++) lat(j) = domain->latvalue(j*domain->niValue_); 
    398398                       SuperClassWriter::writeData(CArray<double,1>(lat.copy()), latid, isCollective, 0,&start,&count); 
    399399 
    400                        start[0]=domain->ibegin; 
    401                        count[0]=domain->ni; 
    402                        CArray<double,1> lon = domain->lonvalue(Range(0,domain->ni-1)); 
     400                       start[0]=domain->ibeginValue_; 
     401                       count[0]=domain->niValue_; 
     402                       CArray<double,1> lon = domain->lonvalue(Range(0,domain->niValue_-1)); 
    403403                       SuperClassWriter::writeData(CArray<double,1>(lon.copy()), lonid, isCollective, 0,&start,&count); 
    404404                     } 
     
    419419                   { 
    420420                     start[2] = 0; 
    421                      start[1] = domain->ibegin; 
    422                      start[0] = domain->jbegin; 
     421                     start[1] = domain->ibeginValue_; 
     422                     start[0] = domain->jbeginValue_; 
    423423                     count[2] = domain->nvertex; 
    424                      count[1] = domain->ni; 
    425                      count[0] = domain->nj; 
     424                     count[1] = domain->niValue_; 
     425                     count[0] = domain->njValue_; 
    426426                   } 
    427427                  
     
    435435                   std::vector<StdSize> count(2); 
    436436 
    437                    start[1] = domain->ibegin; 
    438                    start[0] = domain->jbegin; 
    439                    count[1] = domain->ni; 
    440                    count[0] = domain->nj; 
     437                   start[1] = domain->ibeginValue_; 
     438                   start[0] = domain->jbeginValue_; 
     439                   count[1] = domain->niValue_; 
     440                   count[0] = domain->njValue_; 
    441441                    
    442442                   SuperClassWriter::writeData(domain->areavalue, areaId, isCollective, 0, &start, &count); 
     
    703703               else 
    704704               { 
    705                  startNodes[0] = domain->ibegin; 
    706                  countNodes[0] = domain->ni ; 
     705                 startNodes[0] = domain->ibeginValue_; 
     706                 countNodes[0] = domain->niValue_ ; 
    707707               } 
    708708 
     
    726726               else 
    727727               { 
    728                  startEdges[0] = domain->ibegin; 
    729                  countEdges[0] = domain->ni; 
     728                 startEdges[0] = domain->ibeginValue_; 
     729                 countEdges[0] = domain->niValue_; 
    730730                 startNodes[0] = domain->mesh->node_start; 
    731731                 countNodes[0] = domain->mesh->node_count; 
    732732                 if (countNodes[0]==0) startNodes[0]=0 ; // for netcdf error 
    733                  startEdgeNodes[0] = domain->ibegin; 
     733                 startEdgeNodes[0] = domain->ibeginValue_; 
    734734                 startEdgeNodes[1] = 0; 
    735                  countEdgeNodes[0] = domain->ni; 
     735                 countEdgeNodes[0] = domain->niValue_; 
    736736                 countEdgeNodes[1] = 2; 
    737737               } 
     
    763763               else 
    764764               { 
    765                  startFaces[0] = domain->ibegin; 
    766                  countFaces[0] = domain->ni ; 
     765                 startFaces[0] = domain->ibeginValue_; 
     766                 countFaces[0] = domain->niValue_ ; 
    767767                 startNodes[0] = domain->mesh->node_start; 
    768768                 countNodes[0] = domain->mesh->node_count; 
     
    785785                 countEdgeFaces[1]= 2; 
    786786                  
    787                  startFaceConctv[0] = domain->ibegin; 
    788                  countFaceConctv[0] = domain->ni; 
     787                 startFaceConctv[0] = domain->ibeginValue_; 
     788                 countFaceConctv[0] = domain->niValue_; 
    789789                 startFaceConctv[1] = 0; 
    790790                 countFaceConctv[1] = domain->nvertex; 
     
    998998                 else 
    999999                 { 
    1000                    start[0]=domain->ibegin; 
    1001                    count[0]=domain->ni; 
    1002                    startBounds[0]=domain->ibegin; 
     1000                   start[0]=domain->ibeginValue_; 
     1001                   count[0]=domain->niValue_; 
     1002                   startBounds[0]=domain->ibeginValue_; 
    10031003                   startBounds[1]=0 ; 
    1004                    countBounds[0]=domain->ni; 
     1004                   countBounds[0]=domain->niValue_; 
    10051005                   countBounds[1]=nvertex ; 
    10061006                 } 
     
    11101110          if (!axis->label.isEmpty() && !SuperClassWriter::dimExist(strId)) SuperClassWriter::addDimension(strId, stringArrayLen); 
    11111111 
    1112           if (axis->hasValue || !axis->label.isEmpty()) 
     1112          if (axis->hasValue() || !axis->label.isEmpty()) 
    11131113          { 
    11141114            if (!axis->label.isEmpty()) dims.push_back(strId); 
     
    14991499              } 
    15001500 
    1501               firstGlobalIndex = domain->ibegin + domain->jbegin * domain->ni_glo; 
     1501              firstGlobalIndex = domain->ibeginValue_ + domain->jbeginValue_ * domain->ni_glo; 
    15021502 
    15031503              domain->addRelFileCompressed(this->filename); 
     
    23222322                        if ((domain->type) != CDomain::type_attr::unstructured) 
    23232323                        { 
    2324                           start.push_back(domain->jbegin); 
    2325                           count.push_back(domain->nj); 
     2324                          start.push_back(domain->jbeginValue_); 
     2325                          count.push_back(domain->njValue_); 
    23262326                        } 
    23272327                        --idx; 
    2328                         start.push_back(domain->ibegin); 
    2329                         count.push_back(domain->ni); 
     2328                        start.push_back(domain->ibeginValue_); 
     2329                        count.push_back(domain->niValue_); 
    23302330                        --idx; 
    23312331                      } 
     
    23822382                      if ((domain->type) != CDomain::type_attr::unstructured) 
    23832383                      { 
    2384                         start.push_back(domain->jbegin); 
    2385                         count.push_back(domain->nj); 
     2384                        start.push_back(domain->jbeginValue_); 
     2385                        count.push_back(domain->njValue_); 
    23862386                      } 
    23872387                      --idx ; 
    23882388 
    2389                         start.push_back(domain->ibegin); 
    2390                         count.push_back(domain->ni); 
     2389                        start.push_back(domain->ibeginValue_); 
     2390                        count.push_back(domain->niValue_); 
    23912391                      --idx ; 
    23922392                      --idxDomain; 
  • XIOS3/dev/XIOS_ATTACHED/src/mpi_tools.cpp

    r2118 r2482  
    2828 
    2929  template<> 
     30  MPI_Datatype MPI_GetType<bool>(void) { return MPI_CXX_BOOL ;} 
     31 
     32  template<> 
    3033  MPI_Datatype MPI_GetType<char>(void) { return MPI_CHAR ;} 
    3134 
  • XIOS3/dev/XIOS_ATTACHED/src/node/axis.cpp

    r2461 r2482  
    2424      : CObjectTemplate<CAxis>() 
    2525      , CAxisAttributes(), isChecked(false), relFiles() 
    26       , hasBounds(false), isCompressible_(false) 
    27       , transformationMap_(), hasValue(false), hasLabel(false) 
     26      , hasBounds_(false), isCompressible_(false) 
     27      , transformationMap_() 
    2828      , clients() 
    2929   { 
     
    3333      : CObjectTemplate<CAxis>(id) 
    3434      , CAxisAttributes(), isChecked(false), relFiles() 
    35       , hasBounds(false), isCompressible_(false) 
    36       , transformationMap_(), hasValue(false), hasLabel(false) 
     35      , hasBounds_(false), isCompressible_(false) 
     36      , transformationMap_() 
    3737      , clients() 
    3838   { 
     
    167167         size += CArray<bool,1>::size(n_glo); 
    168168         size += CArray<double,1>::size(n_glo); 
    169          if (hasBounds) 
     169         if (hasBounds_) 
    170170           size += CArray<double,2>::size(2*n_glo); 
    171          if (hasLabel) 
     171         if (hasLabel_) 
    172172          size += CArray<StdString,1>::size(n_glo); 
    173173       } 
     
    200200         size += CArray<bool,1>::size(it->second.size()); 
    201201         size += CArray<double,1>::size(it->second.size()); 
    202          if (hasBounds) 
     202         if (hasBounds_) 
    203203           size += CArray<double,2>::size(2 * it->second.size()); 
    204          if (hasLabel) 
     204         if (hasLabel_) 
    205205           size += CArray<StdString,1>::size(it->second.size()); 
    206206 
     
    459459                                   << ") than the one defined by the \'size\' attribute (" << n.getValue() << ").") 
    460460          else return false ;  
    461         this->hasValue = true; 
     461        this->hasValue_ = true; 
    462462      } 
    463463 
     
    569569                               << "Bounds size is "<< bounds.extent(0) << " x " << bounds.extent(1) << ".") 
    570570         else return false ; 
    571        hasBounds = true; 
    572      } 
    573      else hasBounds = false; 
     571       hasBounds_ = true; 
     572     } 
     573     else hasBounds_ = false; 
    574574     return true ; 
    575575   } 
     
    587587                              << "label size is "<< label.extent(0)<<  " .") 
    588588        else return false ; 
    589       hasLabel = true; 
    590     } 
    591     else hasLabel = false; 
     589      hasLabel_ = true; 
     590    } 
     591    else hasLabel_ = false; 
    592592    return true ; 
    593593  } 
     
    11651165    CContext* context = CContext::getCurrent(); 
    11661166 
    1167     if (hasValue) 
     1167    if (hasValue_) 
    11681168    { 
    11691169      { // send level value 
     
    11751175    } 
    11761176 
    1177     if (hasBounds) 
     1177    if (hasBounds_) 
    11781178    { 
    11791179      { // send bounds level value 
     
    11851185    } 
    11861186 
    1187     if (hasLabel) 
     1187    if (hasLabel_) 
    11881188    { 
    11891189      { // send label 
  • XIOS3/dev/XIOS_ATTACHED/src/node/axis.hpp

    r2397 r2482  
    175175         bool isEqual(CAxis* axis); 
    176176 
    177       public:  
    178         bool hasValue;         
    179         bool hasBounds; 
    180         bool hasLabel; 
     177      private:  
     178        bool hasValue_= false;         
     179        bool hasBounds_= false; 
     180        bool hasLabel_= false; 
     181      public: 
     182        bool hasValue(void) { return hasValue_ ;} 
     183        bool hasBounds(void) { return hasBounds_ ;} 
     184        bool hasLabel(void) { return hasLabel_ ;} 
    181185 
    182186      private: 
  • XIOS3/dev/XIOS_ATTACHED/src/node/context.cpp

    r2458 r2482  
    77#include "duration.hpp" 
    88 
     9#include "online_context_client.hpp" 
    910#include "legacy_context_client.hpp" 
    1011#include "legacy_context_server.hpp" 
     
    678679  vector<CContextClient*> CContext::getContextClient(const string& poolId, const string& serviceId) 
    679680  { 
    680     vector<pair<CContextClient*,CContextServer*>> clientServers ; 
    681     getServerInterComm(poolId, serviceId, clientServers ) ; 
    682     vector<CContextClient*> ret ; 
    683     for(auto& clientServer : clientServers) ret.push_back(clientServer.first) ; 
     681     vector<CContextClient*> ret ; 
     682     
     683    if (serviceId=="attached") ret.push_back(onlineContextClient_) ; 
     684    else 
     685    { 
     686      vector<pair<CContextClient*,CContextServer*>> clientServers ; 
     687      getServerInterComm(poolId, serviceId, clientServers ) ; 
     688      for(auto& clientServer : clientServers) ret.push_back(clientServer.first) ; 
     689    } 
    684690    return ret ; 
    685691  } 
     
    807813      if (serviceType_==CServicesManager::CLIENT) 
    808814      { 
    809 //ym        doPreTimestepOperationsForEnabledReadModeFiles(); // For now we only use server level 1 to read data 
    810815        triggerLateFields() ; 
    811816 
     
    985990 
    986991     CTimer::get("Context : close definition").resume() ; 
     992 
     993     onlineContextClient_=CContextClient::getNew<CContextClient::online>(this,intraComm_, intraComm_); 
    987994           
    988995     // create intercommunicator with servers.  
     
    11451152    { 
    11461153      for(auto field : fileInField)  
    1147       { 
    1148         field->sendFieldToInputFileServer() ; 
    1149         field->connectToServerInput(garbageCollector) ; // connect the field to server filter 
     1154        if (field->getContextClient()->getType() != CContextClient::online) field->sendFieldToInputFileServer() ; 
     1155 
     1156      for(auto field : fileInField)  
     1157      { 
     1158        if (field->getContextClient()->getType() == CContextClient::online) field->connectToOnlineReader(garbageCollector) ; 
     1159        else field->connectToServerInput(garbageCollector) ; // connect the field to server filter 
    11501160        fileInFields_.push_back(field) ; 
    11511161      } 
     
    11571167      for(auto field : fileOutField)  
    11581168      { 
    1159         field->connectToFileServer(garbageCollector) ; // connect the field to server filter 
    1160       } 
    1161       for(auto field : fileOutField) field->sendFieldToFileServer() ; 
     1169        if (field->getContextClient()->getType() == CContextClient::online)  field->connectToOnlineWriter(garbageCollector) ; 
     1170        else  field->connectToFileServer(garbageCollector) ; // connect the field to server filter 
     1171      } 
     1172      for(auto field : fileOutField)  
     1173        if (field->getContextClient()->getType() != CContextClient::online) field->sendFieldToFileServer() ; 
    11621174    } 
    11631175 
     
    11761188      for(auto field : fileInField)  
    11771189      { 
    1178         field->connectToServerToClient(garbageCollector) ; 
     1190        if (field->getContextClient()->getType() == CContextClient::online) field->connectToOnlineReader(garbageCollector) ; 
     1191        else field->connectToServerToClient(garbageCollector) ; 
    11791192      } 
    11801193    } 
     
    12311244    if (serviceType_==CServicesManager::CLIENT)  
    12321245    { 
    1233       for(auto field : fileOutField) slaves[clientsId_[field->getContextClient()]] = field->getContextClient() ;  
    1234       for(auto field : fileInField) slaves[clientsId_[field->getContextClient()]] = field->getContextClient() ;  
     1246      for(auto field : fileOutField) 
     1247        if (field->getContextClient()->getType()!=CContextClient::online)  slaves[clientsId_[field->getContextClient()]] = field->getContextClient() ;  
     1248      for(auto field : fileInField)  
     1249        if (field->getContextClient()->getType()!=CContextClient::online)  slaves[clientsId_[field->getContextClient()]] = field->getContextClient() ;  
    12351250    } 
    12361251    else if (serviceType_==CServicesManager::GATHERER)  
     
    12411256    for(auto& slaveServer : slaveServers_) sendCloseDefinition(slaveServer) ; 
    12421257 
    1243     if (serviceType_==CServicesManager::WRITER)   
    1244     { 
    1245       createFileHeader(); 
    1246     } 
    1247  
    1248     if (serviceType_==CServicesManager::CLIENT) startPrefetchingOfEnabledReadModeFiles(); 
     1258    createFileHeader(); 
     1259    
     1260    //if (serviceType_==CServicesManager::CLIENT) startPrefetchingOfEnabledReadModeFiles(); 
     1261    if (serviceType_==CServicesManager::CLIENT)  
     1262       for(auto field : fileInField) field->sendReadDataRequest(getCalendar()->getCurrentDate());   
    12491263    
    12501264    // send signal to couplerIn context that definition phasis is done 
     
    13551369   CATCH_DUMP_ATTR 
    13561370 
    1357  
    1358    void CContext::postProcessFilterGraph() 
    1359    TRY 
    1360    { 
    1361      int size = enabledFiles.size(); 
    1362      for (int i = 0; i < size; ++i) 
    1363      { 
    1364         enabledFiles[i]->postProcessFilterGraph(); 
    1365      } 
    1366    } 
    1367    CATCH_DUMP_ATTR 
    1368  
    13691371   void CContext::startPrefetchingOfEnabledReadModeFiles() 
    13701372   TRY 
     
    13741376     { 
    13751377        enabledReadModeFiles[i]->prefetchEnabledReadModeFields(); 
    1376      } 
    1377    } 
    1378    CATCH_DUMP_ATTR 
    1379  
    1380    void CContext::doPreTimestepOperationsForEnabledReadModeFiles() 
    1381    TRY 
    1382    { 
    1383      int size = enabledReadModeFiles.size(); 
    1384      for (int i = 0; i < size; ++i) 
    1385      { 
    1386         enabledReadModeFiles[i]->doPreTimestepOperationsForEnabledReadModeFields(); 
    13871378     } 
    13881379   } 
     
    21762167        if (serviceType_==CServicesManager::CLIENT) // For now we only use server level 1 to read data 
    21772168        { 
    2178           doPostTimestepOperationsForEnabledReadModeFiles(); 
     2169         // doPostTimestepOperationsForEnabledReadModeFiles(); 
     2170          for(auto& field : fileInFields_) field->sendReadDataRequestIfNeeded() ; 
    21792171          garbageCollector.invalidate(calendar->getCurrentDate()); 
    21802172        } 
     
    22012193   CATCH_DUMP_ATTR 
    22022194 
    2203    //! Server side: Create header of netcdf file 
     2195   //! Create header of netcdf file 
    22042196   void CContext::createFileHeader(void) 
    22052197   TRY 
    22062198   { 
    2207       vector<CFile*>::const_iterator it; 
    2208  
    2209       //for (it=enabledFiles.begin(); it != enabledFiles.end(); it++) 
    2210       for (it=enabledWriteModeFiles.begin(); it != enabledWriteModeFiles.end(); it++) 
    2211       { 
    2212          (*it)->initWrite(); 
    2213       } 
     2199      for(auto& file : filesToWrite_) file->initWrite(); 
    22142200   } 
    22152201   CATCH_DUMP_ATTR 
  • XIOS3/dev/XIOS_ATTACHED/src/node/context.hpp

    r2458 r2482  
    141141         void initReadFiles(void); 
    142142         void prepareTimeseries(void); 
    143          void postProcessFilterGraph(); 
    144143         void startPrefetchingOfEnabledReadModeFiles(); 
    145          void doPreTimestepOperationsForEnabledReadModeFiles(); 
    146144         void doPostTimestepOperationsForEnabledReadModeFiles(); 
    147145         void findFieldsWithReadAccess(void); 
     
    298296         // Determine context on server or not 
    299297         bool hasServer; 
    300  
     298      public: 
     299        void registerFileToWrite(CFile* file) { filesToWrite_.insert(file); } // Add a file that need to be write for example to create headers 
     300      private:   
     301        std::set<CFile*> filesToWrite_ ;   
    301302 
    302303      private: 
     304        CContextClient* onlineContextClient_=nullptr ; 
     305         
    303306        std::string defaultPoolWriterId_ ; 
    304307        std::string defaultPoolReaderId_ ; 
  • XIOS3/dev/XIOS_ATTACHED/src/node/domain.cpp

    r2461 r2482  
    293293    \param [in] nbLocalDomain number of local domain on the domain destination 
    294294   */ 
     295 
    295296   void CDomain::redistribute(int nbLocalDomain) 
    296297   TRY 
     
    862863         
    863864 
    864         if (!area.isEmpty()) area.transposeSelf(1, 0); // => to be checked why is it transposed 
     865//        if (!area.isEmpty()) area.transposeSelf(1, 0); // => to be checked why is it transposed 
    865866     } 
    866867 
     
    914915   CATCH_DUMP_ATTR 
    915916 
     917   void CDomain::compute2dBox(void) 
     918   { 
     919     if (i_index.numElements()==0) 
     920     { 
     921       ibeginValue_= 0 ; 
     922       jbeginValue_= 0 ; 
     923       niValue_= 0 ; 
     924       njValue_= 0 ; 
     925     } 
     926     else 
     927     { 
     928       int maxI=0 ; 
     929       int maxJ=0 ; 
     930       int minI=nj_glo*ni_glo ; 
     931       int minJ=nj_glo*ni_glo ; 
     932       int i,j,k,ij ; 
     933       for(int k=0; k<i_index.numElements(); k++) 
     934       { 
     935         ij=j_index(k)*ni_glo + i_index(k) ; 
     936         i=ij%ni_glo ; 
     937         j=ij/ni_glo ; 
     938         if (i<minI) minI=i; 
     939         if (j<minJ) minJ=j; 
     940         if (i>maxI) maxI=i; 
     941         if (j>maxJ) maxJ=j; 
     942       } 
     943       ibeginValue_=minI ; 
     944       jbeginValue_=minJ ; 
     945       niValue_=maxI-minI+1 ; 
     946       njValue_=maxJ-minJ+1 ; 
     947     } 
     948   } 
     949 
    916950   size_t CDomain::getGlobalWrittenSize(void) 
    917951   { 
     
    943977        {           
    944978         // No information about ni 
    945           int minIndex = ni_glo - 1; 
     979          int minIndex = ni_glo*nj_glo - 1; 
    946980          int maxIndex = 0; 
    947981          for (int idx = 0; idx < i_index.numElements(); ++idx) 
     
    950984            if (i_index(idx) > maxIndex) maxIndex = i_index(idx); 
    951985          } 
    952           if (i_index.numElements()) { 
     986                if (i_index.numElements()) 
     987          { 
    953988            ni = maxIndex - minIndex + 1;  
    954989            minIIndex = minIndex; 
    955990          }          
    956           else { 
    957             ni = 0; 
    958           } 
    959         } 
     991                else ni = 0; 
     992              } 
    960993 
    961994        // It's not so correct but if ibegin is not the first value of i_index  
     
    10101043        { 
    10111044          // No information about nj 
    1012           int minIndex = nj_glo - 1; 
     1045          int minIndex = ni_glo*nj_glo - 1; 
    10131046          int maxIndex = 0; 
    10141047          for (int idx = 0; idx < j_index.numElements(); ++idx) 
     
    13541387     } 
    13551388     else if (!lonvalue_1d.isEmpty()  && !lonlatValueExisted) 
     1389     { 
     1390       if (type_attr::rectilinear == type) 
     1391       { 
     1392         if (ni == lonvalue_1d.numElements() && nj == latvalue_1d.numElements()) 
     1393         { 
     1394           lonvalue.resize(ni * nj); 
     1395           latvalue.resize(ni * nj); 
     1396           if (hasBounds) 
     1397           { 
     1398             bounds_lonvalue.resize(nvertex, ni * nj); 
     1399             bounds_latvalue.resize(nvertex, ni * nj); 
     1400           } 
     1401 
     1402           for (int j = 0; j < nj; ++j) 
     1403           { 
     1404             for (int i = 0; i < ni; ++i) 
     1405             { 
     1406               int k = j * ni + i; 
     1407 
     1408               lonvalue(k) = lonvalue_1d(i); 
     1409               latvalue(k) = latvalue_1d(j); 
     1410 
     1411               if (hasBounds) 
     1412               { 
     1413                 for (int n = 0; n < nvertex; ++n) 
     1414                 { 
     1415                   bounds_lonvalue(n,k) = bounds_lon_1d(n,i); 
     1416                   bounds_latvalue(n,k) = bounds_lat_1d(n,j); 
     1417                 } 
     1418               } 
     1419             } 
     1420           } 
     1421         } 
     1422         else if (i_index.numElements() == lonvalue_1d.numElements() && j_index.numElements() == latvalue_1d.numElements()  && !lonlatValueExisted) 
     1423         { 
     1424           lonvalue.reference(lonvalue_1d.copy()); 
     1425           latvalue.reference(latvalue_1d.copy()); 
     1426           if (hasBounds) 
     1427           { 
     1428             bounds_lonvalue.reference(bounds_lon_1d.copy()); 
     1429             bounds_latvalue.reference(bounds_lat_1d.copy()); 
     1430           } 
     1431         } 
     1432         else 
     1433           ERROR("CDomain::completeLonClient(void)", 
     1434                 << "[ id = " << this->getId() << " , context = '" << CObjectFactory::GetCurrentContextId() << " ] " 
     1435                 << "'lonvalue_1d' and 'latvalue_1d' does not have the same size as the local domain." << std::endl 
     1436                 << "'lonvalue_1d' size is " << lonvalue_1d.numElements()  
     1437                 << " and 'latvalue_1d' size is " << latvalue_1d.numElements() << std::endl  
     1438                 << " They should be correspondingly " << ni.getValue() << " and "  << nj.getValue() << " or " << std::endl 
     1439                 << i_index.numElements() << " and "  << j_index.numElements() << "."); 
     1440       } 
     1441       else if (type == type_attr::curvilinear || type == type_attr::unstructured  && !lonlatValueExisted) 
     1442       { 
     1443         lonvalue.reference(lonvalue_1d.copy()); 
     1444         latvalue.reference(latvalue_1d.copy()); 
     1445         if (hasBounds) 
     1446         { 
     1447           bounds_lonvalue.reference(bounds_lon_1d.copy()); 
     1448           bounds_latvalue.reference(bounds_lat_1d.copy()); 
     1449         } 
     1450       } 
     1451     } 
     1452 
     1453     if (!area_2d.isEmpty() && areavalue.isEmpty()) 
     1454     { 
     1455       areavalue.resize(ni*nj); 
     1456       for (int j = 0; j < nj; ++j) 
     1457       { 
     1458         for (int i = 0; i < ni; ++i) 
     1459         { 
     1460           int k = j * ni + i; 
     1461           areavalue(k) = area_2d(i,j); 
     1462         } 
     1463       } 
     1464     } 
     1465     else if (!area_1d.isEmpty() && areavalue.isEmpty()) areavalue.reference(area_1d.copy()); 
     1466 
     1467   } 
     1468   CATCH_DUMP_ATTR 
     1469 
     1470   /* 
     1471     Convert internal longitude latitude value used by XIOS to "lonvalue_*" which can be retrieved with Fortran interface 
     1472   */ 
     1473   void CDomain::convertLonLatValue(void) 
     1474   TRY 
     1475   { 
     1476     bool lonlatValueExisted = (0 != lonvalue.numElements()) || (0 != latvalue.numElements()); 
     1477     if (!lonvalue_2d.isEmpty() && lonlatValueExisted) 
     1478     { 
     1479       lonvalue_2d.resize(ni,nj); 
     1480       latvalue_2d.resize(ni,nj); 
     1481       if (hasBounds) 
     1482       { 
     1483         bounds_lon_2d.resize(nvertex, ni, nj); 
     1484         bounds_lat_2d.resize(nvertex, ni, nj); 
     1485       } 
     1486 
     1487       for (int j = 0; j < nj; ++j) 
     1488       { 
     1489         for (int i = 0; i < ni; ++i) 
     1490         { 
     1491           int k = j * ni + i; 
     1492 
     1493           lonvalue_2d(i,j) = lonvalue(k); 
     1494           latvalue_2d(i,j) = latvalue(k); 
     1495 
     1496           if (hasBounds) 
     1497           { 
     1498             for (int n = 0; n < nvertex; ++n) 
     1499             { 
     1500               bounds_lon_2d(n,i,j) = bounds_lonvalue(n,k); 
     1501               bounds_lat_2d(n,i,j) = bounds_latvalue(n,k); 
     1502             } 
     1503           } 
     1504         } 
     1505       } 
     1506     } 
     1507     else if (!lonvalue_1d.isEmpty()  && lonlatValueExisted) 
    13561508     { 
    13571509       if (type_attr::rectilinear == type) 
     
    14171569       } 
    14181570     } 
    1419  
    1420      if (!area.isEmpty() && areavalue.isEmpty()) 
    1421      { 
    1422         areavalue.resize(ni*nj); 
    1423        for (int j = 0; j < nj; ++j) 
    1424        { 
    1425          for (int i = 0; i < ni; ++i) 
    1426          { 
    1427            int k = j * ni + i; 
    1428            areavalue(k) = area(i,j); 
    1429          } 
    1430        } 
    1431      } 
    1432    } 
    1433    CATCH_DUMP_ATTR 
    1434  
    1435    /* 
    1436      Convert internal longitude latitude value used by XIOS to "lonvalue_*" which can be retrieved with Fortran interface 
    1437    */ 
    1438    void CDomain::convertLonLatValue(void) 
    1439    TRY 
    1440    { 
    1441      bool lonlatValueExisted = (0 != lonvalue.numElements()) || (0 != latvalue.numElements()); 
    1442      if (!lonvalue_2d.isEmpty() && lonlatValueExisted) 
    1443      { 
    1444        lonvalue_2d.resize(ni,nj); 
    1445        latvalue_2d.resize(ni,nj); 
    1446        if (hasBounds) 
    1447        { 
    1448          bounds_lon_2d.resize(nvertex, ni, nj); 
    1449          bounds_lat_2d.resize(nvertex, ni, nj); 
    1450        } 
    1451  
    1452        for (int j = 0; j < nj; ++j) 
    1453        { 
    1454          for (int i = 0; i < ni; ++i) 
    1455          { 
    1456            int k = j * ni + i; 
    1457  
    1458            lonvalue_2d(i,j) = lonvalue(k); 
    1459            latvalue_2d(i,j) = latvalue(k); 
    1460  
    1461            if (hasBounds) 
    1462            { 
    1463              for (int n = 0; n < nvertex; ++n) 
    1464              { 
    1465                bounds_lon_2d(n,i,j) = bounds_lonvalue(n,k); 
    1466                bounds_lat_2d(n,i,j) = bounds_latvalue(n,k); 
    1467              } 
    1468            } 
    1469          } 
    1470        } 
    1471      } 
    1472      else if (!lonvalue_1d.isEmpty()  && lonlatValueExisted) 
    1473      { 
    1474        if (type_attr::rectilinear == type) 
    1475        { 
    1476          if (ni == lonvalue_1d.numElements() && nj == latvalue_1d.numElements()) 
    1477          { 
    1478            lonvalue.resize(ni * nj); 
    1479            latvalue.resize(ni * nj); 
    1480            if (hasBounds) 
    1481            { 
    1482              bounds_lonvalue.resize(nvertex, ni * nj); 
    1483              bounds_latvalue.resize(nvertex, ni * nj); 
    1484            } 
    1485  
    1486            for (int j = 0; j < nj; ++j) 
    1487            { 
    1488              for (int i = 0; i < ni; ++i) 
    1489              { 
    1490                int k = j * ni + i; 
    1491  
    1492                lonvalue(k) = lonvalue_1d(i); 
    1493                latvalue(k) = latvalue_1d(j); 
    1494  
    1495                if (hasBounds) 
    1496                { 
    1497                  for (int n = 0; n < nvertex; ++n) 
    1498                  { 
    1499                    bounds_lonvalue(n,k) = bounds_lon_1d(n,i); 
    1500                    bounds_latvalue(n,k) = bounds_lat_1d(n,j); 
    1501                  } 
    1502                } 
    1503              } 
    1504            } 
    1505          } 
    1506          else if (i_index.numElements() == lonvalue_1d.numElements() && j_index.numElements() == latvalue_1d.numElements()  && !lonlatValueExisted) 
    1507          { 
    1508            lonvalue.reference(lonvalue_1d); 
    1509            latvalue.reference(latvalue_1d); 
    1510             if (hasBounds) 
    1511            { 
    1512              bounds_lonvalue.reference(bounds_lon_1d); 
    1513              bounds_latvalue.reference(bounds_lat_1d); 
    1514            } 
    1515          } 
    1516          else 
    1517            ERROR("CDomain::completeLonClient(void)", 
    1518                  << "[ id = " << this->getId() << " , context = '" << CObjectFactory::GetCurrentContextId() << " ] " 
    1519                  << "'lonvalue_1d' and 'latvalue_1d' does not have the same size as the local domain." << std::endl 
    1520                  << "'lonvalue_1d' size is " << lonvalue_1d.numElements()  
    1521                  << " and 'latvalue_1d' size is " << latvalue_1d.numElements() << std::endl  
    1522                  << " They should be correspondingly " << ni.getValue() << " and "  << nj.getValue() << " or " << std::endl 
    1523                  << i_index.numElements() << " and "  << j_index.numElements() << "."); 
    1524        } 
    1525        else if (type == type_attr::curvilinear || type == type_attr::unstructured  && !lonlatValueExisted) 
    1526        { 
    1527          lonvalue.reference(lonvalue_1d); 
    1528          latvalue.reference(latvalue_1d); 
    1529          if (hasBounds) 
    1530          { 
    1531            bounds_lonvalue.reference(bounds_lon_1d); 
    1532            bounds_latvalue.reference(bounds_lat_1d); 
    1533          } 
    1534        } 
    1535      } 
    15361571   } 
    15371572   CATCH_DUMP_ATTR 
     
    16361671   { 
    16371672     bool hasAreaValue = (!areavalue.isEmpty() && 0 != areavalue.numElements()); 
    1638      hasArea = !area.isEmpty(); 
     1673     hasArea = !area_1d.isEmpty() || !area_2d.isEmpty(); 
    16391674     if (hasArea && !hasAreaValue) 
    16401675     { 
    1641        if (area.extent(0) != ni || area.extent(1) != nj) 
     1676       if (!area_2d.isEmpty() && (area_2d.extent(0) != ni || area_2d.extent(1) != nj)) 
    16421677       { 
    16431678         ERROR("CDomain::checkArea(void)", 
     
    16451680               << "The area does not have the same size as the local domain." << std::endl 
    16461681               << "Local size is " << ni.getValue() << " x " << nj.getValue() << "." << std::endl 
    1647                << "Area size is " << area.extent(0) << " x " << area.extent(1) << "."); 
    1648        } 
    1649 //       if (areavalue.isEmpty()) 
    1650 //       { 
    1651 //          areavalue.resize(ni*nj); 
    1652 //         for (int j = 0; j < nj; ++j) 
    1653 //         { 
    1654 //           for (int i = 0; i < ni; ++i) 
    1655 //           { 
    1656 //             int k = j * ni + i; 
    1657 //             areavalue(k) = area(i,j); 
    1658 //           } 
    1659 //         } 
    1660 //       } 
     1682               << "Area size is " << area_2d.extent(0) << " x " << area_2d.extent(1) << "."); 
     1683       } 
     1684        
     1685       if (!area_1d.isEmpty() && area_1d.extent(0) != ni*nj) 
     1686       { 
     1687         ERROR("CDomain::checkArea(void)", 
     1688               << "[ id = " << this->getId() << " , context = '" << CObjectFactory::GetCurrentContextId() << " ] " 
     1689               << "The area does not have the same size as the local domain." << std::endl 
     1690               << "Local size is " << ni.getValue() << " x " << nj.getValue() << "." << std::endl 
     1691               << "Area size is " << area_1d.extent(0) << " but must be ni*nj=" << ni*nj << " ."); 
     1692       } 
     1693 
    16611694     } 
    16621695   } 
     
    17311764      if (this->checkAttributes_done_) return; 
    17321765      this->checkDomain(); 
     1766      this->compute2dBox() ; 
    17331767      this->checkLonLat(); 
    17341768      this->checkBounds(); 
     
    18031837     excludedAttr.insert(excludedAttr.end(), { "mask_1d", "mask_2d" }); // ??? 
    18041838     excludedAttr.insert(excludedAttr.end(), { "bounds_lon_1d", "bounds_lat_1d", "bounds_lon_2d", "bounds_lat_2d" }); 
    1805      excludedAttr.insert(excludedAttr.end(), { "area" }); 
     1839     excludedAttr.insert(excludedAttr.end(), { "area_1d", "area_2d" }); 
    18061840     // private 
    18071841     excludedAttr.insert(excludedAttr.end(), { "lon_start", "lon_end", "lat_start", "lat_end" }); 
     
    19521986    CContext* context = CContext::getCurrent(); 
    19531987    map<int, CArray<size_t,1>> globalIndex ; 
    1954 /* old method 
    1955     if (type==EDistributionType::BANDS) // Bands distribution to send to file server 
    1956     { 
    1957       int nbServer = client->getRemoteSize(); 
    1958       std::vector<int> nGlobDomain(2); 
    1959       nGlobDomain[0] = this->ni_glo; 
    1960       nGlobDomain[1] = this->nj_glo; 
    1961  
    1962       // to be changed in future, need to rewrite more simply domain distribution 
    1963       CServerDistributionDescription serverDescription(nGlobDomain, nbServer); 
    1964       int distributedPosition ; 
    1965       if (isUnstructed_) distributedPosition = 0 ; 
    1966       else distributedPosition = 1 ; 
    1967        
    1968       std::vector<std::vector<int> > serverIndexBegin = serverDescription.getServerIndexBegin(); 
    1969       std::vector<std::vector<int> > serverDimensionSizes = serverDescription.getServerDimensionSizes(); 
    1970       vector<unordered_map<size_t,vector<int>>> indexServerOnElement ; 
    1971       CArray<int,1> axisDomainOrder(1) ; axisDomainOrder(0)=2 ; 
    1972       auto zeroIndex=serverDescription.computeServerGlobalByElement(indexServerOnElement, context->getIntraCommRank(), context->getIntraCommSize(), 
    1973                                                                   axisDomainOrder,distributedPosition) ; 
    1974       // distribution is very bad => to redo 
    1975       // convert indexServerOnElement => map<int,CArray<size_t,1>> - need to be changed later 
    1976       map<int, vector<size_t>> vectGlobalIndex ; 
    1977       for(auto& indexRanks : indexServerOnElement[0]) 
    1978       { 
    1979         size_t index=indexRanks.first ; 
    1980         auto& ranks=indexRanks.second ; 
    1981         for(int rank : ranks) vectGlobalIndex[rank].push_back(index) ; 
    1982       } 
    1983       for(auto& vect : vectGlobalIndex ) globalIndex.emplace(vect.first, CArray<size_t,1>(vect.second.data(), shape(vect.second.size()),duplicateData)) ; 
    1984     // some servers receves no index (zeroIndex array) => root process take them into account. 
    1985       if (context->getIntraCommRank()==0)  
    1986         for(auto& rank : zeroIndex) globalIndex[rank] = CArray<size_t,1>() ;  
    1987     } 
    1988 */     
     1988 
    19891989    if (distType==EDistributionType::BANDS && isUnstructed_) distType=EDistributionType::COLUMNS ; 
    19901990 
     
    21342134  CATCH 
    21352135 
    2136   
    2137  
    21382136  void CDomain::distributeToServer(CContextClient* client, bool inOut, map<int, CArray<size_t,1>>& globalIndexOut, std::map<int, CArray<size_t,1>>& globalIndexIn, 
    21392137                                   shared_ptr<CScattererConnector> &scattererConnector, const string& domainId) 
     
    24092407      CArray<double,1> value ; 
    24102408      gathererConnector_->transfer(event, value, 0.);  
    2411       area.resize(ni,nj) ; 
    2412       if (area.numElements()>0) area=CArray<double,2>(value.dataFirst(),shape(ni,nj),neverDeleteData) ;  
     2409      area_2d.resize(ni,nj) ; 
     2410      if (area_2d.numElements()>0) area_2d=CArray<double,2>(value.dataFirst(),shape(ni,nj),neverDeleteData) ;  
    24132411    } 
    24142412  } 
  • XIOS3/dev/XIOS_ATTACHED/src/node/domain.hpp

    r2397 r2482  
    214214         CArray<double, 2> bounds_lonvalue, bounds_latvalue; 
    215215         CArray<double, 1> areavalue; 
     216         int niValue_ ; 
     217         int njValue_ ; 
     218         int ibeginValue_ ; 
     219         int jbeginValue_ ; 
    216220 
    217221 
     
    241245         void checkArea(void); 
    242246         void checkLonLat(); 
     247         void compute2dBox(void) ; 
    243248          
    244249       public: 
  • XIOS3/dev/XIOS_ATTACHED/src/node/field.cpp

    r2433 r2482  
    2020#include "temporal_filter.hpp" 
    2121#include "server_from_client_source_filter.hpp" 
     22#include "client_online_reader_filter.hpp" 
    2223#include "file_reader_source_filter.hpp" 
     24#include "grid_redistribute_filter.hpp" 
    2325#include "tracer.hpp" 
    2426#include "graph_package.hpp" 
     
    205207  TRY 
    206208  { 
    207     return clientFromServerSourceFilter_->sendReadDataRequest(tsDataRequested) ; 
     209    if (clientFromServerSourceFilter_) return clientFromServerSourceFilter_->sendReadDataRequest(tsDataRequested) ; 
     210    else if (clientOnlineReaderFilter_) return clientOnlineReaderFilter_->sendReadDataRequest(tsDataRequested) ; 
     211    else ERROR("bool CField::sendReadDataRequest(const CDate& tsDataRequested)", << "uninitialized source filter"); 
    208212  } 
    209213  CATCH_DUMP_ATTR 
     
    217221  TRY 
    218222  { 
    219     return clientFromServerSourceFilter_->sendReadDataRequestIfNeeded() ; 
     223    if (clientFromServerSourceFilter_) return clientFromServerSourceFilter_->sendReadDataRequestIfNeeded() ; 
     224    else if (clientOnlineReaderFilter_) return clientOnlineReaderFilter_->sendReadDataRequestIfNeeded() ; 
     225    else ERROR("bool CField::sendReadDataRequestIfNeeded(void)", << "uninitialized source filter"); 
    220226  } 
    221227  CATCH_DUMP_ATTR 
     
    304310  TRY 
    305311  { 
    306     clientFromServerSourceFilter_->checkForLateData() ; 
     312    if (clientFromServerSourceFilter_) return clientFromServerSourceFilter_->checkForLateData() ; 
     313    else if (clientOnlineReaderFilter_) return clientOnlineReaderFilter_->checkForLateData() ; 
     314    else ERROR("void CField::checkForLateDataFromServer(void)", << "uninitialized source filter"); 
    307315  } 
    308316  CATCH_DUMP_ATTR  
     
    315323    { 
    316324      checkForLateDataFromServer() ; 
    317       clientFromServerSourceFilter_->trigger(CContext::getCurrent()->getCalendar()->getCurrentDate()) ; 
     325      if (clientFromServerSourceFilter_) clientFromServerSourceFilter_->trigger(CContext::getCurrent()->getCalendar()->getCurrentDate()) ; 
     326      else if (clientOnlineReaderFilter_) clientOnlineReaderFilter_->trigger(CContext::getCurrent()->getCalendar()->getCurrentDate()) ; 
    318327    }  
    319328    else if (hasCouplerIn()) 
     
    325334  CATCH_DUMP_ATTR 
    326335 
    327  
    328   void CField::checkIfMustAutoTrigger(void) 
    329   TRY 
    330   { 
    331     mustAutoTrigger = clientFromServerSourceFilter_ ? clientFromServerSourceFilter_->mustAutoTrigger() : false; 
    332   } 
    333   CATCH_DUMP_ATTR 
    334  
    335   void CField::autoTriggerIfNeeded(void) 
    336   TRY 
    337   { 
    338     if (mustAutoTrigger) 
    339       clientFromServerSourceFilter_->trigger(CContext::getCurrent()->getCalendar()->getCurrentDate()); 
    340   } 
    341   CATCH_DUMP_ATTR 
    342  
     336   
    343337 
    344338  //---------------------------------------------------------------- 
     
    506500                                              bool bufferForWriting) 
    507501  { 
    508     auto& contextBufferSize = bufferSize[client] ; 
    509     auto& contextMaxEventSize = maxEventSize[client] ; 
    510     const std::map<int, size_t> mapSize = grid_->getDataBufferSize(client, getId(), bufferForWriting); 
     502    auto& contextBufferSize = bufferSize[client_] ; 
     503    auto& contextMaxEventSize = maxEventSize[client_] ; 
     504    const std::map<int, size_t> mapSize = grid_->getDataBufferSize(client_, getId(), bufferForWriting); 
    511505    for(auto& it : mapSize ) 
    512506    { 
     
    525519                                                   bool bufferForWriting) 
    526520  { 
    527     auto& contextBufferSize = bufferSize[client] ; 
    528     auto& contextMaxEventSize = maxEventSize[client] ; 
    529     const std::map<int, size_t> mapSize = grid_->getAttributesBufferSize(client, bufferForWriting); 
     521    auto& contextBufferSize = bufferSize[client_] ; 
     522    auto& contextMaxEventSize = maxEventSize[client_] ; 
     523    const std::map<int, size_t> mapSize = grid_->getAttributesBufferSize(client_, bufferForWriting); 
    530524    for(auto& it : mapSize ) 
    531525    { 
     
    797791  { 
    798792    // insert temporal filter before sending to files 
    799     clientToServerStoreFilter_ = std::shared_ptr<CClientToServerStoreFilter>(new CClientToServerStoreFilter(gc, this, client)); 
     793    clientToServerStoreFilter_ = std::shared_ptr<CClientToServerStoreFilter>(new CClientToServerStoreFilter(gc, this, client_)); 
    800794    // insert temporal filter before sending to files 
    801795    getTemporalDataFilter(gc, fileOut_->output_freq)->connectOutput(clientToServerStoreFilter_, 0); 
     
    809803  }  
    810804 
     805  void CField::connectToOnlineWriter(CGarbageCollector& gc) 
     806  { 
     807    // insert temporal filter before sending to files 
     808    CField* fieldOut ; 
     809    redistributeFilter_ = std::shared_ptr<CGridRedistributeFilter>(new CGridRedistributeFilter(gc, this, fieldOut)); 
     810    fieldOut->setFileOut(this->getFileOut()); 
     811    fileOut_->replaceEnabledFields(this, fieldOut) ; 
     812    // insert temporal filter before sending to files 
     813    getTemporalDataFilter(gc, fileOut_->output_freq)->connectOutput(redistributeFilter_, 0); 
     814    fieldOut->inputFilter = std::shared_ptr<CPassThroughFilter>(new CPassThroughFilter(gc));  
     815    fieldOut->instantDataFilter = fieldOut->inputFilter ; 
     816    redistributeFilter_->connectOutput(fieldOut->inputFilter, 0); 
     817    fieldOut->connectToFileWriter(gc) ; 
     818    fieldOut->solveServerOperation() ; // might not be called, create a new time functor.... find a better solution later 
     819    const bool buildGraph_ = !build_workflow_graph.isEmpty() && build_workflow_graph == true ; 
     820   
     821    if(buildGraph_)  
     822    { 
     823      clientToServerStoreFilter_->graphPackage = new CGraphPackage; 
     824      clientToServerStoreFilter_->graphEnabled = true; 
     825      clientToServerStoreFilter_->graphPackage->inFields.push_back(this); 
     826    } 
     827  }  
     828 
     829  void CField::connectToOnlineReader(CGarbageCollector& gc) 
     830  { 
     831    // insert temporal filter before sending to files 
     832    clientOnlineReaderFilter_ = std::shared_ptr<CClientOnlineReaderFilter>(new CClientOnlineReaderFilter(gc,this)) ; 
     833    clientOnlineReaderFilter_ -> connectOutput(inputFilter,0) ; 
     834  }  
     835 
    811836  void CField::connectToCouplerOut(CGarbageCollector& gc) 
    812837  { 
    813838    // insert temporal filter before sending to files 
    814     clientToServerStoreFilter_ = std::shared_ptr<CClientToServerStoreFilter>(new CClientToServerStoreFilter(gc, this, client)); 
     839    clientToServerStoreFilter_ = std::shared_ptr<CClientToServerStoreFilter>(new CClientToServerStoreFilter(gc, this, client_)); 
    815840    instantDataFilter->connectOutput(clientToServerStoreFilter_, 0); 
    816841    const bool buildGraph_ = !build_workflow_graph.isEmpty() && build_workflow_graph == true ; 
     
    951976  void CField::connectToServerToClient(CGarbageCollector& gc) 
    952977  { 
    953     serverToClientStoreFilter_ = std::shared_ptr<CServerToClientStoreFilter>(new CServerToClientStoreFilter(gc, this, client)); 
     978    serverToClientStoreFilter_ = std::shared_ptr<CServerToClientStoreFilter>(new CServerToClientStoreFilter(gc, this, client_)); 
    954979    instantDataFilter->connectOutput(serverToClientStoreFilter_, 0); 
    955980    const bool buildGraph_ = !build_workflow_graph.isEmpty() && build_workflow_graph == true ; 
     
    14351460  { 
    14361461    CContext* context = CContext::getCurrent(); 
    1437     client = contextClient; 
     1462    client_ = contextClient; 
    14381463   
    14391464    // A grid is sent by a client (both for read or write) or by primary server (write only) 
     
    14411466    { 
    14421467      if (getRelFile()->mode.isEmpty() || (!getRelFile()->mode.isEmpty() && getRelFile()->mode == CFile::mode_attr::write)) 
    1443         grid_->setContextClient(contextClient); 
     1468        /*grid_->setContextClient(contextClient) */; // => nothing to do with thats now, to remove... 
    14441469    } 
    14451470    else if (context->getServiceType()==CServicesManager::CLIENT) 
    14461471    { 
    14471472      if (grid_) 
    1448         grid_->setContextClient(contextClient); 
     1473        /*grid_->setContextClient(contextClient)*/; // => nothing to do with thats now, to remove... 
    14491474      else 
     1475 
    14501476        ERROR( "CField::setContextClient(contextClient)", 
    14511477               << "Grid not defined for " << getId() 
     
    14591485  void CField::sendFieldToFileServer(void) 
    14601486  { 
    1461     CContext::getCurrent()->sendContextToFileServer(client); 
    1462     getRelFile()->sendFileToFileServer(client); 
     1487    CContext::getCurrent()->sendContextToFileServer(client_); 
     1488    getRelFile()->sendFileToFileServer(client_); 
    14631489    sentGrid_ = grid_-> duplicateSentGrid() ; 
    1464     sentGrid_->sendGridToFileServer(client, false); 
     1490    sentGrid_->sendGridToFileServer(client_, false); 
    14651491    name = getFieldOutputName() ; 
    1466     this->sendAllAttributesToServer(client); 
    1467     this->sendAddAllVariables(client); 
     1492    this->sendAllAttributesToServer(client_); 
     1493    this->sendAddAllVariables(client_); 
    14681494  } 
    14691495 
    14701496  void CField::sendFieldToInputFileServer(void) 
    14711497  { 
    1472     CContext::getCurrent()->sendContextToFileServer(client); 
    1473     getRelFile()->sendFileToFileServer(client); 
     1498    CContext::getCurrent()->sendContextToFileServer(client_); 
     1499    getRelFile()->sendFileToFileServer(client_); 
    14741500    sentGrid_ = grid_-> duplicateSentGrid() ; 
    1475     sentGrid_->sendGridToFileServer(client, true); 
     1501    sentGrid_->sendGridToFileServer(client_, true); 
    14761502    read_access=true ; // not the best solution, but on server side, the field must be a starting point of the workflow 
    14771503                       // must be replace by a better solution when implementing filters for reading and send to client 
    14781504                       // on server side 
    1479     this->sendAllAttributesToServer(client); 
    1480     this->sendAddAllVariables(client); 
     1505    this->sendAllAttributesToServer(client_); 
     1506    this->sendAddAllVariables(client_); 
    14811507  } 
    14821508 
     
    14861512    else sendFieldToCouplerOut_done_=true ; 
    14871513    sentGrid_ = grid_-> duplicateSentGrid() ; 
    1488     sentGrid_->sendGridToCouplerOut(client, this->getId()); 
     1514    sentGrid_->sendGridToCouplerOut(client_, this->getId()); 
    14891515    this->sendGridCompleted(); 
    14901516 
     
    15021528      CEventClient event(getType(),EVENT_ID_GRID_COMPLETED); 
    15031529 
    1504       if (client->isServerLeader()) 
     1530      if (client_->isServerLeader()) 
    15051531      { 
    15061532        CMessage msg; 
    15071533        msg<<this->getId(); 
    1508         for (auto& rank : client->getRanksServerLeader()) event.push(rank,1,msg); 
    1509         client->sendEvent(event); 
    1510       } 
    1511       else client->sendEvent(event); 
     1534        for (auto& rank : client_->getRanksServerLeader()) event.push(rank,1,msg); 
     1535        client_->sendEvent(event); 
     1536      } 
     1537      else client_->sendEvent(event); 
    15121538   } 
    15131539   CATCH_DUMP_ATTR 
  • XIOS3/dev/XIOS_ATTACHED/src/node/field.hpp

    r2406 r2482  
    2828#include "client_to_server_store_filter.hpp" 
    2929#include "file_reader_source_filter.hpp" 
     30#include "client_online_reader_filter.hpp" 
    3031 
    3132 
     
    5657   class CSourceFilter; 
    5758   class CServerToClientFilter; 
     59   class CGridRedistributeFilter; 
    5860   ///-------------------------------------------------------------- 
    5961 
     
    199201        void checkForLateDataFromCoupler(void) ; 
    200202 
    201         void checkIfMustAutoTrigger(void); // ym obsolete 
    202         void autoTriggerIfNeeded(void); //ym obsolete 
    203203        void triggerLateField(void) ; 
    204204 
     
    237237        void connectToFileReader(CGarbageCollector& gc) ; 
    238238        void connectToServerToClient(CGarbageCollector& gc) ; 
     239        void connectToOnlineWriter(CGarbageCollector& gc) ; 
     240        void connectToOnlineReader(CGarbageCollector& gc) ; 
    239241 
    240242        void setContextClientDataBufferSize(map<CContextClient*,map<int,size_t>>& bufferSize,  
     
    267269         CGrid*  grid_=nullptr; 
    268270         CGrid* getGrid(void) { return grid_; }  
     271         void setGrid(CGrid* grid) { grid_=grid; }  
    269272       
    270273      private: 
     
    327330         
    328331      private: 
    329          CContextClient* client; 
     332         CContextClient* client_; 
    330333      public: 
    331334         void setContextClient(CContextClient* newContextClient); 
    332          CContextClient* getContextClient(void) {return client;} 
     335         CContextClient* getContextClient(void) {return client_;} 
    333336 
    334337      private: 
     
    372375         std::shared_ptr<COutputPin> selfReferenceFilter; // probably redondant with inputFilter 
    373376 
    374          //! The source filter for data provided by the client 
    375 //         std::shared_ptr<CSourceFilter> clientSourceFilter; // obsolete to remove 
    376377  
    377378         //! The source filter for data provided by the model to enter the client workflow 
     
    393394         std::shared_ptr<CFileReaderSourceFilter> fileReaderSourceFilter_; 
    394395 
    395          //! The source filter for data provided by the server 
    396 //         std::shared_ptr<CSourceFilter> serverSourceFilter; // obsolete to remove 
    397          
    398396         //! The terminal filter which send data to server for writing 
    399397         std::shared_ptr<CClientToServerStoreFilter> clientToServerStoreFilter_; 
     
    405403         std::shared_ptr<CServerToClientStoreFilter> serverToClientStoreFilter_; 
    406404 
     405         //! the filter to redistribute data before to call the fileWriterStoreFilter 
     406         std::shared_ptr<CGridRedistributeFilter>  redistributeFilter_ ; 
     407 
     408          //! the filter to connect to online reader 
     409         std::shared_ptr<CClientOnlineReaderFilter>  clientOnlineReaderFilter_ ; 
    407410 
    408411   }; // class CField 
  • XIOS3/dev/XIOS_ATTACHED/src/node/file.cpp

    r2458 r2482  
    178178 
    179179      return (this->enabledFields); 
     180   } 
     181   CATCH_DUMP_ATTR 
     182 
     183   void CFile::replaceEnabledFields(CField* fieldIn, CField* fieldOut) 
     184   TRY 
     185   { 
     186     for(auto& enableField : enabledFields) if (enableField==fieldIn) enableField=fieldOut ; 
    180187   } 
    181188   CATCH_DUMP_ATTR 
     
    979986 
    980987   /*! 
    981     * Post-process the filter graph for each active field. 
    982     */ 
    983    void CFile::postProcessFilterGraph() 
    984    TRY 
    985    { 
    986      int size = this->enabledFields.size(); 
    987      for (int i = 0; i < size; ++i) 
    988      { 
    989        this->enabledFields[i]->checkIfMustAutoTrigger(); 
    990      } 
    991    } 
    992    CATCH_DUMP_ATTR 
    993  
    994    /*! 
    995988     Prefetching the data for enabled fields read from file. 
    996989   */ 
     
    1004997     for (int i = 0; i < size; ++i) 
    1005998       this->enabledFields[i]->sendReadDataRequest(CContext::getCurrent()->getCalendar()->getCurrentDate()); 
    1006    } 
    1007    CATCH_DUMP_ATTR 
    1008  
    1009    /*! 
    1010      Do all pre timestep operations for enabled fields in read mode: 
    1011       - Check that the data excepted from server has been received 
    1012       - Check if some filters must auto-trigger 
    1013    */ 
    1014    void CFile::doPreTimestepOperationsForEnabledReadModeFields(void) 
    1015    TRY 
    1016    { 
    1017      if (mode.isEmpty() || mode.getValue() != mode_attr::read) 
    1018        return; 
    1019  
    1020      int size = this->enabledFields.size(); 
    1021      for (int i = 0; i < size; ++i) 
    1022      { 
    1023        this->enabledFields[i]->checkForLateDataFromServer(); 
    1024        this->enabledFields[i]->autoTriggerIfNeeded(); 
    1025      } 
    1026999   } 
    10271000   CATCH_DUMP_ATTR 
  • XIOS3/dev/XIOS_ATTACHED/src/node/file.hpp

    r2458 r2482  
    8383                                                int default_level = 1, 
    8484                                                bool default_enabled = true); 
     85         void replaceEnabledFields(CField* fieldIn, CField* fieldOut) ; 
    8586 
    8687         StdString dumpClassAttributes(void); 
     
    112113         void processEnabledFile(void); 
    113114          
    114          void postProcessFilterGraph(); 
    115115         void prefetchEnabledReadModeFields(); 
    116          void doPreTimestepOperationsForEnabledReadModeFields(); 
    117116         void doPostTimestepOperationsForEnabledReadModeFields(); 
    118117 
     
    212211        
    213212       private: 
    214  
    215  
     213         bool isOnline_=false; 
     214       public: 
     215         bool isOnline(void) { return isOnline_ ;} 
     216         void setOnline(bool online=true) { isOnline_=online ;}  
    216217      public: 
    217218        //         virtual void toBinary  (StdOStream& os) const; 
  • XIOS3/dev/XIOS_ATTACHED/src/node/grid.cpp

    r2397 r2482  
    2929#include "generic_algorithm_transformation.hpp" 
    3030#include "algo_types.hpp" 
     31#include "redistribute_domain.hpp" 
     32#include "redistribute_axis.hpp" 
     33#include "redistribute_scalar.hpp" 
     34 
    3135 
    3236#include <regex> 
     
    4852      , axisPositionInGrid_(), hasDomainAxisBaseRef_(false) 
    4953      , gridSrc_(), order_() 
    50       , clients() 
    5154   { 
    5255     setVirtualDomainGroup(CDomainGroup::create(getId() + "_virtual_domain_group")); 
     
    6669      , axisPositionInGrid_(), hasDomainAxisBaseRef_(false) 
    6770      , gridSrc_(), order_() 
    68       , clients() 
    6971   { 
    7072     setVirtualDomainGroup(CDomainGroup::create(getId() + "_virtual_domain_group")); 
     
    14681470    distributeGridToServer(client, false, fieldId) ; 
    14691471  } 
     1472 
     1473  CGrid* CGrid::redistributeGridToWriter(void) 
     1474  { 
     1475    CContext* context = CContext::getCurrent(); 
     1476    CGrid* redistributedGrid ; 
     1477    string redistributeGridId="redistributedToWriter__"+getId() ; 
     1478    if (has(redistributeGridId)) redistributedGrid = get(redistributeGridId) ; 
     1479    else 
     1480    { 
     1481      redistributedGrid = CGrid::create(redistributeGridId) ; 
     1482      // simple Distribution for now  
     1483      // distribute over the fisrt element except if it is a scalar 
     1484      auto& elements = getElements() ; 
     1485      int posDistributed = 0 ; 
     1486      for(auto& element : elements) 
     1487      { 
     1488        if (element.type==TYPE_DOMAIN) break ; 
     1489        else if (element.type==TYPE_AXIS) break ; 
     1490        else if (element.type==TYPE_SCALAR) posDistributed++ ; 
     1491      } 
     1492      if (posDistributed==elements.size()) posDistributed=0 ; // grid composed only of scalar 
     1493     
     1494      for(int i=0 ; i<elements.size() ; i++) 
     1495      { 
     1496        if (elements[i].type==TYPE_DOMAIN)  
     1497        { 
     1498          CDomain* domain = redistributedGrid->addDomain() ; 
     1499          domain->domain_ref=elements[i].domain->getId() ; 
     1500          domain->name = elements[i].domain->getDomainOutputName() ; 
     1501          CRedistributeDomain* redistributeDomain = dynamic_cast<CRedistributeDomain *>(domain->addTransformation(TRANS_REDISTRIBUTE_DOMAIN, "")) ; 
     1502          redistributeDomain->type.setValue(posDistributed==i ? CRedistributeDomain::type_attr::bands : CRedistributeDomain::type_attr::full); 
     1503        } 
     1504        else if (elements[i].type==TYPE_AXIS)       
     1505        { 
     1506          CAxis* axis = redistributedGrid->addAxis() ; 
     1507          axis->axis_ref=elements[i].axis->getId() ; 
     1508          axis->name = elements[i].axis->getAxisOutputName() ; 
     1509          CRedistributeAxis* redistributeAxis = dynamic_cast<CRedistributeAxis *>(axis->addTransformation(TRANS_REDISTRIBUTE_AXIS, "")) ; 
     1510          redistributeAxis->type.setValue(posDistributed==i ? CRedistributeAxis::type_attr::bands : CRedistributeAxis::type_attr::full); 
     1511        } 
     1512        else if (elements[i].type==TYPE_SCALAR)       
     1513        { 
     1514          CScalar* scalar = redistributedGrid->addScalar() ; 
     1515          scalar->scalar_ref=elements[i].scalar->getId() ; 
     1516          scalar->name = elements[i].scalar->getScalarOutputName() ; 
     1517          CRedistributeScalar* redistributeScalar = dynamic_cast<CRedistributeScalar *>(scalar->addTransformation(TRANS_REDISTRIBUTE_SCALAR, "")) ; 
     1518          redistributeScalar->type.setValue(posDistributed==i ? CRedistributeScalar::type_attr::root : CRedistributeScalar::type_attr::full); 
     1519        } 
     1520      } 
     1521    } 
     1522 
     1523    return redistributedGrid ;  
     1524  } 
     1525 
     1526 
    14701527 
    14711528 
     
    23692426  TRY 
    23702427  { 
    2371     if (clientsSet.find(contextClient)==clientsSet.end()) 
    2372     { 
    2373       clients.push_back(contextClient) ; 
    2374       clientsSet.insert(contextClient); 
    2375     } 
    23762428    for (auto domain : getDomains()) domain->setContextClient(contextClient); 
    23772429    for (auto axis : getAxis()) axis->setContextClient(contextClient); 
    23782430    for (auto scalar : getScalars()) scalar->setContextClient(contextClient); 
    2379     
    23802431  } 
    23812432  CATCH_DUMP_ATTR 
     
    24732524  } 
    24742525 
     2526  void CGrid::computeRedistributeToWriterConnector(CGrid* gridSrc) 
     2527  { 
     2528    CContext* context = CContext::getCurrent(); 
     2529 
     2530    vector<shared_ptr<CLocalView>> srcViews ; 
     2531    vector<shared_ptr<CLocalView>> dstViews ; 
     2532         
     2533    for(auto& element : gridSrc->getElements()) 
     2534    { 
     2535      if (element.type==TYPE_DOMAIN) srcViews.push_back(element.domain->getLocalView(CElementView::WORKFLOW)) ; 
     2536      else if (element.type==TYPE_AXIS) srcViews.push_back(element.axis->getLocalView(CElementView::WORKFLOW)) ;  
     2537      else if (element.type==TYPE_SCALAR) srcViews.push_back(element.scalar->getLocalView(CElementView::WORKFLOW)) ;  
     2538    } 
     2539 
     2540    for(auto& element : this->getElements()) 
     2541    { 
     2542      if (element.type==TYPE_DOMAIN) dstViews.push_back(element.domain->getLocalView(CElementView::WORKFLOW)) ; 
     2543      else if (element.type==TYPE_AXIS) dstViews.push_back(element.axis->getLocalView(CElementView::WORKFLOW)) ;  
     2544      else if (element.type==TYPE_SCALAR) dstViews.push_back(element.scalar->getLocalView(CElementView::WORKFLOW)) ;  
     2545    } 
     2546 
     2547    redistributeToWriterConnector_ = make_shared<CGridTransformConnector>(srcViews, dstViews, context->getIntraComm()) ; 
     2548    redistributeToWriterConnector_ -> computeConnector(true) ; 
     2549  } 
    24752550   
    24762551} // namespace xios 
  • XIOS3/dev/XIOS_ATTACHED/src/node/grid.hpp

    r2397 r2482  
    279279 
    280280        bool isDataDistributed(void) ;  
    281       private: 
    282  
    283 /** Clients that have to send a grid. There can be multiple clients in case of secondary server, otherwise only one client. */ 
    284         std::list<CContextClient*> clients; 
    285         std::set<CContextClient*> clientsSet; 
    286281 
    287282      private: 
     
    327322     ////////////////////////////////////////////////////////////////////////////////////// 
    328323      public: 
     324        CGrid* redistributeGridToWriter(void) ; 
     325      public: 
    329326       CGrid* duplicateSentGrid(void) ; 
    330327      private: 
     
    402399         void computeServerFromClientConnector(void) ; 
    403400 
     401      private: 
     402         shared_ptr<CGridTransformConnector> redistributeToWriterConnector_ = nullptr ; 
     403      public: 
     404         shared_ptr<CGridTransformConnector> getRedistributeToWriterConnector(CGrid* gridSrc) { if (redistributeToWriterConnector_==nullptr) computeRedistributeToWriterConnector(gridSrc) ; return redistributeToWriterConnector_;} 
     405         void computeRedistributeToWriterConnector(CGrid* gridSrc) ; 
     406 
     407 
    404408   }; // class CGrid 
    405409 
  • XIOS3/dev/XIOS_ATTACHED/src/node/scalar.cpp

    r2461 r2482  
    123123    if (n.isEmpty()) n=1 ; 
    124124    if (mask.isEmpty()) mask=true ; 
     125     
     126    hasValue_ =  (value.isEmpty())  ? false :true ; 
     127    hasBounds_ = (bounds.isEmpty()) ? false :true ; 
     128    hasLabel_ =  (label.isEmpty())  ? false :true ; 
     129 
    125130 
    126131    initializeLocalElement() ; 
  • XIOS3/dev/XIOS_ATTACHED/src/node/scalar.hpp

    r2397 r2482  
    143143 
    144144      bool isEqual(CScalar* scalar); 
     145 
     146    public: 
     147      bool hasValue() { return hasValue_; } 
     148      bool hasBounds() { return hasBounds_; } 
     149      bool hasLabel() { return hasLabel_; } 
     150    private: 
     151      bool hasValue_  = false ; 
     152      bool hasBounds_ = false ; 
     153      bool hasLabel_  = false ; 
    145154    private:   
    146155          /** Clients that have to send a scalar. There can be multiple clients in case of secondary server, otherwise only one client. */ 
  • XIOS3/dev/XIOS_ATTACHED/src/transformation/axis_algorithm/axis_algorithm_extract.cpp

    r2270 r2482  
    9292  } 
    9393 
    94   if (axisSrc_->hasValue) axisDest_->value.resize(nDest); 
    95   if (axisSrc_->hasLabel) axisDest_->label.resize(nDest); 
    96   if (axisSrc_->hasBounds) axisDest_->bounds.resize(2,nDest); 
     94  if (axisSrc_->hasValue()) axisDest_->value.resize(nDest); 
     95  if (axisSrc_->hasLabel()) axisDest_->label.resize(nDest); 
     96  if (axisSrc_->hasBounds()) axisDest_->bounds.resize(2,nDest); 
    9797 
    9898  auto& transMap = this->transformationMapping_; 
     
    142142      // ----------------------------------------------------------------------------- 
    143143 
    144       if (axisSrc_->hasValue) 
     144      if (axisSrc_->hasValue()) 
    145145      { 
    146146        axisDest_->value(countDest) = axisSrc_->value(countSrc); 
    147147      } 
    148       if (axisSrc_->hasLabel) 
     148      if (axisSrc_->hasLabel()) 
    149149      { 
    150150        axisDest_->label(countDest) = axisSrc_->label(countSrc); 
    151151      } 
    152       if (axisSrc_->hasBounds) 
     152      if (axisSrc_->hasBounds()) 
    153153      { 
    154154        axisDest_->bounds(0,countDest) = axisSrc_->bounds(0,countSrc); 
  • XIOS3/dev/XIOS_ATTACHED/src/transformation/axis_algorithm/axis_algorithm_inverse.cpp

    r2270 r2482  
    123123  } 
    124124 
    125   if (axisSrc_->hasValue) 
     125  if (axisSrc_->hasValue()) 
    126126  { 
    127127    axisDestination->value.resize(indexSize); 
     
    132132  } 
    133133 
    134   if (axisSrc_->hasBounds) 
     134  if (axisSrc_->hasBounds()) 
    135135  { 
    136136    axisDestination->bounds.resize(2,indexSize); 
  • XIOS3/dev/XIOS_ATTACHED/src/transformation/axis_algorithm/axis_algorithm_redistribute.cpp

    r2460 r2482  
    88#include "grid.hpp" 
    99#include "grid_transformation_factory_impl.hpp" 
     10#include "context.hpp" 
    1011 
    1112namespace xios 
     
    4647  TRY 
    4748  { 
     49    CContext* context = CContext::getCurrent();  
    4850 
     51    axisDestination->n_glo.reset(); 
     52    axisDestination->index.reset(); 
     53    axisDestination->n.reset(); 
     54    axisDestination->begin.reset(); 
     55 
     56    axisDestination->mask.reset(); 
     57    axisDestination->data_index.reset(); 
     58    axisDestination->data_n.reset(); 
     59    axisDestination->data_begin.reset(); 
     60 
     61    axisDestination->value.reset(); 
     62    axisDestination->label.reset(); 
     63    axisDestination->bounds.reset(); 
     64 
     65    redistributeAxis->checkValid(axisSource); 
     66 
     67    auto& index = redistributeAxis-> index ; 
     68    int n_glo = axisSource -> n_glo ; 
     69    axisDestination->n_glo = n_glo ; 
     70     
     71     
     72 
     73    // define the global index of the new domain 
     74 
     75    CArray<size_t,1> globalIndex ; 
     76 
     77    if (redistributeAxis->type == CRedistributeAxis::type_attr::index) 
     78    {    
     79      globalIndex.resize(index.numElements()) ; 
     80      globalIndex=index ; 
     81    } 
     82    else 
     83    { 
     84       
     85      auto distType = CRedistributeAxis::type_attr::column ; 
     86 
     87      if (redistributeAxis->type == CRedistributeAxis::type_attr::bands) distType = CRedistributeAxis::type_attr::column ; 
     88      else  distType=redistributeAxis->type; 
     89 
     90      int size, start ; 
     91      if (distType==CRedistributeAxis::type_attr::column) // Bands distribution to send to file server 
     92      { 
     93        int nbClient = context->getIntraCommSize() ; 
     94        int rankClient = context->getIntraCommRank() ; 
     95       
     96        size = n_glo/nbClient ; 
     97        if (rankClient < n_glo % nbClient) 
     98        { 
     99         size++ ; 
     100         start = rankClient*size ; 
     101        } 
     102        else start = (n_glo % nbClient)*(size+1) + (rankClient-(n_glo % nbClient)) * size ; 
     103 
     104      } 
     105      else if (distType==CRedistributeAxis::type_attr::full) // domain is not distributed ie all servers get the same local domain 
     106      { 
     107        size=n_glo ; start=0 ; 
     108      } 
     109      else if (distType==CRedistributeAxis::type_attr::root) // domain is not distributed ie all servers get the same local domain 
     110      { 
     111        if (context->getIntraCommRank()==0) { size=n_glo ; start=0 ; } 
     112        else { size=0 ; start=0 ; } 
     113      } 
     114 
     115      globalIndex.resize(size) ; 
     116      size_t ind ; 
     117      ind=0 ; 
     118      for(int i=start; i<start+size; i++) 
     119      { 
     120       globalIndex(ind) =  i ; 
     121       ind++ ; 
     122      } 
     123    } 
     124     
     125    axisDestination->index.resize(globalIndex.numElements()) ; 
     126    axisDestination->index = globalIndex ; 
     127    // apply the transformation to attributes 
     128 
     129    auto& transMap = this->transformationMapping_; 
     130    for(int i=0; i<globalIndex.numElements(); i++) transMap[globalIndex(i)]=globalIndex(i) ; 
     131 
     132    auto elementDst=shared_ptr<CLocalElement>(new CLocalElement(context->getIntraCommRank(), n_glo, globalIndex)) ; 
     133    elementDst->addFullView() ; 
     134 
     135    auto transformConnector = make_shared<CTransformConnector>(axisSource->getLocalView(CElementView::FULL), elementDst->getView(CElementView::FULL),context->getIntraComm()) ; 
     136    transformConnector->computeConnector() ; 
     137     
     138    if (axisSource->hasValue()) transformConnector->transfer(axisSource->value, axisDestination->value) ; 
     139     
     140     
     141     
     142    if (axisSource->hasBounds()) 
     143    { 
     144      CArray<double,1> boundsSrc(axisSource->bounds.dataFirst(),shape(axisSource->bounds.numElements()),neverDeleteData) ; 
     145      CArray<double,1> boundsDst ;  
     146      transformConnector->transfer(2, boundsSrc, boundsDst) ; 
     147      axisDestination->bounds.resize(2,globalIndex.numElements()) ; 
     148      axisDestination->bounds = CArray<double,2>(boundsDst.dataFirst(), shape(2,globalIndex.numElements()),neverDeleteData) ; 
     149    } 
     150     
     151    if (axisSource->hasLabel()) 
     152    { 
     153//ym transferTransformConnector.transfer(axisSrc->label, axisDestination->label) ;  -> probably not supported now, see later 
     154    } 
     155 
     156    // transfer the mask 
     157    auto transformMask = make_shared<CTransformConnector>(axisSource->getLocalView(CElementView::WORKFLOW), elementDst->getView(CElementView::FULL),context->getIntraComm()) ; 
     158    transformMask->computeConnector() ; 
     159 
     160    CArray<bool,1> workflow(axisSource->getLocalView(CElementView::WORKFLOW)->getSize()) ; 
     161    axisDestination->mask.resize(axisSource->getLocalView(CElementView::FULL)->getSize()) ; 
     162    workflow=true ; 
     163     
     164    transformMask->transfer(workflow,axisDestination->mask,false) ;    
    49165 
    50166    axisDestination->checkAttributes() ; 
     167    this->computeAlgorithm(axisSource->getLocalView(CElementView::WORKFLOW), axisDestination->getLocalView(CElementView::WORKFLOW)) ; 
    51168  } 
    52169  CATCH 
  • XIOS3/dev/XIOS_ATTACHED/src/transformation/axis_algorithm/axis_algorithm_zoom.cpp

    r2270 r2482  
    7979 
    8080  axisDest_->mask.resize(nDest); 
    81   if (axisSrc_->hasValue) axisDest_->value.resize(nDest); 
    82   if (axisSrc_->hasLabel) axisDest_->label.resize(nDest); 
    83   if (axisSrc_->hasBounds) axisDest_->bounds.resize(2,nDest); 
     81  if (axisSrc_->hasValue()) axisDest_->value.resize(nDest); 
     82  if (axisSrc_->hasLabel()) axisDest_->label.resize(nDest); 
     83  if (axisSrc_->hasBounds()) axisDest_->bounds.resize(2,nDest); 
    8484 
    8585  auto& transMap = this->transformationMapping_; 
     
    9292    axisDest_->mask(iDest) = axisSrc_->mask(iSrc); 
    9393 
    94     if (axisSrc_->hasValue) 
     94    if (axisSrc_->hasValue()) 
    9595      axisDest_->value(iDest) = axisSrc_->value(iSrc); 
    96     if (axisSrc_->hasLabel) 
     96    if (axisSrc_->hasLabel()) 
    9797      axisDest_->label(iDest) = axisSrc_->label(iSrc); 
    98     if (axisSrc_->hasBounds) 
     98    if (axisSrc_->hasBounds()) 
    9999    { 
    100100      axisDest_->bounds(0,iDest) = axisSrc_->bounds(0,iSrc); 
  • XIOS3/dev/XIOS_ATTACHED/src/transformation/domain_algorithm/domain_algorithm_extract.cpp

    r2340 r2482  
    7676   domainDestination->bounds_lon_2d.reset(); 
    7777   domainDestination->bounds_lat_2d.reset(); 
    78    domainDestination->area.reset(); 
     78   domainDestination->area_1d.reset(); 
     79   domainDestination->area_2d.reset(); 
    7980   domainDestination->radius.reset(); 
    8081    
     
    175176    } 
    176177  } 
    177   if (domainSrc_->hasArea) domainDest_->area.resize(niDest,njDest); 
    178  
     178  if (domainSrc_->hasArea)  
     179  { 
     180    if (!domainSrc_->area_2d.isEmpty()) domainDest_->area_2d.resize(niDest,njDest); 
     181    else if (!domainSrc_->area_1d.isEmpty()) domainDest_->area_1d.resize(niDest*njDest); 
     182  } 
    179183  // Set attributes required to define domainDestination->localElement_ and associated views, full and workflow) 
    180184  CArray<size_t,1> sourceGlobalIdx = domainSource->getLocalElement()->getGlobalIndex(); 
     
    241245 
    242246      // area 
    243       if (!domainSrc_->area.isEmpty()) 
    244       { 
    245         domainDest_->area(iIdxDestLocal,jIdxDestLocal) = domainSrc_->area(iIdxSrcLocal,jIdxSrcLocal); 
    246       } 
     247      if (!domainSrc_->area_2d.isEmpty()) domainDest_->area_2d(iIdxDestLocal,jIdxDestLocal) = domainSrc_->area_2d(iIdxSrcLocal,jIdxSrcLocal); 
     248      else if (!domainSrc_->area_1d.isEmpty())  domainDest_->area_1d(countDest) = domainSrc_->area_1d(countSrc); 
    247249 
    248250      // bounds 
  • XIOS3/dev/XIOS_ATTACHED/src/transformation/domain_algorithm/domain_algorithm_redistribute.cpp

    r2460 r2482  
    88#include "grid.hpp" 
    99#include "grid_transformation_factory_impl.hpp" 
     10#include "context.hpp" 
    1011 
    1112namespace xios 
     
    4647  TRY 
    4748  { 
    48  
     49     CContext* context = CContext::getCurrent();  
     50   // Reset geometrical attributes to avoid incompatible (user/domainSource) attributs 
     51   //   attributs will be defined using domainSource and/or transformation attributs 
     52    domainDestination->type.reset(); 
     53    domainDestination->ni_glo.reset(); 
     54    domainDestination->nj_glo.reset(); 
     55    
     56    domainDestination->i_index.reset();   // defined using domainSource->getLocalElement() 
     57    domainDestination->j_index.reset();   // " 
     58    domainDestination->ibegin.reset();    // will be computed in domainDestination->checkDomain() (from checkAttributes()) 
     59    domainDestination->ni.reset();        // " 
     60    domainDestination->jbegin.reset();    // " 
     61    domainDestination->nj.reset();        // " 
     62    
     63    domainDestination->mask_1d.reset();   // defined scanning domainSource->getFullView() & domainSource->getWorkflowView() differencies 
     64    domainDestination->mask_2d.reset();   //   in all case domainDestination->mask_1d used as reference   
     65 
     66    // domainDestination->data_* attributes will be computed in : 
     67    domainDestination->data_dim.reset();     // domainDestination->checkDomainData() (from checkAttributes()) 
     68    domainDestination->data_ni.reset(); 
     69    domainDestination->data_nj.reset(); 
     70    domainDestination->data_ibegin.reset(); 
     71    domainDestination->data_jbegin.reset(); 
     72    domainDestination->data_i_index.reset(); // domainDestination->checkCompression() (from checkAttributes()) 
     73    domainDestination->data_j_index.reset(); 
     74 
     75    // Next attributes will be set using domainSource->attributes  
     76    domainDestination->lonvalue_1d.reset(); 
     77    domainDestination->latvalue_1d.reset(); 
     78    domainDestination->lonvalue_2d.reset(); 
     79    domainDestination->latvalue_2d.reset(); 
     80    domainDestination->nvertex.reset(); 
     81    domainDestination->bounds_lon_1d.reset(); 
     82    domainDestination->bounds_lat_1d.reset(); 
     83    domainDestination->bounds_lon_2d.reset(); 
     84    domainDestination->bounds_lat_2d.reset(); 
     85    domainDestination->area.reset(); 
     86    domainDestination->radius.reset(); 
     87 
     88    auto& index = redistributeDomain-> index ; 
     89     
     90    domainDestination->type = domainSource->type ; 
     91    domainDestination-> ni_glo = domainSource-> ni_glo ; 
     92    domainDestination-> nj_glo = domainSource-> nj_glo ; 
     93     
     94    CArray<size_t,1> globalIndex ; 
     95    int start_i, start_j ; 
     96    int size_i, size_j ; 
     97    int ni_glo = domainDestination-> ni_glo ; 
     98    int nj_glo = domainDestination-> nj_glo ; 
     99     
     100        
     101    if (redistributeDomain->type == CRedistributeDomain::type_attr::index) 
     102    {    
     103      globalIndex.resize(index.numElements()) ; 
     104      globalIndex=index ; 
     105    } 
     106    else 
     107    { 
     108       
     109      auto distType = CRedistributeDomain::type_attr::column ; 
     110       
     111      if (redistributeDomain->type == CRedistributeDomain::type_attr::bands && domainDestination->type == CDomain::type_attr::unstructured)  
     112        distType = CRedistributeDomain::type_attr::column ; 
     113      else  distType=redistributeDomain->type; 
     114 
     115      if (distType==CRedistributeDomain::type_attr::bands) // Bands distribution to send to file server 
     116      { 
     117        int nbClient = context->getIntraCommSize() ; 
     118        int rankClient = context->getIntraCommRank() ; 
     119       
     120        int size = nj_glo/nbClient ; 
     121        int start ; 
     122        if (rankClient < nj_glo % nbClient) 
     123        { 
     124         size++ ; 
     125         start = rankClient*size ; 
     126        } 
     127        else start = (nj_glo % nbClient)*(size+1) + (rankClient-(nj_glo % nbClient)) * size ; 
     128 
     129        size_i=ni_glo ; start_i=0 ; 
     130        size_j=size ; start_j=start ; 
     131      } 
     132      else if (distType==CRedistributeDomain::type_attr::column) // Bands distribution to send to file server 
     133      { 
     134        int nbClient = context->getIntraCommSize() ; 
     135        int rankClient = context->getIntraCommRank() ; 
     136       
     137        int size = ni_glo/nbClient ; 
     138        int start ; 
     139 
     140        if (rankClient < ni_glo % nbClient) 
     141        { 
     142         size++ ; 
     143         start = rankClient*size ; 
     144        } 
     145        else start = (ni_glo % nbClient)*(size+1) + (rankClient-(ni_glo % nbClient)) * size ; 
     146 
     147        size_i=size ; start_i=start ; 
     148        size_j=nj_glo ; start_j=0 ; 
     149      } 
     150      else if (distType==CRedistributeDomain::type_attr::full) // domain is not distributed ie all servers get the same local domain 
     151      { 
     152        size_i=ni_glo ; start_i=0 ; 
     153        size_j=nj_glo ; start_j=0 ; 
     154      } 
     155      else if (distType==CRedistributeDomain::type_attr::root) // domain is not distributed ie all servers get the same local domain 
     156      { 
     157        if (context->getIntraCommRank()==0) 
     158        { 
     159          size_i=ni_glo ; start_i=0 ; 
     160          size_j=nj_glo ; start_j=0 ; 
     161        } 
     162        else 
     163        { 
     164          size_i=0 ; start_i=0 ; 
     165          size_j=0 ; start_j=0 ; 
     166        }   
     167      } 
     168      globalIndex.resize(size_i*size_j) ; 
     169      size_t ind ; 
     170      ind=0 ; 
     171      for(int j=start_j;j<start_j+size_j;j++) 
     172        for(int i=start_i;i<start_i+size_i;i++) 
     173        { 
     174         globalIndex(ind) =  j*ni_glo+i ; 
     175         ind++ ; 
     176        } 
     177    } 
     178 
     179 
     180    //domainDestination->ni = globalIndex.numElements() ; 
     181    //domainDestination->nj = 1 ; 
     182    domainDestination->i_index.resize(globalIndex.numElements()) ; 
     183    domainDestination->i_index = globalIndex ; 
     184    domainDestination->j_index.resize(globalIndex.numElements()) ; 
     185    domainDestination->j_index = 0 ; 
     186     
     187    if (!domainSource->nvertex.isEmpty()) domainDestination->nvertex=domainSource->nvertex ; 
     188    if (!domainSource->radius.isEmpty()) domainDestination->radius = domainSource->radius ; 
     189     
     190 
     191    auto& transMap = this->transformationMapping_; 
     192    for(int i=0; i<globalIndex.numElements(); i++) transMap[globalIndex(i)]=globalIndex(i) ; 
     193     
     194    auto elementDst=shared_ptr<CLocalElement>(new CLocalElement(context->getIntraCommRank(),domainDestination-> ni_glo*domainDestination->nj_glo, globalIndex)) ; 
     195    elementDst->addFullView() ; 
     196 
     197    auto transformConnector = make_shared<CTransformConnector>(domainSource->getLocalView(CElementView::FULL), elementDst->getView(CElementView::FULL),context->getIntraComm()) ; 
     198    transformConnector->computeConnector() ; 
     199 
     200    if (domainSource->hasLonLat) 
     201    { 
     202      transformConnector->transfer(domainSource->lonvalue, domainDestination->lonvalue_1d) ; 
     203      transformConnector->transfer(domainSource->latvalue, domainDestination->latvalue_1d) ; 
     204    } 
     205 
     206    if (domainSource->hasBounds) 
     207    { 
     208      int nv ; 
     209      if (domainDestination->type == CDomain::type_attr::rectilinear) nv=2 ; 
     210      else if (domainDestination->type == CDomain::type_attr::curvilinear) nv=4 ; 
     211      else if (domainDestination->type == CDomain::type_attr::unstructured) nv=domainDestination->nvertex ; 
     212 
     213      { // bounds_lon 
     214        CArray<double,1> boundsSrc(domainSource->bounds_lonvalue.dataFirst(),shape(domainSource->bounds_lonvalue.numElements()),neverDeleteData) ; 
     215        CArray<double,1> boundsDst ;  
     216        transformConnector->transfer(nv, boundsSrc, boundsDst) ; 
     217        domainDestination->bounds_lon_1d.resize(nv,globalIndex.numElements()) ; 
     218        domainDestination->bounds_lon_1d = CArray<double,2>(boundsDst.dataFirst(), shape(nv,globalIndex.numElements()),neverDeleteData) ; 
     219      } 
     220      {  // bounds_lat 
     221        CArray<double,1> boundsSrc(domainSource->bounds_latvalue.dataFirst(),shape(domainSource->bounds_latvalue.numElements()),neverDeleteData) ; 
     222        CArray<double,1> boundsDst ;  
     223        transformConnector->transfer(nv, boundsSrc, boundsDst) ; 
     224        domainDestination->bounds_lat_1d.resize(nv,globalIndex.numElements()) ; 
     225        domainDestination->bounds_lat_1d = CArray<double,2>(boundsDst.dataFirst(), shape(nv,globalIndex.numElements()),neverDeleteData) ; 
     226      } 
     227    } 
     228     
     229    if (domainSource->hasArea) transformConnector->transfer(domainSource->areavalue, domainDestination->area_1d) ;  
     230 
     231    // transfer the mask 
     232     auto transformMask = make_shared<CTransformConnector>(domainSource->getLocalView(CElementView::WORKFLOW), elementDst->getView(CElementView::FULL),context->getIntraComm()) ; 
     233    transformMask->computeConnector() ; 
     234 
     235    CArray<bool,1> workflow(domainSource->getLocalView(CElementView::WORKFLOW)->getSize()) ; 
     236    domainDestination->mask_1d.resize(domainSource->getLocalView(CElementView::FULL)->getSize()) ; 
     237    workflow=true ; 
     238     
     239    transformMask->transfer(workflow,domainDestination->mask_1d,false) ;    
     240/* 
     241    CArray<int,1> workflow(domainSource->getLocalView(CElementView::WORKFLOW)->getSize()) ; 
     242    CArray<int,1> mask(domainSource->getLocalView(CElementView::FULL)->getSize()) ; 
     243    workflow=1 ; 
     244     
     245    transformMask->transfer(workflow,mask,0) ; 
     246    domainDestination->mask_1d.resize(mask.numElements()) ; 
     247    for(int i=0 ; i<mask.numElements() ; i++)  
     248      if (mask(i)==1) domainDestination->mask_1d(i)=true ; 
     249      else domainDestination->mask_1d(i)=false ; 
     250*/   
    49251 
    50252    domainDestination->checkAttributes() ; 
     253    this->computeAlgorithm(domainSource->getLocalView(CElementView::WORKFLOW), domainDestination->getLocalView(CElementView::WORKFLOW)) ; 
    51254  } 
    52255  CATCH 
  • XIOS3/dev/XIOS_ATTACHED/src/transformation/domain_algorithm/domain_algorithm_reorder.cpp

    r2270 r2482  
    128128   else if (!domainSource->lonvalue_2d.isEmpty() ) 
    129129   { 
    130      domainDestination->latvalue_2d.resize( domainSource->latvalue_2d.numElements() ); 
    131      domainDestination->lonvalue_2d.resize( domainSource->lonvalue_2d.numElements() ); 
     130     domainDestination->latvalue_2d.resize( domainSource->latvalue_2d.shape() ); 
     131     domainDestination->lonvalue_2d.resize( domainSource->lonvalue_2d.shape() ); 
    132132     domainDestination->latvalue_2d = domainSource->latvalue_2d; 
    133133     domainDestination->lonvalue_2d = domainSource->lonvalue_2d; 
     
    145145   else if (!domainSource->bounds_lon_2d.isEmpty() ) 
    146146   { 
    147      domainDestination->bounds_lon_2d.resize( domainSource->bounds_lon_2d.numElements() ); 
    148      domainDestination->bounds_lat_2d.resize( domainSource->bounds_lat_2d.numElements() ); 
     147     domainDestination->bounds_lon_2d.resize( domainSource->bounds_lon_2d.shape() ); 
     148     domainDestination->bounds_lat_2d.resize( domainSource->bounds_lat_2d.shape() ); 
    149149     domainDestination->bounds_lon_2d = domainSource->bounds_lon_2d; 
    150150     domainDestination->bounds_lat_2d = domainSource->bounds_lat_2d; 
    151151   } 
    152152   // set area 
    153    if (!domainSource->area.isEmpty() ) 
    154    { 
    155      domainDestination->area.resize( domainSource->area.numElements() ); 
    156      domainDestination->area = domainSource->area;     
    157    } 
     153   if (!domainSource->area_1d.isEmpty() ) 
     154   { 
     155     domainDestination->area_1d.resize( domainSource->area_1d.numElements() ); 
     156     domainDestination->area_1d = domainSource->area_1d;     
     157   } 
     158   else if (!domainSource->area_2d.isEmpty() ) 
     159   { 
     160     domainDestination->area_2d.resize( domainSource->area_2d.shape() ); 
     161     domainDestination->area_2d = domainSource->area_2d;     
     162   } 
     163 
    158164   if (!domainSource->radius.isEmpty() ) 
    159165     domainDestination->radius = domainSource->radius; 
  • XIOS3/dev/XIOS_ATTACHED/src/transformation/domain_algorithm/domain_algorithm_zoom.cpp

    r2270 r2482  
    173173    } 
    174174  } 
    175   if (domainSrc_->hasArea) domainDest_->area.resize(niDest,njDest); 
    176  
     175  if (domainSrc_->hasArea) 
     176  { 
     177    if (!domainSrc_->area_1d.isEmpty()) domainDest_->area_1d.resize(niDest*njDest); 
     178    else if (!domainSrc_->area_2d.isEmpty()) domainDest_->area_2d.resize(niDest,njDest); 
     179  } 
    177180 
    178181  for (int iDest = 0; iDest < niDest; iDest++) 
     
    196199 
    197200      if (domainSrc_->hasArea) 
    198         domainDest_->area(iDest,jDest) = domainSrc_->area(iSrc,jSrc); 
     201      {   
     202         if (!domainSrc_->area_1d.isEmpty())      domainDest_->area_1d(indLocDest)  = domainSrc_->area_1d(ind); 
     203         else if (!domainSrc_->area_2d.isEmpty()) domainDest_->area_2d(iDest,jDest) = domainSrc_->area_2d(iSrc,jSrc); 
     204      } 
    199205 
    200206      if (domainSrc_->hasLonLat) 
  • XIOS3/dev/XIOS_ATTACHED/src/transformation/scalar_algorithm/scalar_algorithm_extract_axis.cpp

    r2303 r2482  
    108108    } 
    109109 
    110     if (axisSource->hasValue) 
     110    if (axisSource->hasValue()) 
    111111    { 
    112112      scalarDestination->value = axisSource->value(idxSrc); 
  • XIOS3/dev/XIOS_ATTACHED/src/transformation/scalar_algorithm/scalar_algorithm_redistribute.cpp

    r2460 r2482  
    88#include "grid.hpp" 
    99#include "grid_transformation_factory_impl.hpp" 
     10#include "context.hpp" 
    1011 
    1112namespace xios 
     
    4748  { 
    4849 
     50    CContext* context = CContext::getCurrent();  
     51 
     52    scalarDestination->n.reset(); 
     53    scalarDestination->mask.reset(); 
     54    scalarDestination->value.reset(); 
     55    scalarDestination->bounds.reset(); 
     56 
     57    redistributeScalar->checkValid(scalarSource); 
     58 
     59    // define the global index of the new domain 
     60 
     61    CArray<size_t,1> globalIndex ; 
     62 
     63    if (    redistributeScalar->type == CRedistributeScalar::type_attr::bands  
     64         || redistributeScalar->type == CRedistributeScalar::type_attr::column  
     65         || redistributeScalar->type == CRedistributeScalar::type_attr::root ) 
     66    { 
     67      if (context->getIntraCommRank()==0) 
     68      { 
     69        scalarDestination->n = 1; 
     70        globalIndex.resize(1) ; 
     71        globalIndex(0)=0 ; 
     72      } 
     73      else 
     74      { 
     75        scalarDestination->n = 0; 
     76        globalIndex.resize(0) ; 
     77      } 
     78    } 
     79    else if (redistributeScalar->type == CRedistributeScalar::type_attr::full) 
     80    { 
     81      scalarDestination->n = 1; 
     82      globalIndex.resize(1) ; 
     83      globalIndex(0)=0 ; 
     84    } 
     85     
     86    auto& transMap = this->transformationMapping_; 
     87    for(int i=0; i<globalIndex.numElements(); i++) transMap[globalIndex(i)]=globalIndex(i) ; 
     88 
     89    auto elementDst=shared_ptr<CLocalElement>(new CLocalElement(context->getIntraCommRank(), 1, globalIndex)) ; 
     90    elementDst->addFullView() ; 
     91 
     92    auto transformConnector = make_shared<CTransformConnector>(scalarSource->getLocalView(CElementView::FULL), elementDst->getView(CElementView::FULL),context->getIntraComm()) ; 
     93    transformConnector->computeConnector() ; 
     94 
     95    CArray<double,1> valSrc, valDst ; 
     96    valSrc.resize(scalarSource->getLocalView(CElementView::FULL)->getSize()) ; 
     97    valDst.resize(scalarDestination->getLocalView(CElementView::FULL)->getSize()) ; 
     98     
     99    if (scalarSource->hasValue()) 
     100    { 
     101      if (valSrc.numElements()>0)  valSrc(0)=scalarSource->value ; 
     102      transformConnector->transfer(valSrc, valDst) ; 
     103      if (valDst.numElements()>0)  scalarDestination->value = valDst(0) ; 
     104    } 
     105 
     106    if (scalarSource->hasBounds())  
     107    { 
     108      transformConnector->transfer(2, scalarSource->bounds, scalarDestination->bounds) ; 
     109    } 
     110     
     111    if (scalarSource->hasLabel()) 
     112    { 
     113//ym transferTransformConnector.transfer(axisSrc->label, axisDestination->label) ;  -> probably not supported now, see later 
     114    } 
     115 
     116    // transfer the mask 
     117    auto transformMask = make_shared<CTransformConnector>(scalarSource->getLocalView(CElementView::WORKFLOW), elementDst->getView(CElementView::FULL),context->getIntraComm()) ; 
     118    transformMask->computeConnector() ; 
     119 
     120    CArray<bool,1> workflow(scalarSource->getLocalView(CElementView::WORKFLOW)->getSize()) ; 
     121    CArray<bool,1> mask ; 
     122    mask.resize(scalarSource->getLocalView(CElementView::FULL)->getSize()) ; 
     123    workflow=true ; 
     124     
     125    transformMask->transfer(workflow, mask, false) ;    
     126    scalarDestination->mask = mask(0) ; 
    49127 
    50128    scalarDestination->checkAttributes() ; 
  • XIOS3/dev/XIOS_ATTACHED/src/transport/context_client.cpp

    r2343 r2482  
    1818#include "one_sided_context_client.hpp" 
    1919#include "legacy_context_client.hpp" 
     20#include "online_context_client.hpp" 
     21 
    2022 
    2123namespace xios 
     
    6163      if (defaultProtocol=="one_sided") return getNew<CContextClient::oneSided>(parent, intraComm, interComm) ; 
    6264      else if  (defaultProtocol=="legacy") return getNew<CContextClient::legacy>(parent, intraComm, interComm) ; 
     65      else if  (defaultProtocol=="online") return getNew<CContextClient::online>(parent, intraComm, interComm) ; 
    6366      else if  (defaultProtocol=="default") return getNew<CContextClient::legacy>(parent, intraComm, interComm) ; 
    6467      else ERROR("CContextClient* CContextClient::getNew<CContextClient::generic>(CContext* parent, MPI_Comm intraComm, MPI_Comm interComm, CContext* parentServer)", 
     
    7679    {  
    7780      return new CLegacyContextClient(parent, intraComm, interComm, parentServer);  
     81    } 
     82 
     83    template<> 
     84    CContextClient* CContextClient::getNew<CContextClient::online>(CContext* parent, MPI_Comm intraComm, MPI_Comm interComm, CContext* parentServer) 
     85    {  
     86      return new COnlineContextClient(parent, intraComm, interComm, parentServer);  
    7887    } 
    7988 
  • XIOS3/dev/XIOS_ATTACHED/src/transport/context_client.hpp

    r2343 r2482  
    2828  { 
    2929    public: 
    30       enum ETransport { generic, legacy, oneSided}  ; 
     30      enum ETransport { generic, legacy, oneSided, online}  ; 
    3131       
    3232      template<ETransport transport=generic>  
     
    5656 
    5757 
     58      virtual ETransport getType(void) = 0 ; 
    5859      // Send event to server 
    5960      virtual void sendEvent(CEventClient& event)=0; 
     
    6869      virtual void setBufferSize(const std::map<int,StdSize>& mapSize)=0; 
    6970 
    70  
     71      public:  
     72        static CContextClient* ONLINE(void) { return reinterpret_cast<CContextClient*>(0xdeaddead);} 
    7173    protected: 
    7274 
     
    104106  CContextClient* CContextClient::getNew<CContextClient::legacy>(CContext* parent, MPI_Comm intraComm, MPI_Comm interComm, CContext* parentServer) ; 
    105107 
     108  template<> 
     109  CContextClient* CContextClient::getNew<CContextClient::online>(CContext* parent, MPI_Comm intraComm, MPI_Comm interComm, CContext* parentServer) ; 
     110 
    106111 
    107112} 
  • XIOS3/dev/XIOS_ATTACHED/src/transport/legacy_context_client.cpp

    r2458 r2482  
    4040    } 
    4141 
     42    CContextClient::ETransport getType(void) {return CContextClient::legacy ;} 
    4243 
    4344    /*! 
  • XIOS3/dev/XIOS_ATTACHED/src/transport/legacy_context_client.hpp

    r2458 r2482  
    3131 
    3232      // Send event to server 
     33      ETransport getType(void) {return legacy ;} 
    3334      void sendEvent(CEventClient& event); 
    3435      void eventLoop(void) ; 
  • XIOS3/dev/XIOS_ATTACHED/src/transport/one_sided_context_client.hpp

    r2458 r2482  
    3030      COneSidedContextClient(CContext* parent, MPI_Comm intraComm, MPI_Comm interComm, CContext* parentServer = 0); 
    3131 
     32      ETransport getType(void) {return oneSided ;} 
    3233      // Send event to server 
    3334      void sendEvent(CEventClient& event); 
Note: See TracChangeset for help on using the changeset viewer.