Changeset 852


Ignore:
Timestamp:
05/18/16 15:15:32 (6 years ago)
Author:
ymipsl
Message:

remapper : Fix problem in parallel when number of cell to insert is to small on some process due to masked area.

YM

File:
1 edited

Legend:

Unmodified
Added
Removed
  • XIOS/trunk/extern/remap/src/parallel_tree.cpp

    r812 r852  
    286286        int nbSampleNodes = 2*ipow(MAX_NODE_SZ + 1, assignLevel); 
    287287 
     288 
     289  long int nb1, nb2, nb, nbTot ; 
     290  nb1=node.size() ; nb2=node.size() ; 
     291  nb=nb1+nb2 ; 
     292  MPI_Allreduce(&nb, &nbTot, 1, MPI_LONG, MPI_SUM, communicator) ; 
     293  int commSize ; 
     294  MPI_Comm_size(communicator,&commSize) ; 
     295   
    288296        // make multiple of two 
    289297        nbSampleNodes /= 2; 
    290298        nbSampleNodes *= 2; 
     299  assert( nbTot > nbSampleNodes*commSize) ; 
     300     
     301  int nbSampleNodes1 = nbSampleNodes * (nb1*commSize)/(1.*nbTot) +1 ; 
     302  int nbSampleNodes2 = nbSampleNodes * (nb2*commSize)/(1.*nbTot) +1 ; 
     303   
    291304 
    292305//      assert(node.size() > nbSampleNodes); 
    293306//      assert(node2.size() > nbSampleNodes); 
    294         assert(node.size() + node2.size() > nbSampleNodes); 
    295         vector<Node> sampleNodes; sampleNodes.reserve(nbSampleNodes); 
     307//      assert(node.size() + node2.size() > nbSampleNodes); 
     308        vector<Node> sampleNodes; sampleNodes.reserve(nbSampleNodes1+nbSampleNodes2); 
    296309 
    297310        vector<int> randomArray1(node.size()); 
     
    300313        randomizeArray(randomArray2); 
    301314 
    302          
     315/*       
    303316        int s1,s2 ; 
    304317         
     
    318331          s2=nbSampleNodes/2 ; 
    319332        } 
    320         for (int i = 0; i <s1; i++) sampleNodes.push_back(Node(node[randomArray1[i]].centre,  node[randomArray1[i]].radius, NULL)); 
    321         for (int i = 0; i <s2; i++)  sampleNodes.push_back(Node(node2[randomArray2[i]].centre, node2[randomArray2[i]].radius, NULL)); 
     333*/ 
     334        for (int i = 0; i <nbSampleNodes1; i++) sampleNodes.push_back(Node(node[randomArray1[i]].centre,  node[randomArray1[i]].radius, NULL)); 
     335        for (int i = 0; i <nbSampleNodes2; i++) sampleNodes.push_back(Node(node2[randomArray2[i]].centre, node2[randomArray2[i]].radius, NULL)); 
    322336 
    323337/*           
Note: See TracChangeset for help on using the changeset viewer.