/[escript]/branches/arrayview_from_1695_trunk/escript/src/DataTagged.h
ViewVC logotype

Diff of /branches/arrayview_from_1695_trunk/escript/src/DataTagged.h

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

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

Legend:
Removed from v.97  
changed lines
  Added in v.1710

  ViewVC Help
Powered by ViewVC 1.1.26