/[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 496 by jgs, Tue Feb 7 01:27:14 2006 UTC revision 509 by jgs, Fri Feb 10 03:24:44 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
64    */    */
65    DataTagged();    DataTagged();
66    
# Line 69  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.
83        T
84    */    */
85    DataTagged(const TagListType& tagKeys,    DataTagged(const TagListType& tagKeys,
86               const ValueListType& values,               const ValueListType& values,
# Line 98  class DataTagged : public DataAbstract { Line 101  class DataTagged : public DataAbstract {
101    DataTagged(const FunctionSpace& what,    DataTagged(const FunctionSpace& what,
102               const DataArrayView::ShapeType &shape,               const DataArrayView::ShapeType &shape,
103               const int tags[],               const int tags[],
104               const ValueType &data);               const ValueType& data);
105    
106    /**    /**
107       \brief       \brief
# Line 117  class DataTagged : public DataAbstract { Line 120  class DataTagged : public DataAbstract {
120       \brief       \brief
121       Copy Constructor for DataTagged.       Copy Constructor for DataTagged.
122       Performs a deep copy from the given DataTagged object.       Performs a deep copy from the given DataTagged object.
123        T
124    */    */
125    DataTagged(const DataTagged& other);    DataTagged(const DataTagged& other);
126    
127    /**    /**
128       \brief       \brief
129       Copy Constructor for DataTagged.       Copy Constructor for DataTagged.
130       Construct a tagged data from a DataConstant object.       Construct a DataTagged object from a DataConstant object.
131       The default value will be that held by the DataConstant object.       The default value will be the value of the DataConstant object.
132        T
133    */    */
134    DataTagged(const DataConstant& other);    DataTagged(const DataConstant& other);
135    
# Line 137  class DataTagged : public DataAbstract { Line 142  class DataTagged : public DataAbstract {
142       sample will be visible via the returned pointer.       sample will be visible via the returned pointer.
143    
144       ** This provides an interface into the data suitable for legacy C code.       ** This provides an interface into the data suitable for legacy C code.
145         ** NB: need to do array bounds checking when accessing returned value!
146        T
147    */    */
148    virtual    virtual
149    double*    double*
# Line 147  class DataTagged : public DataAbstract { Line 154  class DataTagged : public DataAbstract {
154       Write the data as a string.       Write the data as a string.
155       Writes out each tag, including the default, and the data-point which is       Writes out each tag, including the default, and the data-point which is
156       associated with each tag.       associated with each tag.
157        T
158    */    */
159    virtual    virtual
160    std::string    std::string
# Line 156  class DataTagged : public DataAbstract { Line 164  class DataTagged : public DataAbstract {
164       \brief       \brief
165       Return the tag number associated with the given data-point number       Return the tag number associated with the given data-point number
166       according to the associated function space.       according to the associated function space.
167        T
168    */    */
169    virtual    virtual
170    int    int
# Line 171  class DataTagged : public DataAbstract { Line 180  class DataTagged : public DataAbstract {
180    
181       \param sampleNo - Input - sample number.       \param sampleNo - Input - sample number.
182       \param dataPointNo - Input - data-point number.       \param dataPointNo - Input - data-point number.
183     */      T
184      */
185    virtual    virtual
186    ValueType::size_type    ValueType::size_type
187    getPointOffset(int sampleNo,    getPointOffset(int sampleNo,
# Line 182  class DataTagged : public DataAbstract { Line 192  class DataTagged : public DataAbstract {
192       addTaggedValues       addTaggedValues
193    
194       Description:       Description:
195       Add the given tags and values to this DataTagged object, by repeatedly       Add the given tags and values to this DataTagged object.
196       using addTaggedValue for each given tag/value pair.       \param tagKeys - Input - A vector of integer tags.
      \param tagKeys - Input - A vector of integer keys.  
197       \param values - Input - A vector of DataArrayViews. If this is empty       \param values - Input - A vector of DataArrayViews. If this is empty
198                        then all given tags will be assigned a value of zero. If                       all tag values will be assigned a scalar data-point of value
199                        it contains one value all tags will be assigned the same value.                       0. If it contains one value all tag values will be assigned
200                        Otherwise if there is a mismatch between the number of tags and               this value. Otherwise consecutive tags will be assigned
201                        the number of values an exception will be generated.                       consecutive values.  If there is a mismatch between  the
202                 number of keys and the number of values an exception
203                 will be generated.
204        T
205    */    */
206    void    void
207    addTaggedValues(const TagListType& tagKeys,    addTaggedValues(const TagListType& tagKeys,
# Line 202  class DataTagged : public DataAbstract { Line 214  class DataTagged : public DataAbstract {
214       Description:       Description:
215       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
216       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.
217       \param tagKey - Input - Integer key.       \param tagKey - Input - Integer tag.
218       \param value - Input - Single DataArrayView value to be assigned to the tag.       \param value - Input - Single DataArrayView value to be assigned to the tag.
219        T
220    */    */
221    void    void
222    addTaggedValue(int tagKey,    addTaggedValue(int tagKey,
# Line 214  class DataTagged : public DataAbstract { Line 227  class DataTagged : public DataAbstract {
227       setTaggedValues       setTaggedValues
228    
229       Description:       Description:
230       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.
231       using setTaggedValue for each given tag/value pair.       \param tagKeys - Input - A vector of integer tag.
      \param tagKeys - Input - A vector of integer keys.  
232       \param values - Input - A vector of DataArrayViews. If this is empty       \param values - Input - A vector of DataArrayViews. If this is empty
233                        then all given tags will be assigned a value of zero. If                       all tag values will be assigned a scalar data-point of value
234                        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
235                        Otherwise if there is a mismatch between the number of keys and               this value. Otherwise consecutive tags will be assigned
236                        the number of values an exception will be generated.                       consecutive values.  If there is a mismatch between  the
237                 number of keys and the number of values an exception
238                 will be generated.
239        T
240    */    */
241    void    void
242    setTaggedValues(const TagListType& tagKeys,    setTaggedValues(const TagListType& tagKeys,
# Line 232  class DataTagged : public DataAbstract { Line 247  class DataTagged : public DataAbstract {
247       setTaggedValue       setTaggedValue
248    
249       Description:       Description:
250       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.
251       associated with it, addTaggedValue will be used to add this tag/value pair.       \param tagKey - Input - Integer tag.
      \param tagKey - Input - Integer key.  
252       \param value - Input - Single DataArrayView value to be assigned to the tag.       \param value - Input - Single DataArrayView value to be assigned to the tag.
253        T
254    */    */
255    virtual    virtual
256    void    void
# Line 247  class DataTagged : public DataAbstract { Line 262  class DataTagged : public DataAbstract {
262       getDataPointByTag       getDataPointByTag
263    
264       Description:       Description:
265       Return a view into the data-point associated with the given tag.       Return data-point associated with the given tag as a DataArrayView.
266       \param tag - Input - Integer key.       \param tag - Input - Integer key.
267        T
268    */    */
269    DataArrayView    DataArrayView
270    getDataPointByTag(int tag) const;    getDataPointByTag(int tag) const;
# Line 258  class DataTagged : public DataAbstract { Line 274  class DataTagged : public DataAbstract {
274       getDataPoint       getDataPoint
275    
276       Description:       Description:
277       Return a view into the data-point specified by the given sample       Return the data-point specified by the given sample and data-point
278       and data-point numbers.       numbers as a DataArrayView.
279       \param sampleNo - Input.       \param sampleNo - Input.
280       \param dataPointNo - Input.       \param dataPointNo - Input.
281        T
282    */    */
283    virtual    virtual
284    DataArrayView    DataArrayView
# Line 274  class DataTagged : public DataAbstract { Line 291  class DataTagged : public DataAbstract {
291    
292       Description:       Description:
293       Return a reference to the tag offset lookup table.       Return a reference to the tag offset lookup table.
294        T
295    */    */
296    const DataMapType&    const DataMapType&
297    getTagLookup() const;    getTagLookup() const;
# Line 285  class DataTagged : public DataAbstract { Line 303  class DataTagged : public DataAbstract {
303       Description:       Description:
304       Return true if the given tag exists within the DataTagged tag map.       Return true if the given tag exists within the DataTagged tag map.
305    
306       NOTE: The DataTagged tag map does not necessarily coincide with the tag       *** NB: The DataTagged tag map does not necessarily coincide with the tag
307       keys in the associated function space.       keys in the associated function space.
308     */      T
309      */
310    bool    bool
311    isCurrentTag(int tag) const;    isCurrentTag(int tag) const;
312    
# Line 298  class DataTagged : public DataAbstract { Line 317  class DataTagged : public DataAbstract {
317       Description:       Description:
318       Return the default value. This value is associated with any tag which       Return the default value. This value is associated with any tag which
319       is not explicitly recorded in this DataTagged object's tag map.       is not explicitly recorded in this DataTagged object's tag map.
320        T
321    */    */
322    DataArrayView&    DataArrayView&
323    getDefaultValue();    getDefaultValue();
# Line 310  class DataTagged : public DataAbstract { Line 330  class DataTagged : public DataAbstract {
330       getLength       getLength
331    
332       Description:       Description:
333       Return the number of doubles stored for the Data.       Return the total number of doubles stored for this DataTagged object.
334        T
335    */    */
336    virtual    virtual
337    ValueType::size_type    ValueType::size_type
# Line 347  class DataTagged : public DataAbstract { Line 368  class DataTagged : public DataAbstract {
368       reshapeDataPoint       reshapeDataPoint
369    
370       Description:       Description:
371       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
372       An exception is thrown if the data-point has rank other than 0.       if current data-points are scalars. An exception is thrown if
373       The original data point value is used for all values of the new       the current data-points have rank other than 0.
374       data point.       The original values of the data-points are used for all values
375         of the new data-points.
376        T
377    */    */
378    void    void
379    reshapeDataPoint(const DataArrayView::ShapeType& shape);    reshapeDataPoint(const DataArrayView::ShapeType& shape);
380    
381    /**    /**
382      \brief       \brief
383      Archive the underlying data values to the file referenced       Archive the underlying data values to the file referenced
384      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
385      is provided as a cross-check.       is provided as a cross-check.
386    
387      The return value indicates success (0) or otherwise (1).       The return value indicates success (0) or otherwise (1).
388    */    */
389    int    int
390    archiveData(std::ofstream& archiveFile,    archiveData(std::ofstream& archiveFile,
391                const DataArrayView::ValueType::size_type noValues) const;                const DataArrayView::ValueType::size_type noValues) const;
392    
393    /**    /**
394      \brief       \brief
395      Extract the number of values specified by noValues from the file       Extract the number of values specified by noValues from the file
396      referenced by ifstream to the underlying data structure.       referenced by ifstream to the underlying data structure.
397    
398      The return value indicates success (0) or otherwise (1).       The return value indicates success (0) or otherwise (1).
399    */    */
400    int    int
401    extractData(std::ifstream& archiveFile,    extractData(std::ifstream& archiveFile,

Legend:
Removed from v.496  
changed lines
  Added in v.509

  ViewVC Help
Powered by ViewVC 1.1.26