73   const Comm<int> &comm,      
 
   75   const ArrayView<const int> &sendCount,   
 
   77   const ArrayView<int> &recvCount          
 
   81   int nprocs = comm.getSize();
 
   82   int rank = comm.getRank();
 
   84   recvCount[rank] = sendCount[rank];
 
   89     RCP<CommRequest<int> > *requests = 
new RCP<CommRequest<int> > [nprocs];
 
   90     for (
int cnt = 0, i = 0; i < nprocs; i++) {
 
   93           requests[cnt++] = Teuchos::ireceive<int,int>(comm,
 
   94                                                      rcp(&(recvCount[i]),
false),
 
  101     Teuchos::barrier<int>(comm);
 
  104     for (
int i = 0; i < nprocs; i++) {
 
  107           Teuchos::readySend<int,int>(comm, sendCount[i], i);
 
  115       Teuchos::waitAll<int>(comm, arrayView(requests, nprocs-1));
 
  133                const ArrayView<const std::string> &sendBuf,
 
  134                const ArrayView<const int> &sendCount,
 
  135                ArrayRCP<std::string> &recvBuf,
 
  136                const ArrayView<int> &recvCount
 
  139   int nprocs = comm.getSize();
 
  140   int *newCount = 
new int [nprocs];
 
  141   memset(newCount, 0, 
sizeof(
int) * nprocs);
 
  142   ArrayView<const int> newSendCount(newCount, nprocs);
 
  144   size_t numStrings = sendBuf.size();
 
  148   for (
int p=0, i=0; !fail && p < nprocs; p++){
 
  149     for (
int c=0; !fail && c < sendCount[p]; c++, i++){
 
  150       size_t nchars = sendBuf[i].size();
 
  151       if (nchars > SCHAR_MAX)
 
  154         newCount[p] += nchars;
 
  156     newCount[p] += sendCount[p];
 
  157     numChars += newCount[p];
 
  161     throw std::runtime_error(
"id string length exceeds SCHAR_MAX");
 
  165     sbuf = 
new char [numChars];
 
  166   char *sbufptr = sbuf;
 
  168   ArrayView<const char> newSendBuf(sbuf, numChars);
 
  170   for (
size_t i=0; i < numStrings; i++){
 
  171     size_t nchars = sendBuf[i].size();
 
  172     *sbufptr++ = 
static_cast<char>(nchars);
 
  173     for (
size_t j=0; j < nchars; j++)
 
  174       *sbufptr++ = sendBuf[i][j];
 
  177   ArrayRCP<char> newRecvBuf;
 
  178   Array<int> newRecvCount(nprocs, 0);
 
  180   AlltoAllv<char>(comm, env, newSendBuf, newSendCount,
 
  181                   newRecvBuf, newRecvCount());
 
  186   char *inBuf = newRecvBuf.getRawPtr();
 
  188   int numNewStrings = 0;
 
  190   char *endChar = inBuf + newRecvBuf.size();
 
  191   while (buf < endChar){
 
  192     int slen = 
static_cast<int>(*buf++);
 
  198   std::string *newStrings = 
new std::string [numNewStrings];
 
  203   for (
int p=0; p < nprocs; p++){
 
  204     int nchars = newRecvCount[p];
 
  205     endChar = buf + nchars;
 
  206     while (buf < endChar){
 
  208       std::string nextString;
 
  209       for (
int i=0; i < slen; i++)
 
  210         nextString.push_back(*buf++);
 
  211       newStrings[next++] = nextString;
 
  216   recvBuf = arcp<std::string>(newStrings, 0, numNewStrings, 
true);
 
  223 #ifdef HAVE_TPETRA_INT_LONG_LONG 
  226               const Environment &env,
 
  227               const ArrayView<const unsigned long long> &sendBuf,
 
  228               const ArrayView<const int> &sendCount,
 
  229               ArrayRCP<unsigned long long> &recvBuf,  
 
  230               const ArrayView<int> &recvCount   
 
  233   const long long *sbuf =
 
  234     reinterpret_cast<const long long *
>(sendBuf.getRawPtr());
 
  235   ArrayView<const long long> newSendBuf(sbuf, sendBuf.size());
 
  236   ArrayRCP<long long> newRecvBuf;
 
  238   AlltoAllv<long long>(comm, env, newSendBuf, sendCount,
 
  239     newRecvBuf, recvCount);
 
  241   recvBuf = arcp_reinterpret_cast<
unsigned long long>(newRecvBuf);
 
  251               const ArrayView<const unsigned short> &sendBuf,
 
  252               const ArrayView<const int> &sendCount,
 
  253               ArrayRCP<unsigned short> &recvBuf,  
 
  254               const ArrayView<int> &recvCount   
 
  257   const short *sbuf = 
reinterpret_cast<const short *
>(sendBuf.getRawPtr());
 
  258   ArrayView<const short> newSendBuf(sbuf, sendBuf.size());
 
  259   ArrayRCP<short> newRecvBuf;
 
  261   AlltoAllv<short>(comm, env, newSendBuf, sendCount,
 
  262     newRecvBuf, recvCount);
 
  264   recvBuf = arcp_reinterpret_cast<
unsigned short>(newRecvBuf);
 
  273               const ArrayView<const unsigned char> &sendBuf,
 
  274               const ArrayView<const int> &sendCount,
 
  275               ArrayRCP<unsigned char> &recvBuf,      
 
  276               const ArrayView<int> &recvCount   
 
  279   const char *sbuf = 
reinterpret_cast<const char *
>(sendBuf.getRawPtr());
 
  280   ArrayView<const char> newSendBuf(sbuf, sendBuf.size());
 
  281   ArrayRCP<char> newRecvBuf;
 
  283   AlltoAllv<char>(comm, env, newSendBuf, sendCount,
 
  284     newRecvBuf, recvCount);
 
  286   recvBuf = arcp_reinterpret_cast<
unsigned char>(newRecvBuf);
 
void AlltoAllv(const Comm< int > &comm, const Environment &env, const ArrayView< const std::string > &sendBuf, const ArrayView< const int > &sendCount, ArrayRCP< std::string > &recvBuf, const ArrayView< int > &recvCount)
 
The user parameters, debug, timing and memory profiling output objects, and error checking methods...
 
static const std::string fail
 
Gathering definitions used in software development. 
 
Defines the Environment class. 
 
#define Z2_THROW_OUTSIDE_ERROR(env)
Throw an error returned from outside the Zoltan2 library. 
 
void AlltoAllCount(const Comm< int > &comm, const Environment &env, const ArrayView< const int > &sendCount, const ArrayView< int > &recvCount)
Each process sends a value to every process, an all-to-all. 
 
AlltoAll communication methods.