# Diff of /branches/diaplayground/ripley/src/Brick.cpp

revision 4696 by jfenwick, Wed Feb 19 07:29:50 2014 UTC revision 4703 by jfenwick, Fri Feb 21 00:55:31 2014 UTC
# Line 2877  namespace Line 2877  namespace
2877          {                  {
2878              arr[(x+r)+(y+r)*(r*2+1)+(z+r)*(r*2+1)*(r*2+1)]=common*exp(-(x*x+y*y+z*z)/(2*sigma*sigma));              arr[(x+r)+(y+r)*(r*2+1)+(z+r)*(r*2+1)*(r*2+1)]=common*exp(-(x*x+y*y+z*z)/(2*sigma*sigma));
2879              total+=arr[(x+r)+(y+r)*(r*2+1)+(z+r)*(r*2+1)*(r*2+1)];              total+=arr[(x+r)+(y+r)*(r*2+1)+(z+r)*(r*2+1)*(r*2+1)];
2880    cerr <<     arr[(x+r)+(y+r)*(r*2+1)+(z+r)*(r*2+1)*(r*2+1)] << " ";
2881          }          }
2882    cerr << endl;
2883          }          }
2884      }      }
2885      double invtotal=1/total;      double invtotal=1/total;
# Line 3055  escript::Data Brick::randomFillWorker(co Line 3057  escript::Data Brick::randomFillWorker(co
3057      dim_t Z=m_mpiInfo->rank/(m_NX[0]*m_NX[1]);      dim_t Z=m_mpiInfo->rank/(m_NX[0]*m_NX[1]);
3058  #endif      #endif
3059
3060  /*
3061      // if we wanted to test a repeating pattern      // if we wanted to test a repeating pattern
3062      size_t basex=0;      size_t basex=0;
3063      size_t basey=0;      size_t basey=0;
# Line 3063  escript::Data Brick::randomFillWorker(co Line 3065  escript::Data Brick::randomFillWorker(co
3065  #ifdef ESYS_MPI      #ifdef ESYS_MPI
3066      basex=X*m_gNE[0]/m_NX[0];      basex=X*m_gNE[0]/m_NX[0];
3067      basey=Y*m_gNE[1]/m_NX[1];      basey=Y*m_gNE[1]/m_NX[1];
3068      basez=Z*m_gNE[2]/m_NX[2];          basez=Z*m_gNE[2]/m_NX[2];
3069
3070    cout << "basex=" << basex << " basey=" << basey << " basez=" << basez << endl;
3071
3072  #endif      #endif
3073      if (seed==0)      if (seed==0)
3074      {      {
3075      seed=2; // since we are using the seed parameter as the spacing and 0 spacing causes an exception      seed=2; // since we are using the seed parameter as the spacing and 0 spacing causes an exception
3076      }      }
3077      esysUtils::patternFillArray(1, ext[0],ext[1],ext[2], src, 4, basex, basey, basez, numvals);      esysUtils::patternFillArray(1, ext[0],ext[1],ext[2], src, 4, basex, basey, basez, numvals);
3078  */
3079
3080    for (int z=0;z<ext[2];++z)
3081    {
3082        for (int y=0;y<ext[1];++y)
3083        {
3084        for (int x=0;x<ext[0];++x)
3085        {
3086            cout << "(";
3087            for (int p=0;p<numvals;++p)
3088            {
3089            cout << src[(x+y*ext[0]+z*ext[0]*ext[1])*numvals+p] << ", ";
3090            }
3091            cout << ") ";
3092
3093        }
3094        cout << endl;
3095        }
3096        cout << endl;
3097    }
3098
3099
3100
3101  /*  /*
# Line 3111  for (int i=0;i<ext[0]*ext[1]*ext[2];) Line 3136  for (int i=0;i<ext[0]*ext[1]*ext[2];)
3136
3137
3138      block.copyAllToBuffer(src);      block.copyAllToBuffer(src);
3139
3140
3141    for (size_t j=0;j<incoms.size();++j)
3142    {
3143        message& m=incoms[j];
3144    for (int i=0;i<block.getBuffSize(m.srcbuffid);++i)
3145    {
3146        block.getInBuffer(m.srcbuffid)[i]=-42;
3147    }
3148    }
3149
3150
3151      int comserr=0;          int comserr=0;
# Line 3125  for (int i=0;i<ext[0]*ext[1]*ext[2];) Line 3160  for (int i=0;i<ext[0]*ext[1]*ext[2];)
3160      {      {
3161      message& m=outcoms[i];      message& m=outcoms[i];
3162      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++));
3163    if (m.destID==1)
3164    {
3165    cout << "Sending to 1\n";
3166    for (int i=0;i<block.getBuffSize(m.srcbuffid);++i)
3167    {
3168        cout << block.getOutBuffer(m.srcbuffid)[i] << " ";
3169    }
3170    cout << endl;
3171    }
3172      }          }
3173
3174      if (!comserr)      if (!comserr)
# Line 3142  for (int i=0;i<ext[0]*ext[1]*ext[2];) Line 3186  for (int i=0;i<ext[0]*ext[1]*ext[2];)
3186
3187      block.copyUsedFromBuffer(src);      block.copyUsedFromBuffer(src);
3188
3189        for (size_t i=0;i<incoms.size();++i)
3190        {
3191        message& m=incoms[i];
3192        cout << "From" <<  m.sourceID << "Recv " << (int)m.destbuffid << endl;
3193        for (int j=0;j<block.getBuffSize(m.destbuffid);++j)
3194        {
3195            cout << block.getInBuffer(m.destbuffid)[j] << " ";
3196        }
3197        cout << endl;
3198        }
3199
3200
3201
3202
3203

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