/[escript]/trunk/escript/src/Data/DataExpanded.h
ViewVC logotype

Diff of /trunk/escript/src/Data/DataExpanded.h

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

revision 82 by jgs, Tue Oct 26 06:53:54 2004 UTC revision 113 by jgs, Mon Feb 28 07:06:33 2005 UTC
# Line 1  Line 1 
1    // $Id$
2  /*  /*
3   ******************************************************************************   ******************************************************************************
4   *                                                                            *   *                                                                            *
# Line 12  Line 13 
13   ******************************************************************************   ******************************************************************************
14  */  */
15                                                                                                                                                        
16  #if !defined  escript_DataExpanded_20040323_H  #if !defined escript_DataExpanded_20040323_H
17  #define escript_DataExpanded_20040323_H  #define escript_DataExpanded_20040323_H
18    
19  #include "DataAbstract.h"  #include "DataAbstract.h"
# Line 24  Line 25 
25    
26  namespace escript {  namespace escript {
27    
28    class DataConstant;  class DataEmpty;
29    class DataTagged;  class DataConstant;
30    class DataTagged;
31    
32  /**  /**
33     \brief     \brief
# Line 51  class DataExpanded : public DataAbstract Line 53  class DataExpanded : public DataAbstract
53    
54    /**    /**
55       \brief       \brief
56       Construct a DataExpanded from a DataConstant       Construct a DataExpanded from a DataConstant.
57    */    */
58    DataExpanded(const DataConstant& other);    DataExpanded(const DataConstant& other);
59    
60    /**    /**
61       \brief       \brief
62       Construct a DataExpanded from a DataTagged       Construct a DataExpanded from a DataTagged.
63    */    */
64    DataExpanded(const DataTagged& other);    DataExpanded(const DataTagged& other);
65    
# Line 70  class DataExpanded : public DataAbstract Line 72  class DataExpanded : public DataAbstract
72       \param value - Input - Data value for a single point.       \param value - Input - Data value for a single point.
73       \param what - Input - A description of what this data represents.       \param what - Input - A description of what this data represents.
74    */    */
75    DataExpanded(const boost::python::numeric::array& value, const FunctionSpace& what);    DataExpanded(const boost::python::numeric::array& value,
76                   const FunctionSpace& what);
77    
78    /**    /**
79       \brief       \brief
80       Alternative constructor for DataExpanded       Alternative constructor for DataExpanded
81    
82       Description:       Description:
83       Alternative Constructor for DataExpanded       Alternative Constructor for DataExpanded.
84       \param value - Input - Data value for a single point.       \param value - Input - Data value for a single point.
85       \param what - Input - A description of what this data represents.       \param what - Input - A description of what this data represents.
86    
87    */    */
88    DataExpanded(const DataArrayView& value, const FunctionSpace& what);    DataExpanded(const DataArrayView& value,
89                   const FunctionSpace& what);
90    
91    /**    /**
92       \brief       \brief
93       Alternative constructor for DataExpanded that copies a slice from       Alternative constructor for DataExpanded that copies a slice from
94       another DataExpanded.       another DataExpanded.
95    
96       \param other - Input - DataExpanded object to slice from       \param other - Input - DataExpanded object to slice from.
97       \param region - Input - region to copy       \param region - Input - region to copy.
98    */    */
99    DataExpanded(const DataExpanded& other, const DataArrayView::RegionType& region);    DataExpanded(const DataExpanded& other,
100                   const DataArrayView::RegionType& region);
101    
102    /**    /**
103       \brief       \brief
104       Destructor       Destructor
105    */    */
106    virtual ~DataExpanded();    virtual
107      ~DataExpanded();
108    
109    /**    /**
110       \brief       \brief
111       Return a textual representation of the data       Return a textual representation of the data
112    */    */
113    virtual std::string toString() const;    virtual
114      std::string
115      toString() const;
116    
117    /**    /**
118       \brief       \brief
# Line 112  class DataExpanded : public DataAbstract Line 120  class DataExpanded : public DataAbstract
120       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
121       data point.       data point.
122    */    */
123    void reshapeDataPoint(const DataArrayView::ShapeType& shape);    void
124      reshapeDataPoint(const DataArrayView::ShapeType& shape);
125    
126    /**    /**
127       \brief       \brief
# Line 122  class DataExpanded : public DataAbstract Line 131  class DataExpanded : public DataAbstract
131       \param sampleNo - Input - number of samples.       \param sampleNo - Input - number of samples.
132       \param dataPointNo - Input - Input.       \param dataPointNo - Input - Input.
133    */    */
134    virtual DataArrayView::ValueType::size_type getPointOffset(int sampleNo, int dataPointNo) const;    virtual
135      DataArrayView::ValueType::size_type
136      getPointOffset(int sampleNo,
137                     int dataPointNo) const;
138    
139    /**    /**
140       \brief       \brief
141       Return a view into the data for the data point specified.       Return a view into the data for the data point specified.
142       NOTE: Construction of the DataArrayView is a relatively expensive       NOTE: Construction of the DataArrayView is a relatively expensive
143       operation       operation.
144       \param sampleNo - Input       \param sampleNo - Input
145       \param dataPointNo - Input       \param dataPointNo - Input
146       \return DataArrayView of the data point.       \return DataArrayView of the data point.
147    */    */
148    DataArrayView getDataPoint(int sampleNo, int dataPointNo);    DataArrayView
149      getDataPoint(int sampleNo,
150                   int dataPointNo);
151    
152    /**    /**
153       \brief       \brief
154       Return the number of doubles stored for the Data       Return the number of doubles stored for the Data.
155    */    */
156    virtual ValueType::size_type getLength() const;    virtual
157      ValueType::size_type
158      getLength() const;
159    
160    /**    /**
161       \brief       \brief
# Line 147  class DataExpanded : public DataAbstract Line 163  class DataExpanded : public DataAbstract
163       The caller is reponsible for managing the object created.       The caller is reponsible for managing the object created.
164       \param region - Input - Region to copy.       \param region - Input - Region to copy.
165    */    */
166    virtual DataAbstract* getSlice(const DataArrayView::RegionType& region) const;    virtual
167      DataAbstract*
168      getSlice(const DataArrayView::RegionType& region) const;
169    
170    /**    /**
171       \brief       \brief
# Line 155  class DataExpanded : public DataAbstract Line 173  class DataExpanded : public DataAbstract
173       \param value - Input - Data to copy from       \param value - Input - Data to copy from
174       \param region - Input - Region to copy.       \param region - Input - Region to copy.
175    */    */
176    virtual void setSlice(const DataAbstract* value, const DataArrayView::RegionType& region);    virtual
177      void
178      setSlice(const DataAbstract* value,
179               const DataArrayView::RegionType& region);
180    
181      /**
182         \brief
183         Assign the given value to all data-points associated with the given
184         reference number.
185    
186         A reference number corresponds to a sample, and thus to all data-points
187         in that sample.
188    
189         If the given reference number does not correspond to any sample in this
190         Data object, an exception will be thrown.
191    
192         If the given value is a different shape to this Data object, an exception
193         will be thrown.
194    
195         \param ref - Input - reference number which determines sample numebr to
196                              assign given values to.
197         \param value - Input - Value to assign to data-point associated with
198                                the given reference number.
199      */
200      virtual
201      void
202      setRefValue(int ref,
203                  const DataArray& value);
204    
205      /**
206         \brief
207         Return the value of the first data-point in the sample associated with
208         the given reference number.
209    
210         A reference number corresponds to a sample, and thus to all data-points
211         in that sample. If there is more than one data-point per sample number
212         in this Data object, the value of the first data-point will be returned.
213    
214         If the given reference number does not correspond to any sample in this
215         Data object, an exception will be thrown.
216    
217         If the given value is a different shape to this Data object, an exception
218         will be thrown.
219    
220         \param ref - Input - reference number which determines sample number to
221                              read from.
222         \param value - Output - Object to receive data-points associated with
223                                the given reference number.
224      */
225      virtual
226      void
227      getRefValue(int ref,
228                  DataArray& value);
229    
230   protected:   protected:
231    
# Line 171  class DataExpanded : public DataAbstract Line 241  class DataExpanded : public DataAbstract
241       \param noSamples - Input - number of samples.       \param noSamples - Input - number of samples.
242       \param noDataPointsPerSample - Input -       \param noDataPointsPerSample - Input -
243    */    */
244    void initialise(const DataArrayView::ShapeType& shape, int noSamples, int noDataPointsPerSample);    void
245      initialise(const DataArrayView::ShapeType& shape,
246                 int noSamples,
247                 int noDataPointsPerSample);
248    
249    /**    /**
250       \brief       \brief
# Line 179  class DataExpanded : public DataAbstract Line 252  class DataExpanded : public DataAbstract
252    
253       Description:       Description:
254       Copy the given data point to all data points.       Copy the given data point to all data points.
255       \param value Input - Value for a single data point       \param value Input - Value for a single data point.
256    */    */
257    void copy(const DataArrayView& value);    void
258    void copy(const boost::python::numeric::array& value);    copy(const DataArrayView& value);
259    
260      void
261      copy(const boost::python::numeric::array& value);
262    
263    //    //
264    // The main data storage, a 2D array of data blocks    // The main data storage, a 2D array of data blocks.
265    DataBlocks2D m_data;    DataBlocks2D m_data;
266    
267  };  };
268    
269  } // end of namespace  } // end of namespace
 #endif  
   
   
   
270    
271    #endif

Legend:
Removed from v.82  
changed lines
  Added in v.113

  ViewVC Help
Powered by ViewVC 1.1.26