/[escript]/trunk/escript/src/DataLazy.cpp
ViewVC logotype

Diff of /trunk/escript/src/DataLazy.cpp

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

revision 2157 by jfenwick, Mon Dec 15 06:05:58 2008 UTC revision 2166 by jfenwick, Tue Dec 16 06:08:02 2008 UTC
# Line 977  DataLazy::resolveNP1OUT_P(ValueType& v, Line 977  DataLazy::resolveNP1OUT_P(ValueType& v,
977      // since we can't write the result over the input, we need a result offset further along      // since we can't write the result over the input, we need a result offset further along
978    size_t subroffset;    size_t subroffset;
979    const ValueType* vleft=m_left->resolveSample(v,offset+m_left->m_samplesize,sampleNo,subroffset);    const ValueType* vleft=m_left->resolveSample(v,offset+m_left->m_samplesize,sampleNo,subroffset);
980  LAZYDEBUG(cerr << "from=" << offset+m_left->m_samplesize << " to=" << subroffset << " ret=" << roffset << endl;)  LAZYDEBUG(cerr << "srcsamplesize=" << offset+m_left->m_samplesize << " beg=" << subroffset << endl;)
981    LAZYDEBUG(cerr << "Offset for 5800=" << getPointOffset(5800/getNumDPPSample(),5800%getNumDPPSample()) << endl;)
982    roffset=offset;    roffset=offset;
983    size_t loop=0;    size_t loop=0;
984    size_t numsteps=(m_readytype=='E')?getNumDPPSample():1;    size_t numsteps=(m_readytype=='E')?getNumDPPSample():1;
985    size_t step=getNoValues();    size_t outstep=getNoValues();
986      size_t instep=m_left->getNoValues();
987    LAZYDEBUG(cerr << "instep=" << instep << " outstep=" << outstep<< " numsteps=" << numsteps << endl;)
988    switch (m_op)    switch (m_op)
989    {    {
990      case TRACE:      case TRACE:
991      for (loop=0;loop<numsteps;++loop)      for (loop=0;loop<numsteps;++loop)
992      {      {
993              DataMaths::trace(*vleft,m_left->getShape(),subroffset, v,getShape(),offset,m_axis_offset);  size_t zz=sampleNo*getNumDPPSample()+loop;
994          subroffset+=step;  if (zz==5800)
995          offset+=step;  {
996    LAZYDEBUG(cerr << "point=" <<  zz<< endl;)
997    LAZYDEBUG(cerr << "Input to  trace=" << DataTypes::pointToString(*vleft,m_left->getShape(),subroffset,"") << endl;)
998    LAZYDEBUG(cerr << "Offset for point=" << getPointOffset(5800/getNumDPPSample(),5800%getNumDPPSample()) << " vs ";)
999    LAZYDEBUG(cerr << subroffset << endl;)
1000    LAZYDEBUG(cerr << "output=" << offset << endl;)
1001    }
1002                DataMaths::trace(*vleft,m_left->getShape(),subroffset, v ,getShape(),offset,m_axis_offset);
1003    if (zz==5800)
1004    {
1005    LAZYDEBUG(cerr << "Result of trace=" << DataTypes::pointToString(v,getShape(),offset,"") << endl;)
1006    }
1007            subroffset+=instep;
1008            offset+=outstep;
1009      }      }
1010      break;      break;
1011      case TRANS:      case TRANS:
1012      for (loop=0;loop<numsteps;++loop)      for (loop=0;loop<numsteps;++loop)
1013      {      {
1014              DataMaths::transpose(*vleft,m_left->getShape(),subroffset, v,getShape(),offset,m_axis_offset);              DataMaths::transpose(*vleft,m_left->getShape(),subroffset, v,getShape(),offset,m_axis_offset);
1015          subroffset+=step;          subroffset+=instep;
1016          offset+=step;          offset+=outstep;
1017      }      }
1018      break;      break;
1019      default:      default:
# Line 1357  LAZYDEBUG(cout << "Total number of sampl Line 1373  LAZYDEBUG(cout << "Total number of sampl
1373    for (sample=0;sample<totalsamples;++sample)    for (sample=0;sample<totalsamples;++sample)
1374    {    {
1375        if (sample==0)  {ENABLEDEBUG}        if (sample==0)  {ENABLEDEBUG}
1376    
1377    //       if (sample==5800/getNumDPPSample())  {ENABLEDEBUG}
1378  LAZYDEBUG(cout << "################################# " << sample << endl;)  LAZYDEBUG(cout << "################################# " << sample << endl;)
1379  #ifdef _OPENMP  #ifdef _OPENMP
1380      res=resolveSample(v,threadbuffersize*omp_get_thread_num(),sample,resoffset);      res=resolveSample(v,threadbuffersize*omp_get_thread_num(),sample,resoffset);
# Line 1369  LAZYDEBUG(cerr<< "Copying sample#" << sa Line 1387  LAZYDEBUG(cerr<< "Copying sample#" << sa
1387  LAZYDEBUG(cerr << "offset=" << outoffset << " from offset=" << resoffset << " " << m_samplesize << " doubles" << endl;)  LAZYDEBUG(cerr << "offset=" << outoffset << " from offset=" << resoffset << " " << m_samplesize << " doubles" << endl;)
1388      for (unsigned int i=0;i<m_samplesize;++i,++outoffset,++resoffset)   // copy values into the output vector      for (unsigned int i=0;i<m_samplesize;++i,++outoffset,++resoffset)   // copy values into the output vector
1389      {      {
1390  // LAZYDEBUG(cerr << "outoffset=" << outoffset << " resoffset=" << resoffset << endl;)  LAZYDEBUG(cerr << "outoffset=" << outoffset << " resoffset=" << resoffset << " " << (*res)[resoffset]<< endl;)
1391      resvec[outoffset]=(*res)[resoffset];      resvec[outoffset]=(*res)[resoffset];
1392      }      }
1393  LAZYDEBUG(cerr << DataTypes::pointToString(resvec,getShape(),outoffset-m_samplesize+DataTypes::noValues(getShape()),"Final result:") << endl;)  LAZYDEBUG(cerr << DataTypes::pointToString(resvec,getShape(),outoffset-m_samplesize+DataTypes::noValues(getShape()),"Final result:") << endl;)

Legend:
Removed from v.2157  
changed lines
  Added in v.2166

  ViewVC Help
Powered by ViewVC 1.1.26