/[escript]/trunk/escript/src/DataAbstract.h
ViewVC logotype

Diff of /trunk/escript/src/DataAbstract.h

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

revision 116 by jgs, Mon Feb 14 04:14:42 2005 UTC revision 117 by jgs, Fri Apr 1 05:48:57 2005 UTC
# Line 30  namespace escript { Line 30  namespace escript {
30    
31  /**  /**
32     \brief     \brief
33     DataAbstract provides an interface for the class of containers     DataAbstract provides an abstract interface for the class of containers
34     which hold ESyS data.     which hold ESyS data.
35    
36     Description:     Description:
37     DataAbstract provides an interface for the class of containers     DataAbstract provides an abstract interface for the class of containers
38     which hold ESyS data. The container may be thought of as a 2 dimensional     which hold ESyS data. The container may be thought of as a 2 dimensional
39     array of data points. The data points themselves are arrays of rank 0-4.     array of data points where one dimension corresponds to the number of samples
40       and the other to the number of data points per sample as defined by the function
41       space associated with each Data object. The data points themselves are arrays of
42       doubles of rank 0-4.
43  */  */
44    
45  class DataAbstract {  class DataAbstract {
# Line 52  class DataAbstract { Line 55  class DataAbstract {
55    
56       Description:       Description:
57       Constructor for DataAbstract.       Constructor for DataAbstract.
58    
59       \param what - Input - A description of what this data represents.       \param what - Input - A description of what this data represents.
60    */    */
61    DataAbstract(const FunctionSpace& what);    DataAbstract(const FunctionSpace& what);
# Line 91  class DataAbstract { Line 95  class DataAbstract {
95       the shape information for each data point although it also may be used       the shape information for each data point although it also may be used
96       to manipulate the point data.       to manipulate the point data.
97    */    */
   const DataArrayView&  
   getPointDataView() const;  
   
98    DataArrayView&    DataArrayView&
99    getPointDataView();    getPointDataView();
100    
101      const DataArrayView&
102      getPointDataView() const;
103    
104    /**    /**
105       \brief       \brief
106       Return the offset for the given sample. This is somewhat artificial notion       Return the offset for the given sample. This returns the offset for the given
107       but returns the offset for the given point into the container       point into the container holding the point data. Only really necessary to
108       holding the point data. Only really necessary to avoid many DataArrayView       avoid creating many DataArrayView objects.
109       objects.  
110       \param sampleNo - Input - sample number.       \param sampleNo - Input - sample number.
111       \param dataPointNo - Input - Input.       \param dataPointNo - Input - data point number.
112     */     */
113    virtual    virtual
114    ValueType::size_type    ValueType::size_type
# Line 113  class DataAbstract { Line 117  class DataAbstract {
117    
118    /**    /**
119       \brief       \brief
120       Return the sample data for the given sample no.       Return the sample data for the given sample number.
121    */    */
122    double*    double*
123    getSampleData(ValueType::size_type sampleNo);    getSampleData(ValueType::size_type sampleNo);
124    
125    /**    /**
126       \brief       \brief
127       Return the number of doubles stored for the Data.       Return the number of doubles stored for this Data object.
128    */    */
129    virtual    virtual
130    ValueType::size_type    ValueType::size_type
# Line 171  class DataAbstract { Line 175  class DataAbstract {
175    
176    /**    /**
177       \brief       \brief
178       Check this and the right operands are compatible. Throws       Check this and the given RHS operands are compatible. Throws
179       an exception if they aren't.       an exception if they aren't.
180    
181       \param right - Input - The right hand side.       \param right - Input - The right hand side.
182    */    */
183    void    void
# Line 187  class DataAbstract { Line 192  class DataAbstract {
192    
193    /**    /**
194       \brief       \brief
195       Return true if a valid number.       Return true if a valid sample number.
196    */    */
197    bool    bool
198    validSampleNo(int sampleNo) const;    validSampleNo(int sampleNo) const;
# Line 197  class DataAbstract { Line 202  class DataAbstract {
202       Return a view into the data for the data point specified.       Return a view into the data for the data point specified.
203       NOTE: Construction of the DataArrayView is a relatively expensive       NOTE: Construction of the DataArrayView is a relatively expensive
204       operation.       operation.
205       \param samplesNo Input  
206       \param dataPointNo Input       \param sampleNo - Input - the sample number.
207         \param dataPointNo - Input - the data point number.
208    */    */
209    virtual    virtual
210    DataArrayView    DataArrayView
211    getDataPoint(int samplesNo,    getDataPoint(int sampleNo,
212                 int dataPointNo) = 0;                 int dataPointNo) = 0;
213    
214    /**    /**
215       \brief       \brief
216       Return the function space.       Return the function space associated with this Data object.
217    */    */
218    const FunctionSpace&    const
219      FunctionSpace&
220    getFunctionSpace() const;    getFunctionSpace() const;
221    
222    /**    /**
223       \brief       \brief
224       Return a newly constructed DataAbstract. The caller is responsible for       Return the given slice from this object.
225       managing the object created.  
226         NB: The caller is responsible for managing the object created.
227    */    */
228    virtual    virtual
229    DataAbstract*    DataAbstract*
# Line 223  class DataAbstract { Line 231  class DataAbstract {
231    
232    /**    /**
233       \brief       \brief
234       Copy the specified region from the given value.       Copy the specified region from the given object.
235    
236       \param value - Input - Data to copy from       \param value - Input - Data to copy from
237       \param region - Input - Region to copy.       \param region - Input - Region to copy.
238    */    */
# Line 234  class DataAbstract { Line 243  class DataAbstract {
243    
244    /**    /**
245       \brief       \brief
246       Reshape the data point if the data point is currently rank 0.       Reshape the data points if they are currently rank 0.
247       Will throw an exception if the data points are not rank 0.       Will throw an exception if the data points are not rank 0.
248       The original data point value is used for all values of the new       The original data point value is used for all values of the new
249       data point.       data point.
250    */    */
251    virtual    virtual
252    void    void
253    reshapeDataPoint(const DataArrayView::ShapeType& shape) = 0;    reshapeDataPoint(const ShapeType& shape) = 0;
254    
255    /**    /**
256       \brief       \brief
# Line 249  class DataAbstract { Line 258  class DataAbstract {
258                                                                                                                                                                                                                                                                        
259       Description:       Description:
260       Assign the given value to the given tag.       Assign the given value to the given tag.
261    
262         NB: If the data isn't tagged an exception will be thrown.
263    
264       \param tagKey - Input - Integer key.       \param tagKey - Input - Integer key.
265       \param value - Input - Single DataArrayView value to be assigned to the tag.       \param value - Input - Single DataArrayView value to be assigned to the tag.
      NB: If the data isn't tagged an exception will be thrown.  
266    */    */
267    virtual    virtual
268    void    void
# Line 262  class DataAbstract { Line 273  class DataAbstract {
273    
274    /**    /**
275       \brief       \brief
276       Set the pointDataView       Set the pointDataView DataArrayView associated with this object.
277    
278       \param right - Input - The point data view. DataAbstract takes ownership       \param right - Input - The point data view. DataAbstract takes ownership
279       of the DataArrayView provided. It will delete it when it is destructed.       of the DataArrayView provided. It will delete it when it is destructed.
280    */    */
# Line 271  class DataAbstract { Line 283  class DataAbstract {
283    
284   private:   private:
285    
286    int m_noDataPointsPerSample;    //
287      // The number of samples in this Data object.
288      // This is derived directly from the FunctionSpace.
289    int m_noSamples;    int m_noSamples;
290    
291    //    //
292    // Provides a view of the data as point data    // The number of data points per sample in this Data object.
293      // This is derived directly from the FunctionSpace.
294      int m_noDataPointsPerSample;
295    
296      //
297      // The DataArrayView of the data array associated with this object.
298      // The data array is defined only in child classes of this class, it
299      // is not defined in this abstract parent class.
300    boost::scoped_ptr<DataArrayView> m_pointDataView;    boost::scoped_ptr<DataArrayView> m_pointDataView;
301    
302    //    //
303    // function space    // A FunctionSpace which provides a description of the data associated
304      // with this Data object.
305    FunctionSpace m_functionSpace;    FunctionSpace m_functionSpace;
306    
307  };  };
# Line 344  DataAbstract::getPointDataView() Line 365  DataAbstract::getPointDataView()
365  }  }
366    
367  } // end of namespace  } // end of namespace
368    
369  #endif  #endif

Legend:
Removed from v.116  
changed lines
  Added in v.117

  ViewVC Help
Powered by ViewVC 1.1.26