/[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 100 by jgs, Wed Dec 15 03:48:48 2004 UTC trunk/escript/src/DataTagged.h revision 2766 by jfenwick, Mon Nov 23 05:10:53 2009 UTC
# Line 1  Line 1 
1  // $Id$  
2  /*  /*******************************************************
3   ******************************************************************************  *
4   *                                                                            *  * Copyright (c) 2003-2009 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 29  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    typedef std::vector<int> TagListType;    //
45    typedef std::vector<DataArrayView> ValueListType;    // Types for the lists of tags and values.
46      typedef std::vector<int>           TagListType;
47    //  typedef std::vector<DataArrayView> ValueListType;
48      typedef DataTypes::ValueType   ValueType;
49      typedef std::vector<ValueType::ElementType> ValueBatchType;
50    
51    //    //
52    // Map type, maps the key to an array offset.    // 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 57  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       Slice constructor for DataTagged.       Alternative Constructor for DataTagged.
89    
90       Description:       Description:
91       Slice constructor for DataTagged.       Alternative Constructor for DataTagged.
92       Copies a slice from another DataTagged object.       \param what - Input - A description of what this data object represents.
93       \param other - Input - DataTagged object to copy from.       \param shape - Input - The shape of each data-point.
94       \param region - Input - region to copy.       \param tags - Input - An vector of tags, one for each sample number.
95    */       \param data - The data values for each tag.
96    DataTagged(const DataTagged& other,  TODO Make sure to document the relationship between tags and data, ie: data also contains the default value
97           const DataArrayView::RegionType& region);   */
98      ESCRIPT_DLL_API
99      DataTagged(const FunctionSpace& what,
100                 const DataTypes::ShapeType &shape,
101                 const TagListType& tags,
102                 const ValueType& data);
103    
104    /**    /**
105       \brief       \brief
106       Copy constructorfor DataTagged.       Copy Constructor for DataTagged.
107       Performs a deep copy from the given DataTagged object.       Performs a deep copy from the given DataTagged object.
108        T
109    */    */
110      ESCRIPT_DLL_API
111    DataTagged(const DataTagged& other);    DataTagged(const DataTagged& other);
112    
113    /**    /**
114       \brief       \brief
115       Construct a tagged data from a DataConstant object.       Copy Constructor for DataTagged.
116       The default data-point will be that held by the DataConstant object.       Construct a DataTagged object from a DataConstant object.
117         The default value will be the value of the DataConstant object.
118        T
119    */    */
120      ESCRIPT_DLL_API
121    DataTagged(const DataConstant& other);    DataTagged(const DataConstant& other);
122    
123    /**    /**
124       \brief       \brief
125         Copies the tags from a DataTagged into a new Data Tagged and assigns them the default value. ** Not unit tested **
126    
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      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
141         Destructor
142      */
143      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      \brief Return true if any one of the datapoints contains a NaN.
156      */
157      ESCRIPT_DLL_API
158      bool
159      hasNaN() const;
160    
161      /**
162         \brief Return a deep copy of the current object.
163      */
164      ESCRIPT_DLL_API
165      virtual
166      DataAbstract*
167      deepCopy();
168    
169    
170      /**
171         \brief
172       getSampleDataByTag       getSampleDataByTag
173    
174       Description:       Description:
175       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
176       sample should be visable via the returned pointer. This provides an       sample will be visible via the returned pointer.
177       interface into the data suitable for legacy C code.  
178         ** This provides an interface into the data suitable for legacy C code.
179         ** NB: need to do array bounds checking when accessing returned value!
180        T
181    */    */
182      ESCRIPT_DLL_API
183    virtual    virtual
184    double*    double*
185    getSampleDataByTag(int tag);    getSampleDataByTag(int tag);
# Line 128  class DataTagged : public DataAbstract { Line 189  class DataTagged : public DataAbstract {
189       Write the data as a string.       Write the data as a string.
190       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
191       associated with each tag.       associated with each tag.
192        T
193    */    */
194      ESCRIPT_DLL_API
195    virtual    virtual
196    std::string    std::string
197    toString() const;    toString() const;
198     /**
199         \brief
200         dumps the object into a netCDF file
201      */
202      ESCRIPT_DLL_API
203      virtual
204      void
205      dump(const std::string fileName) const;
206    
207      /**
208        \brief invert square matricies
209        \param out - Where to store the results
210      */
211      ESCRIPT_DLL_API
212      virtual void
213      matrixInverse(DataAbstract* out) const;
214    
215     /**
216         \brief
217        sets all values to zero
218      */
219      ESCRIPT_DLL_API
220      virtual
221      void
222      setToZero();
223    
224      /**
225         \brief
226         Return the tag number associated with the given data-point number
227         according to the associated function space.
228        T
229      */
230      ESCRIPT_DLL_API
231      virtual
232      int
233      getTagNumber(int dpno);
234    
235    /**    /**
236       \brief       \brief
237       getPointOffset       getPointOffset
238    
239       Description:       Description:
240       Return the offset to the given data-point. This is somewhat artificial,       Return the offset to the given data-point value in the underlying
241       but returns the offset for the given point in the DataTagged object.       data vector.
      Only really necessary to avoid many DataArrayView objects.  
242    
243       \param sampleNo - Input - sample number.       \param sampleNo - Input - sample number.
244       \param dataPointNo - Input - data-point number.       \param dataPointNo - Input - data-point number.
245     */      T
246      */
247      ESCRIPT_DLL_API
248    virtual    virtual
249    DataArrayView::ValueType::size_type    ValueType::size_type
250    getPointOffset(int sampleNo,    getPointOffset(int sampleNo,
251                   int dataPointNo) const;                   int dataPointNo) const;
252    
253    /**    ESCRIPT_DLL_API
254      virtual
255      ValueType::size_type
256      getPointOffset(int sampleNo,
257                     int dataPointNo);
258    
259     /**
260       \brief       \brief
261       addTaggedValues       addTaggedValues
262    
263       Description:       Description:
264       Add the given tags and values to this DataTagged object.       Add the given tags and values to this DataTagged object.
265       \param tagKeys - Input - A vector of integer keys.       \param tagKeys - Input - A vector of integer tags.
266       \param values - Input - A vector of DataArrayViews. If this is empty       \param values - Input - A vector of doubles. If this is empty, the default value for
267                     then all given tags will be assigned a value of zero. If                       this DataTagged will be used for all tags.
268                     it contains one value all tags will be assigned the same value.                       If it contains one value all tag values will be assigned
269                     Otherwise if there is a mismatch between the number of tags and               this value. Otherwise consecutive tags will be assigned
270                     the number of values an exception will be generated.                       consecutive values.  If there is a mismatch between  the
271       NB: If a tag given here already exists in this object, this attempt to add the given               number of keys and the number of values an exception
272       value will have no effect. setTaggedValues is more versatile and should be               will be generated.
273       used in most cases in preference to addTaggedValues.       \param vShape - shape of the datapoints in "values"
274        T
275     */
276      ESCRIPT_DLL_API
277      void
278      addTaggedValues(const TagListType& tagKeys,
279                                const ValueBatchType& values,
280                                const ShapeType& vShape);
281    
282    
283      /**
284       Description:
285       Add the given tags and values to this DataTagged object.
286       \param tagKeys - Input - A vector of integer tags.
287       \param values - Input - A DataVector containing the datapoints.
288                 If this is empty, the default value for
289                         this DataTagged will be used for all tags.
290                         If it contains one value all tag values will be assigned
291                 this value. Otherwise consecutive tags will be assigned
292                         consecutive values.  If there is a mismatch between  the
293                 number of keys and the number of values an exception
294                 will be generated.
295        \param vShape - shape of the datapoints in "values"
296    
297       TODO Makesure this is properly unit tested
298    */    */
299      ESCRIPT_DLL_API
300    void    void
301    addTaggedValues(const TagListType& tagKeys,    addTaggedValues(const TagListType& tagKeys,
302                    const ValueListType& values);                                const ValueType& values,
303                                const ShapeType& vShape);
304    
305    
306    
307    
308    /**    /**
309       \brief       \brief
310       addTaggedValue       addTaggedValue
311    
312       Description:       Description:
313       Add a single tag and value to this DataTagged object.       Add a single tag and value to this DataTagged object. If this tag already has
314       \param tagKey - Input - Integer key.       a value associated with it, setTaggedValue will be used to update this value.
315       \param value - Input - DataArrayView.       \param tagKey - Input - Integer tag.
316       NB: If this tag already exists in this object, this attempt to add the given       \param pointshape - Shape of the value parameter
317       value will have no effect. setTaggedValue is more versatile and should be       \param value - Input - Single DataArrayView value to be assigned to the tag.
318       used in most cases in preference to addTaggedValue.       \param dataOffset - Input - Offset of the beginning of the point in the value parameter
319    */    */
320      ESCRIPT_DLL_API
321    void    void
322    addTaggedValue(int tagKey,    addTaggedValue(int tagKey,
323                   const DataArrayView& value);           const DataTypes::ShapeType& pointshape,
324                     const ValueType& value,
325             int dataOffset=0);
326    
327    /**    /**
328       \brief       \brief
329       setTaggedValues       addTag - does not modify the default value for this object. ** Not unit tested **
330    
331       Description:       Description:
332       Assign the given values to the tags listed.       Add a single tag. The default value for this DataTagged will be associated with the tag.
333       \param tagKeys - Input - A vector of integer keys.       If this tag already has a value associated with it, then no change will be made.
334       \param values - Input - A vector of DataArrayViews. If this is empty       \param tagKey - Input - Integer tag.
335                        then all given tags will be assigned a value of zero. If      TODO: Make sure this is unit tested
                       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.  
      NB: If a given tag does not yet exist in this DataTagged object, it will be added.  
336    */    */
337      ESCRIPT_DLL_API
338    void    void
339    setTaggedValues(const TagListType& tagKeys,    addTag(int tagKey);
                   const ValueListType& values);  
340    
341    /**    /**
342       \brief       \brief
# Line 210  class DataTagged : public DataAbstract { Line 344  class DataTagged : public DataAbstract {
344    
345       Description:       Description:
346       Assign the given value to the given tag.       Assign the given value to the given tag.
347       \param tagKey - Input - Integer key.       \param tagKey - Input - Integer tag.
348       \param value - Input - Single DataArrayView value to be assigned to the tag.       \param pointshape - the shape of the value parameter
349       NB: If the given tag does not yet exist in this DataTagged object, it will be added.       \param value - Input - Vector storing the datapoint to be assigned to the tag.
350         \param dataOffset - beginning of the datapoint within "value".
351        T
352    */    */
353    virtual    ESCRIPT_DLL_API
354    void    void
355    setTaggedValue(int tagKey,    setTaggedValue(int tagKey,
356                   const DataArrayView& value);           const DataTypes::ShapeType& pointshape,
357                     const ValueType& value,
358             int dataOffset=0);
359    
360    /**    /**
361       \brief       \brief
362       getDataPointByTag       getDataByTag
363    
364       Description:       Return a pointer to the beginning of the datapoint with the specified tag.
365       Return a view into the data-point associated with the given tag.       TODO Eventually these should be inlined.
366       \param tag - Input - Integer key.       \param tag - Input - Integer key.
367         \param i - position in the underlying datastructure
368    */    */
369    DataArrayView  
370    getDataPointByTag(int tag) const;    ESCRIPT_DLL_API
371      DataTypes::ValueType::reference
372      getDataByTagRW(int tag, DataTypes::ValueType::size_type i);
373    
374      ESCRIPT_DLL_API
375      DataTypes::ValueType::const_reference
376      getDataByTagRO(int tag, DataTypes::ValueType::size_type i) const;
377    
378    
379    
380    /**    /**
381       \brief        \brief
382       getDataPoint        getOffsetForTag
383    
384       Description:        \param tag
385       Return a view into the data-point specified by the given sample        \return the offset of the beginning of the datapoint corresponding to tag.
386       and data-point numbers.  
387       NOTE: Construction of the DataArrayView is a relatively expensive        Note: If the tag is not valid, the offset of the default value is returned instead.
      operation.  
      \param sampleNo - Input.  
      \param dataPointNo - Input.  
388    */    */
389    virtual    ESCRIPT_DLL_API
390    DataArrayView    DataTypes::ValueType::size_type
391    getDataPoint(int sampleNo,    getOffsetForTag(int tag) const;
392                 int dataPointNo);  
393    
394      /**
395         \brief
396         Return a reference to the underlying DataVector.
397      */
398    
399      ESCRIPT_DLL_API
400      DataTypes::ValueType&
401      getVectorRW();
402    
403      ESCRIPT_DLL_API
404      const DataTypes::ValueType&
405      getVectorRO() const;
406    
407    
408    
409    /**    /**
410       \brief       \brief
# Line 253  class DataTagged : public DataAbstract { Line 412  class DataTagged : public DataAbstract {
412    
413       Description:       Description:
414       Return a reference to the tag offset lookup table.       Return a reference to the tag offset lookup table.
415        T
416    */    */
417      ESCRIPT_DLL_API
418    const DataMapType&    const DataMapType&
419    getTagLookup() const;    getTagLookup() const;
420    
# Line 262  class DataTagged : public DataAbstract { Line 423  class DataTagged : public DataAbstract {
423       isCurrentTag       isCurrentTag
424    
425       Description:       Description:
426       Return true if the given tag exists within the DataTagged tag keys.       Return true if the given tag exists within the DataTagged tag map.
427       NOTE: The DataTagged keys do not necessarily coincide with the tag  
428       keys for the function space.       *** NB: The DataTagged tag map does not necessarily coincide with the tag
429     */       keys in the associated function space.
430        T
431      */
432      ESCRIPT_DLL_API
433    bool    bool
434    isCurrentTag(int tag) const;    isCurrentTag(int tag) const;
435    
# Line 275  class DataTagged : public DataAbstract { Line 439  class DataTagged : public DataAbstract {
439    
440       Description:       Description:
441       Return the default value. This value is associated with any tag which       Return the default value. This value is associated with any tag which
442       is not explicitly recorded in this DataTagged object.       is not explicitly recorded in this DataTagged object's tag map.
443         \param i - position in the underlying datastructure
444    */    */
445    DataArrayView&    ESCRIPT_DLL_API
446    getDefaultValue();    DataTypes::ValueType::reference
447      getDefaultValueRW(DataTypes::ValueType::size_type i);
448    
449      ESCRIPT_DLL_API
450      DataTypes::ValueType::const_reference
451      getDefaultValueRO(DataTypes::ValueType::size_type i) const;
452    
453    
454    
   /**  
      \brief  
      getDefaultValue  
455    
      Description:  
      Return the default value, const version.  
   */  
   const DataArrayView&  
   getDefaultValue() const;  
456    
457    /**    /**
458       \brief       \brief
459       getLength       getLength
460    
461       Description:       Description:
462       Return the number of doubles stored for the Data.       Return the total number of doubles stored for this DataTagged object.
463        T
464    */    */
465      ESCRIPT_DLL_API
466    virtual    virtual
467    ValueType::size_type    ValueType::size_type
468    getLength() const;    getLength() const;
# Line 306  class DataTagged : public DataAbstract { Line 472  class DataTagged : public DataAbstract {
472       getSlice       getSlice
473    
474       Description:       Description:
475       Factory method that returns a newly created DataTagged.       Factory method that returns a newly created DataTagged object generated
476       The caller is reponsible for managing the object created.       by taking the specified slice from this DataTagged object.
477         The caller is reponsible for managing the returned object.
478        T
479    */    */
480      ESCRIPT_DLL_API
481    virtual    virtual
482    DataAbstract*    DataAbstract*
483    getSlice(const DataArrayView::RegionType& region) const;    getSlice(const DataTypes::RegionType& region) const;
484    
485      /**
486         \brief
487         Slice Constructor for DataTagged.
488    
489         Description:
490         Creates a DataTagged object which is the specified slice
491         from the given DataTagged object.
492         \param other - Input - DataTagged object to slice from.
493         \param region - Input - Region to slice.
494        T
495      */
496      ESCRIPT_DLL_API
497      DataTagged(const DataTagged& other,
498             const DataTypes::RegionType& region);
499    
500    /**    /**
501       \brief       \brief
502       setSlice       setSlice
503    
504       Description:       Description:
505       Copy the specified region from the given value.       Copy the given Data object into the specified region in this object.
506       \param value - Input - Data to copy from.       \param other - Input - Data object to copy from.
507       \param region - Input - Region to copy.       \param region - Input - Region to copy into (NB: must have same shape as other!).
508        T
509    */    */
510      ESCRIPT_DLL_API
511    virtual    virtual
512    void    void
513    setSlice(const DataAbstract* value,    setSlice(const DataAbstract* other,
514             const DataArrayView::RegionType& region);             const DataTypes::RegionType& region);
515    
516    
517    /**    /**
518       \brief       \brief
519       reshapeDataPoint       Computes a symmetric matrix (A + AT) / 2
520    
521         \param ev - Output - symmetric matrix
522    
      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.  
523    */    */
524    void    ESCRIPT_DLL_API
525    reshapeDataPoint(const DataArrayView::ShapeType& shape);    virtual void
526      symmetric(DataAbstract* ev);
527    
528      /**
529         \brief
530         Computes a nonsymmetric matrix (A - AT) / 2
531    
532         \param ev - Output - nonsymmetric matrix
533    
534      */
535      ESCRIPT_DLL_API
536      virtual void
537      nonsymmetric(DataAbstract* ev);
538    
539      /**
540         \brief
541         Computes the trace of a matrix
542    
543         \param ev - Output - the trace of a matrix
544         \param axis_offset
545      */
546      ESCRIPT_DLL_API
547      virtual void
548      trace(DataAbstract* ev, int axis_offset);
549    
550      /**
551         \brief
552         swaps components axis0 and axis1
553    
554         \param ev - Output - swapped components
555         \param axis0
556         \param axis1
557      */
558      ESCRIPT_DLL_API
559      virtual void
560      swapaxes(DataAbstract* ev, int axis0, int axis1);
561    
562      /**
563         \brief
564         Transpose each data point of this Data object around the given axis.
565    
566         \param ev - Output - the transpose of a matrix
567         \param axis_offset
568      */
569      ESCRIPT_DLL_API
570      virtual void
571      transpose(DataAbstract* ev, int axis_offset);
572    
573      /**
574         \brief
575         solves the eigenvalue problem this*V=ev*V for the eigenvalues ev
576    
577         \param ev - Output - eigenvalues in increasing order at each data point
578    
579      */
580      ESCRIPT_DLL_API
581      virtual void
582      eigenvalues(DataAbstract* ev);
583    
584      /**
585         \brief
586         solves the eigenvalue problem this*V=ev*V for the eigenvalues ev and eigenvectors V
587    
588         \param ev - Output - eigenvalues in increasing order at each data point
589         \param V - Output - corresponding eigenvectors. They are normalized such that their length is one
590                             and the first nonzero component is positive.
591         \param tol - Input - eigenvalue with relative distance tol are treated as equal.
592    
593      */
594    
595      ESCRIPT_DLL_API
596      virtual void
597      eigenvalues_and_eigenvectors(DataAbstract* ev,DataAbstract* V,const double tol=1.e-13);
598    
599    
600      /**
601         \brief  Returns the offset in the structure which stores the default value
602      */
603      ESCRIPT_DLL_API
604      DataTypes::ValueType::size_type
605      getDefaultOffset() const;
606    
607   protected:   protected:
608    
# Line 349  class DataTagged : public DataAbstract { Line 613  class DataTagged : public DataAbstract {
613    DataMapType m_offsetLookup;    DataMapType m_offsetLookup;
614    
615    //    //
616    // The actual data    // the offset to the default value
617    DataArrayView::ValueType m_data;    static const int m_defaultValueOffset = 0;
618    
619    //    //
620    // the default value offset    // The actual data
621    static const int m_defaultValueOffset = 0;    ValueType m_data;
622    
623  };  };
624    
# Line 366  DataTagged::isCurrentTag(int tag) const Line 630  DataTagged::isCurrentTag(int tag) const
630    return (pos!=m_offsetLookup.end());    return (pos!=m_offsetLookup.end());
631  }  }
632    
633    inline
634    DataTypes::ValueType::size_type
635    DataTagged::getDefaultOffset() const
636    {
637      return m_defaultValueOffset;  
638    }
639    
640  inline  inline
641  DataArrayView&  DataTypes::ValueType::reference
642  DataTagged::getDefaultValue()  DataTagged::getDefaultValueRW(DataTypes::ValueType::size_type i)
643    {  
644        return getVectorRW()[i];        // getVectorRW has exclusive write checks
645    }
646    
647    inline
648    DataTypes::ValueType::const_reference
649    DataTagged::getDefaultValueRO(DataTypes::ValueType::size_type i) const
650  {  {
651    //      return getVectorRO()[i];
   // The default value is always the first value.  
   return getPointDataView();  
652  }  }
653    
654  inline  inline
655  const DataArrayView&  const DataTagged::DataMapType&
656  DataTagged::getDefaultValue() const  DataTagged::getTagLookup() const
657  {  {
658    //    return m_offsetLookup;
659    // The default value is always the first value.  }
660    return getPointDataView();  
661    inline
662    DataTypes::ValueType::size_type
663    DataTagged::getLength() const
664    {
665      return m_data.size();
666  }  }
667    
668  } // end of namespace  } // end of namespace

Legend:
Removed from v.100  
changed lines
  Added in v.2766

  ViewVC Help
Powered by ViewVC 1.1.26