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

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

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

revision 113 by jgs, Mon Feb 28 07:06:33 2005 UTC revision 123 by jgs, Fri Jul 8 04:08:13 2005 UTC
# Line 25  Line 25 
25    
26  namespace escript {  namespace escript {
27    
28    //
29    // Forward declarations of other Data types.
30  class DataEmpty;  class DataEmpty;
31  class DataConstant;  class DataConstant;
32  class DataTagged;  class DataTagged;
# Line 34  class DataTagged; Line 36  class DataTagged;
36     Give a short description of what DataExpanded does.     Give a short description of what DataExpanded does.
37    
38     Description:     Description:
39     Give a detailed description of DataExpanded     Give a detailed description of DataExpanded.
40    
41     Template Parameters:     Template Parameters:
42     For templates describe any conditions that the parameters used in the     For templates describe any conditions that the parameters used in the
43     template must satisfy     template must satisfy.
44  */  */
45    
46  class DataExpanded : public DataAbstract{  class DataExpanded : public DataAbstract {
47    
48   public:   public:
49    
50    /**    /**
51       \brief       \brief
52       Copy constructor for DataExpanded. Performs a deep copy.       Constructor for DataExpanded.
   */  
   DataExpanded(const DataExpanded& other);  
   
   /**  
      \brief  
      Construct a DataExpanded from a DataConstant.  
   */  
   DataExpanded(const DataConstant& other);  
53    
54    /**       Description:
55       \brief       Constructor for DataExpanded.
      Construct a DataExpanded from a DataTagged.  
   */  
   DataExpanded(const DataTagged& other);  
56    
57    /**       The given single data value is copied to all the data points in
58       \brief       this data object, where the number of data points is defined by
59       Constructor for DataExpanded       the given function space.
60    
61       Description:       \param value - Input - A single data value.
      Constructor for DataExpanded  
      \param value - Input - Data value for a single point.  
62       \param what - Input - A description of what this data represents.       \param what - Input - A description of what this data represents.
63    */    */
64    DataExpanded(const boost::python::numeric::array& value,    DataExpanded(const boost::python::numeric::array& value,
# Line 77  class DataExpanded : public DataAbstract Line 66  class DataExpanded : public DataAbstract
66    
67    /**    /**
68       \brief       \brief
69       Alternative constructor for DataExpanded       Alternative constructor for DataExpanded.
70    
71       Description:       Description:
72       Alternative Constructor for DataExpanded.       Alternative Constructor for DataExpanded.
      \param value - Input - Data value for a single point.  
      \param what - Input - A description of what this data represents.  
73    
74         The given single data value is copied to all the data points in
75         this data object, where the number of data points is defined by
76         the given function space.
77    
78         \param value - Input - A single data value.
79         \param what - Input - A description of what this data represents.
80    */    */
81    DataExpanded(const DataArrayView& value,    DataExpanded(const DataArrayView& value,
82                 const FunctionSpace& what);                 const FunctionSpace& what);
# Line 101  class DataExpanded : public DataAbstract Line 94  class DataExpanded : public DataAbstract
94    
95    /**    /**
96       \brief       \brief
97       Destructor       Alternative constructor for DataExpanded objects.
98    
99         Description:
100         Alternative Constructor for DataExpanded objects.
101         \param what - Input - A description of what this data object represents.
102         \param shape - Input - the shape of each data-point.
103         \param data - the array of data values for the data-points.
104      */
105      DataExpanded(const FunctionSpace& what,
106                   const DataArrayView::ShapeType &shape,
107                   const DataArrayView::ValueType &data);
108    
109      /**
110         \brief
111         Copy constructor for DataExpanded.
112         Performs a deep copy from another DataExpanded.
113      */
114      DataExpanded(const DataExpanded& other);
115    
116      /**
117         \brief
118         Copy constructor for DataExpanded.
119         Construct a DataExpanded from a DataConstant.
120      */
121      DataExpanded(const DataConstant& other);
122    
123      /**
124         \brief
125         Copy constructor for DataExpanded.
126         Construct a DataExpanded from a DataTagged.
127      */
128      DataExpanded(const DataTagged& other);
129    
130      /**
131         \brief
132         Default destructor for DataExpanded.
133    */    */
134    virtual    virtual
135    ~DataExpanded();    ~DataExpanded();
136    
137    /**    /**
138       \brief       \brief
139       Return a textual representation of the data       Return a textual representation of the data.
140    */    */
141    virtual    virtual
142    std::string    std::string
# Line 125  class DataExpanded : public DataAbstract Line 153  class DataExpanded : public DataAbstract
153    
154    /**    /**
155       \brief       \brief
156       Return the offset for the given sample. This is somewhat artificial notion       Return the offset for the given given data point. This returns
157       but returns the offset in bytes for the given point into the container       the offset in bytes for the given point into the container
158       holding the point data.       holding the point data.
159       \param sampleNo - Input - number of samples.  
160       \param dataPointNo - Input - Input.       \param sampleNo - Input - sample number.
161         \param dataPointNo - Input - data point number.
162    */    */
163    virtual    virtual
164    DataArrayView::ValueType::size_type    DataArrayView::ValueType::size_type
# Line 138  class DataExpanded : public DataAbstract Line 167  class DataExpanded : public DataAbstract
167    
168    /**    /**
169       \brief       \brief
170       Return a view into the data for the data point specified.       Return a view into the data array for the data point specified.
171    
172       NOTE: Construction of the DataArrayView is a relatively expensive       NOTE: Construction of the DataArrayView is a relatively expensive
173       operation.       operation.
174       \param sampleNo - Input  
175       \param dataPointNo - Input       \param sampleNo - Input - sample number.
176       \return DataArrayView of the data point.       \param dataPointNo - Input - data point number.
177         \return DataArrayView for the data point.
178    */    */
179    DataArrayView    DataArrayView
180    getDataPoint(int sampleNo,    getDataPoint(int sampleNo,
# Line 161  class DataExpanded : public DataAbstract Line 192  class DataExpanded : public DataAbstract
192       \brief       \brief
193       Factory method that returns a newly created DataExpanded.       Factory method that returns a newly created DataExpanded.
194       The caller is reponsible for managing the object created.       The caller is reponsible for managing the object created.
195    
196       \param region - Input - Region to copy.       \param region - Input - Region to copy.
197    */    */
198    virtual    virtual
# Line 170  class DataExpanded : public DataAbstract Line 202  class DataExpanded : public DataAbstract
202    /**    /**
203       \brief       \brief
204       Copy the specified region from the given value.       Copy the specified region from the given value.
205       \param value - Input - Data to copy from  
206         \param value - Input - Data object to copy from.
207       \param region - Input - Region to copy.       \param region - Input - Region to copy.
208    */    */
209    virtual    virtual
# Line 227  class DataExpanded : public DataAbstract Line 260  class DataExpanded : public DataAbstract
260    getRefValue(int ref,    getRefValue(int ref,
261                DataArray& value);                DataArray& value);
262    
263      /**
264        \brief
265        Archive the underlying data values to the file referenced
266        by ofstream. A count of the number of values expected to be written
267        is provided as a cross-check.
268    
269        The return value indicates success (0) or otherwise (1).
270      */
271      int
272      archiveData(std::ofstream& archiveFile,
273                  const DataArrayView::ValueType::size_type noValues) const;
274    
275      /**
276        \brief
277        Extract the number of values specified by noValues from the file
278        referenced by ifstream to the underlying data structure.
279    
280        The return value indicates success (0) or otherwise (1).
281      */
282      int
283      extractData(std::ifstream& archiveFile,
284                  const DataArrayView::ValueType::size_type noValues);
285    
286   protected:   protected:
287    
288   private:   private:
289    
290    /**    /**
291       \brief       \brief
292       Common initialisation called from constructors       Common initialisation called from constructors.
293    
294       Description:       Description:
295       Common initialisation called from constructors       Common initialisation called from constructors.
296    
297         Resizes the underlying data array to provide sufficient storage for the
298         given shape and number of data points, and creates the corresponding
299         DataArrayView of this data.
300    
301       \param shape - Input - The shape of the point data.       \param shape - Input - The shape of the point data.
302       \param noSamples - Input - number of samples.       \param noSamples - Input - number of samples.
303       \param noDataPointsPerSample - Input -       \param noDataPointsPerSample - Input - number of data points per sample.
304    */    */
305    void    void
306    initialise(const DataArrayView::ShapeType& shape,    initialise(const DataArrayView::ShapeType& shape,
# Line 248  class DataExpanded : public DataAbstract Line 309  class DataExpanded : public DataAbstract
309    
310    /**    /**
311       \brief       \brief
312       Copy the given data point to all data points.       Copy the given data point to all data points in this object.
313    
314       Description:       Description:
315       Copy the given data point to all data points.       Copy the given data point to all data points in this object.
316       \param value Input - Value for a single data point.  
317         \param value Input - A single data point value.
318    */    */
319    void    void
320    copy(const DataArrayView& value);    copy(const DataArrayView& value);
# Line 261  class DataExpanded : public DataAbstract Line 323  class DataExpanded : public DataAbstract
323    copy(const boost::python::numeric::array& value);    copy(const boost::python::numeric::array& value);
324    
325    //    //
326    // The main data storage, a 2D array of data blocks.    // The main data storage array, a 2D array of data blocks.
327      // noSamples * noDataPointsPerSample
328    DataBlocks2D m_data;    DataBlocks2D m_data;
329    
330  };  };

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

  ViewVC Help
Powered by ViewVC 1.1.26