Changeset 1144 for XIOS


Ignore:
Timestamp:
05/23/17 16:32:26 (7 years ago)
Author:
mhnguyen
Message:

Cleaning up some redundant codes

Location:
XIOS/dev/dev_olga/src
Files:
23 edited

Legend:

Unmodified
Added
Removed
  • XIOS/dev/dev_olga/src/distribution_client.cpp

    r1129 r1144  
    1010 
    1111namespace xios { 
    12  
    13 CDistributionClient::CDistributionClient(int rank, CGrid* grid, const GlobalLocalDataMap& globalLocalIndex) 
    14   : CDistribution(rank, 0) 
    15    , axisDomainOrder_() 
    16    , nLocal_(), nGlob_(), nBeginLocal_(), nBeginGlobal_(),nZoomBegin_(), nZoomEnd_() 
    17    , dataNIndex_(), dataDims_(), dataBegin_(), dataIndex_(), domainMasks_(), axisMasks_() 
    18    , gridMask_(), indexMap_() 
    19    , isDataDistributed_(true), axisNum_(0), domainNum_(0) 
    20    , localDataIndex_(), localMaskIndex_() 
    21    , globalLocalDataSendToServerMap_(globalLocalIndex) 
    22    , infoIndex_(), isComputed_(false) 
    23    , elementLocalIndex_(), elementGlobalIndex_(), elementIndexData_() 
    24    , elementZoomMask_(), elementNLocal_(), elementNGlobal_() 
    25 { 
    26   isComputed_ = true; 
    27   localDataIndex_.resize(globalLocalIndex.size()); 
    28   localMaskIndex_.resize(globalLocalIndex.size()); 
    29   GlobalLocalDataMap::const_iterator it = globalLocalIndex.begin(), ite = globalLocalIndex.end(); 
    30   int idx = 0; 
    31   for (; it!=ite; ++it) 
    32   { 
    33     localMaskIndex_[idx] = localDataIndex_[idx] = it->second; 
    34     ++idx; 
    35   } 
    36  
    37   std::vector<CDomain*> domList = grid->getDomains(); 
    38   std::vector<CAxis*> axisList = grid->getAxis(); 
    39   std::vector<CScalar*> scalarList = grid->getScalars(); 
    40   CArray<int,1> axisDomainOrder = grid->axis_domain_order; 
    41  
    42   int numElement = axisDomainOrder.numElements(); 
    43   // Because domain and axis can be in any order (axis1, domain1, axis2, axis3, ) 
    44   // their position should be specified. In axisDomainOrder, domain == true, axis == false 
    45   int dims = numElement; 
    46   idx = 0; 
    47   std::vector<int> indexMap(numElement);   
    48   for (int i = 0; i < numElement; ++i) 
    49   { 
    50     indexMap[i] = idx; 
    51     if (2 == axisDomainOrder(i)) 
    52     { 
    53       ++dims; 
    54       idx += 2; 
    55     } 
    56     else ++idx; 
    57   } 
    58  
    59   nGlob_.resize(dims); 
    60  
    61   // Data_n_index of domain or axis (For now, axis uses its size as data_n_index 
    62   dataNIndex_.resize(numElement); 
    63   dataDims_.resize(numElement); 
    64   isDataDistributed_ = false; 
    65   int domIndex = 0, axisIndex = 0, scalarIndex = 0; 
    66   for (idx = 0; idx < numElement; ++idx) 
    67   { 
    68     int eleDim = axisDomainOrder(idx); 
    69  
    70     // If this is a domain 
    71     if (2 == eleDim) 
    72     { 
    73       // On the j axis 
    74       nGlob_.at(indexMap[idx]+1)  = domList[domIndex]->nj_glo.getValue(); 
    75       nGlob_.at(indexMap[idx]) = domList[domIndex]->ni_glo.getValue(); 
    76       dataNIndex_.at(idx) = domList[domIndex]->data_i_index.numElements(); 
    77       dataDims_.at(idx) = domList[domIndex]->data_dim.getValue(); 
    78  
    79       isDataDistributed_ |= domList[domIndex]->isDistributed(); 
    80       ++domIndex; 
    81     } 
    82     else if (1 == eleDim)// So it's an axis 
    83     { 
    84       nGlob_.at(indexMap[idx]) = axisList[axisIndex]->n_glo.getValue(); 
    85       dataNIndex_.at(idx) = axisList[axisIndex]->data_index.numElements(); 
    86       dataDims_.at(idx) = 1; 
    87  
    88       isDataDistributed_ |= axisList[axisIndex]->isDistributed(); 
    89       ++axisIndex; 
    90     } 
    91     else // scalar 
    92     { 
    93       nGlob_.at(indexMap[idx]) = 1; 
    94       dataNIndex_.at(idx) = 1; 
    95       dataDims_.at(idx) = 1; 
    96  
    97       isDataDistributed_ |= false; 
    98       ++scalarIndex; 
    99     } 
    100   } 
    101  
    102 } 
    103  
    104 CDistributionClient::CDistributionClient(int rank, int dims, const CArray<size_t,1>& globalIndex) 
    105    : CDistribution(rank, dims, globalIndex) 
    106    , axisDomainOrder_() 
    107    , nLocal_(), nGlob_(), nBeginLocal_(), nBeginGlobal_(),nZoomBegin_(), nZoomEnd_() 
    108    , dataNIndex_(), dataDims_(), dataBegin_(), dataIndex_(), domainMasks_(), axisMasks_() 
    109    , gridMask_(), indexMap_() 
    110    , isDataDistributed_(true), axisNum_(0), domainNum_(0) 
    111    , localDataIndex_(), localMaskIndex_() 
    112    , globalLocalDataSendToServerMap_() 
    113    , infoIndex_(), isComputed_(false) 
    114    , elementLocalIndex_(), elementGlobalIndex_(), elementIndexData_() 
    115    , elementZoomMask_(), elementNLocal_(), elementNGlobal_() 
    116 { 
    117 } 
    11812 
    11913CDistributionClient::CDistributionClient(int rank, CGrid* grid) 
  • XIOS/dev/dev_olga/src/distribution_client.hpp

    r1129 r1144  
    3333 
    3434  public: 
    35     /** Default constructor */ 
    36     CDistributionClient(int rank, CGrid* grid, const GlobalLocalDataMap& globalLocalIndex); 
    37     CDistributionClient(int rank, int dims, const CArray<size_t,1>& globalIndex = CArray<size_t,1>()); 
     35    /** Default constructor */         
    3836    CDistributionClient(int rank, CGrid* grid); 
    3937 
  • XIOS/dev/dev_olga/src/distribution_server.cpp

    r1129 r1144  
    1212namespace xios { 
    1313 
    14 CDistributionServer::CDistributionServer(int rank, int dims, const CArray<size_t,1>& globalIndex) 
    15   : CDistribution(rank, dims, globalIndex), nGlobal_(), nZoomSize_(), nZoomBegin_(), globalLocalIndexMap_(), 
    16   globalIndexEachDimension_() 
    17 { 
    18 } 
    19  
    20 CDistributionServer::CDistributionServer(int rank, const std::vector<int>& nZoomBegin, 
    21                                          const std::vector<int>& nZoomSize, const std::vector<int>& nGlobal) 
    22   : CDistribution(rank, nGlobal.size()), nGlobal_(nGlobal), nZoomSize_(nZoomSize), nZoomBegin_(nZoomBegin), globalLocalIndexMap_(), 
    23   globalIndexEachDimension_() 
    24 { 
    25   createGlobalIndex(); 
    26 } 
    27  
    2814CDistributionServer::CDistributionServer(int rank, const std::vector<int>& nZoomBegin, 
    2915                                         const std::vector<int>& nZoomSize, 
     
    3117                                         const std::vector<int>& nGlobal) 
    3218  : CDistribution(rank, nGlobal.size()), nGlobal_(nGlobal), nZoomBeginGlobal_(nZoomBeginGlobal), 
    33     nZoomSize_(nZoomSize), nZoomBegin_(nZoomBegin), globalLocalIndexMap_(), 
    34     globalIndexEachDimension_() 
     19    nZoomSize_(nZoomSize), nZoomBegin_(nZoomBegin), globalLocalIndexMap_() 
    3520{ 
    3621  createGlobalIndex(); 
    3722} 
    38  
    39 // CDistributionServer::CDistributionServer(int rank,  
    40 //                                          const std::vector<CArray<int,1> >& globalIndexEachDimension, 
    41 //                                          const std::vector<int>& nGlobal) 
    42 //   : CDistribution(rank, nGlobal.size()), nGlobal_(nGlobal), nZoomBeginGlobal_(), 
    43 //     nZoomSize_(), nZoomBegin_(), globalLocalIndexMap_(),  
    44 //     globalIndexEachDimension_(globalIndexEachDimension) 
    45 // { 
    46 //   createGlobalIndexFromIndex(globalIndexEachDimension, nGlobal); 
    47 // } 
    4823 
    4924CDistributionServer::~CDistributionServer() 
     
    9974    idxLoop[0] += innerLoopSize; 
    10075  } 
    101 } 
    102  
    103 // void CDistributionServer::createGlobalIndexFromIndex(const std::vector<CArray<int,1> >& globalIndexOnEachDimension, 
    104 //                                                      const std::vector<int>& nbGlobal) 
    105 // { 
    106 //   size_t idx = 0, ssize = 1; 
    107 //   for (int i = 0; i < globalIndexOnEachDimension.size(); ++i) ssize *= globalIndexOnEachDimension[i].numElements(); 
    108  
    109 //   this->globalIndex_.resize(ssize); 
    110 //   size_t nbDim = nbGlobal.size(); 
    111 //   std::vector<int> idxLoop(nbDim,0); 
    112 //   std::vector<int> currentIndex(nbDim); 
    113 //   int innerLoopSize = globalIndexOnEachDimension[0].numElements(); 
    114  
    115 //   globalLocalIndexMap_.rehash(std::ceil(ssize/globalLocalIndexMap_.max_load_factor())); 
    116 //   while (idx<ssize) 
    117 //   { 
    118 //     for (int i = 0; i < nbDim-1; ++i) 
    119 //     { 
    120 //       if (idxLoop[i] == globalIndexOnEachDimension[i].numElements()) 
    121 //       { 
    122 //         idxLoop[i] = 0; 
    123 //         ++idxLoop[i+1]; 
    124 //       } 
    125 //     } 
    126  
    127 //     for (int i = 1; i < nbDim; ++i) 
    128 //       currentIndex[i] = globalIndexOnEachDimension[i](idxLoop[i]); 
    129  
    130 //     size_t mulDim, globalIndex; 
    131 //     for (int i = 0; i < innerLoopSize; ++i) 
    132 //     { 
    133 //       mulDim = 1; 
    134 //       globalIndex = globalIndexOnEachDimension[0](i); 
    135  
    136 //       for (int k = 0; k < nbDim; ++k) 
    137 //       { 
    138 //         mulDim *= nbGlobal[k]; 
    139 //         globalIndex += (currentIndex[k])*mulDim; 
    140 //       } 
    141 //       globalLocalIndexMap_[globalIndex] = idx; 
    142 //       this->globalIndex_(idx) = globalIndex; 
    143  
    144 //       ++idx; 
    145 //     } 
    146 //     idxLoop[0] += innerLoopSize; 
    147 //   } 
    148  
    149 // } 
    150  
    151 /*! 
    152   Compute local index for writing data on server 
    153   \param [in] globalIndex global index received from client 
    154   \return local index of written data 
    155 */ 
    156 CArray<size_t,1> CDistributionServer::computeLocalIndex(const CArray<size_t,1>& globalIndex) 
    157 { 
    158   size_t ssize = globalIndex.numElements(); 
    159   size_t localIndexSize = std::min(globalIndex_.numElements(), ssize); 
    160   CArray<size_t,1> localIndex(localIndexSize); 
    161   GlobalLocalMap::const_iterator ite = globalLocalIndexMap_.end(), it; 
    162   for (int idx = 0, i = 0; idx < ssize; ++idx) 
    163   { 
    164     it = globalLocalIndexMap_.find(globalIndex(idx)); 
    165     if (ite != it) 
    166     { 
    167       localIndex(idx) = it->second; 
    168       ++i; 
    169     } 
    170   } 
    171  
    172   return localIndex; 
    17376} 
    17477 
  • XIOS/dev/dev_olga/src/distribution_server.hpp

    r1099 r1144  
    2323  public: 
    2424    /** Default constructor */ 
    25     CDistributionServer(int rank, int dims, const CArray<size_t,1>& globalIndex = CArray<size_t,1>()); 
    26     CDistributionServer(int rank, const std::vector<int>& nZoomBeginServer, 
    27                         const std::vector<int>& nZoomSizeServer, const std::vector<int>& nGlobal); 
    2825    CDistributionServer(int rank, const std::vector<int>& nZoomBeginServer, 
    2926                        const std::vector<int>& nZoomSizeServer, 
    3027                        const std::vector<int>& nZoomBeginGlobal, 
    31                         const std::vector<int>& nGlobal); 
    32     CDistributionServer(int rank,  
    33                         const std::vector<CArray<int,1> >& globalIndexEachDimension, 
    3428                        const std::vector<int>& nGlobal); 
    3529 
     
    4034    const std::vector<int>& getZoomBeginServer() const; 
    4135    const std::vector<int>& getZoomSizeServer() const; 
    42     const GlobalLocalMap& getGlobalLocalIndex() const { return globalLocalIndexMap_; } 
    43     const std::vector<CArray<int,1> >& getGlobalIndexEachDimension() const {return globalIndexEachDimension_;} 
     36    const GlobalLocalMap& getGlobalLocalIndex() const { return globalLocalIndexMap_; }     
    4437    int getGridSize() const; 
    45  
    46     virtual CArray<size_t,1> computeLocalIndex(const CArray<size_t,1>& globalIndex); 
     38     
    4739    virtual void computeLocalIndex(CArray<size_t,1>& globalIndex); 
    4840    virtual void computeGlobalIndex(CArray<int,1>& indexes) const; 
     
    6254    std::vector<int> nZoomSize_; 
    6355    std::vector<int> nZoomBegin_; 
    64     std::vector<CArray<int, 1> > globalIndexEachDimension_; 
    65  
    6656}; 
    6757 
  • XIOS/dev/dev_olga/src/io/nc4_data_output.cpp

    r1143 r1144  
    13781378             if (i != 0) compress << ' '; 
    13791379           } 
    1380            SuperClassWriter::addAttribute("compress", compress.str(), &varId); 
    1381  
    1382            // grid->computeCompressedIndex(); 
     1380           SuperClassWriter::addAttribute("compress", compress.str(), &varId);          
    13831381 
    13841382           CArray<int, 1> indexes(grid->getNumberWrittenIndexes()); 
    13851383           indexes = grid->localIndexToWriteOnServer; 
    1386            // std::map<int, CArray<size_t, 1> >::const_iterator it; 
    1387            // for (it = grid->outIndexFromClient.begin(); it != grid->outIndexFromClient.end(); ++it) 
    1388            // { 
    1389            //   const CArray<size_t, 1> compressedIndexes = grid->compressedOutIndexFromClient[it->first]; 
    1390            //   for (int i = 0; i < it->second.numElements(); i++) 
    1391            //     indexes(compressedIndexes(i)) = it->second(i); 
    1392            // } 
    13931384 
    13941385           switch (SuperClass::type) 
     
    14471438               } 
    14481439 
    1449                // const std::vector<int>& indexesToWrite = domain->getIndexesToWrite(); 
    1450                // indexes.resize(indexesToWrite.size()); 
    1451                // for (int n = 0; n < indexes.numElements(); ++n) 
    1452                //   indexes(n) = indexesToWrite[n]; 
    1453  
    14541440               indexes.resize(domain->compressedIndexToWriteOnServer.numElements()); 
    14551441               indexes = domain->compressedIndexToWriteOnServer; 
     
    14781464               compress = axisId; 
    14791465 
    1480                // const std::vector<int>& indexesToWrite = axis->getIndexesToWrite(); 
    1481                // indexes.resize(indexesToWrite.size()); 
    1482                // for (int n = 0; n < indexes.numElements(); ++n) 
    1483                //   indexes(n) = indexesToWrite[n]; 
    1484  
    14851466               indexes.resize(axis->compressedIndexToWriteOnServer.numElements()); 
    14861467               indexes = axis->compressedIndexToWriteOnServer; 
     
    15291510               } 
    15301511             } 
    1531            } 
    1532  
    1533            // if (!dims.empty()) 
    1534            //   grid->computeCompressedIndex(); 
     1512            } 
    15351513         } 
    15361514 
  • XIOS/dev/dev_olga/src/node/axis.cpp

    r1143 r1144  
    5858 
    5959   ///--------------------------------------------------------------- 
    60  
    61    const std::set<StdString> & CAxis::getRelFiles(void) const 
    62    { 
    63       return (this->relFiles); 
    64    } 
    65  
    6660   bool CAxis::IsWritten(const StdString & filename) const 
    6761   { 
     
    10195 
    10296   //---------------------------------------------------------------- 
    103  
    104    const std::vector<int>& CAxis::getIndexesToWrite(void) const 
    105    { 
    106      return indexesToWrite; 
    107    } 
    10897 
    10998   /*! 
     
    207196   } 
    208197 
    209    void CAxis::fillInValues(const CArray<double,1>& values) 
    210    { 
    211      this->value = values; 
    212    } 
    213  
     198   /*! 
     199     Check common attributes of an axis. 
     200     This check should be done in the very beginning of work flow 
     201   */ 
    214202   void CAxis::checkAttributes(void) 
    215203   { 
     
    270258   } 
    271259 
     260   /*! 
     261      Check the validity of data and fill in values if any. 
     262   */ 
    272263   void CAxis::checkData() 
    273264   { 
     
    292283   } 
    293284 
     285   /*! 
     286     Check validity of zoom info and fill in values if any. 
     287   */ 
    294288   void CAxis::checkZoom(void) 
    295289   { 
     
    304298   } 
    305299 
     300   /*! 
     301     Check validity of mask info and fill in values if any. 
     302   */ 
    306303   void CAxis::checkMask() 
    307304   { 
     
    325322   } 
    326323 
    327   void CAxis::checkBounds() 
    328   { 
    329     if (!bounds.isEmpty()) 
    330     { 
    331       if (bounds.extent(0) != 2 || bounds.extent(1) != n) 
    332         ERROR("CAxis::checkAttributes(void)", 
    333               << "The bounds array of the axis [ id = '" << getId() << "' , context = '" << CObjectFactory::GetCurrentContextId() << "' ] must be of dimension 2 x axis size." << std::endl 
    334               << "Axis size is " << n.getValue() << "." << std::endl 
    335               << "Bounds size is "<< bounds.extent(0) << " x " << bounds.extent(1) << "."); 
    336       hasBounds_ = true; 
    337     } 
    338     else hasBounds_ = false; 
    339   } 
    340  
    341   void CAxis::checkEligibilityForCompressedOutput() 
    342   { 
    343     // We don't check if the mask is valid here, just if a mask has been defined at this point. 
    344     isCompressible_ = !mask.isEmpty(); 
    345   } 
    346  
    347   bool CAxis::dispatchEvent(CEventServer& event) 
     324   /*! 
     325     Check validity of bounds info and fill in values if any. 
     326   */ 
     327   void CAxis::checkBounds() 
     328   { 
     329     if (!bounds.isEmpty()) 
     330     { 
     331       if (bounds.extent(0) != 2 || bounds.extent(1) != n) 
     332         ERROR("CAxis::checkAttributes(void)", 
     333               << "The bounds array of the axis [ id = '" << getId() << "' , context = '" << CObjectFactory::GetCurrentContextId() << "' ] must be of dimension 2 x axis size." << std::endl 
     334               << "Axis size is " << n.getValue() << "." << std::endl 
     335               << "Bounds size is "<< bounds.extent(0) << " x " << bounds.extent(1) << "."); 
     336       hasBounds_ = true; 
     337     } 
     338     else hasBounds_ = false; 
     339   } 
     340 
     341   void CAxis::checkEligibilityForCompressedOutput() 
     342   { 
     343     // We don't check if the mask is valid here, just if a mask has been defined at this point. 
     344     isCompressible_ = !mask.isEmpty(); 
     345   } 
     346 
     347   bool CAxis::dispatchEvent(CEventServer& event) 
    348348   { 
    349349      if (SuperClass::dispatchEvent(event)) return true; 
     
    356356             return true; 
    357357             break; 
    358           //  case EVENT_ID_INDEX: 
    359           //   recvIndex(event); 
    360           //   return true; 
    361           //   break; 
    362358          case EVENT_ID_NON_DISTRIBUTED_ATTRIBUTES: 
    363359            recvNonDistributedAttributes(event); 
     
    376372   } 
    377373 
     374   /*! 
     375     Check attributes on client side (This name is still adequate???) 
     376   */ 
    378377   void CAxis::checkAttributesOnClient() 
    379378   { 
     
    385384   } 
    386385 
     386   /* 
     387     The (spatial) transformation sometimes can change attributes of an axis. Therefore, we should recheck them. 
     388   */ 
    387389   void CAxis::checkAttributesOnClientAfterTransformation(const std::vector<int>& globalDim, int orderPositionInGrid, 
    388390                                                          CServerDistributionDescription::ServerDistributionType distType) 
     
    413415   } 
    414416 
     417  /*! 
     418    Send attributes from one client to other clients 
     419    \param[in] globalDim global dimension of grid which contains this axis 
     420    \param[in] order 
     421  */ 
    415422  void CAxis::sendAttributes(const std::vector<int>& globalDim, int orderPositionInGrid, 
    416423                             CServerDistributionDescription::ServerDistributionType distType) 
     
    561568      indSrv_.swap(globalIndexAxisOnServer); 
    562569 
    563       // CClientServerMapping::GlobalIndexMap::const_iterator it = globalIndexAxisOnServer.begin(), 
    564       //                                                      ite = globalIndexAxisOnServer.end(); 
    565570      CClientServerMapping::GlobalIndexMap::const_iterator it = indSrv_.begin(), 
    566571                                                           ite = indSrv_.end(); 
    567       // std::vector<size_t>::const_iterator itbVec = (globalAxisZoom).begin(), 
    568       //                                     iteVec = (globalAxisZoom).end(); 
    569       // indSrv_.clear(); 
    570       // indWrittenSrv_.clear(); 
    571       // for (; it != ite; ++it) 
    572       // { 
    573       //   int rank = it->first; 
    574       //   const std::vector<size_t>& globalIndexTmp = it->second; 
    575       //   int nb = globalIndexTmp.size(); 
    576  
    577       //   for (int i = 0; i < nb; ++i) 
    578       //   { 
    579       //     if (std::binary_search(itbVec, iteVec, globalIndexTmp[i])) 
    580       //     { 
    581       //       indSrv_[rank].push_back(globalIndexTmp[i]); 
    582       //     } 
    583  
    584       //     if (writtenInd.count(globalIndexTmp[i])) 
    585       //     { 
    586       //       indWrittenSrv_[rank].push_back(globalIndexTmp[i]); 
    587       //     } 
    588       //   } 
    589       // } 
    590572 
    591573      connectedServerRank_.clear(); 
     
    594576      } 
    595577 
    596       // if (!indSrv_.empty()) 
    597       // { 
    598       //   std::map<int, vector<size_t> >::const_iterator itIndSrv  = indSrv_.begin(), 
    599       //                                                  iteIndSrv = indSrv_.end(); 
    600       //   connectedServerRank_.clear(); 
    601       //   for (; itIndSrv != iteIndSrv; ++itIndSrv) 
    602       //     connectedServerRank_.push_back(itIndSrv->first); 
    603       // } 
    604578      nbConnectedClients_ = CClientServerMapping::computeConnectedClients(client->serverSize, client->clientSize, client->intraComm, connectedServerRank_); 
    605579    } 
     
    750724    } 
    751725  } 
    752  
    753   // void CAxis::computeConnectedServer(const std::vector<int>& globalDim, int orderPositionInGrid, 
    754   //                                    CServerDistributionDescription::ServerDistributionType distType) 
    755   // { 
    756   //   CContext* context = CContext::getCurrent(); 
    757   //   CContextClient* client = (0 != context->clientPrimServer) ? context->clientPrimServer : context->client; 
    758   //   int nbServer = client->serverSize; 
    759   //   int range, clientSize = client->clientSize; 
    760   //   int rank = client->clientRank; 
    761  
    762   //   size_t ni = this->n.getValue(); 
    763   //   size_t ibegin = this->begin.getValue(); 
    764   //   size_t zoom_end = global_zoom_begin+global_zoom_n-1; 
    765   //   size_t nZoomCount = 0; 
    766   //   size_t nbIndex = index.numElements(); 
    767   //   for (size_t idx = 0; idx < nbIndex; ++idx) 
    768   //   { 
    769   //     size_t globalIndex = index(idx); 
    770   //     if (globalIndex >= global_zoom_begin && globalIndex <= zoom_end) ++nZoomCount; 
    771   //   } 
    772  
    773   //   CArray<size_t,1> globalIndexAxis(nbIndex); 
    774   //   std::vector<size_t> globalAxisZoom(nZoomCount); 
    775   //   nZoomCount = 0; 
    776   //   for (size_t idx = 0; idx < nbIndex; ++idx) 
    777   //   { 
    778   //     size_t globalIndex = index(idx); 
    779   //     globalIndexAxis(idx) = globalIndex; 
    780   //     if (globalIndex >= global_zoom_begin && globalIndex <= zoom_end) 
    781   //     { 
    782   //       globalAxisZoom[nZoomCount] = globalIndex; 
    783   //       ++nZoomCount; 
    784   //     } 
    785   //   } 
    786  
    787   //   std::set<int> writtenInd; 
    788   //   if (isCompressible_) 
    789   //   { 
    790   //     for (int idx = 0; idx < data_index.numElements(); ++idx) 
    791   //     { 
    792   //       int ind = CDistributionClient::getAxisIndex(data_index(idx), data_begin, ni); 
    793  
    794   //       if (ind >= 0 && ind < ni && mask(ind)) 
    795   //       { 
    796   //         ind += ibegin; 
    797   //         if (ind >= global_zoom_begin && ind <= zoom_end) 
    798   //           writtenInd.insert(ind); 
    799   //       } 
    800   //     } 
    801   //   } 
    802  
    803   //   CServerDistributionDescription serverDescriptionGlobal(globalDim, nbServer); 
    804   //   int distributedDimensionOnServer = serverDescriptionGlobal.getDimensionDistributed(); 
    805   //   CClientServerMapping::GlobalIndexMap globalIndexAxisOnServer; 
    806   //   if (distributedDimensionOnServer == orderPositionInGrid) // So we have distributed axis on client side and also on server side* 
    807   //   { 
    808   //     std::vector<int> nGlobAxis(1); 
    809   //     nGlobAxis[0] = n_glo.getValue(); 
    810  
    811   //     size_t globalSizeIndex = 1, indexBegin, indexEnd; 
    812   //     for (int i = 0; i < nGlobAxis.size(); ++i) globalSizeIndex *= nGlobAxis[i]; 
    813   //     indexBegin = 0; 
    814   //     if (globalSizeIndex <= clientSize) 
    815   //     { 
    816   //       indexBegin = rank%globalSizeIndex; 
    817   //       indexEnd = indexBegin; 
    818   //     } 
    819   //     else 
    820   //     { 
    821   //       for (int i = 0; i < clientSize; ++i) 
    822   //       { 
    823   //         range = globalSizeIndex / clientSize; 
    824   //         if (i < (globalSizeIndex%clientSize)) ++range; 
    825   //         if (i == client->clientRank) break; 
    826   //         indexBegin += range; 
    827   //       } 
    828   //       indexEnd = indexBegin + range - 1; 
    829   //     } 
    830  
    831   //     CServerDistributionDescription serverDescription(nGlobAxis, nbServer); 
    832   //     serverDescription.computeServerGlobalIndexInRange(std::make_pair<size_t,size_t>(indexBegin, indexEnd)); 
    833   //     CClientServerMapping* clientServerMap = new CClientServerMappingDistributed(serverDescription.getGlobalIndexRange(), client->intraComm); 
    834   //     clientServerMap->computeServerIndexMapping(globalIndexAxis); 
    835   //     globalIndexAxisOnServer = clientServerMap->getGlobalIndexOnServer(); 
    836   //     delete clientServerMap; 
    837   //   } 
    838   //   else 
    839   //   { 
    840   //     std::vector<size_t> globalIndexServer(n_glo.getValue()); 
    841   //     for (size_t idx = 0; idx < n_glo.getValue(); ++idx) 
    842   //     { 
    843   //       globalIndexServer[idx] = idx; 
    844   //     } 
    845  
    846   //     for (int idx = 0; idx < nbServer; ++idx) 
    847   //     { 
    848   //       globalIndexAxisOnServer[idx] = globalIndexServer; 
    849   //     } 
    850   //   } 
    851  
    852   //   CClientServerMapping::GlobalIndexMap::const_iterator it = globalIndexAxisOnServer.begin(), 
    853   //                                                        ite = globalIndexAxisOnServer.end(); 
    854   //   std::vector<size_t>::const_iterator itbVec = (globalAxisZoom).begin(), 
    855   //                                       iteVec = (globalAxisZoom).end(); 
    856   //   indSrv_.clear(); 
    857   //   indWrittenSrv_.clear(); 
    858   //   for (; it != ite; ++it) 
    859   //   { 
    860   //     int rank = it->first; 
    861   //     const std::vector<size_t>& globalIndexTmp = it->second; 
    862   //     int nb = globalIndexTmp.size(); 
    863  
    864   //     for (int i = 0; i < nb; ++i) 
    865   //     { 
    866   //       if (std::binary_search(itbVec, iteVec, globalIndexTmp[i])) 
    867   //       { 
    868   //         indSrv_[rank].push_back(globalIndexTmp[i]); 
    869   //       } 
    870  
    871   //       if (writtenInd.count(globalIndexTmp[i])) 
    872   //       { 
    873   //         indWrittenSrv_[rank].push_back(globalIndexTmp[i]); 
    874   //       } 
    875   //     } 
    876   //   } 
    877  
    878   //   connectedServerRank_.clear(); 
    879   //   for (it = globalIndexAxisOnServer.begin(); it != ite; ++it) { 
    880   //     connectedServerRank_.push_back(it->first); 
    881   //   } 
    882  
    883   //   if (!indSrv_.empty()) 
    884   //   { 
    885   //     std::map<int, vector<size_t> >::const_iterator itIndSrv  = indSrv_.begin(), 
    886   //                                                    iteIndSrv = indSrv_.end(); 
    887   //     connectedServerRank_.clear(); 
    888   //     for (; itIndSrv != iteIndSrv; ++itIndSrv) 
    889   //       connectedServerRank_.push_back(itIndSrv->first); 
    890   //   } 
    891   //   nbConnectedClients_ = CClientServerMapping::computeConnectedClients(client->serverSize, client->clientSize, client->intraComm, connectedServerRank_); 
    892   // } 
    893726 
    894727  void CAxis::sendNonDistributedAttributes() 
  • XIOS/dev/dev_olga/src/node/axis.hpp

    r1143 r1144  
    4545         enum EEventId 
    4646         { 
    47            EVENT_ID_DISTRIBUTION_ATTRIBUTE, 
    48            EVENT_ID_INDEX, 
     47           EVENT_ID_DISTRIBUTION_ATTRIBUTE,            
    4948           EVENT_ID_DISTRIBUTED_VALUE, 
    5049           EVENT_ID_NON_DISTRIBUTED_VALUE, 
     
    6968 
    7069         static CAxis* createAxis(); 
    71  
    72          /// Accesseurs /// 
    73          const std::set<StdString> & getRelFiles(void) const; 
    74  
    75          const std::vector<int>& getIndexesToWrite(void) const; 
     70      
    7671         int getNumberWrittenIndexes() const; 
    7772         int getTotalNumberWrittenIndexes() const; 
     
    117112         bool hasTransformation(); 
    118113         void solveInheritanceTransformation(); 
    119          TransMapTypes getAllTransformations(); 
    120          void fillInValues(const CArray<double,1>& values); 
     114         TransMapTypes getAllTransformations();          
    121115         void duplicateTransformation(CAxis*); 
    122116         CTransformation<CAxis>* addTransformation(ETranformationType transType, const StdString& id=""); 
  • XIOS/dev/dev_olga/src/node/context.cpp

    r1139 r1144  
    526526   void CContext::postProcessingGlobalAttributes() 
    527527   { 
    528      if (allProcessed) return; 
     528     if (allProcessed) return;   
    529529      
    530      // if (hasClient) 
    531      // { 
    532        // After xml is parsed, there are some more works with post processing 
    533        postProcessing(); 
    534  
    535        // Check grid and calculate its distribution 
    536        checkGridEnabledFields(); 
    537  
    538      //} 
    539  
    540  
     530     // After xml is parsed, there are some more works with post processing 
     531     postProcessing(); 
     532 
     533     // Check grid and calculate its distribution 
     534     checkGridEnabledFields();     
    541535 
    542536     setClientServerBuffer(); 
     
    565559       // We have a xml tree on the server side and now, it should be also processed 
    566560       sendPostProcessing(); 
     561 
    567562       sendGridEnabledFields();        
    568563     } 
     
    605600 
    606601   void CContext::recvPostProcessingGlobalAttributes(CBufferIn& buffer) 
    607    { 
    608       // CCalendarWrapper::get(CCalendarWrapper::GetDefName())->createCalendar(); 
     602   {       
    609603      postProcessingGlobalAttributes(); 
    610604   } 
     
    632626      buildFilterGraphOfFieldsWithReadAccess(); 
    633627    } 
    634  
    635     // if (hasClient) this->solveAllRefOfEnabledFields(true);     
    636     checkGridEnabledFields(); 
    637     // sendGridEnabledFields(); 
     628     
     629    checkGridEnabledFields();     
    638630 
    639631    if (hasClient) this->sendProcessingGridOfEnabledFields(); 
     
    666658      for (unsigned int i = 0; i < this->enabledReadModeFiles.size(); ++i) 
    667659        (void)this->enabledReadModeFiles[i]->readAttributesOfEnabledFieldsInReadMode(); 
    668    } 
    669  
    670    void CContext::solveAllEnabledFields() 
    671    { 
    672      int size = this->enabledFiles.size(); 
    673      for (int i = 0; i < size; ++i) 
    674      { 
    675        this->enabledFiles[i]->solveOnlyRefOfEnabledFields(false); 
    676      } 
    677  
    678      for (int i = 0; i < size; ++i) 
    679      { 
    680        this->enabledFiles[i]->generateNewTransformationGridDest(); 
    681      } 
    682660   } 
    683661 
     
    10621040      CBufferIn* buffer=event.subEvents.begin()->buffer; 
    10631041      string id; 
    1064       *buffer>>id; 
    1065       //get(id)->solveOnlyRefOfEnabledFields(false); 
     1042      *buffer>>id;       
    10661043   } 
    10671044 
     
    11561133 
    11571134      // Check if some automatic time series should be generated 
    1158       // Warning: This must be done after solving the inheritance and before the rest of post-processing 
    1159       // prepareTimeseries(); 
     1135      // Warning: This must be done after solving the inheritance and before the rest of post-processing       
    11601136 
    11611137      // The timeseries should only be prepared in client 
     
    11641140      //Initialisation du vecteur 'enabledFiles' contenant la liste des fichiers à sortir. 
    11651141      this->findEnabledFiles(); 
    1166       // this->findEnabledReadModeFiles(); 
     1142       
    11671143      // For now, only read files with client and only one level server 
    11681144      if (hasClient && !hasServer) this->findEnabledReadModeFiles(); 
    1169  
    11701145 
    11711146      // Find all enabled fields of each file 
     
    11741149      if (hasClient && !hasServer) this->findAllEnabledFieldsInReadModeFiles(); 
    11751150 
    1176 //     if (hasClient) 
    1177      if (hasClient && !hasServer) 
    1178      { 
    1179       // Try to read attributes of fields in file then fill in corresponding grid (or domain, axis) 
    1180       this->readAttributesOfEnabledFieldsInReadModeFiles(); 
    1181      } 
     1151 
     1152      if (hasClient && !hasServer) 
     1153      { 
     1154       // Try to read attributes of fields in file then fill in corresponding grid (or domain, axis) 
     1155       this->readAttributesOfEnabledFieldsInReadModeFiles(); 
     1156      } 
    11821157 
    11831158      // Only search and rebuild all reference objects of enable fields, don't transform 
  • XIOS/dev/dev_olga/src/node/context.hpp

    r1139 r1144  
    128128 
    129129         void solveAllRefOfEnabledFieldsAndTransform(bool sendToServer); 
    130          void solveAllEnabledFields(); 
    131130         void checkGridEnabledFields(); 
    132131         void sendGridEnabledFields(); 
  • XIOS/dev/dev_olga/src/node/domain.cpp

    r1143 r1144  
    7979   } 
    8080 
    81    const std::set<StdString> & CDomain::getRelFiles(void) const 
    82    { 
    83       return (this->relFiles); 
    84    } 
    85  
    86  
    87    const std::vector<int>& CDomain::getIndexesToWrite(void) const 
    88    { 
    89      return indexesToWrite; 
    90    } 
    91  
    9281   /*! 
    9382     Returns the number of indexes written by each server. 
     
    115104   { 
    116105     return offsetWrittenIndexes_; 
    117    } 
    118  
    119    /*! 
    120      Returns the start of indexes written by each server. 
    121      \return the start of indexes written by each server 
    122    */ 
    123    const std::vector<int>& CDomain::getStartWriteIndex() const 
    124    { 
    125      return start_write_index_; 
    126    } 
    127  
    128    /*! 
    129      Returns the count of indexes written by each server. 
    130      \return the count of indexes written by each server 
    131    */ 
    132    const std::vector<int>& CDomain::getCountWriteIndex() const 
    133    { 
    134      return count_write_index_; 
    135    } 
    136  
    137    /*! 
    138      Returns the local data written by each server.      
    139    */ 
    140    const std::vector<int>& CDomain::getLocalWriteSize() const 
    141    { 
    142      return local_write_size_; 
    143    } 
    144  
    145    /*! 
    146      Returns the global data written by all server.      
    147    */ 
    148    const std::vector<int>& CDomain::getGlobalWriteSize() const 
    149    { 
    150      return global_write_size_; 
    151106   } 
    152107 
     
    15641519   } 
    15651520 
    1566  
    1567   // void CDomain::computeConnectedClients(const std::vector<int>& globalDim, int orderPositionInGrid, 
    1568   //                                     CServerDistributionDescription::ServerDistributionType distType) 
    15691521  /*! 
    1570      Compute the connection of a client to other clients to determine which clients to send attributes to 
     1522     Compute the connection of a client to other clients to determine which clients to send attributes to. 
     1523     The sending clients are supposed to already know the distribution of receiving clients (In simple cases, it's band) 
     1524     The connection among clients is calculated by using global index.  
     1525     A client connects to other clients which holds the same global index as it.      
    15711526  */ 
    15721527  void CDomain::computeConnectedClients() 
     
    16091564      } 
    16101565 
    1611       // for (i = 0; i < nbIndex; ++i) 
    1612       // { 
    1613       //   i_ind=i_index(i); 
    1614       //   j_ind=j_index(i); 
    1615  
    1616       //   if (i_ind >= global_zoom_ibegin && i_ind <= global_zoom_iend && j_ind >= global_zoom_jbegin && j_ind <= global_zoom_jend) 
    1617       //   { 
    1618       //     ++globalIndexCountZoom; 
    1619       //   } 
    1620       // } 
    1621  
    1622       // int globalIndexWrittenCount = 0; 
    1623       // if (isCompressible_) 
    1624       // { 
    1625       //   for (i = 0; i < data_i_index.numElements(); ++i) 
    1626       //   { 
    1627       //     i_ind = CDistributionClient::getDomainIndex(data_i_index(i), data_j_index(i), 
    1628       //                                                 data_ibegin, data_jbegin, data_dim, ni, 
    1629       //                                                 j_ind); 
    1630       //     if (i_ind >= 0 && i_ind < ni && j_ind >= 0 && j_ind < nj && mask_1d(i_ind + j_ind * ni)) 
    1631       //     { 
    1632       //       i_ind += ibegin; 
    1633       //       j_ind += jbegin; 
    1634       //       if (i_ind >= global_zoom_ibegin && i_ind <= global_zoom_iend && j_ind >= global_zoom_jbegin && j_ind <= global_zoom_jend) 
    1635       //         ++globalIndexWrittenCount; 
    1636       //     } 
    1637       //   } 
    1638       // } 
    16391566 
    16401567      // Fill in index 
    1641  
    16421568      CArray<size_t,1> globalIndexDomainZoom(globalIndexCountZoom); 
    16431569      CArray<size_t,1> localIndexDomainZoom(globalIndexCountZoom); 
     
    16721598          globalIndexDomainZoom(globalIndexCountZoom) = globalIndex; 
    16731599          ++globalIndexCountZoom; 
    1674           // if (i_ind >= global_zoom_ibegin && i_ind <= global_zoom_iend && j_ind >= global_zoom_jbegin && j_ind <= global_zoom_jend) 
    1675           // { 
    1676           //   globalIndexDomainZoom(globalIndexCountZoom) = globalIndex; 
    1677           //   localIndexDomainZoom(globalIndexCountZoom) = i; 
    1678           //   ++globalIndexCountZoom; 
    1679           // } 
    16801600        } 
    16811601      } 
     
    16991619          int jend = jbegin + nj -1; 
    17001620          zoom_ibegin = global_zoom_ibegin > ibegin ? global_zoom_ibegin : ibegin; 
    1701           int zoom_iend   = global_zoom_iend < iend ? zoom_iend : iend ; 
     1621          int zoom_iend  = global_zoom_iend < iend ? zoom_iend : iend ; 
    17021622          zoom_ni     = zoom_iend-zoom_ibegin+1 ; 
    17031623 
     
    17071627      } 
    17081628 
    1709       // if (globalLocalIndexZoomMap_.empty()) 
    1710       // { 
    1711       //   int nbIndexZoom = globalIndexDomainZoom.numElements(); 
    1712       //   for (i = 0; i < nbIndex; ++i) 
    1713       //     globalLocalIndexZoomMap_[globalIndexDomainZoom(i)] = i; 
    1714       // } 
    1715  
    1716  
    1717       // CArray<int,1> globalIndexWrittenDomain(globalIndexWrittenCount); 
    1718       // if (isCompressible_) 
    1719       // { 
    1720       //   globalIndexWrittenCount = 0; 
    1721       //   for (i = 0; i < data_i_index.numElements(); ++i) 
    1722       //   { 
    1723       //     i_ind = CDistributionClient::getDomainIndex(data_i_index(i), data_j_index(i), 
    1724       //                                                 data_ibegin, data_jbegin, data_dim, ni, 
    1725       //                                                 j_ind); 
    1726       //     if (i_ind >= 0 && i_ind < ni && j_ind >= 0 && j_ind < nj && mask_1d(i_ind + j_ind * ni)) 
    1727       //     { 
    1728       //       i_ind += ibegin; 
    1729       //       j_ind += jbegin; 
    1730       //       if (i_ind >= global_zoom_ibegin && i_ind <= global_zoom_iend && j_ind >= global_zoom_jbegin && j_ind <= global_zoom_jend) 
    1731       //       { 
    1732       //         globalIndexWrittenDomain(globalIndexWrittenCount) = i_ind + j_ind * ni_glo; 
    1733       //         ++globalIndexWrittenCount; 
    1734       //       } 
    1735       //     } 
    1736       //   } 
    1737       // } 
    17381629 
    17391630      size_t globalSizeIndex = 1, indexBegin, indexEnd; 
     
    17721663      CClientServerMapping::GlobalIndexMap::const_iterator it  = globalIndexDomainOnServer.begin(), 
    17731664                                                           ite = globalIndexDomainOnServer.end(); 
    1774       // typedef XIOSBinarySearchWithIndex<size_t> BinarySearch; 
    1775       // std::vector<int>::iterator itVec; 
    1776  
    1777       // indSrv_.clear(); 
    1778       // indWrittenSrv_.clear(); 
    1779       // for (; it != ite; ++it) 
    1780       // { 
    1781       //   int rank = it->first; 
    1782       //   int indexSize = it->second.size(); 
    1783       //   std::vector<int> permutIndex(indexSize); 
    1784       //   XIOSAlgorithms::fillInIndex(indexSize, permutIndex); 
    1785       //   XIOSAlgorithms::sortWithIndex<size_t, CVectorStorage>(it->second, permutIndex); 
    1786       //   BinarySearch binSearch(it->second); 
    1787       //   int nb = globalIndexDomainZoom.numElements(); 
    1788       //   for (int i = 0; i < nb; ++i) 
    1789       //   { 
    1790       //     if (binSearch.search(permutIndex.begin(), permutIndex.end(), globalIndexDomainZoom(i), itVec)) 
    1791       //     { 
    1792       //       indSrv_[rank].push_back(localIndexDomainZoom(i)); 
    1793       //     } 
    1794       //   } 
    1795       //   for (int i = 0; i < globalIndexWrittenDomain.numElements(); ++i) 
    1796       //   { 
    1797       //     if (binSearch.search(permutIndex.begin(), permutIndex.end(), globalIndexWrittenDomain(i), itVec)) 
    1798       //     { 
    1799       //       indWrittenSrv_[rank].push_back(globalIndexWrittenDomain(i)); 
    1800       //     } 
    1801       //   } 
    1802       // } 
    1803  
    18041665      connectedServerRank_.clear(); 
    18051666      for (it = globalIndexDomainOnServer.begin(); it != ite; ++it) { 
     
    18231684  } 
    18241685 
    1825   const boost::unordered_map<int, vector<size_t> >& CDomain::getIndexServer() const 
    1826   { 
    1827     return indSrv_; 
    1828   } 
    1829  
     1686   /*! 
     1687     Compute index to write data. We only write data on the zoomed region, therefore, there should 
     1688     be a map between the complete grid and the reduced grid where we write data. 
     1689     By using global index we can easily create this kind of mapping. 
     1690   */ 
    18301691   void CDomain::computeWrittenIndex() 
    18311692   {   
     
    19761837        list_msgsIndex.back() << list_indGlob.back(); //list_indi.back() << list_indj.back(); 
    19771838        
    1978         // if (isCompressible_) 
    1979         // { 
    1980         //   std::vector<int>& writtenIndSrc = indWrittenSrv_[rank]; 
    1981         //   list_writtenInd.push_back(CArray<int,1>(writtenIndSrc.size())); 
    1982         //   CArray<int,1>& writtenInd = list_writtenInd.back(); 
    1983  
    1984         //   for (n = 0; n < writtenInd.numElements(); ++n) 
    1985         //     writtenInd(n) = writtenIndSrc[n]; 
    1986  
    1987         //   list_msgsIndex.back() << writtenInd; 
    1988         // } 
    1989  
    19901839        eventIndex.push(rank, nbConnectedClients_[rank], list_msgsIndex.back()); 
    19911840      } 
     
    19971846  /*! 
    19981847    Send global index and zoom index from client to connected client(s) 
    1999     zoom index can be smaller than global index 
     1848    zoom index can be smaller than global index. 
     1849    This function can be used in the future??? 
    20001850  */ 
    20011851  void CDomain::sendIndexZoom() 
     
    21001950 
    21011951  /*! 
    2102     Send mask index from client to connected(s) 
     1952    Send mask index from client to connected(s) clients     
    21031953  */ 
    21041954  void CDomain::sendMask() 
     
    21962046  /*! 
    21972047    Send longitude and latitude from client to servers 
    2198     Each client send long and lat information to corresponding connected server(s). 
     2048    Each client send long and lat information to corresponding connected clients(s). 
    21992049    Because longitude and latitude are optional, this function only called if latitude and longitude exist 
    22002050  */ 
     
    22952145    Data index can be compressed however, we always send decompressed data index 
    22962146    and they will be compressed on receiving. 
     2147    The compressed index are represented with 1 and others are represented with -1 
    22972148  */ 
    22982149  void CDomain::sendDataIndex() 
     
    24312282    } 
    24322283    get(domainId)->recvIndex(rankBuffers); 
    2433  
    2434     // if (domain->isCompressible_) 
    2435     // { 
    2436     //   std::sort(domain->indexesToWrite.begin(), domain->indexesToWrite.end()); 
    2437  
    2438     //   CContextServer* server = CContext::getCurrent()->server; 
    2439     //   domain->numberWrittenIndexes_ = domain->indexesToWrite.size(); 
    2440     //   MPI_Allreduce(&domain->numberWrittenIndexes_, &domain->totalNumberWrittenIndexes_, 1, MPI_INT, MPI_SUM, server->intraComm); 
    2441     //   MPI_Scan(&domain->numberWrittenIndexes_, &domain->offsetWrittenIndexes_, 1, MPI_INT, MPI_SUM, server->intraComm); 
    2442     //   domain->offsetWrittenIndexes_ -= domain->numberWrittenIndexes_; 
    2443     // } 
    24442284  } 
    24452285 
    24462286  /*! 
    2447     Receive index information from client(s) 
     2287    Receive index information from client(s). We use the global index for mapping index between 
     2288    sending clients and receiving clients. 
    24482289    \param[in] rankBuffers rank of sending client and the corresponding receive buffer   
    24492290  */ 
     
    24842325         ++nbIndGlob; 
    24852326      }  
    2486     }    
    2487      
    2488     // { 
    2489     //   CContextServer* server = CContext::getCurrent()->server; 
    2490     //   count_write_index_.resize(2); 
    2491     //   start_write_index_.resize(2); 
    2492     //   local_write_size_.resize(2); 
    2493     //   global_write_size_.resize(2); 
    2494     //   if ((this->type) == CDomain::type_attr::unstructured) 
    2495     //   { 
    2496     //     count_write_index_[0] = zoom_i_index.numElements(); 
    2497     //     count_write_index_[1] = 0; 
    2498     //   } 
    2499     //   else 
    2500     //   { 
    2501     //     int ni_zoom = zoom_i_index.numElements(), idx, nbIZoom = 0, nbJZoom = 0; 
    2502     //     for (idx =0; idx < ni_zoom; ++idx) 
    2503     //     { 
    2504     //        if ((ibegin <= zoom_i_index(idx)) && (zoom_i_index(idx) < ibegin+ni) && (nbIZoom < ni)) 
    2505     //         ++nbIZoom; 
    2506     //        if ((jbegin <= zoom_j_index(idx)) && (zoom_j_index(idx) < jbegin+nj) && (nbJZoom < nj)) 
    2507     //         ++nbJZoom; 
    2508     //     } 
    2509     //     count_write_index_[0] = nbIZoom; 
    2510     //     count_write_index_[1] = nbJZoom; 
    2511  
    2512     //     // Reoder the zoom_index 
    2513     //     for (int j = 0; j < nbJZoom; ++j) 
    2514     //       for (int i = 0; i < nbIZoom; ++i) 
    2515     //       { 
    2516     //         idx = nbIZoom * j + i; 
    2517     //         if (idx < ni_zoom) 
    2518     //         { 
    2519     //           zoom_i_index(idx) = ibegin + i; 
    2520     //           zoom_j_index(idx) = jbegin + j; 
    2521     //         } 
    2522     //       }   
    2523  
    2524     //     // Reorder the global index 
    2525     //     for (int j = 0; j < nj; ++j) 
    2526     //       for (int i = 0; i < ni; ++i) 
    2527     //       { 
    2528     //         idx = ni * j + i; 
    2529     //         if (idx < nbIndGlob) 
    2530     //         { 
    2531     //           i_index(idx) = ibegin + i; 
    2532     //           j_index(idx) = jbegin + j; 
    2533     //         } 
    2534     //       }          
    2535     //   } 
    2536  
    2537              
    2538     //   MPI_Scan(&count_write_index_[0], &start_write_index_[0], 2, MPI_INT, MPI_SUM, server->intraComm);       
    2539     //   start_write_index_[0] = 0;  
    2540     //   start_write_index_[1] -= count_write_index_[1]; 
    2541     //   local_write_size_[0] = count_write_index_[0]; 
    2542     //   local_write_size_[1] = count_write_index_[1]; 
    2543     //   MPI_Allreduce(&count_write_index_[0], &global_write_size_[0], 2, MPI_INT, MPI_SUM, server->intraComm); 
    2544     //   global_write_size_[0] = count_write_index_[0]; 
    2545     //   global_write_size_[1] = (global_write_size_[1] > nj_glo) ? nj_glo : global_write_size_[1]; 
    2546           
    2547  
    2548     // } 
    2549  
    2550     // int type_int; 
    2551     // buffer >> type_int >> isCurvilinear >> indiSrv[rank] >> indjSrv[rank]; 
    2552     // type.setValue((type_attr::t_enum)type_int); // probleme des type enum avec les buffers : ToFix 
    2553  
    2554     // if (isCompressible_) 
    2555     // { 
    2556     //   CArray<int, 1> writtenIndexes; 
    2557     //   buffer >> writtenIndexes; 
    2558     //   indexesToWrite.reserve(indexesToWrite.size() + writtenIndexes.numElements()); 
    2559     //   for (int i = 0; i < writtenIndexes.numElements(); ++i) 
    2560     //     indexesToWrite.push_back(writtenIndexes(i)); 
    2561     // } 
     2327    }  
    25622328  } 
    25632329 
     
    26272393    { 
    26282394    } 
    2629  
    2630     // globalLocalIndexZoomMap_.rehash(std::ceil(nbZoomInd/globalLocalIndexZoomMap_.max_load_factor())); 
    2631     // nbZoomInd = 0; 
    2632     // for (int j = 0; j < zoom_nj; ++j)  
    2633     //   for (int i = 0; i < zoom_ni; ++i) 
    2634     //   { 
    2635     //     globalLocalIndexZoomMap_[(i + zoom_ibegin) + (j + zoom_jbegin) * ni_glo] = nbZoomInd; 
    2636     //     ++nbZoomInd; 
    2637     //   } 
    26382395  } 
    26392396 
     
    30042761    } 
    30052762    get(domainId)->recvDataIndex(rankBuffers); 
    3006  
    3007     // if (domain->isCompressible_) 
    3008     // { 
    3009     //   std::sort(domain->indexesToWrite.begin(), domain->indexesToWrite.end()); 
    3010  
    3011     //   CContextServer* server = CContext::getCurrent()->server; 
    3012     //   domain->numberWrittenIndexes_ = domain->indexesToWrite.size(); 
    3013     //   MPI_Allreduce(&domain->numberWrittenIndexes_, &domain->totalNumberWrittenIndexes_, 1, MPI_INT, MPI_SUM, server->intraComm); 
    3014     //   MPI_Scan(&domain->numberWrittenIndexes_, &domain->offsetWrittenIndexes_, 1, MPI_INT, MPI_SUM, server->intraComm); 
    3015     //   domain->offsetWrittenIndexes_ -= domain->numberWrittenIndexes_; 
    3016     // } 
    30172763  } 
    30182764 
  • XIOS/dev/dev_olga/src/node/domain.hpp

    r1143 r1144  
    9191         CTransformation<CDomain>* addTransformation(ETranformationType transType, const StdString& id=""); 
    9292 
    93       public: 
    94          const std::set<StdString> & getRelFiles(void) const; 
     93      public:          
    9594         bool IsWritten(const StdString & filename) const; 
    9695         bool isWrittenCompressed(const StdString& filename) const; 
    97  
    98          const std::vector<int>& getIndexesToWrite(void) const; 
     96          
    9997         int getNumberWrittenIndexes() const; 
    10098         int getTotalNumberWrittenIndexes() const; 
    10199         int getOffsetWrittenIndexes() const; 
    102  
    103          const std::vector<int>& getStartWriteIndex() const; 
    104          const std::vector<int>& getCountWriteIndex() const; 
    105          const std::vector<int>& getLocalWriteSize() const; 
    106          const std::vector<int>& getGlobalWriteSize() const; 
    107100 
    108101         std::map<int, StdSize> getAttributesBufferSize(); 
     
    164157         static StdString GetName(void); 
    165158         static StdString GetDefName(void); 
    166  
    167          static ENodeType GetType(void); 
    168          const boost::unordered_map<int, vector<size_t> >& getIndexServer() const; 
     159         static ENodeType GetType(void);    
     160 
    169161         CArray<bool, 1> localMask; 
    170162         bool isCurvilinear ; 
     
    199191         void sendIndexZoom(); 
    200192         void sendDataIndex(); 
    201  
    202193         void convertLonLatValue(); 
    203194 
    204195       private:          
    205          std::vector<int> start_write_index_; 
    206          std::vector<int> count_write_index_; 
    207          std::vector<int> local_write_size_; 
    208          std::vector<int> global_write_size_; 
    209  
    210196         bool doZoomByIndex_; 
    211197         bool isChecked, computedWrittenIndex_; 
  • XIOS/dev/dev_olga/src/node/field.cpp

    r1143 r1144  
    172172        } 
    173173        client->sendEvent(event); 
    174       } 
    175     // } 
     174      }     
    176175 
    177176    CTimer::get("XIOS Send Data").suspend(); 
    178177  } 
    179  
    180   // void CField::sendUpdateData(const CArray<double,1>& data, CContextClient* client) 
    181   // { 
    182   //   CTimer::get("XIOS Send Data").resume(); 
    183  
    184   //   CEventClient event(getType(), EVENT_ID_UPDATE_DATA); 
    185  
    186   //   map<int, CArray<int,1> >::iterator it; 
    187   //   list<CMessage> list_msg; 
    188   //   list<CArray<double,1> > list_data; 
    189  
    190   //   if (!grid->doGridHaveDataDistributed()) 
    191   //   { 
    192   //      if (client->isServerLeader()) 
    193   //      { 
    194   //         for (it = grid->storeIndex_toSrv.begin(); it != grid->storeIndex_toSrv.end(); it++) 
    195   //         { 
    196   //           int rank = it->first; 
    197   //           CArray<int,1>& index = it->second; 
    198  
    199   //           list_msg.push_back(CMessage()); 
    200   //           list_data.push_back(CArray<double,1>(index.numElements())); 
    201  
    202   //           CArray<double,1>& data_tmp = list_data.back(); 
    203   //           for (int n = 0; n < data_tmp.numElements(); n++) data_tmp(n) = data(index(n)); 
    204  
    205   //           list_msg.back() << getId() << data_tmp; 
    206   //           event.push(rank, 1, list_msg.back()); 
    207   //         } 
    208   //         client->sendEvent(event); 
    209   //      } 
    210   //      else client->sendEvent(event); 
    211   //   } 
    212   //   else 
    213   //   { 
    214   //     for (it = grid->storeIndex_toSrv.begin(); it != grid->storeIndex_toSrv.end(); it++) 
    215   //     { 
    216   //       int rank = it->first; 
    217   //       CArray<int,1>& index = it->second; 
    218  
    219   //       list_msg.push_back(CMessage()); 
    220   //       list_data.push_back(CArray<double,1>(index.numElements())); 
    221  
    222   //       CArray<double,1>& data_tmp = list_data.back(); 
    223   //       for (int n = 0; n < data_tmp.numElements(); n++) data_tmp(n) = data(index(n)); 
    224  
    225   //       list_msg.back() << getId() << data_tmp; 
    226   //       event.push(rank, grid->nbSenders[rank], list_msg.back()); 
    227   //     } 
    228   //     client->sendEvent(event); 
    229   //   } 
    230   //   CTimer::get("XIOS Send Data").suspend(); 
    231   // } 
    232178 
    233179  void CField::recvUpdateData(CEventServer& event) 
     
    388334  { 
    389335    CContext* context = CContext::getCurrent(); 
    390 //    CContextClient* client = context->client; 
    391336    CContextClient* client = (!context->hasServer) ? context->client : this->file->getContextClient(); 
    392337 
     
    686631     CContext* context = CContext::getCurrent(); 
    687632     if (context->hasClient && !context->hasServer) 
    688 //     if (context->hasClient) 
    689633     { 
    690634       if (grid && !grid->isTransformed() && hasDirectFieldReference() && grid != getDirectFieldReference()->grid) 
     
    702646     CContext* context = CContext::getCurrent(); 
    703647     if (context->hasClient && !context->hasServer) 
    704 //     if (context->hasClient) 
    705648     { 
    706649       std::map<CGrid*,std::pair<bool,StdString> >& gridSrcMap = grid->getTransGridSource(); 
     
    840783 
    841784        if (context->hasClient && !context->hasServer) 
    842 //        if (context->hasClient) 
    843785        { 
    844786          solveRefInheritance(true); 
    845787          if (hasDirectFieldReference()) getDirectFieldReference()->solveOnlyReferenceEnabledField(false); 
    846788        } 
    847 //        else if (context->hasServer) 
     789 
    848790        if (context->hasServer) 
    849791          solveServerOperation(); 
     
    852794 
    853795        if (context->hasClient && !context->hasServer) 
    854 //       if (context->hasClient) 
    855796       { 
    856797         solveGenerateGrid(); 
     
    868809     { 
    869810        areAllReferenceSolved = true; 
    870  
    871        // if (context->hasClient) 
     811        
    872812        if (context->hasClient && !context->hasServer) 
    873813        { 
     
    875815          if (hasDirectFieldReference()) getDirectFieldReference()->solveAllReferenceEnabledField(false); 
    876816        } 
    877        else if (context->hasServer) 
    878         // if (context->hasServer && !context->hasClient) 
     817       else if (context->hasServer)         
    879818          solveServerOperation(); 
    880819 
     
    959898    */ 
    960899   void CField::buildFilterGraph(CGarbageCollector& gc, bool enableOutput) 
    961    { 
    962      // if (!areAllReferenceSolved) solveAllReferenceEnabledField(false); 
     900   {      
    963901    if (!isReferenceSolvedAndTransformed) solveAllEnabledFieldsAndTransform(); 
    964902     CContext* context = CContext::getCurrent(); 
     
    13671305   void CField::scaleFactorAddOffset(double scaleFactor, double addOffset) 
    13681306   { 
    1369      // map<int, CArray<double,1> >::iterator it; 
    1370      // for (it = data_srv.begin(); it != data_srv.end(); it++) it->second = (it->second - addOffset) / scaleFactor; 
    13711307     recvDataSrv = (recvDataSrv - addOffset) / scaleFactor; 
    13721308   } 
     
    13741310   void CField::invertScaleFactorAddOffset(double scaleFactor, double addOffset) 
    13751311   { 
    1376      // map<int, CArray<double,1> >::iterator it; 
    1377      // for (it = data_srv.begin(); it != data_srv.end(); it++) it->second = it->second * scaleFactor + addOffset; 
    13781312     recvDataSrv = recvDataSrv * scaleFactor + addOffset; 
    13791313   } 
     
    14021336   void CField::outputCompressedField(CArray<double,1>& fieldOut) 
    14031337   { 
    1404       // map<int, CArray<double,1> >::iterator it; 
    1405  
    1406       // for (it = data_srv.begin(); it != data_srv.end(); it++) 
    1407       // { 
    1408       //    grid->outputCompressedField(it->first, it->second, fieldOut.dataFirst()); 
    1409       // } 
    1410  
    14111338      CArray<size_t,1>& outIndexClient = grid->localIndexToWriteOnClient; 
    14121339      CArray<size_t,1>& outIndexServer = grid->localIndexToWriteOnServer; 
     
    14801407   } 
    14811408 
    1482    void CField::sendAddAllVariables() 
     1409   void CField::sendAddAllVariables(CContextClient* client) 
    14831410   { 
    14841411     std::vector<CVariable*> allVar = getAllVariables(); 
     
    14881415     for (; it != itE; ++it) 
    14891416     { 
    1490        this->sendAddVariable((*it)->getId()); 
    1491        (*it)->sendAllAttributesToServer(); 
    1492        (*it)->sendValue(); 
    1493      } 
    1494    } 
    1495  
    1496    void CField::sendAddAllVariables(CContextClient* client) 
    1497    { 
    1498      std::vector<CVariable*> allVar = getAllVariables(); 
    1499      std::vector<CVariable*>::const_iterator it = allVar.begin(); 
    1500      std::vector<CVariable*>::const_iterator itE = allVar.end(); 
    1501  
    1502      for (; it != itE; ++it) 
    1503      { 
    15041417       this->sendAddVariable((*it)->getId(), client); 
    15051418       (*it)->sendAllAttributesToServer(client); 
     
    15081421   } 
    15091422 
    1510    void CField::sendAddVariable(const string& id) 
    1511    { 
    1512       sendAddItem(id, (int)EVENT_ID_ADD_VARIABLE); 
    1513    } 
    1514  
    15151423   void CField::sendAddVariable(const string& id, CContextClient* client) 
    15161424   { 
     
    15181426   } 
    15191427 
    1520    void CField::sendAddVariableGroup(const string& id) 
    1521    { 
    1522       sendAddItem(id, (int)EVENT_ID_ADD_VARIABLE_GROUP); 
     1428   void CField::sendAddVariableGroup(const string& id, CContextClient* client) 
     1429   { 
     1430      sendAddItem(id, (int)EVENT_ID_ADD_VARIABLE_GROUP, client); 
    15231431   } 
    15241432 
  • XIOS/dev/dev_olga/src/node/field.hpp

    r1136 r1144  
    170170 
    171171        CVariable* addVariable(const string& id = ""); 
    172         CVariableGroup* addVariableGroup(const string& id = ""); 
    173         void sendAddVariable(const string& id = ""); 
     172        CVariableGroup* addVariableGroup(const string& id = "");         
    174173        void sendAddVariable(const string& id, CContextClient* client); 
    175         void sendAddVariableGroup(const string& id = ""); 
     174        void sendAddVariableGroup(const string& id, CContextClient* client); 
    176175        static void recvAddVariable(CEventServer& event); 
    177176        void recvAddVariable(CBufferIn& buffer); 
    178177        static void recvAddVariableGroup(CEventServer& event); 
    179         void recvAddVariableGroup(CBufferIn& buffer); 
    180         void sendAddAllVariables(); 
     178        void recvAddVariableGroup(CBufferIn& buffer);         
    181179        void sendAddAllVariables(CContextClient* client); 
    182180        void writeUpdateData(const CArray<double,1>& data); 
    183  
    184181 
    185182        const std::vector<StdString>& getRefDomainAxisIds(); 
     
    206203         map<int,boost::shared_ptr<func::CFunctor> > foperation_srv; 
    207204 
    208          map<int, CArray<double,1> > data_srv; 
     205         // map<int, CArray<double,1> > data_srv; 
    209206         CArray<double,1> recvDataSrv; 
    210207          
  • XIOS/dev/dev_olga/src/node/file.cpp

    r1136 r1144  
    616616 
    617617     // Just check file and try to open it 
    618      CContext* context = CContext::getCurrent(); 
    619      // CContextClient* client=context->client; 
    620      CContextClient* client = (0 != context->clientPrimServer.size()) ? context->clientPrimServer[0] : context->client; 
    621  
    622      // It would probably be better to call initFile() somehow 
    623      // MPI_Comm_dup(client->intraComm, &fileComm); 
    624618     if (time_counter_name.isEmpty()) time_counter_name = "time_counter"; 
    625619 
     
    719713     { 
    720714       this->enabledFields[i]->solveOnlyReferenceEnabledField(sendToServer); 
    721        // this->enabledFields[i]->solveAllEnabledFields(); 
    722 //       this->enabledFields[i]->buildGridTransformationGraph(); 
    723715     } 
    724716   } 
     
    763755     int size = this->enabledFields.size(); 
    764756     for (int i = 0; i < size; ++i) 
    765      { 
    766        // this->enabledFields[i]->solveAllReferenceEnabledField(sendToServer); 
     757     {        
    767758      this->enabledFields[i]->solveAllEnabledFieldsAndTransform(); 
    768759     } 
     
    886877   \param[in] id String identity of field that will be created on server 
    887878   */ 
    888    void CFile::sendAddField(const string& id) 
    889    { 
    890       sendAddItem(id, EVENT_ID_ADD_FIELD); 
    891    } 
    892  
    893879   void CFile::sendAddField(const string& id, CContextClient* client) 
    894880   { 
    895881      sendAddItem(id, EVENT_ID_ADD_FIELD, client); 
    896    } 
    897  
    898    /*! 
    899    \brief Send a message to create a field group on server side 
    900    \param[in] id String identity of field group that will be created on server 
    901    */ 
    902    void CFile::sendAddFieldGroup(const string& id) 
    903    { 
    904       sendAddItem(id, (int)EVENT_ID_ADD_FIELD_GROUP); 
    905882   } 
    906883 
     
    968945   is to duplicate this value on server, too. 
    969946   */ 
    970    void CFile::sendAddAllVariables() 
    971    { 
    972      std::vector<CVariable*> allVar = getAllVariables(); 
    973      std::vector<CVariable*>::const_iterator it = allVar.begin(); 
    974      std::vector<CVariable*>::const_iterator itE = allVar.end(); 
    975  
    976      for (; it != itE; ++it) 
    977      { 
    978        this->sendAddVariable((*it)->getId()); 
    979        (*it)->sendAllAttributesToServer(); 
    980        (*it)->sendValue(); 
    981      } 
    982    } 
    983  
    984947   void CFile::sendAddAllVariables(CContextClient* client) 
    985948   { 
     
    999962   \brief Send a message to create a variable group on server side 
    1000963   \param[in] id String identity of variable group that will be created on server 
    1001    */ 
    1002    void CFile::sendAddVariableGroup(const string& id) 
    1003    { 
    1004       sendAddItem(id, (int)EVENT_ID_ADD_VARIABLE_GROUP); 
    1005    } 
    1006  
    1007    /*! 
    1008    \brief Send a message to create a variable group on server side 
    1009    \param[in] id String identity of variable group that will be created on server 
    1010964   \param [in] client client to which we will send this adding action 
    1011965   */ 
     
    1013967   { 
    1014968      sendAddItem(id, (int)EVENT_ID_ADD_VARIABLE_GROUP, client); 
    1015    } 
    1016  
    1017    /*! 
    1018    \brief Send a message to create a variable on server side 
    1019       A variable always belongs to a variable group 
    1020    \param[in] id String identity of variable that will be created on server 
    1021    */ 
    1022    void CFile::sendAddVariable(const string& id) 
    1023    { 
    1024       sendAddItem(id, (int)EVENT_ID_ADD_VARIABLE); 
    1025969   } 
    1026970 
  • XIOS/dev/dev_olga/src/node/file.hpp

    r1136 r1144  
    123123         CContextClient* getContextClient(); 
    124124 
    125          // Send info to server 
    126          void sendEnabledFields(); 
    127          void sendEnabledFields(CContextClient* client); 
    128          void sendAddField(const string& id = ""); 
    129          void sendAddField(const string& id, CContextClient* client); 
    130          void sendAddFieldGroup(const string& id = ""); 
    131          void sendAddFieldGroup(const string& id, CContextClient* client); 
    132          void sendAddAllVariables();                        // to be removed (?) 
     125         // Send info to server          
     126         void sendEnabledFields(CContextClient* client);          
     127         void sendAddField(const string& id, CContextClient* client);          
     128         void sendAddFieldGroup(const string& id, CContextClient* client);                            
     129         void sendAddVariable(const string& id, CContextClient* client); 
     130         void sendAddVariableGroup(const string& id, CContextClient* client); 
    133131         void sendAddAllVariables(CContextClient* client); 
    134          void sendAddVariable(const string& id = "");         // to be removed (?) 
    135          void sendAddVariable(const string& id, CContextClient* client); 
    136          void sendAddVariableGroup(const string& id = ""); 
    137          void sendAddVariableGroup(const string& id, CContextClient* client); 
    138  
     132          
    139133         // Receive info from client 
    140134         static void recvAddField(CEventServer& event); 
  • XIOS/dev/dev_olga/src/node/grid.cpp

    r1143 r1144  
    536536   } 
    537537 
    538    std::vector<int> CGrid::getAxisPositionInGrid() const 
    539    { 
    540      return axisPositionInGrid_; 
    541    } 
    542  
     538   /*! 
     539      Compute the index to for write data into a file 
     540   */ 
    543541   void CGrid::computeWrittenIndex() 
    544542   {       
     
    561559      localIndexToWriteOnClient.resize(nbWritten);   
    562560      localIndexToWriteOnServer.resize(nbWritten); 
    563  
    564       // if (isCompressible()) 
     561       
    565562      { 
    566563        numberWrittenIndexes_ = nbWritten; 
     
    607604       int rank = client->clientRank; 
    608605 
    609          clientDistribution_ = new CDistributionClient(rank, this); 
    610          // Get local data index on client 
    611          storeIndex_client.resize(clientDistribution_->getLocalDataIndexOnClient().size()); 
    612          int nbStoreIndex = storeIndex_client.numElements(); 
    613          for (int idx = 0; idx < nbStoreIndex; ++idx) storeIndex_client(idx) = (clientDistribution_->getLocalDataIndexOnClient())[idx]; 
    614        // } 
     606       clientDistribution_ = new CDistributionClient(rank, this); 
     607       // Get local data index on client 
     608       storeIndex_client.resize(clientDistribution_->getLocalDataIndexOnClient().size()); 
     609       int nbStoreIndex = storeIndex_client.numElements(); 
     610       for (int idx = 0; idx < nbStoreIndex; ++idx) storeIndex_client(idx) = (clientDistribution_->getLocalDataIndexOnClient())[idx];        
    615611      
    616612       if (0 == serverDistribution_) isDataDistributed_= clientDistribution_->isDataDistributed(); 
    617613       else           
    618        { 
    619            
     614       {           
    620615          // Mapping global index received from clients to the storeIndex_client 
    621616          CDistributionClient::GlobalLocalDataMap& globalDataIndex = clientDistribution_->getGlobalDataIndexOnClient(); 
     
    858853         } 
    859854 
    860 //         nbIndexOnServer = 0; 
    861 //         for (it = itb; it != ite; ++it) 
    862 //         { 
    863 //           const std::vector<int>& tmp = it->second; 
    864 //           nbIndexOnServerTmp = 0; 
    865 //           for (int i = 0; i < tmp.size(); ++i) 
    866 //           { 
    867 //             if (0 == nbIndexOnServerTmp(tmp[i])) 
    868 //             { 
    869 //               globalElementIndexOnServer[idx][tmp[i]][nbIndexOnServer(tmp[i])] = it->first; 
    870 //               ++nbIndexOnServerTmp(tmp[i]); 
    871 //             } 
    872 //           } 
    873 //           nbIndexOnServer += nbIndexOnServerTmp; 
    874 //         } 
    875 //       } 
    876  
    877855       nbIndexOnServer = 0; 
    878856       for (size_t j = 0; j < globalIndexElementOnServerMap.size(); ++j) 
     
    11441122   } 
    11451123 
    1146    void CGrid::outputField(int rank, const CArray<double, 1>& stored, double* field) 
    1147    { 
    1148      const CArray<size_t,1>& out_i = outIndexFromClient[rank]; 
    1149      StdSize numElements = stored.numElements(); 
    1150      for (StdSize n = 0; n < numElements; ++n) 
    1151      { 
    1152        field[out_i(n)] = stored(n); 
    1153      } 
    1154    } 
    1155  
    1156    void CGrid::inputField(int rank, const double* const field, CArray<double,1>& stored) 
    1157    { 
    1158      const CArray<size_t,1>& out_i = outIndexFromClient[rank]; 
    1159      StdSize numElements = stored.numElements(); 
    1160      for (StdSize n = 0; n < numElements; ++n) 
    1161      { 
    1162        stored(n) = field[out_i(n)]; 
    1163      } 
    1164    } 
    1165  
    1166    void CGrid::outputCompressedField(int rank, const CArray<double,1>& stored, double* field) 
    1167    { 
    1168      const CArray<size_t,1>& out_i = compressedOutIndexFromClient[rank]; 
    1169      StdSize numElements = stored.numElements(); 
    1170      for (StdSize n = 0; n < numElements; ++n) 
    1171      { 
    1172        field[out_i(n)] = stored(n); 
    1173      } 
    1174    } 
    1175  
    1176    //---------------------------------------------------------------- 
    1177  
    11781124   void CGrid::storeField_arr(const double* const data, CArray<double, 1>& stored) const 
    11791125   { 
     
    11931139  void CGrid::computeIndexScalarGrid() 
    11941140  { 
    1195     CContext* context = CContext::getCurrent(); 
    1196     // int nbSrvPools = (context->hasServer) ? context->clientPrimServer.size() : 1; 
     1141    CContext* context = CContext::getCurrent();     
    11971142    int nbSrvPools = (context->hasServer) ? (context->hasClient ? context->clientPrimServer.size() : 1) : 1; 
    11981143    connectedServerRank_.resize(nbSrvPools); 
     
    12191164      } 
    12201165      isDataDistributed_ = false; 
    1221     } 
    1222   } 
    1223  
    1224   void CGrid::computeCompressedIndex() 
    1225   { 
    1226     compressedOutIndexFromClient = outIndexFromClient; 
    1227  
    1228     std::map<size_t, size_t> indexes; 
    1229  
    1230     { 
    1231       std::map<int, CArray<size_t,1> >::const_iterator it = compressedOutIndexFromClient.begin(); 
    1232       std::map<int, CArray<size_t,1> >::const_iterator itEnd = compressedOutIndexFromClient.end(); 
    1233       for (; it != itEnd; ++it) 
    1234       { 
    1235         for (int i = 0; i < it->second.numElements(); ++i) 
    1236           indexes.insert(std::make_pair(it->second(i), 0)); 
    1237       } 
    1238     } 
    1239  
    1240     { 
    1241       std::map<size_t, size_t>::iterator it = indexes.begin(); 
    1242       std::map<size_t, size_t>::iterator itEnd = indexes.end(); 
    1243       for (size_t i = 0; it != itEnd; ++it, ++i) 
    1244         it->second = i; 
    1245     } 
    1246  
    1247     { 
    1248       std::map<int, CArray<size_t,1> >::iterator it = compressedOutIndexFromClient.begin(); 
    1249       std::map<int, CArray<size_t,1> >::iterator itEnd = compressedOutIndexFromClient.end(); 
    1250       for (; it != itEnd; ++it) 
    1251       { 
    1252         for (int i = 0; i < it->second.numElements(); ++i) 
    1253           it->second(i) = indexes[it->second(i)]; 
    1254       } 
    12551166    } 
    12561167  } 
     
    13781289      else 
    13791290      { 
    1380         // CClientServerMapping::GlobalIndexMap::const_iterator iteGlobalMap, itGlobalMap, itbGlobalMap; 
    1381         // itbGlobalMap = globalIndexOnServer_.begin(), itGlobalMap; 
    1382         // iteGlobalMap = globalIndexOnServer_.end(); 
    1383          
    1384         // std::map<int,int > nbGlobalLocalTmp; 
    1385         // for (itGlobalMap = itbGlobalMap; itGlobalMap != iteGlobalMap; ++itGlobalMap) 
    1386         // { 
    1387         //   int serverRank = itGlobalMap->first; 
    1388         //   nbGlobalLocalTmp[serverRank] = 0; 
    1389         //   const std::vector<size_t>& indexVec = itGlobalMap->second; 
    1390         //   int indexSize = indexVec.size();           
    1391         //   for (int idx = 0; idx < indexSize; ++idx) 
    1392         //   { 
    1393         //     itIndex = globalLocalIndexSendToServer.find(indexVec[idx]); 
    1394         //     if (iteIndex != itIndex) 
    1395         //     { 
    1396         //       ++nbGlobalLocalTmp[serverRank]; 
    1397         //     } 
    1398         //   } 
    1399         // } 
    1400  
    1401         // std::map<int,std::vector<int> >localIndexTmp; 
    1402         // std::map<int,std::vector<size_t> > globalIndexTmp; 
    1403         // for (std::map<int,int>::iterator it = nbGlobalLocalTmp.begin(); it != nbGlobalLocalTmp.end(); ++it) 
    1404         // { 
    1405         //   localIndexTmp[it->first].resize(it->second); 
    1406         //   globalIndexTmp[it->first].resize(it->second); 
    1407         //   it->second = 0; 
    1408         // } 
    1409  
    1410         // for (itGlobalMap = itbGlobalMap; itGlobalMap != iteGlobalMap; ++itGlobalMap) 
    1411         // { 
    1412         //   int serverRank = itGlobalMap->first;           
    1413         //   const std::vector<size_t>& indexVec = itGlobalMap->second; 
    1414         //   int indexSize = indexVec.size();           
    1415         //   int ind = 0; 
    1416         //   for (int idx = 0; idx < indexSize; ++idx) 
    1417         //   { 
    1418         //     itIndex = globalLocalIndexSendToServer.find(indexVec[idx]); 
    1419         //     if (iteIndex != itIndex) 
    1420         //     {               
    1421         //       ind = nbGlobalLocalTmp[serverRank]; 
    1422         //       globalIndexTmp[serverRank][ind] = itIndex->first; 
    1423         //       localIndexTmp[serverRank][ind]  = itIndex->second; 
    1424         //       ++nbGlobalLocalTmp[serverRank]; 
    1425         //     } 
    1426         //   } 
    1427         // } 
    1428  
    14291291        CClientServerMapping::GlobalIndexMap::const_iterator iteGlobalMap, itGlobalMap; 
    14301292        itGlobalMap = globalIndexOnServer_.begin(); 
     
    15021364 
    15031365    int nbSrvPools = (context->hasServer) ? (context->hasClient ? context->clientPrimServer.size() : 1) : 1; 
    1504     nbSrvPools = 1; 
    1505     // connectedServerRank_.resize(nbSrvPools); 
     1366    nbSrvPools = 1;     
    15061367    nbReadSenders.resize(nbSrvPools); 
    15071368    for (int p = 0; p < nbSrvPools; ++p) 
     
    15101371      CContextClient* client = (!context->hasClient) ? context->client : context->clientPrimServer[p]; 
    15111372       
    1512 //      CContextServer* server = (context->hasServer) ? context->server : context->serverPrimServer[p]; 
    1513 //      CContextClient* client = (context->hasServer) ? context->client : context->clientPrimServer[p]; 
    1514       // numberWrittenIndexes_ = totalNumberWrittenIndexes_ = offsetWrittenIndexes_ = 0; 
    1515       //connectedServerRank_[p] = ranks; 
    1516  
    15171373      int idx = 0, numElement = axis_domain_order.numElements(); 
    15181374      int ssize = numElement; 
     
    15961452        else 
    15971453        { 
    1598 //          dataSize = outIndex.numElements(); 
    1599 //          for (int i = 0; i < outIndex.numElements(); ++i) outIndex(i) = i; 
    16001454          // THE PROBLEM HERE IS THAT DATA CAN BE NONDISTRIBUTED ON CLIENT AND DISTRIBUTED ON SERVER 
    16011455          // BELOW IS THE TEMPORARY FIX only for a single type of element (domain, asix, scalar) 
    16021456          dataSize = serverDistribution_->getGridSize(); 
    1603           // dataSize = serverDistribution_->getGlobalIndexEachDimension()[0].numElements(); 
    1604           // outIndex.resize(dataSize); 
    1605           // outIndex = serverDistribution_->getGlobalIndexEachDimension()[0]; 
    1606  
    16071457        } 
    16081458        writtenDataSize_ += dataSize; 
    1609  
    1610         // outIndexFromClient.insert(std::make_pair(rank, outIndex)); 
    1611         // connectedDataSize_[p][rank] = outIndex.numElements(); 
    1612         // numberWrittenIndexes_ += outIndex.numElements(); 
    16131459      } 
    16141460 
     
    16861532      } 
    16871533 
    1688       // if (isScalarGrid()) return; 
    1689  
    1690       // if (isDataDistributed_) 
    1691       // { 
    1692       //   MPI_Allreduce(&numberWrittenIndexes_, &totalNumberWrittenIndexes_, 1, MPI_INT, MPI_SUM, server->intraComm); 
    1693       //   MPI_Scan(&numberWrittenIndexes_, &offsetWrittenIndexes_, 1, MPI_INT, MPI_SUM, server->intraComm); 
    1694       //   offsetWrittenIndexes_ -= numberWrittenIndexes_; 
    1695       // } 
    1696       // else 
    1697       //   totalNumberWrittenIndexes_ = numberWrittenIndexes_; 
     1534      if (isScalarGrid()) return; 
    16981535 
    16991536      nbReadSenders[p] = CClientServerMappingDistributed::computeConnectedClients(context->client->serverSize, context->client->clientSize, context->client->intraComm, ranks); 
     
    19101747   { 
    19111748      sendAddItem(id, (int)EVENT_ID_ADD_DOMAIN); 
    1912     // CContext* context=CContext::getCurrent(); 
    1913  
    1914     // if (! context->hasServer ) 
    1915     // { 
    1916     //    CContextClient* client=context->client; 
    1917  
    1918     //    CEventClient event(this->getType(),EVENT_ID_ADD_DOMAIN); 
    1919     //    if (client->isServerLeader()) 
    1920     //    { 
    1921     //      CMessage msg; 
    1922     //      msg<<this->getId(); 
    1923     //      msg<<id; 
    1924     //      const std::list<int>& ranks = client->getRanksServerLeader(); 
    1925     //      for (std::list<int>::const_iterator itRank = ranks.begin(), itRankEnd = ranks.end(); itRank != itRankEnd; ++itRank) 
    1926     //        event.push(*itRank,1,msg); 
    1927     //      client->sendEvent(event); 
    1928     //    } 
    1929     //    else client->sendEvent(event); 
    1930     // } 
    19311749   } 
    19321750 
     
    19381756   { 
    19391757      sendAddItem(id, (int)EVENT_ID_ADD_AXIS); 
    1940     // CContext* context=CContext::getCurrent(); 
    1941  
    1942     // if (! context->hasServer ) 
    1943     // { 
    1944     //    CContextClient* client=context->client; 
    1945  
    1946     //    CEventClient event(this->getType(),EVENT_ID_ADD_AXIS); 
    1947     //    if (client->isServerLeader()) 
    1948     //    { 
    1949     //      CMessage msg; 
    1950     //      msg<<this->getId(); 
    1951     //      msg<<id; 
    1952     //      const std::list<int>& ranks = client->getRanksServerLeader(); 
    1953     //      for (std::list<int>::const_iterator itRank = ranks.begin(), itRankEnd = ranks.end(); itRank != itRankEnd; ++itRank) 
    1954     //        event.push(*itRank,1,msg); 
    1955     //      client->sendEvent(event); 
    1956     //    } 
    1957     //    else client->sendEvent(event); 
    1958     // } 
    19591758   } 
    19601759 
     
    19661765   { 
    19671766      sendAddItem(id, (int)EVENT_ID_ADD_SCALAR); 
    1968     // CContext* context=CContext::getCurrent(); 
    1969  
    1970     // if (! context->hasServer ) 
    1971     // { 
    1972     //    CContextClient* client=context->client; 
    1973  
    1974     //    CEventClient event(this->getType(),EVENT_ID_ADD_SCALAR); 
    1975     //    if (client->isServerLeader()) 
    1976     //    { 
    1977     //      CMessage msg; 
    1978     //      msg<<this->getId(); 
    1979     //      msg<<id; 
    1980     //      const std::list<int>& ranks = client->getRanksServerLeader(); 
    1981     //      for (std::list<int>::const_iterator itRank = ranks.begin(), itRankEnd = ranks.end(); itRank != itRankEnd; ++itRank) 
    1982     //        event.push(*itRank,1,msg); 
    1983     //      client->sendEvent(event); 
    1984     //    } 
    1985     //    else client->sendEvent(event); 
    1986     // } 
    19871767   } 
    19881768 
     
    20751855    { 
    20761856      CDomain* pDom = CDomain::get(*it); 
    2077       if (context->hasClient && !context->hasServer) 
    2078       //if (context->hasClient) 
     1857      if (context->hasClient && !context->hasServer)       
    20791858      { 
    20801859        pDom->solveRefInheritance(apply); 
     
    20891868      CAxis* pAxis = CAxis::get(*it); 
    20901869      if (context->hasClient && !context->hasServer) 
    2091 //     if (context->hasClient) 
    20921870      { 
    20931871        pAxis->solveRefInheritance(apply); 
     
    21021880      CScalar* pScalar = CScalar::get(*it); 
    21031881      if (context->hasClient && !context->hasServer) 
    2104 //     if (context->hasClient) 
    21051882      { 
    21061883        pScalar->solveRefInheritance(apply); 
  • XIOS/dev/dev_olga/src/node/grid.hpp

    r1136 r1144  
    9191         StdSize  getDataSize(void) const; 
    9292 
    93          /// Entrées-sorties de champs /// 
     93         /// Entrées-sorties de champs  
    9494         template <int n> 
    9595         void inputField(const CArray<double,n>& field, CArray<double,1>& stored) const; 
    9696         template <int n> 
    97          void outputField(const CArray<double,1>& stored, CArray<double,n>& field) const; 
    98  
    99          void outputField(int rank, const CArray<double,1>& stored, double* field); 
    100          void inputField(int rank, const double* const field, CArray<double,1>& stored); 
    101  
    102          void outputCompressedField(int rank, const CArray<double,1>& stored, double* field); 
     97         void outputField(const CArray<double,1>& stored, CArray<double,n>& field) const;       
    10398 
    10499         virtual void parse(xml::CXMLNode& node); 
     
    129124         static CGrid* cloneGrid(const StdString& idNewGrid, CGrid* gridSrc); 
    130125 
    131       public: 
    132  
    133          /// Entrées-sorties de champs (interne) /// 
    134          void storeField_arr(const double* const data, CArray<double,1>& stored) const; 
    135          void restoreField_arr(const CArray<double,1>& stored, double* const data) const; 
    136  
    137          /// Traitements protégés /// 
     126      public:             
    138127         void computeIndexServer(void); 
    139128         void computeIndex(void); 
    140129         void computeIndexScalarGrid(); 
    141          void computeCompressedIndex(); 
    142130         void computeWrittenIndex(); 
    143131 
     
    188176         std::vector<int> getGlobalDimension(); 
    189177         bool isScalarGrid() const; 
    190          std::vector<int> getAxisPositionInGrid() const; 
    191178 
    192179         bool doGridHaveDataToWrite(); 
     
    261248        template<int N> 
    262249        void modifyGridMaskSize(CArray<bool,N>& gridMask, const std::vector<int>& eachDimSize, bool newValue); 
     250 
     251        void storeField_arr(const double* const data, CArray<double, 1>& stored) const; 
     252        void restoreField_arr(const CArray<double, 1>& stored, double* const data) const; 
    263253 
    264254        void setVirtualDomainGroup(CDomainGroup* newVDomainGroup); 
  • XIOS/dev/dev_olga/src/node/scalar.cpp

    r976 r1144  
    8686  } 
    8787 
    88   /*! 
    89     Check the validity of all transformations applied on scalar 
    90   This functions is called AFTER all inherited attributes are solved 
    91   */ 
    92   void CScalar::checkTransformations() 
    93   { 
    94     TransMapTypes::const_iterator itb = transformationMap_.begin(), it, 
    95                                   ite = transformationMap_.end(); 
    96 //    for (it = itb; it != ite; ++it) 
    97 //    { 
    98 //      (it->second)->checkValid(this); 
    99 //    } 
    100   } 
    101  
    10288  void CScalar::duplicateTransformation(CScalar* src) 
    10389  { 
  • XIOS/dev/dev_olga/src/node/scalar.hpp

    r888 r1144  
    8181 
    8282         private: 
    83             TransMapTypes transformationMap_; 
    84             void checkTransformations(); 
     83            TransMapTypes transformationMap_;             
    8584            void setTransformations(const TransMapTypes&); 
    8685 
  • XIOS/dev/dev_olga/src/transformation/axis_algorithm_zoom.cpp

    r1129 r1144  
    104104correct index be extracted 
    105105*/ 
    106 void CAxisAlgorithmZoom::updateAxisDestinationMask() 
    107 { 
    108   StdSize niMask = axisDest_->mask.numElements(); 
    109   StdSize iBeginMask = axisDest_->begin.getValue(); 
    110   StdSize globalIndexMask = 0; 
    111   TransformationIndexMap& transMap = this->transformationMapping_[0]; 
    112   TransformationIndexMap::const_iterator ite = (transMap).end(); 
    113   for (StdSize idx = 0; idx < niMask; ++idx) 
    114   { 
    115     globalIndexMask = iBeginMask + idx; 
    116     if (transMap.find(globalIndexMask) == ite) 
    117       (axisDest_->mask)(idx) = false; 
    118   } 
    119 } 
     106// void CAxisAlgorithmZoom::updateAxisDestinationMask() 
     107// { 
     108//   StdSize niMask = axisDest_->mask.numElements(); 
     109//   StdSize iBeginMask = axisDest_->begin.getValue(); 
     110//   StdSize globalIndexMask = 0; 
     111//   TransformationIndexMap& transMap = this->transformationMapping_[0]; 
     112//   TransformationIndexMap::const_iterator ite = (transMap).end(); 
     113//   for (StdSize idx = 0; idx < niMask; ++idx) 
     114//   { 
     115//     globalIndexMask = iBeginMask + idx; 
     116//     if (transMap.find(globalIndexMask) == ite) 
     117//       (axisDest_->mask)(idx) = false; 
     118//   } 
     119// } 
    120120 
    121121} 
  • XIOS/dev/dev_olga/src/transformation/axis_algorithm_zoom.hpp

    r933 r1144  
    3535 
    3636private: 
    37   void updateAxisDestinationMask(); 
     37  // void updateAxisDestinationMask(); 
    3838  void updateZoom(); 
    3939 
  • XIOS/dev/dev_olga/src/transformation/domain_algorithm_zoom.cpp

    r1129 r1144  
    132132correct index be extracted 
    133133*/ 
    134 void CDomainAlgorithmZoom::updateDomainDestinationMask() 
    135 { 
    136   int niMask     = domainDest_->ni.getValue(); 
    137   int iBeginMask = domainDest_->ibegin.getValue(); 
    138   int njMask     = domainDest_->nj.getValue(); 
    139   int jBeginMask = domainDest_->jbegin.getValue(); 
    140   int niGlob = domainDest_->ni_glo.getValue(); 
    141   int globalIndexMask = 0; 
     134// void CDomainAlgorithmZoom::updateDomainDestinationMask() 
     135// { 
     136//   int niMask     = domainDest_->ni.getValue(); 
     137//   int iBeginMask = domainDest_->ibegin.getValue(); 
     138//   int njMask     = domainDest_->nj.getValue(); 
     139//   int jBeginMask = domainDest_->jbegin.getValue(); 
     140//   int niGlob = domainDest_->ni_glo.getValue(); 
     141//   int globalIndexMask = 0; 
    142142 
    143   TransformationIndexMap& transMap = this->transformationMapping_[0]; 
    144   TransformationIndexMap::const_iterator ite = (transMap).end(); 
    145   for (int j = 0; j < njMask; ++j) 
    146   { 
    147     for (int i = 0; i < niMask; ++i) 
    148     { 
    149       globalIndexMask = (j+jBeginMask) * niGlob + (i + iBeginMask); 
    150       if (transMap.find(globalIndexMask) == ite) 
    151         (domainDest_->mask_1d)(i+j*niMask) = false; 
    152     } 
    153   } 
    154 } 
     143//   TransformationIndexMap& transMap = this->transformationMapping_[0]; 
     144//   TransformationIndexMap::const_iterator ite = (transMap).end(); 
     145//   for (int j = 0; j < njMask; ++j) 
     146//   { 
     147//     for (int i = 0; i < niMask; ++i) 
     148//     { 
     149//       globalIndexMask = (j+jBeginMask) * niGlob + (i + iBeginMask); 
     150//       if (transMap.find(globalIndexMask) == ite) 
     151//         (domainDest_->mask_1d)(i+j*niMask) = false; 
     152//     } 
     153//   } 
     154// } 
    155155 
    156156} 
  • XIOS/dev/dev_olga/src/transformation/domain_algorithm_zoom.hpp

    r933 r1144  
    3636 
    3737private: 
    38   void updateDomainDestinationMask(); 
     38  // void updateDomainDestinationMask(); 
    3939  void updateZoom(); 
    4040 
Note: See TracChangeset for help on using the changeset viewer.