Ignore:
Timestamp:
07/26/22 09:50:48 (2 years ago)
Author:
jderouillat
Message:

Move in a new method of CLocalView the management of a without redundancy full view connector (used in hash computation of elements)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • XIOS3/trunk/src/distribution/local_view.cpp

    r2267 r2385  
    33#include "array_new.hpp" 
    44#include "remote_connector.hpp" 
     5#include "grid_transform_connector.hpp" 
    56 
    67namespace xios 
     
    3839    connector->transferToServer(ind, client, event, message) ; 
    3940  } 
     41   
     42  void CLocalView::createWithoutRedundancyFullViewConnector( int globalSize, MPI_Comm comm_file, shared_ptr<CGridTransformConnector>& gridTransformConnector, CArray<size_t,1>& globalIndex ) 
     43  { 
     44    int comm_file_rank(0); 
     45    MPI_Comm_rank( comm_file, &comm_file_rank ); 
     46    int comm_file_size(1); 
     47    MPI_Comm_size( comm_file, &comm_file_size ); 
    4048 
     49    vector<shared_ptr<CLocalView>> srcViews; 
     50    shared_ptr<CLocalView> srcView = shared_from_this(); 
     51    srcViews.push_back( srcView ); 
     52           
     53    // Compute a without redundancy element FULL view to enable a consistent hash computation 
     54    vector<shared_ptr<CLocalView>> remoteViews; 
     55    shared_ptr<CLocalView> remoteView; 
     56    // define the remote view without redundancy (naive distribution of the remote view) 
     57    int localSize = globalSize/comm_file_size; 
     58    if ( (comm_file_rank==comm_file_size-1) && (localSize*comm_file_size != globalSize ) ) 
     59      localSize += globalSize-localSize*comm_file_size; 
     60    globalIndex.resize( localSize ); 
     61    CArray<int,1> index( localSize ); 
     62    for (int iloc=0; iloc<localSize ; iloc++ ) 
     63      { 
     64        globalIndex(iloc) = comm_file_rank*(globalSize/comm_file_size) + iloc; 
     65        index(iloc) = iloc; 
     66      } 
     67    shared_ptr<CLocalElement> localElement = make_shared<CLocalElement>(comm_file_rank, globalSize, globalIndex) ; 
     68    localElement->addView(CElementView::FULL, index) ; 
     69    remoteView = localElement->getView(CElementView::FULL) ; 
     70    remoteViews.push_back( remoteView ); 
     71         
     72    // Compute the connector between current and without redundancy FULL views 
     73    gridTransformConnector = make_shared<CGridTransformConnector>(srcViews, remoteViews, comm_file ) ; 
     74    gridTransformConnector->computeConnector(true) ; // eliminateRedondant = true 
     75 
     76  } 
    4177 
    4278} 
Note: See TracChangeset for help on using the changeset viewer.