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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1811 - (hide annotations)
Thu Sep 25 23:11:13 2008 UTC (11 years, 1 month ago) by ksteube
File MIME type: text/plain
File size: 21024 byte(s)
Copyright updated in all files

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

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26