/[escript]/branches/schroedinger/escript/src/Data.cpp
ViewVC logotype

Diff of /branches/schroedinger/escript/src/Data.cpp

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

revision 1934 by jfenwick, Thu Oct 23 04:50:35 2008 UTC revision 1935 by jfenwick, Mon Oct 27 06:06:39 2008 UTC
# Line 461  Data::delay() Line 461  Data::delay()
461  }  }
462    
463  void  void
464    Data::delaySelf()
465    {
466      if (!isLazy())
467      {
468        m_data=(new DataLazy(m_data))->getPtr();
469      }
470    }
471    
472    void
473  Data::setToZero()  Data::setToZero()
474  {  {
475    if (isEmpty())    if (isEmpty())
476    {    {
477       throw DataException("Error - Operations not permitted on instances of DataEmpty.");       throw DataException("Error - Operations not permitted on instances of DataEmpty.");
478    }    }
479    {    m_data->setToZero();
     DataExpanded* temp=dynamic_cast<DataExpanded*>(m_data.get());  
     if (temp!=0) {  
        temp->setToZero();  
        return;  
     }  
   }  
   {  
     DataTagged* temp=dynamic_cast<DataTagged*>(m_data.get());  
     if (temp!=0) {  
       temp->setToZero();  
       return;  
     }  
   }  
   {  
     DataConstant* temp=dynamic_cast<DataConstant*>(m_data.get());  
     if (temp!=0) {  
       temp->setToZero();  
       return;  
     }  
   }  
   throw DataException("Error - Data can not be set to zero.");  
480  }  }
481    
482    
# Line 2875  Data::getDataAtOffset(DataTypes::ValueTy Line 2863  Data::getDataAtOffset(DataTypes::ValueTy
2863  {  {
2864      if (isLazy())      if (isLazy())
2865      {      {
2866      throw DataException("getDataAtOffset not permitted on lazy data.");      throw DataException("Programmer error - getDataAtOffset not permitted on lazy data (object is const which prevents resolving).");
2867      }      }
2868      return getReady()->getDataAtOffset(i);      return getReady()->getDataAtOffset(i);
2869  }  }
# Line 2884  Data::getDataAtOffset(DataTypes::ValueTy Line 2872  Data::getDataAtOffset(DataTypes::ValueTy
2872  DataTypes::ValueType::reference  DataTypes::ValueType::reference
2873  Data::getDataAtOffset(DataTypes::ValueType::size_type i)  Data::getDataAtOffset(DataTypes::ValueType::size_type i)
2874  {  {
2875      if (isLazy())  //     if (isLazy())
2876      {  //     {
2877      throw DataException("getDataAtOffset not permitted on lazy data.");  //  throw DataException("getDataAtOffset not permitted on lazy data.");
2878      }  //     }
2879        FORCERESOLVE;
2880      return getReady()->getDataAtOffset(i);      return getReady()->getDataAtOffset(i);
2881  }  }
2882    
# Line 2896  Data::getDataPoint(int sampleNo, int dat Line 2885  Data::getDataPoint(int sampleNo, int dat
2885  {  {
2886    if (!isReady())    if (!isReady())
2887    {    {
2888      throw DataException("Programmer error - getDataPoint() not permitted on Lazy Data.");      throw DataException("Programmer error - getDataPoint() not permitted on Lazy Data (object is const which prevents resolving).");
2889    }    }
2890    else    else
2891    {    {
# Line 2909  Data::getDataPoint(int sampleNo, int dat Line 2898  Data::getDataPoint(int sampleNo, int dat
2898  DataTypes::ValueType::reference  DataTypes::ValueType::reference
2899  Data::getDataPoint(int sampleNo, int dataPointNo)  Data::getDataPoint(int sampleNo, int dataPointNo)
2900  {  {
2901      FORCERESOLVE;
2902    if (!isReady())    if (!isReady())
2903    {    {
2904      throw DataException("Programmer error - getDataPoint() not permitted on Lazy Data.");      throw DataException("Programmer error - getDataPoint() not permitted on Lazy Data.");

Legend:
Removed from v.1934  
changed lines
  Added in v.1935

  ViewVC Help
Powered by ViewVC 1.1.26