/[escript]/trunk/ripley/src/Rectangle.cpp
ViewVC logotype

Diff of /trunk/ripley/src/Rectangle.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 4687 by jfenwick, Wed Feb 19 00:03:29 2014 UTC revision 4696 by jfenwick, Wed Feb 19 07:29:50 2014 UTC
# Line 2042  escript::Data Rectangle::randomFillWorke Line 2042  escript::Data Rectangle::randomFillWorke
2042      }      }
2043    
2044      double* src=new double[ext[0]*ext[1]*numvals];      double* src=new double[ext[0]*ext[1]*numvals];
2045      esysUtils::randomFillArray(seed, src, ext[0]*ext[1]*numvals);            esysUtils::randomFillArray(seed, src, ext[0]*ext[1]*numvals);  
2046        
2047    
2048    
2049  #ifdef ESYS_MPI  #ifdef ESYS_MPI
2050      if ((internal[0]<5) || (internal[1]<5))      if ((internal[0]<5) || (internal[1]<5))
# Line 2054  escript::Data Rectangle::randomFillWorke Line 2056  escript::Data Rectangle::randomFillWorke
2056      dim_t X=m_mpiInfo->rank%m_NX[0];      dim_t X=m_mpiInfo->rank%m_NX[0];
2057      dim_t Y=m_mpiInfo->rank%(m_NX[0]*m_NX[1])/m_NX[0];      dim_t Y=m_mpiInfo->rank%(m_NX[0]*m_NX[1])/m_NX[0];
2058  #endif        #endif      
2059        
2060    /*    
2061        // if we wanted to test a repeating pattern
2062        size_t basex=0;
2063        size_t basey=0;
2064    #ifdef ESYS_MPI    
2065        basex=X*m_gNE[0]/m_NX[0];
2066        basey=Y*m_gNE[1]/m_NX[1];
2067    #endif
2068            
2069        esysUtils::patternFillArray2D(ext[0], ext[1], src, 4, basex, basey, numvals);
2070    */    
2071            
2072        
2073  #ifdef ESYS_MPI    #ifdef ESYS_MPI  
# Line 2078  escript::Data Rectangle::randomFillWorke Line 2091  escript::Data Rectangle::randomFillWorke
2091      grid.generateInNeighbours(X, Y, incoms);      grid.generateInNeighbours(X, Y, incoms);
2092      grid.generateOutNeighbours(X, Y, outcoms);      grid.generateOutNeighbours(X, Y, outcoms);
2093            
2094      block.copyAllToBuffer(src);          block.copyAllToBuffer(src);  
2095    
2096    // for (int i=0;i<9;++i)
2097    // {
2098    //     if (i!=4)
2099    //     {
2100    //       for (int j=0;j<block.getBuffSize(i);++j)
2101    //       {
2102    //    block.getOutBuffer(i)[j]=100+i;
2103    //       }
2104    //     }
2105    // }
2106        
2107            
2108      int comserr=0;          int comserr=0;    
2109      for (size_t i=0;i<incoms.size();++i)      for (size_t i=0;i<incoms.size();++i)
# Line 2086  escript::Data Rectangle::randomFillWorke Line 2111  escript::Data Rectangle::randomFillWorke
2111          message& m=incoms[i];          message& m=incoms[i];
2112          comserr|=MPI_Irecv(block.getInBuffer(m.destbuffid), block.getBuffSize(m.destbuffid) , MPI_DOUBLE, m.sourceID, m.tag, m_mpiInfo->comm, reqs+(rused++));          comserr|=MPI_Irecv(block.getInBuffer(m.destbuffid), block.getBuffSize(m.destbuffid) , MPI_DOUBLE, m.sourceID, m.tag, m_mpiInfo->comm, reqs+(rused++));
2113          block.setUsed(m.destbuffid);          block.setUsed(m.destbuffid);
2114        
2115      }      }
2116    
2117      for (size_t i=0;i<outcoms.size();++i)      for (size_t i=0;i<outcoms.size();++i)
2118      {      {
2119          message& m=outcoms[i];          message& m=outcoms[i];
2120    // cout << "Sending " <<    (int)m.srcbuffid << " with tag " << m.tag << endl;
2121          comserr|=MPI_Isend(block.getOutBuffer(m.srcbuffid), block.getBuffSize(m.srcbuffid) , MPI_DOUBLE, m.destID, m.tag, m_mpiInfo->comm, reqs+(rused++));          comserr|=MPI_Isend(block.getOutBuffer(m.srcbuffid), block.getBuffSize(m.srcbuffid) , MPI_DOUBLE, m.destID, m.tag, m_mpiInfo->comm, reqs+(rused++));
2122    // for (int i=0;i<block.getBuffSize(m.srcbuffid);++i)
2123    // {
2124    //     cout << block.getOutBuffer(m.srcbuffid)[i] << " ";
2125    // }
2126    // cout << endl;    
2127      }          }    
2128            
2129      if (!comserr)      if (!comserr)
2130      {          {    
2131          comserr=MPI_Waitall(rused, reqs, stats);          comserr=MPI_Waitall(rused, reqs, stats);
2132        
2133        
2134    //     for (size_t i=0;i<incoms.size();++i)
2135    //     {
2136    //         message& m=incoms[i];      
2137    // cout << "Gettinging " <<     (int)m.destbuffid << " with tag " << m.tag << endl;
2138    // for (int i=0;i<block.getBuffSize(m.destbuffid);++i)
2139    // {
2140    //     cout << block.getInBuffer(m.destbuffid)[i] << " ";
2141    // }
2142    // cout << endl;
2143    //  
2144    //     }    
2145        
2146      }      }
2147    
2148      if (comserr)      if (comserr)

Legend:
Removed from v.4687  
changed lines
  Added in v.4696

  ViewVC Help
Powered by ViewVC 1.1.26