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

Diff of /branches/schroedinger/escript/src/DataAbstract.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 50  class DataAbstract; Line 50  class DataAbstract;
50  typedef POINTER_WRAPPER_CLASS(DataAbstract) DataAbstract_ptr;  typedef POINTER_WRAPPER_CLASS(DataAbstract) DataAbstract_ptr;
51  typedef POINTER_WRAPPER_CLASS(const DataAbstract) const_DataAbstract_ptr;  typedef POINTER_WRAPPER_CLASS(const DataAbstract) const_DataAbstract_ptr;
52    
53    class DataReady;
54    
55    typedef POINTER_WRAPPER_CLASS(DataReady) DataReady_ptr;
56    typedef POINTER_WRAPPER_CLASS(const DataReady) const_DataReady_ptr;
57    
58  class DataAbstract : public REFCOUNT_BASE_CLASS(DataAbstract)  class DataAbstract : public REFCOUNT_BASE_CLASS(DataAbstract)
59  {  {
# Line 101  class DataAbstract : public REFCOUNT_BAS Line 105  class DataAbstract : public REFCOUNT_BAS
105    DataAbstract*    DataAbstract*
106    deepCopy()=0;    deepCopy()=0;
107    
108      /**
109         \brief Return a data object with all points resolved.
110      */
111      ESCRIPT_DLL_API
112      virtual
113      DataReady_ptr
114      resolve()=0;
115    
116   /**   /**
117       \brief       \brief
118       dumps the object into a netCDF file       dumps the object into a netCDF file
# Line 146  class DataAbstract : public REFCOUNT_BAS Line 158  class DataAbstract : public REFCOUNT_BAS
158    
159    
160    
161    /**   /**
162       \brief      \brief
163       Return the offset for the given sample. This returns the offset for the given      Return the offset for the given sample. This returns the offset for the given
164       point into the container holding the point data. Only really necessary to      point into the container holding the point data. Only really necessary to
165       avoid creating many DataArrayView objects.      avoid creating many DataArrayView objects.
166    
167       \param sampleNo - Input - sample number.      \param sampleNo - Input - sample number.
168       \param dataPointNo - Input - data point number.      \param dataPointNo - Input - data point number.
169     */    */
170    ESCRIPT_DLL_API    ESCRIPT_DLL_API
171    virtual    virtual
172    ValueType::size_type    ValueType::size_type
# Line 175  class DataAbstract : public REFCOUNT_BAS Line 187  class DataAbstract : public REFCOUNT_BAS
187  //   getVector() const;  //   getVector() const;
188    
189    
190    /**  //  /**
191       \brief  //     \brief
192       Return the sample data for the given sample number.  //     Return the sample data for the given sample number.
193    */  //  */
194    ESCRIPT_DLL_API  //  ESCRIPT_DLL_API
195    double*  //  double*
196    getSampleData(ValueType::size_type sampleNo);  //  getSampleData(ValueType::size_type sampleNo);
197    
198    /**    /**
199       \brief       \brief
# Line 251  class DataAbstract : public REFCOUNT_BAS Line 263  class DataAbstract : public REFCOUNT_BAS
263    DataAbstract*    DataAbstract*
264    getSlice(const DataTypes::RegionType& region) const = 0;    getSlice(const DataTypes::RegionType& region) const = 0;
265    
266    /**  //  /**
267       \brief  //     \brief
268       Copy the specified region from the given object.  //     Copy the specified region from the given object.
269    //
270       \param value - Input - Data to copy from  //     \param value - Input - Data to copy from
271       \param region - Input - Region to copy.  //     \param region - Input - Region to copy.
272    */  //  */
273    ESCRIPT_DLL_API  //   ESCRIPT_DLL_API
274    virtual  //   virtual
275    void  //   void
276    setSlice(const DataAbstract* value,  //   setSlice(const DataAbstract* value,
277             const DataTypes::RegionType& region) = 0;  //            const DataTypes::RegionType& region) = 0;
278    
279    /**    /**
280       \brief       \brief
# Line 455  class DataAbstract : public REFCOUNT_BAS Line 467  class DataAbstract : public REFCOUNT_BAS
467    
468    
469    
470    /**  //  /**
471        \brief get a reference to the beginning of a data point  //      \brief get a reference to the beginning of a data point
472    */  //  */
473    ESCRIPT_DLL_API  //   ESCRIPT_DLL_API
474    DataTypes::ValueType::const_reference  //   DataTypes::ValueType::const_reference
475    getDataAtOffset(DataTypes::ValueType::size_type i) const;  //   getDataAtOffset(DataTypes::ValueType::size_type i) const;
476    //
477    //
478    ESCRIPT_DLL_API  //   ESCRIPT_DLL_API
479    DataTypes::ValueType::reference  //   DataTypes::ValueType::reference
480    getDataAtOffset(DataTypes::ValueType::size_type i);  //   getDataAtOffset(DataTypes::ValueType::size_type i);
481    
482    
483    /**  //  /**
484      \brief Provide access to underlying storage. Internal use only!  //  \brief Provide access to underlying storage. Internal use only!
485    */  //  */
486    ESCRIPT_DLL_API  //   ESCRIPT_DLL_API
487    virtual DataTypes::ValueType&  //   virtual DataTypes::ValueType&
488    getVector()=0;  //   getVector()=0;
489    //
490    //   ESCRIPT_DLL_API
491    //   virtual const DataTypes::ValueType&
492    //   getVector() const=0;
493    
494    ESCRIPT_DLL_API    bool isLazy() const;  // a test to determine if this object is an instance of DataLazy
   virtual const DataTypes::ValueType&  
   getVector() const=0;  
495    
496   protected:   protected:
497    
498    bool isEmpty() const; // a fast test to determine if this object is an instance of DataEmpty    bool isEmpty() const; // a fast test to determine if this object is an instance of DataEmpty
499    
   
   
   
500   private:   private:
501    
502    //    //
# Line 520  class DataAbstract : public REFCOUNT_BAS Line 531  class DataAbstract : public REFCOUNT_BAS
531    bool m_isempty;    bool m_isempty;
532  };  };
533    
   
534  inline  inline
535  bool  bool
536  DataAbstract::isEmpty() const  DataAbstract::isEmpty() const
# Line 528  DataAbstract::isEmpty() const Line 538  DataAbstract::isEmpty() const
538      return m_isempty;      return m_isempty;
539  }  }
540    
541    // inline
542  inline  // DataTypes::ValueType::const_reference
543  DataTypes::ValueType::const_reference  // DataAbstract::getDataAtOffset(DataTypes::ValueType::size_type i) const
544  DataAbstract::getDataAtOffset(DataTypes::ValueType::size_type i) const  // {
545  {  //    if (isLazy())
546      return getVector()[i];  //    {
547  }  //  throw DataException("Programmer error - getDataAtOffset() not permitted on Lazy Data.");
548    //    }
549  inline  //    DataReady* d;
550  DataTypes::ValueType::reference  //    return (dynamic_cast<const DataReady*>(this))->getVector()[i];
551  DataAbstract::getDataAtOffset(DataTypes::ValueType::size_type i)  // //   return getVector()[i];
552  {  // }
553      return getVector()[i];  
554  }  // inline
555    // DataTypes::ValueType::reference
556    // DataAbstract::getDataAtOffset(DataTypes::ValueType::size_type i)
557    // {
558    //    if (isLazy())
559    //    {
560    //  throw DataException("Programmer error - getDataAtOffset() not permitted on Lazy Data.");
561    //    }
562    //    return dynamic_cast<DataReady*>(this)->getVector()[i];
563    // //   return getVector()[i];
564    // }
565    
566    
567  inline  inline
# Line 558  DataAbstract::validSampleNo(int sampleNo Line 578  DataAbstract::validSampleNo(int sampleNo
578    return ((0 <= sampleNo) && (sampleNo < m_noSamples));    return ((0 <= sampleNo) && (sampleNo < m_noSamples));
579  }  }
580    
581  inline  // inline
582  DataAbstract::ValueType::value_type*  // DataAbstract::ValueType::value_type*
583  DataAbstract::getSampleData(ValueType::size_type sampleNo)  // DataAbstract::getSampleData(ValueType::size_type sampleNo)
584  {  // {
585  //   return &(m_pointDataView->getData(getPointOffset(sampleNo,0)));  // //   return &(m_pointDataView->getData(getPointOffset(sampleNo,0)));
586    return &(getVector()[getPointOffset(sampleNo,0)]);  //   return &(getVector()[getPointOffset(sampleNo,0)]);
587  }  // }
588    
589  inline  inline
590  int  int

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

  ViewVC Help
Powered by ViewVC 1.1.26