/[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

trunk/esys2/escript/src/Data/DataTagged.h revision 121 by jgs, Fri May 6 04:26:16 2005 UTC trunk/escript/src/DataTagged.h revision 2005 by jfenwick, Mon Nov 10 01:21:39 2008 UTC
# Line 1  Line 1 
 // $Id$  
1    
2  /*  /*******************************************************
3   ******************************************************************************  *
4   *                                                                            *  * Copyright (c) 2003-2008 by University of Queensland
5   *       COPYRIGHT  ACcESS 2004 -  All Rights Reserved                        *  * Earth Systems Science Computational Center (ESSCC)
6   *                                                                            *  * http://www.uq.edu.au/esscc
7   * This software is the property of ACcESS. No part of this code              *  *
8   * may be copied in any form or by any means without the expressed written    *  * Primary Business: Queensland, Australia
9   * consent of ACcESS.  Copying, use or modification of this software          *  * Licensed under the Open Software License version 3.0
10   * by any unauthorised person is illegal unless that person has a software    *  * http://www.opensource.org/licenses/osl-3.0.php
11   * license agreement with ACcESS.                                             *  *
12   *                                                                            *  *******************************************************/
13   ******************************************************************************  
 */  
14    
15  #if !defined escript_DataTagged_20040615_H  #if !defined escript_DataTagged_20040615_H
16  #define escript_DataTagged_20040615_H  #define escript_DataTagged_20040615_H
17    #include "system_dep.h"
18    
19  #include "escript/Data/DataAbstract.h"  #include "DataReady.h"
20  #include "escript/Data/DataArray.h"  #include "DataTypes.h"
 #include "escript/Data/DataArrayView.h"  
21    
22  #include <vector>  #include <vector>
23  #include <map>  #include <map>
# Line 30  class DataConstant; Line 28  class DataConstant;
28    
29  /**  /**
30     \brief     \brief
31     Creates the illusion of a full dataset accessible via sampleNo and dataPointNo.     Simulates a full dataset accessible via sampleNo and dataPointNo.
32    
33     Description:     Description:
34     Creates the illusion of a full dataset accessible via sampleNo and     Each data-point has an associated tag number, and a given tag can represent a
35     dataPointNo. In reality a much smaller number of data-points is stored.     range of dataPointNo and sampleNo. Each tag indexes only a single data-point.
    Each data-point has an associated key, thus a given key represents a specific  
    range of dataPointNo and sampleNo. Each key indexes a single data-point.  
36     Thus only a single data-point needs to be stored for a range of sampleNo and     Thus only a single data-point needs to be stored for a range of sampleNo and
37     dataPointNo values.     dataPointNo values.
38  */  */
39    
40  class DataTagged : public DataAbstract {  class DataTagged : public DataReady {
41    typedef DataReady parent;
42   public:   public:
43    
44    //    //
45    // Types for the lists of tags and values    // Types for the lists of tags and values.
46    typedef std::vector<int>           TagListType;    typedef std::vector<int>           TagListType;
47    typedef std::vector<DataArrayView> ValueListType;  //  typedef std::vector<DataArrayView> ValueListType;
48    typedef DataArrayView::ValueType   ValueType;    typedef DataTypes::ValueType   ValueType;
49      typedef std::vector<ValueType::ElementType> ValueBatchType;
50    
51    //    //
52    // Map from the tag to an offset the the data array.    // Map from a tag to an offset into the data array.
53    typedef std::map<int, int> DataMapType;    typedef std::map<int, int> DataMapType;
54    
55    /**    /**
# Line 61  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 default data-point is a scalar data-point with value 0.0. Any given tag       the default data-point is a scalar data-point with value 0.0, and no other
62       will map to this data-point.       tag values are stored.
63        T
64    */    */
65      ESCRIPT_DLL_API
66    DataTagged();    DataTagged();
67    
68    /**    /**
69       \brief       \brief
70       Constructor for DataTagged.       Alternative Constructor for DataTagged.
71    
72       Description:       Description:
73       Constructor for DataTagged.       Alternative Constructor for DataTagged.
74       \param tagKeys - Input - A vector of integer keys.       \param what - Input - A description of what this data object represents.
75       \param values - Input - A vector of DataArrayViews. If this is empty       \param shape - Input - The shape of each data-point.
76                     all tag values will be assigned a value of zero. If       \param tags - Input - An array of tags, one for each sample number (starts at tag[1]).
77                     it contains one value all tag values will be assigned the       \param data - The data values for each tag.
78             same value. Otherwise if there is a mismatch between      NB: no unit testing yet
            the number of keys and the number of values an exception  
            will be generated.  
      \param defaultValue - Input - Value returned if a requested tag doesn't exist.  
      \param what - Input - A description of what this data represents.  
79    */    */
80    DataTagged(const TagListType& tagKeys,    ESCRIPT_DLL_API
81               const ValueListType& values,    DataTagged(const FunctionSpace& what,
82           const DataArrayView& defaultValue,               const DataTypes::ShapeType &shape,
83           const FunctionSpace& what);               const int tags[],
84                 const ValueType& data);
85    
86    /**   /**
87       \brief       \brief
88       Alternative constructor for DataTagged objects.       Alternative Constructor for DataTagged.
89    
90       Description:       Description:
91       Alternative Constructor for DataTagged objects.       Alternative Constructor for DataTagged.
92       \param what - Input - A description of what this data object represents.       \param what - Input - A description of what this data object represents.
93       \param shape - Input - the shape of each data-point.       \param shape - Input - The shape of each data-point.
94       \param tags - Input - array of tags, one for each sample number       \param tags - Input - An vector of tags, one for each sample number.
95       \param data - the data values for each data-point.       \param data - The data values for each tag.
96    */  TODO Make sure to document the relationship between tags and data, ie: data also contains the default value
97     */
98      ESCRIPT_DLL_API
99    DataTagged(const FunctionSpace& what,    DataTagged(const FunctionSpace& what,
100               const DataArrayView::ShapeType &shape,               const DataTypes::ShapeType &shape,
101               const int tags[],               const TagListType& tags,
102               const ValueType &data);               const ValueType& data);
103    
104    /**    /**
105       \brief       \brief
106       Slice constructor for DataTagged.       Copy Constructor for DataTagged.
107         Performs a deep copy from the given DataTagged object.
108        T
109      */
110      ESCRIPT_DLL_API
111      DataTagged(const DataTagged& other);
112    
113       Description:    /**
114       Slice constructor for DataTagged.       \brief
115       Copies a slice from another DataTagged object.       Copy Constructor for DataTagged.
116       \param other - Input - DataTagged object to copy from.       Construct a DataTagged object from a DataConstant object.
117       \param region - Input - region to copy.       The default value will be the value of the DataConstant object.
118        T
119    */    */
120    DataTagged(const DataTagged& other,    ESCRIPT_DLL_API
121           const DataArrayView::RegionType& region);    DataTagged(const DataConstant& other);
122    
123    /**    /**
124       \brief       \brief
125       Copy constructorfor DataTagged.       Copies the tags from a DataTagged into a new Data Tagged and assigns them the default value. ** Not unit tested **
126       Performs a deep copy from the given DataTagged object.  
127         This is different from a deep copy because we are not copying shape or other information, just tags.
128         \param what - Input - FunctionSpace for the new DataTagged
129         \param shape - Input - Shape for points in the new DataTagged
130         \param defaultvalue - Input - Default value for new DataTagged
131         \param tagsource - Input - A DataTagged object which supplies the tags.
132    */    */
133    DataTagged(const DataTagged& other);    ESCRIPT_DLL_API
134      DataTagged(const FunctionSpace& what,
135                 const DataTypes::ShapeType& shape,
136             const DataTypes::ValueType& defaultvalue,
137                 const DataTagged* tagsource=0);
138    
139    /**    /**
140       \brief       \brief
141       Construct a tagged data from a DataConstant object.       Destructor
      The default data-point will be that held by the DataConstant object.  
142    */    */
143    DataTagged(const DataConstant& other);    ESCRIPT_DLL_API
144      inline virtual
145      ~DataTagged() {};
146    
147      ESCRIPT_DLL_API
148      bool
149      isTagged() const
150      {
151        return true;
152      };
153    
154    
155      /**
156         \brief Return a deep copy of the current object.
157      */
158      ESCRIPT_DLL_API
159      virtual
160      DataAbstract*
161      deepCopy();
162    
163    
164    /**    /**
165       \brief       \brief
166       getSampleDataByTag       getSampleDataByTag
167    
168       Description:       Description:
169       Return the data-point for the given tag. All of the data for the entire       Return the data-point for the given tag. All of the data for the
170       sample should be visable via the returned pointer. This provides an       sample will be visible via the returned pointer.
171       interface into the data suitable for legacy C code.  
172         ** This provides an interface into the data suitable for legacy C code.
173         ** NB: need to do array bounds checking when accessing returned value!
174        T
175    */    */
176      ESCRIPT_DLL_API
177    virtual    virtual
178    double*    double*
179    getSampleDataByTag(int tag);    getSampleDataByTag(int tag);
# Line 148  class DataTagged : public DataAbstract { Line 183  class DataTagged : public DataAbstract {
183       Write the data as a string.       Write the data as a string.
184       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
185       associated with each tag.       associated with each tag.
186        T
187    */    */
188      ESCRIPT_DLL_API
189    virtual    virtual
190    std::string    std::string
191    toString() const;    toString() const;
192     /**
193         \brief
194         dumps the object into a netCDF file
195      */
196      ESCRIPT_DLL_API
197      virtual
198      void
199      dump(const std::string fileName) const;
200    
201     /**
202         \brief
203        sets all values to zero
204      */
205      ESCRIPT_DLL_API
206      virtual
207      void
208      setToZero();
209    
210      /**
211         \brief
212         Return the tag number associated with the given data-point number
213         according to the associated function space.
214        T
215      */
216      ESCRIPT_DLL_API
217      virtual
218      int
219      getTagNumber(int dpno);
220    
221    /**    /**
222       \brief       \brief
223       getPointOffset       getPointOffset
224    
225       Description:       Description:
226       Return the offset to the given data-point. This is somewhat artificial,       Return the offset to the given data-point value in the underlying
227       but returns the offset for the given point in the DataTagged object.       data vector.
      Only really necessary to avoid many DataArrayView objects.  
228    
229       \param sampleNo - Input - sample number.       \param sampleNo - Input - sample number.
230       \param dataPointNo - Input - data-point number.       \param dataPointNo - Input - data-point number.
231     */      T
232      */
233      ESCRIPT_DLL_API
234    virtual    virtual
235    ValueType::size_type    ValueType::size_type
236    getPointOffset(int sampleNo,    getPointOffset(int sampleNo,
237                   int dataPointNo) const;                   int dataPointNo) const;
238    
239    /**    ESCRIPT_DLL_API
240      virtual
241      ValueType::size_type
242      getPointOffset(int sampleNo,
243                     int dataPointNo);
244    
245     /**
246       \brief       \brief
247       addTaggedValues       addTaggedValues
248    
249       Description:       Description:
250       Add the given tags and values to this DataTagged object, by repeatedly       Add the given tags and values to this DataTagged object.
251       using addTaggedValue for each given tag/value pair.       \param tagKeys - Input - A vector of integer tags.
252       \param tagKeys - Input - A vector of integer keys.       \param values - Input - A vector of doubles. If this is empty, the default value for
253       \param values - Input - A vector of DataArrayViews. If this is empty                       this DataTagged will be used for all tags.
254                        then all given tags will be assigned a value of zero. If                       If it contains one value all tag values will be assigned
255                        it contains one value all tags will be assigned the same value.               this value. Otherwise consecutive tags will be assigned
256                        Otherwise if there is a mismatch between the number of tags and                       consecutive values.  If there is a mismatch between  the
257                        the number of values an exception will be generated.               number of keys and the number of values an exception
258                 will be generated.
259         \param vShape - shape of the datapoints in "values"
260        T
261     */
262      ESCRIPT_DLL_API
263      void
264      addTaggedValues(const TagListType& tagKeys,
265                                const ValueBatchType& values,
266                                const ShapeType& vShape);
267    
268    
269      /**
270       Description:
271       Add the given tags and values to this DataTagged object.
272       \param tagKeys - Input - A vector of integer tags.
273       \param values - Input - A DataVector containing the datapoints.
274                 If this is empty, the default value for
275                         this DataTagged will be used for all tags.
276                         If it contains one value all tag values will be assigned
277                 this value. Otherwise consecutive tags will be assigned
278                         consecutive values.  If there is a mismatch between  the
279                 number of keys and the number of values an exception
280                 will be generated.
281        \param vShape - shape of the datapoints in "values"
282    
283       TODO Makesure this is properly unit tested
284    */    */
285      ESCRIPT_DLL_API
286    void    void
287    addTaggedValues(const TagListType& tagKeys,    addTaggedValues(const TagListType& tagKeys,
288                    const ValueListType& values);                                const ValueType& values,
289                                const ShapeType& vShape);
290    
291    
292    
293    
294    /**    /**
295       \brief       \brief
# Line 195  class DataTagged : public DataAbstract { Line 298  class DataTagged : public DataAbstract {
298       Description:       Description:
299       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
300       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.
301       \param tagKey - Input - Integer key.       \param tagKey - Input - Integer tag.
302       \param value - Input - Single DataArrayView value to be assigned to the tag.       \param pointshape - Shape of the value parameter
303         \param value - Input - Single DataArrayView value to be assigned to the tag.
304         \param dataOffset - Input - Offset of the beginning of the point in the value parameter
305    */    */
306      ESCRIPT_DLL_API
307    void    void
308    addTaggedValue(int tagKey,    addTaggedValue(int tagKey,
309                   const DataArrayView& value);           const DataTypes::ShapeType& pointshape,
310                     const ValueType& value,
311             int dataOffset=0);
312    
313    /**    /**
314       \brief       \brief
315       setTaggedValues       addTag - does not modify the default value for this object. ** Not unit tested **
316    
317       Description:       Description:
318       Set the given tags to the given values in this DataTagged object, by repeatedly       Add a single tag. The default value for this DataTagged will be associated with the tag.
319       using setTaggedValue for each given tag/value pair.       If this tag already has a value associated with it, then no change will be made.
320       \param tagKeys - Input - A vector of integer keys.       \param tagKey - Input - Integer tag.
321       \param values - Input - A vector of DataArrayViews. If this is empty      TODO: Make sure this is unit tested
                       then all given tags will be assigned a value of zero. If  
                       it contains one value all tag values will be assigned the same value.  
                       Otherwise if there is a mismatch between the number of keys and  
                       the number of values an exception will be generated.  
322    */    */
323      ESCRIPT_DLL_API
324    void    void
325    setTaggedValues(const TagListType& tagKeys,    addTag(int tagKey);
                   const ValueListType& values);  
326    
327    /**    /**
328       \brief       \brief
329       setTaggedValue       setTaggedValue
330    
331       Description:       Description:
332       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.
333       associated with it, addTaggedValue will be used to add this tag/value pair.       \param tagKey - Input - Integer tag.
334       \param tagKey - Input - Integer key.       \param pointshape - the shape of the value parameter
335       \param value - Input - Single DataArrayView value to be assigned to the tag.       \param value - Input - Vector storing the datapoint to be assigned to the tag.
336         \param dataOffset - beginning of the datapoint within "value".
337        T
338    */    */
339    virtual    ESCRIPT_DLL_API
340    void    void
341    setTaggedValue(int tagKey,    setTaggedValue(int tagKey,
342                   const DataArrayView& value);           const DataTypes::ShapeType& pointshape,
343                     const ValueType& value,
344             int dataOffset=0);
345    
346    /**    /**
347       \brief       \brief
348       getDataPointByTag       getDataByTag
349    
350       Description:       Return a pointer to the beginning of the datapoint with the specified tag.
351       Return a view into the data-point associated with the given tag.       TODO Eventually these should be inlined.
352       \param tag - Input - Integer key.       \param tag - Input - Integer key.
353         \param i - position in the underlying datastructure
354        T
355    */    */
356    DataArrayView    ESCRIPT_DLL_API
357    getDataPointByTag(int tag) const;    DataTypes::ValueType::const_reference
358      getDataByTag(int tag, DataTypes::ValueType::size_type i) const;
359    
360      ESCRIPT_DLL_API
361      DataTypes::ValueType::reference
362      getDataByTag(int tag, DataTypes::ValueType::size_type i);
363    
364    
365      /**
366          \brief
367          getOffsetForTag
368    
369          \param tag
370          \return the offset of the beginning of the datapoint corresponding to tag.
371    
372          Note: If the tag is not valid, the offset of the default value is returned instead.
373      */
374      ESCRIPT_DLL_API
375      DataTypes::ValueType::size_type
376      getOffsetForTag(int tag) const;
377    
378    
379      /**
380         \brief
381         Return a reference to the underlying DataVector.
382      */
383    
384      ESCRIPT_DLL_API
385      DataTypes::ValueType&
386      getVector();
387    
388      ESCRIPT_DLL_API
389      const DataTypes::ValueType&
390      getVector() const;
391    
392    
393    
394    /**    /**
395       \brief       \brief
396       getDataPoint       getData
397    
398       Description:       Description:
399       Return a view into the data-point specified by the given sample       Return pointer to the data
400       and data-point numbers.      T
      NOTE: Construction of the DataArrayView is a relatively expensive  
      operation.  
      \param sampleNo - Input.  
      \param dataPointNo - Input.  
401    */    */
402    virtual  //   ESCRIPT_DLL_API
403    DataArrayView  //   const DataTypes::ValueType::ElementType*
404    getDataPoint(int sampleNo,  //   getData() const;
                int dataPointNo);  
405    
406    /**    /**
407       \brief       \brief
# Line 269  class DataTagged : public DataAbstract { Line 409  class DataTagged : public DataAbstract {
409    
410       Description:       Description:
411       Return a reference to the tag offset lookup table.       Return a reference to the tag offset lookup table.
412        T
413    */    */
414      ESCRIPT_DLL_API
415    const DataMapType&    const DataMapType&
416    getTagLookup() const;    getTagLookup() const;
417    
# Line 278  class DataTagged : public DataAbstract { Line 420  class DataTagged : public DataAbstract {
420       isCurrentTag       isCurrentTag
421    
422       Description:       Description:
423       Return true if the given tag exists within the DataTagged tag keys.       Return true if the given tag exists within the DataTagged tag map.
424       NOTE: The DataTagged keys do not necessarily coincide with the tag  
425       keys for the function space.       *** NB: The DataTagged tag map does not necessarily coincide with the tag
426     */       keys in the associated function space.
427        T
428      */
429      ESCRIPT_DLL_API
430    bool    bool
431    isCurrentTag(int tag) const;    isCurrentTag(int tag) const;
432    
# Line 291  class DataTagged : public DataAbstract { Line 436  class DataTagged : public DataAbstract {
436    
437       Description:       Description:
438       Return the default value. This value is associated with any tag which       Return the default value. This value is associated with any tag which
439       is not explicitly recorded in this DataTagged object.       is not explicitly recorded in this DataTagged object's tag map.
440    */       \param i - position in the underlying datastructure
441    DataArrayView&      T
442    getDefaultValue();    */
443      ESCRIPT_DLL_API
444      DataTypes::ValueType::reference
445      getDefaultValue(DataTypes::ValueType::size_type i);
446    
447      ESCRIPT_DLL_API
448      DataTypes::ValueType::const_reference
449      getDefaultValue(DataTypes::ValueType::size_type i) const;
450    
451    
452    
   const DataArrayView&  
   getDefaultValue() const;  
453    
454    /**    /**
455       \brief       \brief
456       getLength       getLength
457    
458       Description:       Description:
459       Return the number of doubles stored for the Data.       Return the total number of doubles stored for this DataTagged object.
460        T
461    */    */
462      ESCRIPT_DLL_API
463    virtual    virtual
464    ValueType::size_type    ValueType::size_type
465    getLength() const;    getLength() const;
# Line 315  class DataTagged : public DataAbstract { Line 469  class DataTagged : public DataAbstract {
469       getSlice       getSlice
470    
471       Description:       Description:
472       Factory method that returns a newly created DataTagged object.       Factory method that returns a newly created DataTagged object generated
473       The caller is reponsible for managing the object created.       by taking the specified slice from this DataTagged object.
474         The caller is reponsible for managing the returned object.
475        T
476    */    */
477      ESCRIPT_DLL_API
478    virtual    virtual
479    DataAbstract*    DataAbstract*
480    getSlice(const DataArrayView::RegionType& region) const;    getSlice(const DataTypes::RegionType& region) const;
481    
482      /**
483         \brief
484         Slice Constructor for DataTagged.
485    
486         Description:
487         Creates a DataTagged object which is the specified slice
488         from the given DataTagged object.
489         \param other - Input - DataTagged object to slice from.
490         \param region - Input - Region to slice.
491        T
492      */
493      ESCRIPT_DLL_API
494      DataTagged(const DataTagged& other,
495             const DataTypes::RegionType& region);
496    
497    /**    /**
498       \brief       \brief
499       setSlice       setSlice
500    
501       Description:       Description:
502       Copy the specified region from the given value into this object.       Copy the given Data object into the specified region in this object.
503       \param value - Input - Data to copy from.       \param other - Input - Data object to copy from.
504       \param region - Input - Region to copy.       \param region - Input - Region to copy into (NB: must have same shape as other!).
505        T
506    */    */
507      ESCRIPT_DLL_API
508    virtual    virtual
509    void    void
510    setSlice(const DataAbstract* value,    setSlice(const DataAbstract* other,
511             const DataArrayView::RegionType& region);             const DataTypes::RegionType& region);
512    
513    
514    /**    /**
515       \brief       \brief
516       reshapeDataPoint       Computes a symmetric matrix (A + AT) / 2
517    
518         \param ev - Output - symmetric matrix
519    
      Description:  
      Reshape the data point only if the data-point is currently rank 0.  
      An exception is thrown if the data-point has rank other than 0.  
      The original data point value is used for all values of the new  
      data point.  
520    */    */
521    void    ESCRIPT_DLL_API
522    reshapeDataPoint(const DataArrayView::ShapeType& shape);    virtual void
523      symmetric(DataAbstract* ev);
524    
525      /**
526         \brief
527         Computes a nonsymmetric matrix (A - AT) / 2
528    
529         \param ev - Output - nonsymmetric matrix
530    
531      */
532      ESCRIPT_DLL_API
533      virtual void
534      nonsymmetric(DataAbstract* ev);
535    
536      /**
537         \brief
538         Computes the trace of a matrix
539    
540         \param ev - Output - the trace of a matrix
541    
542      */
543      ESCRIPT_DLL_API
544      virtual void
545      trace(DataAbstract* ev, int axis_offset);
546    
547      /**
548         \brief
549         swaps components axis0 and axis1
550    
551         \param ev - Output - swapped components
552    
553      */
554      ESCRIPT_DLL_API
555      virtual void
556      swapaxes(DataAbstract* ev, int axis0, int axis1);
557    
558      /**
559         \brief
560         Transpose each data point of this Data object around the given axis.
561    
562         \param ev - Output - the transpose of a matrix
563    
564      */
565      ESCRIPT_DLL_API
566      virtual void
567      transpose(DataAbstract* ev, int axis_offset);
568    
569      /**
570         \brief
571         solves the eigenvalue problem this*V=ev*V for the eigenvalues ev
572    
573         \param ev - Output - eigenvalues in increasing order at each data point
574    
575      */
576      ESCRIPT_DLL_API
577      virtual void
578      eigenvalues(DataAbstract* ev);
579    
580      /**
581         \brief
582         solves the eigenvalue problem this*V=ev*V for the eigenvalues ev and eigenvectors V
583    
584         \param ev - Output - eigenvalues in increasing order at each data point
585         \param V - Output - corresponding eigenvectors. They are normalized such that their length is one
586                             and the first nonzero component is positive.
587         \param tol - Input - eigenvalue with relative distance tol are treated as equal.
588    
589      */
590    
591      ESCRIPT_DLL_API
592      virtual void
593      eigenvalues_and_eigenvectors(DataAbstract* ev,DataAbstract* V,const double tol=1.e-13);
594    
595    
596      /**
597         \brief  Returns the offset in the structure which stores the default value
598      */
599      ESCRIPT_DLL_API
600      DataTypes::ValueType::size_type
601      getDefaultOffset() const;
602    
603   protected:   protected:
604    
# Line 358  class DataTagged : public DataAbstract { Line 609  class DataTagged : public DataAbstract {
609    DataMapType m_offsetLookup;    DataMapType m_offsetLookup;
610    
611    //    //
612    // the default value offset    // the offset to the default value
613    static const int m_defaultValueOffset = 0;    static const int m_defaultValueOffset = 0;
614    
615    //    //
# Line 375  DataTagged::isCurrentTag(int tag) const Line 626  DataTagged::isCurrentTag(int tag) const
626    return (pos!=m_offsetLookup.end());    return (pos!=m_offsetLookup.end());
627  }  }
628    
629    // inline
630    // DataArrayView&
631    // DataTagged::getDefaultValue()
632    // {
633    //   // The default value is always the first value.
634    //   return getPointDataView();
635    // }
636    
637    // inline
638    // const DataArrayView&
639    // DataTagged::getDefaultValue() const
640    // {
641    //   // The default value is always the first value.
642    //   return getPointDataView();
643    // }
644    
645    
646    inline
647    DataTypes::ValueType::size_type
648    DataTagged::getDefaultOffset() const
649    {
650      return m_defaultValueOffset;  
651    }
652    
653    inline
654    DataTypes::ValueType::reference
655    DataTagged::getDefaultValue(DataTypes::ValueType::size_type i)
656    {
657        return getVector()[i];
658    }
659    
660    inline
661    DataTypes::ValueType::const_reference
662    DataTagged::getDefaultValue(DataTypes::ValueType::size_type i) const
663    {
664        return getVector()[i];
665    }
666    
667    
668    
669    
670    // inline
671    // const DataTypes::ValueType::ElementType*
672    // DataTagged::getData() const
673    // {
674    //    return &(m_data[0]);
675    // }
676    
677  inline  inline
678  DataArrayView&  const DataTagged::DataMapType&
679  DataTagged::getDefaultValue()  DataTagged::getTagLookup() const
680  {  {
681    // The default value is always the first value.    return m_offsetLookup;
   return getPointDataView();  
682  }  }
683    
684  inline  inline
685  const DataArrayView&  DataTypes::ValueType::size_type
686  DataTagged::getDefaultValue() const  DataTagged::getLength() const
687  {  {
688    // The default value is always the first value.    return m_data.size();
   return getPointDataView();  
689  }  }
690    
691  } // end of namespace  } // end of namespace

Legend:
Removed from v.121  
changed lines
  Added in v.2005

  ViewVC Help
Powered by ViewVC 1.1.26