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

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

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

revision 507 by jgs, Thu Feb 9 06:13:07 2006 UTC revision 513 by jgs, Mon Feb 13 04:46:51 2006 UTC
# Line 58  class DataTagged : public DataAbstract { Line 58  class DataTagged : public DataAbstract {
58    
59       Description:       Description:
60       Default constructor for DataTagged. Creates a DataTagged object for which       Default constructor for DataTagged. Creates a DataTagged object for which
61       the only data-point is a scalar data-point with value 0.0. All tags       the default data-point is a scalar data-point with value 0.0, and no other
62       will map to this single data-point.       tag values are stored.
63      T      T
64    */    */
65    DataTagged();    DataTagged();
# Line 70  class DataTagged : public DataAbstract { Line 70  class DataTagged : public DataAbstract {
70    
71       Description:       Description:
72       Constructor for DataTagged.       Constructor for DataTagged.
73       \param tagKeys - Input - A vector of integer keys.       \param tagKeys - Input - A vector of integer tags.
74       \param values - Input - A vector of DataArrayViews. If this is empty       \param values - Input - A vector of DataArrayViews. If this is empty
75                       all tag values will be assigned a value of zero. If                       all tag values will be assigned a scalar data-point of value
76                       it contains one value all tag values will be assigned the                       0. If it contains one value all tag values will be assigned
77               same value. Otherwise if there is a mismatch between               this value. Otherwise consecutive tags will be assigned
78               the number of keys and the number of values an exception                       consecutive values.  If there is a mismatch between  the
79                 number of keys and the number of values an exception
80               will be generated.               will be generated.
81       \param defaultValue - Input - Value returned if a requested tag doesn't exist.       \param defaultValue - Input - Value returned if a requested tag doesn't exist.
82       \param what - Input - A description of what this data represents.       \param what - Input - A description of what this data represents.
# Line 104  class DataTagged : public DataAbstract { Line 105  class DataTagged : public DataAbstract {
105    
106    /**    /**
107       \brief       \brief
      Slice Constructor for DataTagged.  
   
      Description:  
      Slice Constructor for DataTagged.  
      Copies a slice from another DataTagged object.  
      \param other - Input - DataTagged object to copy from.  
      \param region - Input - Region to copy.  
   */  
   DataTagged(const DataTagged& other,  
          const DataArrayView::RegionType& region);  
   
   /**  
      \brief  
108       Copy Constructor for DataTagged.       Copy Constructor for DataTagged.
109       Performs a deep copy from the given DataTagged object.       Performs a deep copy from the given DataTagged object.
110      T      T
# Line 126  class DataTagged : public DataAbstract { Line 114  class DataTagged : public DataAbstract {
114    /**    /**
115       \brief       \brief
116       Copy Constructor for DataTagged.       Copy Constructor for DataTagged.
117       Construct a tagged data from a DataConstant object.       Construct a DataTagged object from a DataConstant object.
118       The default value will be that held by the DataConstant object.       The default value will be the value of the DataConstant object.
119      T      T
120    */    */
121    DataTagged(const DataConstant& other);    DataTagged(const DataConstant& other);
# Line 191  class DataTagged : public DataAbstract { Line 179  class DataTagged : public DataAbstract {
179       addTaggedValues       addTaggedValues
180    
181       Description:       Description:
182       Add the given tags and values to this DataTagged object, by repeatedly       Add the given tags and values to this DataTagged object.
      using addTaggedValue for each given tag/value pair.  
183       \param tagKeys - Input - A vector of integer tags.       \param tagKeys - Input - A vector of integer tags.
184       \param values - Input - A vector of DataArrayViews. If this is empty       \param values - Input - A vector of DataArrayViews. If this is empty
185                        then all given tags will be assigned a value of zero. If                       all tag values will be assigned a scalar data-point of value
186                        it contains one value all tags will be assigned the same value.                       0. If it contains one value all tag values will be assigned
187                        Otherwise if there is a mismatch between the number of tags and               this value. Otherwise consecutive tags will be assigned
188                        the number of values an exception will be generated.                       consecutive values.  If there is a mismatch between  the
189                 number of keys and the number of values an exception
190                 will be generated.
191      T      T
192    */    */
193    void    void
# Line 212  class DataTagged : public DataAbstract { Line 201  class DataTagged : public DataAbstract {
201       Description:       Description:
202       Add a single tag and value to this DataTagged object. If this tag already has       Add a single tag and value to this DataTagged object. If this tag already has
203       a value associated with it, setTaggedValue will be used to update this value.       a value associated with it, setTaggedValue will be used to update this value.
204       \param tagKey - Input - Integer key.       \param tagKey - Input - Integer tag.
205       \param value - Input - Single DataArrayView value to be assigned to the tag.       \param value - Input - Single DataArrayView value to be assigned to the tag.
206      T      T
207    */    */
# Line 225  class DataTagged : public DataAbstract { Line 214  class DataTagged : public DataAbstract {
214       setTaggedValues       setTaggedValues
215    
216       Description:       Description:
217       Set the given tags to the given values in this DataTagged object, by repeatedly       Set the given tags to the given values in this DataTagged object.
218       using setTaggedValue for each given tag/value pair.       \param tagKeys - Input - A vector of integer tag.
      \param tagKeys - Input - A vector of integer keys.  
219       \param values - Input - A vector of DataArrayViews. If this is empty       \param values - Input - A vector of DataArrayViews. If this is empty
220                        then all given tags will be assigned a value of zero. If                       all tag values will be assigned a scalar data-point of value
221                        it contains one value all tag values will be assigned the same value.                       0. If it contains one value all tag values will be assigned
222                        Otherwise if there is a mismatch between the number of keys and               this value. Otherwise consecutive tags will be assigned
223                        the number of values an exception will be generated.                       consecutive values.  If there is a mismatch between  the
224                 number of keys and the number of values an exception
225                 will be generated.
226      T      T
227    */    */
228    void    void
# Line 244  class DataTagged : public DataAbstract { Line 234  class DataTagged : public DataAbstract {
234       setTaggedValue       setTaggedValue
235    
236       Description:       Description:
237       Assign the given value to the given tag. If this tag does not already have a value       Assign the given value to the given tag.
238       associated with it, addTaggedValue will be used to add this tag/value pair.       \param tagKey - Input - Integer tag.
      \param tagKey - Input - Integer key.  
239       \param value - Input - Single DataArrayView value to be assigned to the tag.       \param value - Input - Single DataArrayView value to be assigned to the tag.
240      T      T
241    */    */
# Line 260  class DataTagged : public DataAbstract { Line 249  class DataTagged : public DataAbstract {
249       getDataPointByTag       getDataPointByTag
250    
251       Description:       Description:
252       Return a view into the data-point associated with the given tag.       Return data-point associated with the given tag as a DataArrayView.
253       \param tag - Input - Integer key.       \param tag - Input - Integer key.
254      T      T
255    */    */
# Line 272  class DataTagged : public DataAbstract { Line 261  class DataTagged : public DataAbstract {
261       getDataPoint       getDataPoint
262    
263       Description:       Description:
264       Return a view into the data-point specified by the given sample       Return the data-point specified by the given sample and data-point
265       and data-point numbers.       numbers as a DataArrayView.
266       \param sampleNo - Input.       \param sampleNo - Input.
267       \param dataPointNo - Input.       \param dataPointNo - Input.
268      T      T
# Line 301  class DataTagged : public DataAbstract { Line 290  class DataTagged : public DataAbstract {
290       Description:       Description:
291       Return true if the given tag exists within the DataTagged tag map.       Return true if the given tag exists within the DataTagged tag map.
292    
293       NOTE: The DataTagged tag map does not necessarily coincide with the tag       *** NB: The DataTagged tag map does not necessarily coincide with the tag
294       keys in the associated function space.       keys in the associated function space.
295      T      T
296    */    */
# Line 328  class DataTagged : public DataAbstract { Line 317  class DataTagged : public DataAbstract {
317       getLength       getLength
318    
319       Description:       Description:
320       Return the number of doubles stored for the Data.       Return the total number of doubles stored for this DataTagged object.
321      T      T
322    */    */
323    virtual    virtual
# Line 340  class DataTagged : public DataAbstract { Line 329  class DataTagged : public DataAbstract {
329       getSlice       getSlice
330    
331       Description:       Description:
332       Factory method that returns a newly created DataTagged object.       Factory method that returns a newly created DataTagged object generated
333       The caller is reponsible for managing the object created.       by taking the specified slice from this DataTagged object.
334         The caller is reponsible for managing the returned object.
335    */    */
336    virtual    virtual
337    DataAbstract*    DataAbstract*
# Line 349  class DataTagged : public DataAbstract { Line 339  class DataTagged : public DataAbstract {
339    
340    /**    /**
341       \brief       \brief
342       setSlice       Slice Constructor for DataTagged.
343    
344       Description:       Description:
345       Copy the specified region from the given value into this object.       Slice Constructor for DataTagged.
346       \param value - Input - Data to copy from.       Creates a DataTagged object which is the specified slice
347         from another DataTagged object.
348         \param other - Input - DataTagged object to copy from.
349       \param region - Input - Region to copy.       \param region - Input - Region to copy.
350    */    */
351      DataTagged(const DataTagged& other,
352             const DataArrayView::RegionType& region);
353    
354      /**
355         \brief
356         setSlice
357    
358         Description:
359         Copy the specified region from the given Data object into this object.
360         \param other - Input - Data object to copy from.
361         \param region - Input - Region to copy (NB: must have same shape as this!).
362      */
363    virtual    virtual
364    void    void
365    setSlice(const DataAbstract* value,    setSlice(const DataAbstract* other,
366             const DataArrayView::RegionType& region);             const DataArrayView::RegionType& region);
367    
368    /**    /**
# Line 366  class DataTagged : public DataAbstract { Line 370  class DataTagged : public DataAbstract {
370       reshapeDataPoint       reshapeDataPoint
371    
372       Description:       Description:
373       Reshape the data point only if the data-point is currently rank 0.       Reshape each data-point in this object to the given shape, only
374       An exception is thrown if the data-point has rank other than 0.       if current data-points are scalars. An exception is thrown if
375       The original data point value is used for all values of the new       the current data-points have rank other than 0.
376       data point.       The original values of the data-points are used for all values
377         of the new data-points.
378        T
379    */    */
380    void    void
381    reshapeDataPoint(const DataArrayView::ShapeType& shape);    reshapeDataPoint(const DataArrayView::ShapeType& shape);
382    
383    /**    /**
384      \brief       \brief
385      Archive the underlying data values to the file referenced       Archive the underlying data values to the file referenced
386      by ofstream. A count of the number of values expected to be written       by ofstream. A count of the number of values expected to be written
387      is provided as a cross-check.       is provided as a cross-check.
388    
389      The return value indicates success (0) or otherwise (1).       The return value indicates success (0) or otherwise (1).
390    */    */
391    int    int
392    archiveData(std::ofstream& archiveFile,    archiveData(std::ofstream& archiveFile,
393                const DataArrayView::ValueType::size_type noValues) const;                const DataArrayView::ValueType::size_type noValues) const;
394    
395    /**    /**
396      \brief       \brief
397      Extract the number of values specified by noValues from the file       Extract the number of values specified by noValues from the file
398      referenced by ifstream to the underlying data structure.       referenced by ifstream to the underlying data structure.
399    
400      The return value indicates success (0) or otherwise (1).       The return value indicates success (0) or otherwise (1).
401    */    */
402    int    int
403    extractData(std::ifstream& archiveFile,    extractData(std::ifstream& archiveFile,

Legend:
Removed from v.507  
changed lines
  Added in v.513

  ViewVC Help
Powered by ViewVC 1.1.26