Skip to content
  • Mark OLESEN's avatar
    ENH: additional MPI gather/scatter routines, globalIndex gather methods · b6539cd0
    Mark OLESEN authored
    - UPstream::mpiGather (MPI_Gather)   - used by Pstream::listGatherValues
    - UPstream::mpiScatter (MPI_Scatter) - used by Pstream::listScatterValues
    
      These are much simpler forms for gather/scatter of fixed-sized
      contiguous types data types (eg, primitives, simple pairs etc).
    
      In the gather form, creates a list of gathered values on the master
      process. The subranks have a list size of zero.
    
      Similarly, scatter will distribute a list of values to single values
      on each process.
    
      Instead of
    
          labelList sendSizes(Pstream::nProcs());
          sendSizes[Pstream::myProcNo()] = sendData.size();
          Pstream::gatherList(sendSizes);
    
      Can write
    
          const labelList sendSizes
          (
              UPstream::listGatherValues<label>(sendData.size())
          );
    
      // Less code, lower overhead and list can be const.
    
      For scattering an individual value only,
      instead of
    
          labelList someValues;
          if (Pstream::master()) someValu...
    b6539cd0