Ignore:
Timestamp:
03/23/16 16:11:01 (8 years ago)
Author:
mhnguyen
Message:

Refactoring transformation code

+) On exchanging information during transformation, not only global index are sent but also local index
+) Correct a bug in distributed hash table (dht)
+) Add new type for dht
+) Clean up some redundant codes

Test
+) On Curie
+) Every test passes
+) Code runs faster in some cases (up to 30%)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • XIOS/trunk/src/client_server_mapping.hpp

    r598 r829  
    1313#include "array_new.hpp" 
    1414#include "mpi.hpp" 
     15#include <boost/unordered_map.hpp> 
    1516 
    1617namespace xios { 
     
    2324class CClientServerMapping 
    2425{ 
     26public: 
     27  typedef boost::unordered_map<int, std::vector<size_t> > GlobalIndexMap; 
     28  typedef std::map<int, std::vector<int> > LocalIndexMap; 
    2529  public: 
    2630    /** Default constructor */ 
     
    3337    virtual void computeServerIndexMapping(const CArray<size_t,1>& globalIndexOnClient) = 0; 
    3438 
    35 //    // In case of computing local index on client sent to server 
     39//    // Simple case, global index on client and index on servers 
    3640//    virtual void computeServerIndexMapping(const CArray<size_t,1>& globalIndexOnClient, 
    37 //                                           const CArray<int,1>& localIndexOnClient) = 0; 
    38  
    39     // Simple case, global index on client and index on servers 
    40     virtual void computeServerIndexMapping(const CArray<size_t,1>& globalIndexOnClient, 
    41                                            const std::vector<CArray<size_t,1>* >& globalIndexOnServer); 
     41//                                           const std::vector<CArray<size_t,1>* >& globalIndexOnServer); 
    4242 
    4343    static std::map<int,int> computeConnectedClients(int nbServer, int nbClient, 
     
    4545                                                     const std::vector<int>& connectedServerRank); 
    4646 
    47     const std::map<int, std::vector<size_t> >& getGlobalIndexOnServer() const; 
    48     const std::map<int, std::vector<int> >& getLocalIndexSendToServer() const; 
     47    const GlobalIndexMap& getGlobalIndexOnServer() const; 
     48//    const LocalIndexMap& getLocalIndexSendToServer() const; 
    4949 
    5050  protected: 
    51     void defaultComputeServerIndexMapping(const CArray<size_t,1>& globalIndexOnClient, 
    52                                           const std::vector<CArray<size_t,1>* >& globalIndexOnServer, 
    53                                           const CArray<int,1>* localIndexOnClient = 0); 
     51//    void defaultComputeServerIndexMapping(const CArray<size_t,1>& globalIndexOnClient, 
     52//                                          const std::vector<CArray<size_t,1>* >& globalIndexOnServer, 
     53//                                          const CArray<int,1>* localIndexOnClient = 0); 
    5454 
    5555  protected: 
    5656    //! Global index of data on SERVER, which are calculated by client(s) 
    57     std::map<int, std::vector<size_t> > indexGlobalOnServer_; 
     57    GlobalIndexMap indexGlobalOnServer_; 
    5858 
    5959    //! Index of the local data which will be sent to the corresponding server(s) 
    60     std::map<int, std::vector<int> >  localIndexSend2Server_; 
     60//    LocalIndexMap  localIndexSend2Server_; 
    6161 
    6262    //!< Number of clients connected to a server 
Note: See TracChangeset for help on using the changeset viewer.