source: XIOS/trunk/src/client_server_mapping_distributed.cpp @ 835

Last change on this file since 835 was 835, checked in by mhnguyen, 8 years ago

Exposing some functions to Fortran interface

+) Allow add axis and domain into grid with Fortran interface
+) Remove some redundant code

Test
+) On Curie
+) test_client passes

File size: 1.5 KB
RevLine 
[569]1/*!
2   \file client_server_mapping.hpp
3   \author Ha NGUYEN
4   \since 27 Feb 2015
[829]5   \date 16 Mars 2016
[569]6
7   \brief Mapping between index client and server.
8   Clients pre-calculate all information of server distribution.
9 */
[568]10#include "client_server_mapping_distributed.hpp"
11#include <limits>
12#include <boost/functional/hash.hpp>
[584]13#include "utils.hpp"
[720]14#include "mpi_tag.hpp"
[568]15
16namespace xios
17{
18
19CClientServerMappingDistributed::CClientServerMappingDistributed(const boost::unordered_map<size_t,int>& globalIndexOfServer,
[585]20                                                                 const MPI_Comm& clientIntraComm, bool isDataDistributed)
[829]21  : CClientServerMapping(), ccDHT_(0)
[568]22{
[721]23  ccDHT_ = new CClientClientDHTInt(globalIndexOfServer,
[835]24                                   clientIntraComm);
[568]25}
26
27CClientServerMappingDistributed::~CClientServerMappingDistributed()
28{
[720]29  if (0 != ccDHT_) delete ccDHT_;
[569]30}
[568]31
[569]32/*!
33   Compute mapping global index of server which client sends to.
34   \param [in] globalIndexOnClient global index client has
35*/
[584]36void CClientServerMappingDistributed::computeServerIndexMapping(const CArray<size_t,1>& globalIndexOnClient)
[568]37{
[721]38  ccDHT_->computeIndexInfoMapping(globalIndexOnClient);
[829]39  const boost::unordered_map<size_t,int>& infoIndexMap = (ccDHT_->getInfoIndexMap());
40  boost::unordered_map<size_t,int>::const_iterator it = infoIndexMap.begin(), ite = infoIndexMap.end();
[568]41  for (; it != ite; ++it)
42  {
[829]43    indexGlobalOnServer_[it->second].push_back(it->first);
[568]44  }
45}
46
47}
Note: See TracBrowser for help on using the repository browser.