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

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

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

revision 1863 by jfenwick, Wed Oct 8 00:28:28 2008 UTC revision 1864 by jfenwick, Thu Oct 9 03:09:30 2008 UTC
# Line 227  class Data { Line 227  class Data {
227    copySelf();    copySelf();
228    
229    
230      /**
231         \brief produce a delayed evaluation version of this Data.
232      */
233      ESCRIPT_DLL_API
234      Data
235      delay();
236    
237    /**    /**
238       Member access methods.       Member access methods.
# Line 394  class Data { Line 399  class Data {
399    isConstant() const;    isConstant() const;
400    
401    /**    /**
402         \brief Return true if this Data is lazy.
403      */
404      ESCRIPT_DLL_API
405      bool
406      isLazy() const;
407    
408      /**
409       \brief       \brief
410       Return true if this Data holds an instance of DataEmpty. This is _not_ the same as asking if the object       Return true if this Data holds an instance of DataEmpty. This is _not_ the same as asking if the object
411  contains datapoints.  contains datapoints.
# Line 526  contains datapoints. Line 538  contains datapoints.
538    ESCRIPT_DLL_API    ESCRIPT_DLL_API
539    void    void
540    dump(const std::string fileName) const;    dump(const std::string fileName) const;
541    
542    /**    /**
543       \brief       \brief
544       Return the sample data for the given sample no. This is not the       Return the sample data for the given sample no. This is not the
# Line 535  contains datapoints. Line 548  contains datapoints.
548    ESCRIPT_DLL_API    ESCRIPT_DLL_API
549    inline    inline
550    DataAbstract::ValueType::value_type*    DataAbstract::ValueType::value_type*
551    getSampleData(DataAbstract::ValueType::size_type sampleNo)    getSampleData(DataAbstract::ValueType::size_type sampleNo);
   {  
     return m_data->getSampleData(sampleNo);  
   }  
552    
553    /**    /**
554       \brief       \brief
# Line 554  contains datapoints. Line 564  contains datapoints.
564      return m_data->getSampleDataByTag(tag);      return m_data->getSampleDataByTag(tag);
565    }    }
566    
 //  /**  
 /*     \brief  
      Return a view into the data for the data point specified.  
      NOTE: Construction of the DataArrayView is a relatively expensive  
      operation.  
      \param sampleNo - Input -  
      \param dataPointNo - Input -*/  
 //  */  
 //   ESCRIPT_DLL_API  
 //   inline  
 //   DataArrayView  
 //   getDataPoint(int sampleNo,  
 //                int dataPointNo)  
 //   {  
 //                 return m_data->getDataPoint(sampleNo,dataPointNo);  
 //   }  
   
   
567    /**    /**
568       \brief       \brief
569       Return a view into the data for the data point specified.       Return a view into the data for the data point specified.
# Line 601  contains datapoints. Line 593  contains datapoints.
593    getDataOffset(int sampleNo,    getDataOffset(int sampleNo,
594                 int dataPointNo)                 int dataPointNo)
595    {    {
596                  return m_data->getPointOffset(sampleNo,dataPointNo);        return m_data->getPointOffset(sampleNo,dataPointNo);
597    }    }
598    
599    /**    /**
# Line 671  contains datapoints. Line 663  contains datapoints.
663    setTaggedValue(int tagKey,    setTaggedValue(int tagKey,
664                   const boost::python::object& value);                   const boost::python::object& value);
665    
   
 //  /**  
 //     \brief  
 //     Assign the given value to the tag. Implicitly converts this  
 //     object to type DataTagged if it is constant.  
 //  
 //     \param tagKey - Input - Integer key.  
 //     \param value - Input - Value to associate with given key.  
 //    ==>*  
 //  */  
 //   ESCRIPT_DLL_API  
 //   void  
 //   setTaggedValueFromCPP(int tagKey,  
 //                         const DataArrayView& value);  
   
666    /**    /**
667       \brief       \brief
668       Assign the given value to the tag. Implicitly converts this       Assign the given value to the tag. Implicitly converts this
# Line 1477  contains datapoints. Line 1454  contains datapoints.
1454  //   boost::shared_ptr<DataAbstract> m_data;  //   boost::shared_ptr<DataAbstract> m_data;
1455    DataAbstract_ptr m_data;    DataAbstract_ptr m_data;
1456    
1457      const DataReady*
1458      getReady() const;
1459    
1460      DataReady*
1461      getReady();
1462    
1463  };  };
1464    
1465    }   // end namespace escript
1466    
1467    
1468    // No, this is not supposed to be at the top of the file
1469    #include "DataReady.h"
1470    
1471    namespace escript
1472    {
1473    
1474    inline
1475    const DataReady*
1476    Data::getReady() const
1477    {
1478       const DataReady* dr=dynamic_cast<const DataReady*>(m_data.get());
1479       EsysAssert((dr!=0), "Error - casting to DataReady.");
1480       return dr;
1481    }
1482    
1483    inline
1484    DataReady*
1485    Data::getReady()
1486    {
1487       DataReady* dr=dynamic_cast<DataReady*>(m_data.get());
1488       EsysAssert((dr!=0), "Error - casting to DataReady.");
1489       return dr;
1490    }
1491    
1492    inline
1493    DataAbstract::ValueType::value_type*
1494    Data::getSampleData(DataAbstract::ValueType::size_type sampleNo)
1495    {
1496       return getReady()->getSampleData(sampleNo);
1497    }
1498    
1499    
1500  /**  /**
# Line 1635  Data::binaryOp(const Data& right, Line 1651  Data::binaryOp(const Data& right,
1651     if (getDataPointRank()==0 && right.getDataPointRank()!=0) {     if (getDataPointRank()==0 && right.getDataPointRank()!=0) {
1652       throw DataException("Error - attempt to update rank zero object with object with rank bigger than zero.");       throw DataException("Error - attempt to update rank zero object with object with rank bigger than zero.");
1653     }     }
1654    
1655       if (isLazy() || right.isLazy())
1656       {
1657         throw DataException("Programmer error - attempt to call binaryOp with Lazy Data.");
1658       }
1659     //     //
1660     // initially make the temporary a shallow copy     // initially make the temporary a shallow copy
1661     Data tempRight(right);     Data tempRight(right);
1662    
1663     if (getFunctionSpace()!=right.getFunctionSpace()) {     if (getFunctionSpace()!=right.getFunctionSpace()) {
1664       if (right.probeInterpolation(getFunctionSpace())) {       if (right.probeInterpolation(getFunctionSpace())) {
1665         //         //
# Line 1663  Data::binaryOp(const Data& right, Line 1685  Data::binaryOp(const Data& right,
1685       // of any data type       // of any data type
1686       DataExpanded* leftC=dynamic_cast<DataExpanded*>(m_data.get());       DataExpanded* leftC=dynamic_cast<DataExpanded*>(m_data.get());
1687       EsysAssert((leftC!=0), "Programming error - casting to DataExpanded.");       EsysAssert((leftC!=0), "Programming error - casting to DataExpanded.");
1688       escript::binaryOp(*leftC,*(tempRight.m_data.get()),operation);       escript::binaryOp(*leftC,*(tempRight.getReady()),operation);
1689     } else if (isTagged()) {     } else if (isTagged()) {
1690       //       //
1691       // Tagged data is operated on serially, the right hand side can be       // Tagged data is operated on serially, the right hand side can be

Legend:
Removed from v.1863  
changed lines
  Added in v.1864

  ViewVC Help
Powered by ViewVC 1.1.26