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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1796 - (hide annotations)
Wed Sep 17 01:45:46 2008 UTC (11 years, 1 month ago) by jfenwick
File MIME type: text/plain
File size: 20934 byte(s)
Merged noarrayview branch onto trunk.


1 jgs 121
2 ksteube 1312 /* $Id$ */
3 jgs 121
4 ksteube 1312 /*******************************************************
5     *
6     * Copyright 2003-2007 by ACceSS MNRF
7     * Copyright 2007 by University of Queensland
8     *
9     * http://esscc.uq.edu.au
10     * Primary Business: Queensland, Australia
11     * Licensed under the Open Software License version 3.0
12     * http://www.opensource.org/licenses/osl-3.0.php
13     *
14     *******************************************************/
15    
16 jgs 82 #if !defined escript_DataTagged_20040615_H
17     #define escript_DataTagged_20040615_H
18 woo409 757 #include "system_dep.h"
19 jgs 82
20 jgs 474 #include "DataAbstract.h"
21 jfenwick 1796 #include "DataTypes.h"
22 jgs 82
23     #include <vector>
24     #include <map>
25    
26     namespace escript {
27    
28     class DataConstant;
29    
30     /**
31     \brief
32 jgs 496 Simulates a full dataset accessible via sampleNo and dataPointNo.
33 jgs 82
34     Description:
35 jgs 496 Each data-point has an associated tag number, and a given tag can represent a
36     range of dataPointNo and sampleNo. Each tag indexes only a single data-point.
37 jgs 82 Thus only a single data-point needs to be stored for a range of sampleNo and
38     dataPointNo values.
39     */
40    
41     class DataTagged : public DataAbstract {
42    
43     public:
44    
45 jgs 119 //
46 jgs 496 // Types for the lists of tags and values.
47 jgs 121 typedef std::vector<int> TagListType;
48 jfenwick 1796 // typedef std::vector<DataArrayView> ValueListType;
49     typedef DataTypes::ValueType ValueType;
50     typedef std::vector<ValueType::ElementType> ValueBatchType;
51 jgs 82
52     //
53 jgs 496 // Map from a tag to an offset into the data array.
54 jgs 82 typedef std::map<int, int> DataMapType;
55    
56     /**
57     \brief
58     Default constructor for DataTagged.
59    
60     Description:
61     Default constructor for DataTagged. Creates a DataTagged object for which
62 jgs 509 the default data-point is a scalar data-point with value 0.0, and no other
63     tag values are stored.
64 jgs 507 T
65 jgs 82 */
66 woo409 757 ESCRIPT_DLL_API
67 jgs 82 DataTagged();
68    
69 jfenwick 1796 // /**
70     // \brief
71     // Constructor for DataTagged.
72     //
73     // Description:
74     // Constructor for DataTagged.
75     // \param tagKeys - Input - A vector of integer tags.
76     // \param values - Input - A vector of DataArrayViews. If this is empty
77     // all tag values will be assigned a scalar data-point of value
78     // 0. If it contains one value all tag values will be assigned
79     // this value. Otherwise consecutive tags will be assigned
80     // consecutive values. If there is a mismatch between the
81     // 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.
84     // \param what - Input - A description of what this data represents.
85     // T
86     // */
87     // ESCRIPT_DLL_API
88     // DataTagged(const TagListType& tagKeys,
89     // const ValueListType& values,
90     // const DataArrayView& defaultValue,
91     // const FunctionSpace& what);
92 jgs 82
93     /**
94     \brief
95 jgs 496 Alternative Constructor for DataTagged.
96 jgs 119
97     Description:
98 jgs 496 Alternative Constructor for DataTagged.
99 jgs 119 \param what - Input - A description of what this data object represents.
100 jgs 496 \param shape - Input - The shape of each data-point.
101 jfenwick 1796 \param tags - Input - An array of tags, one for each sample number (starts at tag[1]).
102 jgs 496 \param data - The data values for each tag.
103 jgs 535 NB: no unit testing yet
104 jgs 119 */
105 woo409 757 ESCRIPT_DLL_API
106 jgs 119 DataTagged(const FunctionSpace& what,
107 jfenwick 1796 const DataTypes::ShapeType &shape,
108 jgs 119 const int tags[],
109 jgs 500 const ValueType& data);
110 jgs 119
111 jfenwick 1796 /**
112 jgs 119 \brief
113 woo409 757 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 jfenwick 1796 TODO Make sure to document the relationship between tags and data, ie: data also contains the default value
122     */
123 woo409 757 ESCRIPT_DLL_API
124     DataTagged(const FunctionSpace& what,
125 jfenwick 1796 const DataTypes::ShapeType &shape,
126 woo409 757 const TagListType& tags,
127     const ValueType& data);
128    
129     /**
130     \brief
131 jgs 496 Copy Constructor for DataTagged.
132 jgs 82 Performs a deep copy from the given DataTagged object.
133 jgs 507 T
134 jgs 82 */
135 woo409 757 ESCRIPT_DLL_API
136 jgs 82 DataTagged(const DataTagged& other);
137    
138     /**
139     \brief
140 jgs 496 Copy Constructor for DataTagged.
141 jgs 509 Construct a DataTagged object from a DataConstant object.
142     The default value will be the value of the DataConstant object.
143 jgs 507 T
144 jgs 82 */
145 woo409 757 ESCRIPT_DLL_API
146 jgs 82 DataTagged(const DataConstant& other);
147    
148     /**
149     \brief
150 jfenwick 1796 Copies the tags from a DataTagged into a new Data Tagged and assigns them the default value. ** Not unit tested **
151    
152     This is different from a deep copy because we are not copying shape or other information, just tags.
153     \param what - Input - FunctionSpace for the new DataTagged
154     \param shape - Input - Shape for points in the new DataTagged
155     \param defaultvalue - Input - Default value for new DataTagged
156     \param tagsource - Input - A DataTagged object which supplies the tags.
157     */
158     ESCRIPT_DLL_API
159     DataTagged(const FunctionSpace& what,
160     const DataTypes::ShapeType& shape,
161     const DataTypes::ValueType& defaultvalue,
162     const DataTagged* tagsource=0);
163    
164     /**
165     \brief
166 phornby 1628 Destructor
167     */
168     ESCRIPT_DLL_API
169     inline virtual
170     ~DataTagged() {};
171    
172     /**
173     \brief
174 jgs 82 getSampleDataByTag
175    
176     Description:
177 jgs 496 Return the data-point for the given tag. All of the data for the
178     sample will be visible via the returned pointer.
179    
180     ** This provides an interface into the data suitable for legacy C code.
181 jgs 507 ** NB: need to do array bounds checking when accessing returned value!
182     T
183 jgs 82 */
184 woo409 757 ESCRIPT_DLL_API
185 jgs 82 virtual
186     double*
187     getSampleDataByTag(int tag);
188    
189     /**
190     \brief
191     Write the data as a string.
192     Writes out each tag, including the default, and the data-point which is
193     associated with each tag.
194 jgs 507 T
195 jgs 82 */
196 woo409 757 ESCRIPT_DLL_API
197 jgs 82 virtual
198     std::string
199     toString() const;
200 gross 950 /**
201     \brief
202     dumps the object into a netCDF file
203     */
204     ESCRIPT_DLL_API
205     virtual
206     void
207     dump(const std::string fileName) const;
208 jgs 82
209 gross 1118 /**
210     \brief
211     sets all values to zero
212     */
213     ESCRIPT_DLL_API
214     virtual
215     void
216     setToZero();
217    
218 jgs 82 /**
219     \brief
220 jgs 496 Return the tag number associated with the given data-point number
221     according to the associated function space.
222 jgs 507 T
223 jgs 149 */
224 woo409 757 ESCRIPT_DLL_API
225 jgs 149 virtual
226     int
227     getTagNumber(int dpno);
228    
229     /**
230     \brief
231 jgs 82 getPointOffset
232    
233     Description:
234 jgs 496 Return the offset to the given data-point value in the underlying
235     data vector.
236 jgs 82
237     \param sampleNo - Input - sample number.
238     \param dataPointNo - Input - data-point number.
239 jgs 507 T
240     */
241 woo409 757 ESCRIPT_DLL_API
242 jgs 82 virtual
243 jgs 121 ValueType::size_type
244 jgs 82 getPointOffset(int sampleNo,
245     int dataPointNo) const;
246    
247 jfenwick 1796
248    
249     // /**
250     // \brief
251     // addTaggedValues
252     //
253     // Description:
254     // Add the given tags and values to this DataTagged object.
255     // \param tagKeys - Input - A vector of integer tags.
256     // \param values - Input - A vector of DataArrayViews. If this is empty
257     // all tag values will be assigned a scalar data-point of value
258     // 0. If it contains one value all tag values will be assigned
259     // this value. Otherwise consecutive tags will be assigned
260     // consecutive values. If there is a mismatch between the
261     // number of keys and the number of values an exception
262     // will be generated.
263     // T
264     // */
265     // ESCRIPT_DLL_API
266     // void
267     // addTaggedValues(const TagListType& tagKeys,
268     // const ValueListType& values);
269    
270     // /**
271     // \brief
272     // addTaggedValue
273     //
274     // Description:
275     // Add a single tag and value to this DataTagged object. If this tag already has
276     // a value associated with it, setTaggedValue will be used to update this value.
277     // \param tagKey - Input - Integer tag.
278     // \param value - Input - Single DataArrayView value to be assigned to the tag.
279     // T
280     // */
281     // ESCRIPT_DLL_API
282     // void
283     // addTaggedValue(int tagKey,
284     // const DataArrayView& value);
285    
286    
287    
288     /**
289 jgs 82 \brief
290     addTaggedValues
291    
292     Description:
293 jgs 509 Add the given tags and values to this DataTagged object.
294 jgs 507 \param tagKeys - Input - A vector of integer tags.
295 jfenwick 1796 \param values - Input - A vector of doubles. If this is empty, the default value for
296     this DataTagged will be used for all tags.
297     If it contains one value all tag values will be assigned
298 jgs 509 this value. Otherwise consecutive tags will be assigned
299     consecutive values. If there is a mismatch between the
300     number of keys and the number of values an exception
301     will be generated.
302 jfenwick 1796 \param vShape - shape of the datapoints in "values"
303 jgs 507 T
304 jfenwick 1796 */
305     ESCRIPT_DLL_API
306     void
307     addTaggedValues(const TagListType& tagKeys,
308     const ValueBatchType& values,
309     const ShapeType& vShape);
310    
311    
312     /**
313     Description:
314     Add the given tags and values to this DataTagged object.
315     \param tagKeys - Input - A vector of integer tags.
316     \param values - Input - A DataVector containing the datapoints.
317     If this is empty, the default value for
318     this DataTagged will be used for all tags.
319     If it contains one value all tag values will be assigned
320     this value. Otherwise consecutive tags will be assigned
321     consecutive values. If there is a mismatch between the
322     number of keys and the number of values an exception
323     will be generated.
324     \param vShape - shape of the datapoints in "values"
325    
326     TODO Makesure this is properly unit tested
327 jgs 82 */
328 woo409 757 ESCRIPT_DLL_API
329 jgs 82 void
330     addTaggedValues(const TagListType& tagKeys,
331 jfenwick 1796 const ValueType& values,
332     const ShapeType& vShape);
333 jgs 82
334 jfenwick 1796
335    
336    
337 jgs 82 /**
338     \brief
339     addTaggedValue
340    
341     Description:
342 jgs 121 Add a single tag and value to this DataTagged object. If this tag already has
343     a value associated with it, setTaggedValue will be used to update this value.
344 jgs 509 \param tagKey - Input - Integer tag.
345 jfenwick 1796 \param pointshape - Shape of the value parameter
346     \param value - Input - Single DataArrayView value to be assigned to the tag.
347     \param dataOffset - Input - Offset of the beginning of the point in the value parameter
348 jgs 82 */
349 woo409 757 ESCRIPT_DLL_API
350 jgs 82 void
351     addTaggedValue(int tagKey,
352 jfenwick 1796 const DataTypes::ShapeType& pointshape,
353     const ValueType& value,
354     int dataOffset=0);
355 jgs 82
356     /**
357     \brief
358 jfenwick 1796 addTag - does not modify the default value for this object. ** Not unit tested **
359 jgs 82
360     Description:
361 jfenwick 1796 Add a single tag. The default value for this DataTagged will be associated with the tag.
362     If this tag already has a value associated with it, then no change will be made.
363     \param tagKey - Input - Integer tag.
364     TODO: Make sure this is unit tested
365 jgs 82 */
366 woo409 757 ESCRIPT_DLL_API
367 jgs 82 void
368 jfenwick 1796 addTag(int tagKey);
369 jgs 82
370 jfenwick 1796
371     // /**
372     // \brief
373     // setTaggedValues
374     //
375     // Description:
376     // Set the given tags to the given values in this DataTagged object.
377     // \param tagKeys - Input - A vector of integer tag.
378     // \param values - Input - A vector of DataArrayViews. If this is empty
379     // all tag values will be assigned a scalar data-point of value
380     // 0. If it contains one value all tag values will be assigned
381     // this value. Otherwise consecutive tags will be assigned
382     // consecutive values. If there is a mismatch between the
383     // number of keys and the number of values an exception
384     // will be generated.
385     // T
386     // */
387     // ESCRIPT_DLL_API
388     // void
389     // setTaggedValues(const TagListType& tagKeys,
390     // const ValueListType& values);
391    
392     // /**
393     // \brief
394     // setTaggedValue
395     //
396     // Description:
397     // Assign the given value to the given tag.
398     // \param tagKey - Input - Integer tag.
399     // \param value - Input - Single DataArrayView value to be assigned to the tag.
400     // T
401     // */
402     // ESCRIPT_DLL_API
403     // virtual
404     // void
405     // setTaggedValue(int tagKey,
406     // const DataArrayView& value);
407    
408 jgs 82 /**
409     \brief
410     setTaggedValue
411    
412     Description:
413 jgs 509 Assign the given value to the given tag.
414     \param tagKey - Input - Integer tag.
415 jfenwick 1796 \param pointshape - the shape of the value parameter
416     \param value - Input - Vector storing the datapoint to be assigned to the tag.
417     \param dataOffset - beginning of the datapoint within "value".
418 jgs 507 T
419 jgs 82 */
420 woo409 757 ESCRIPT_DLL_API
421 jgs 82 void
422     setTaggedValue(int tagKey,
423 jfenwick 1796 const DataTypes::ShapeType& pointshape,
424     const ValueType& value,
425     int dataOffset=0);
426 jgs 82
427 jfenwick 1796
428     // /**
429     // \brief
430     // getDataPointByTag
431     //
432     // Description:
433     // Return data-point associated with the given tag as a DataArrayView.
434     // \param tag - Input - Integer key.
435     // T
436     // */
437     // ESCRIPT_DLL_API
438     // DataArrayView
439     // getDataPointByTag(int tag) const;
440    
441 jgs 82 /**
442     \brief
443 jfenwick 1796 getDataByTag
444 jgs 82
445 jfenwick 1796 Return a pointer to the beginning of the datapoint with the specified tag.
446     TODO Eventually these should be inlined.
447 jgs 82 \param tag - Input - Integer key.
448 jfenwick 1796 \param i - position in the underlying datastructure
449 jgs 507 T
450 jgs 82 */
451 woo409 757 ESCRIPT_DLL_API
452 jfenwick 1796 DataTypes::ValueType::const_reference
453     getDataByTag(int tag, DataTypes::ValueType::size_type i) const;
454 jgs 82
455 jfenwick 1796 ESCRIPT_DLL_API
456     DataTypes::ValueType::reference
457     getDataByTag(int tag, DataTypes::ValueType::size_type i);
458    
459    
460 jgs 82 /**
461 jfenwick 1796 \brief
462     getOffsetForTag
463 jgs 82
464 jfenwick 1796 \param tag
465     \return the offset of the beginning of the datapoint corresponding to tag.
466    
467     Note: If the tag is not valid, the offset of the default value is returned instead.
468 jgs 82 */
469 woo409 757 ESCRIPT_DLL_API
470 jfenwick 1796 DataTypes::ValueType::size_type
471     getOffsetForTag(int tag) const;
472 jgs 82
473 jfenwick 1796 // /**
474     // \brief
475     // getDataPoint
476     //
477     // Description:
478     // Return the data-point specified by the given sample and data-point
479     // numbers as a DataArrayView.
480     // \param sampleNo - Input.
481     // \param dataPointNo - Input.
482     // T
483     // */
484     // ESCRIPT_DLL_API
485     // virtual
486     // DataArrayView
487     // getDataPoint(int sampleNo,
488     // int dataPointNo);
489    
490    
491 jgs 82 /**
492 gross 983 \brief
493 jfenwick 1796 Return a reference to the underlying DataVector.
494     */
495    
496     ESCRIPT_DLL_API
497     DataTypes::ValueType&
498     getVector();
499    
500     ESCRIPT_DLL_API
501     const DataTypes::ValueType&
502     getVector() const;
503    
504    
505    
506     /**
507     \brief
508 gross 983 getData
509    
510     Description:
511     Return pointer to the data
512     T
513     */
514 jfenwick 1796 // ESCRIPT_DLL_API
515     // const DataTypes::ValueType::ElementType*
516     // getData() const;
517 gross 983
518     /**
519 jgs 82 \brief
520     getTagLookup
521    
522     Description:
523     Return a reference to the tag offset lookup table.
524 jgs 507 T
525 jgs 82 */
526 woo409 757 ESCRIPT_DLL_API
527 jgs 82 const DataMapType&
528     getTagLookup() const;
529    
530     /**
531     \brief
532     isCurrentTag
533    
534     Description:
535 jgs 496 Return true if the given tag exists within the DataTagged tag map.
536    
537 jgs 509 *** NB: The DataTagged tag map does not necessarily coincide with the tag
538 jgs 496 keys in the associated function space.
539 jgs 507 T
540     */
541 woo409 757 ESCRIPT_DLL_API
542 jgs 82 bool
543     isCurrentTag(int tag) const;
544    
545 jfenwick 1796 // /**
546     // \brief
547     // getDefaultValue
548     //
549     // Description:
550     // Return the default value. This value is associated with any tag which
551     // is not explicitly recorded in this DataTagged object's tag map.
552     // T
553     // */
554     // ESCRIPT_DLL_API
555     // DataArrayView&
556     // getDefaultValue();
557     //
558     // ESCRIPT_DLL_API
559     // const DataArrayView&
560     // getDefaultValue() const;
561    
562 jgs 82 /**
563     \brief
564     getDefaultValue
565    
566     Description:
567     Return the default value. This value is associated with any tag which
568 jgs 496 is not explicitly recorded in this DataTagged object's tag map.
569 jfenwick 1796 \param i - position in the underlying datastructure
570 jgs 507 T
571 jgs 82 */
572 woo409 757 ESCRIPT_DLL_API
573 jfenwick 1796 DataTypes::ValueType::reference
574     getDefaultValue(DataTypes::ValueType::size_type i);
575 jgs 82
576 woo409 757 ESCRIPT_DLL_API
577 jfenwick 1796 DataTypes::ValueType::const_reference
578     getDefaultValue(DataTypes::ValueType::size_type i) const;
579 jgs 82
580 jfenwick 1796
581    
582    
583 jgs 82 /**
584     \brief
585     getLength
586    
587     Description:
588 jgs 509 Return the total number of doubles stored for this DataTagged object.
589 jgs 507 T
590 jgs 82 */
591 woo409 757 ESCRIPT_DLL_API
592 jgs 82 virtual
593     ValueType::size_type
594     getLength() const;
595    
596     /**
597     \brief
598     getSlice
599    
600     Description:
601 jgs 513 Factory method that returns a newly created DataTagged object generated
602     by taking the specified slice from this DataTagged object.
603     The caller is reponsible for managing the returned object.
604 jgs 535 T
605 jgs 82 */
606 woo409 757 ESCRIPT_DLL_API
607 jgs 82 virtual
608     DataAbstract*
609 jfenwick 1796 getSlice(const DataTypes::RegionType& region) const;
610 jgs 82
611     /**
612     \brief
613 jgs 513 Slice Constructor for DataTagged.
614 jgs 82
615     Description:
616 jgs 513 Creates a DataTagged object which is the specified slice
617 jgs 519 from the given DataTagged object.
618     \param other - Input - DataTagged object to slice from.
619     \param region - Input - Region to slice.
620 jgs 535 T
621 jgs 82 */
622 woo409 757 ESCRIPT_DLL_API
623 jgs 513 DataTagged(const DataTagged& other,
624 jfenwick 1796 const DataTypes::RegionType& region);
625 jgs 513
626     /**
627     \brief
628     setSlice
629    
630     Description:
631 jgs 519 Copy the given Data object into the specified region in this object.
632 jgs 513 \param other - Input - Data object to copy from.
633 jgs 519 \param region - Input - Region to copy into (NB: must have same shape as other!).
634 jgs 535 T
635 jgs 513 */
636 woo409 757 ESCRIPT_DLL_API
637 jgs 82 virtual
638     void
639 jgs 513 setSlice(const DataAbstract* other,
640 jfenwick 1796 const DataTypes::RegionType& region);
641 jgs 82
642 jgs 123
643     /**
644 jgs 509 \brief
645 ksteube 775 Computes a symmetric matrix (A + AT) / 2
646    
647     \param ev - Output - symmetric matrix
648    
649     */
650 gross 800 ESCRIPT_DLL_API
651 ksteube 775 virtual void
652     symmetric(DataAbstract* ev);
653    
654     /**
655     \brief
656     Computes a nonsymmetric matrix (A - AT) / 2
657    
658     \param ev - Output - nonsymmetric matrix
659    
660     */
661 gross 800 ESCRIPT_DLL_API
662 ksteube 775 virtual void
663     nonsymmetric(DataAbstract* ev);
664    
665     /**
666     \brief
667     Computes the trace of a matrix
668    
669     \param ev - Output - the trace of a matrix
670    
671     */
672 gross 800 ESCRIPT_DLL_API
673 ksteube 775 virtual void
674 gross 800 trace(DataAbstract* ev, int axis_offset);
675 ksteube 775
676     /**
677     \brief
678 gross 804 swaps components axis0 and axis1
679 gross 800
680     \param ev - Output - swapped components
681    
682     */
683     ESCRIPT_DLL_API
684     virtual void
685 gross 804 swapaxes(DataAbstract* ev, int axis0, int axis1);
686 gross 800
687     /**
688     \brief
689 ksteube 775 Transpose each data point of this Data object around the given axis.
690    
691     \param ev - Output - the transpose of a matrix
692    
693     */
694 gross 800 ESCRIPT_DLL_API
695 ksteube 775 virtual void
696     transpose(DataAbstract* ev, int axis_offset);
697    
698     /**
699     \brief
700 gross 580 solves the eigenvalue problem this*V=ev*V for the eigenvalues ev
701    
702     \param ev - Output - eigenvalues in increasing order at each data point
703    
704     */
705 woo409 757 ESCRIPT_DLL_API
706 gross 580 virtual void
707     eigenvalues(DataAbstract* ev);
708    
709     /**
710     \brief
711     solves the eigenvalue problem this*V=ev*V for the eigenvalues ev and eigenvectors V
712    
713     \param ev - Output - eigenvalues in increasing order at each data point
714     \param V - Output - corresponding eigenvectors. They are normalized such that their length is one
715     and the first nonzero component is positive.
716     \param tol - Input - eigenvalue with relative distance tol are treated as equal.
717    
718     */
719    
720 woo409 757 ESCRIPT_DLL_API
721 gross 580 virtual void
722     eigenvalues_and_eigenvectors(DataAbstract* ev,DataAbstract* V,const double tol=1.e-13);
723    
724    
725 jfenwick 1796 /**
726     \brief Returns the offset in the structure which stores the default value
727     */
728     ESCRIPT_DLL_API
729     DataTypes::ValueType::size_type
730     getDefaultOffset() const;
731    
732 jgs 82 protected:
733    
734     private:
735    
736     //
737     // The offset lookup table
738     DataMapType m_offsetLookup;
739    
740     //
741 jgs 496 // the offset to the default value
742 jgs 119 static const int m_defaultValueOffset = 0;
743    
744     //
745 jgs 82 // The actual data
746 jgs 121 ValueType m_data;
747 jgs 82
748     };
749    
750     inline
751     bool
752     DataTagged::isCurrentTag(int tag) const
753     {
754     DataMapType::const_iterator pos(m_offsetLookup.find(tag));
755     return (pos!=m_offsetLookup.end());
756     }
757    
758 jfenwick 1796 // inline
759     // DataArrayView&
760     // DataTagged::getDefaultValue()
761     // {
762     // // The default value is always the first value.
763     // return getPointDataView();
764     // }
765    
766     // inline
767     // const DataArrayView&
768     // DataTagged::getDefaultValue() const
769     // {
770     // // The default value is always the first value.
771     // return getPointDataView();
772     // }
773    
774    
775     inline
776     DataTypes::ValueType::size_type
777     DataTagged::getDefaultOffset() const
778 jgs 82 {
779 jfenwick 1796 return m_defaultValueOffset;
780 jgs 82 }
781    
782     inline
783 jfenwick 1796 DataTypes::ValueType::reference
784     DataTagged::getDefaultValue(DataTypes::ValueType::size_type i)
785 jgs 82 {
786 jfenwick 1796 return getVector()[i];
787 jgs 82 }
788    
789 jgs 496 inline
790 jfenwick 1796 DataTypes::ValueType::const_reference
791     DataTagged::getDefaultValue(DataTypes::ValueType::size_type i) const
792 gross 983 {
793 jfenwick 1796 return getVector()[i];
794 gross 983 }
795    
796 jfenwick 1796
797    
798    
799     // inline
800     // const DataTypes::ValueType::ElementType*
801     // DataTagged::getData() const
802     // {
803     // return &(m_data[0]);
804     // }
805    
806 gross 983 inline
807 jgs 496 const DataTagged::DataMapType&
808     DataTagged::getTagLookup() const
809     {
810     return m_offsetLookup;
811     }
812    
813     inline
814 jfenwick 1796 DataTypes::ValueType::size_type
815 jgs 496 DataTagged::getLength() const
816     {
817     return m_data.size();
818     }
819    
820 jgs 82 } // end of namespace
821    
822     #endif

Properties

Name Value
svn:eol-style native
svn:keywords Author Date Id Revision

  ViewVC Help
Powered by ViewVC 1.1.26