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

revision 580 by gross, Wed Mar 8 05:45:51 2006 UTC revision 1796 by jfenwick, Wed Sep 17 01:45:46 2008 UTC
# Line 1  Line 1 
 // $Id$  
1    
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 "DataAbstract.h"  #include "DataAbstract.h"
21  #include "DataArrayView.h"  #include "DataTypes.h"
22    
23  #include <vector>  #include <vector>
24  #include <map>  #include <map>
# Line 45  class DataTagged : public DataAbstract { Line 45  class DataTagged : public DataAbstract {
45    //    //
46    // Types for the lists of tags and values.    // Types for the lists of tags and values.
47    typedef std::vector<int>           TagListType;    typedef std::vector<int>           TagListType;
48    typedef std::vector<DataArrayView> ValueListType;  //  typedef std::vector<DataArrayView> ValueListType;
49    typedef DataArrayView::ValueType   ValueType;    typedef DataTypes::ValueType   ValueType;
50      typedef std::vector<ValueType::ElementType> ValueBatchType;
51    
52    //    //
53    // Map from a tag to an offset into the data array.    // Map from a tag to an offset into the data array.
# Line 62  class DataTagged : public DataAbstract { Line 63  class DataTagged : public DataAbstract {
63       tag values are stored.       tag values are stored.
64      T      T
65    */    */
66      ESCRIPT_DLL_API
67    DataTagged();    DataTagged();
68    
69    //  /**
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    
93    /**    /**
94       \brief       \brief
95       Constructor for DataTagged.       Alternative Constructor for DataTagged.
96    
97       Description:       Description:
98       Constructor for DataTagged.       Alternative Constructor for DataTagged.
99       \param tagKeys - Input - A vector of integer tags.       \param what - Input - A description of what this data object represents.
100       \param values - Input - A vector of DataArrayViews. If this is empty       \param shape - Input - The shape of each data-point.
101                       all tag values will be assigned a scalar data-point of value       \param tags - Input - An array of tags, one for each sample number (starts at tag[1]).
102                       0. If it contains one value all tag values will be assigned       \param data - The data values for each tag.
103               this value. Otherwise consecutive tags will be assigned      NB: no unit testing yet
                      consecutive values.  If there is a mismatch between  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.  
     T  
104    */    */
105    DataTagged(const TagListType& tagKeys,    ESCRIPT_DLL_API
106               const ValueListType& values,    DataTagged(const FunctionSpace& what,
107           const DataArrayView& defaultValue,               const DataTypes::ShapeType &shape,
108           const FunctionSpace& what);               const int tags[],
109                 const ValueType& data);
110    
111    /**   /**
112       \brief       \brief
113       Alternative Constructor for DataTagged.       Alternative Constructor for DataTagged.
114    
# Line 95  class DataTagged : public DataAbstract { Line 116  class DataTagged : public DataAbstract {
116       Alternative Constructor for DataTagged.       Alternative Constructor for DataTagged.
117       \param what - Input - A description of what this data object represents.       \param what - Input - A description of what this data object represents.
118       \param shape - Input - The shape of each data-point.       \param shape - Input - The shape of each data-point.
119       \param tags - Input - An array of tags, one for each sample number.       \param tags - Input - An vector of tags, one for each sample number.
120       \param data - The data values for each tag.       \param data - The data values for each tag.
121      NB: no unit testing yet  TODO Make sure to document the relationship between tags and data, ie: data also contains the default value
122    */   */
123      ESCRIPT_DLL_API
124    DataTagged(const FunctionSpace& what,    DataTagged(const FunctionSpace& what,
125               const DataArrayView::ShapeType &shape,               const DataTypes::ShapeType &shape,
126               const int tags[],               const TagListType& tags,
127               const ValueType& data);               const ValueType& data);
128    
129    /**    /**
# Line 110  class DataTagged : public DataAbstract { Line 132  class DataTagged : public DataAbstract {
132       Performs a deep copy from the given DataTagged object.       Performs a deep copy from the given DataTagged object.
133      T      T
134    */    */
135      ESCRIPT_DLL_API
136    DataTagged(const DataTagged& other);    DataTagged(const DataTagged& other);
137    
138    /**    /**
# Line 119  class DataTagged : public DataAbstract { Line 142  class DataTagged : public DataAbstract {
142       The default value will be the value of the DataConstant object.       The default value will be the value of the DataConstant object.
143      T      T
144    */    */
145      ESCRIPT_DLL_API
146    DataTagged(const DataConstant& other);    DataTagged(const DataConstant& other);
147    
148    /**    /**
149       \brief       \brief
150         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         Destructor
167      */
168      ESCRIPT_DLL_API
169      inline virtual
170      ~DataTagged() {};
171    
172      /**
173         \brief
174       getSampleDataByTag       getSampleDataByTag
175    
176       Description:       Description:
# Line 133  class DataTagged : public DataAbstract { Line 181  class DataTagged : public DataAbstract {
181       ** NB: need to do array bounds checking when accessing returned value!       ** NB: need to do array bounds checking when accessing returned value!
182      T      T
183    */    */
184      ESCRIPT_DLL_API
185    virtual    virtual
186    double*    double*
187    getSampleDataByTag(int tag);    getSampleDataByTag(int tag);
# Line 144  class DataTagged : public DataAbstract { Line 193  class DataTagged : public DataAbstract {
193       associated with each tag.       associated with each tag.
194      T      T
195    */    */
196      ESCRIPT_DLL_API
197    virtual    virtual
198    std::string    std::string
199    toString() const;    toString() const;
200     /**
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    
209     /**
210         \brief
211        sets all values to zero
212      */
213      ESCRIPT_DLL_API
214      virtual
215      void
216      setToZero();
217    
218    /**    /**
219       \brief       \brief
# Line 154  class DataTagged : public DataAbstract { Line 221  class DataTagged : public DataAbstract {
221       according to the associated function space.       according to the associated function space.
222      T      T
223    */    */
224      ESCRIPT_DLL_API
225    virtual    virtual
226    int    int
227    getTagNumber(int dpno);    getTagNumber(int dpno);
# Line 170  class DataTagged : public DataAbstract { Line 238  class DataTagged : public DataAbstract {
238       \param dataPointNo - Input - data-point number.       \param dataPointNo - Input - data-point number.
239      T      T
240    */    */
241      ESCRIPT_DLL_API
242    virtual    virtual
243    ValueType::size_type    ValueType::size_type
244    getPointOffset(int sampleNo,    getPointOffset(int sampleNo,
245                   int dataPointNo) const;                   int dataPointNo) const;
246    
247    /**  
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       \brief       \brief
290       addTaggedValues       addTaggedValues
291    
292       Description:       Description:
293       Add the given tags and values to this DataTagged object.       Add the given tags and values to this DataTagged object.
294       \param tagKeys - Input - A vector of integer tags.       \param tagKeys - Input - A vector of integer tags.
295       \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
296                       all tag values will be assigned a scalar data-point of value                       this DataTagged will be used for all tags.
297                       0. If it contains one value all tag values will be assigned                       If it contains one value all tag values will be assigned
298               this value. Otherwise consecutive tags will be assigned               this value. Otherwise consecutive tags will be assigned
299                       consecutive values.  If there is a mismatch between  the                       consecutive values.  If there is a mismatch between  the
300               number of keys and the number of values an exception               number of keys and the number of values an exception
301               will be generated.               will be generated.
302         \param vShape - shape of the datapoints in "values"
303      T      T
304     */
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    */    */
328      ESCRIPT_DLL_API
329    void    void
330    addTaggedValues(const TagListType& tagKeys,    addTaggedValues(const TagListType& tagKeys,
331                    const ValueListType& values);                                const ValueType& values,
332                                const ShapeType& vShape);
333    
334    
335    
336    
337    /**    /**
338       \brief       \brief
# Line 203  class DataTagged : public DataAbstract { Line 342  class DataTagged : public DataAbstract {
342       Add a single tag and value to this DataTagged object. If this tag already has       Add a single tag and value to this DataTagged object. If this tag already has
343       a value associated with it, setTaggedValue will be used to update this value.       a value associated with it, setTaggedValue will be used to update this value.
344       \param tagKey - Input - Integer tag.       \param tagKey - Input - Integer tag.
345       \param value - Input - Single DataArrayView value to be assigned to the tag.       \param pointshape - Shape of the value parameter
346      T       \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    */    */
349      ESCRIPT_DLL_API
350    void    void
351    addTaggedValue(int tagKey,    addTaggedValue(int tagKey,
352                   const DataArrayView& value);           const DataTypes::ShapeType& pointshape,
353                     const ValueType& value,
354             int dataOffset=0);
355    
356    /**    /**
357       \brief       \brief
358       setTaggedValues       addTag - does not modify the default value for this object. ** Not unit tested **
359    
360       Description:       Description:
361       Set the given tags to the given values in this DataTagged object.       Add a single tag. The default value for this DataTagged will be associated with the tag.
362       \param tagKeys - Input - A vector of integer tag.       If this tag already has a value associated with it, then no change will be made.
363       \param values - Input - A vector of DataArrayViews. If this is empty       \param tagKey - Input - Integer tag.
364                       all tag values will be assigned a scalar data-point of value      TODO: Make sure this is unit tested
                      0. If it contains one value all tag values will be assigned  
              this value. Otherwise consecutive tags will be assigned  
                      consecutive values.  If there is a mismatch between  the  
              number of keys and the number of values an exception  
              will be generated.  
     T  
365    */    */
366      ESCRIPT_DLL_API
367    void    void
368    setTaggedValues(const TagListType& tagKeys,    addTag(int tagKey);
369                    const ValueListType& values);  
370    
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    /**    /**
409       \brief       \brief
# Line 237  class DataTagged : public DataAbstract { Line 412  class DataTagged : public DataAbstract {
412       Description:       Description:
413       Assign the given value to the given tag.       Assign the given value to the given tag.
414       \param tagKey - Input - Integer tag.       \param tagKey - Input - Integer tag.
415       \param value - Input - Single DataArrayView value to be assigned to the tag.       \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      T      T
419    */    */
420    virtual    ESCRIPT_DLL_API
421    void    void
422    setTaggedValue(int tagKey,    setTaggedValue(int tagKey,
423                   const DataArrayView& value);           const DataTypes::ShapeType& pointshape,
424                     const ValueType& value,
425             int dataOffset=0);
426    
427    
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    /**    /**
442       \brief       \brief
443       getDataPointByTag       getDataByTag
444    
445       Description:       Return a pointer to the beginning of the datapoint with the specified tag.
446       Return data-point associated with the given tag as a DataArrayView.       TODO Eventually these should be inlined.
447       \param tag - Input - Integer key.       \param tag - Input - Integer key.
448         \param i - position in the underlying datastructure
449      T      T
450    */    */
451    DataArrayView    ESCRIPT_DLL_API
452    getDataPointByTag(int tag) const;    DataTypes::ValueType::const_reference
453      getDataByTag(int tag, DataTypes::ValueType::size_type i) const;
454    
455      ESCRIPT_DLL_API
456      DataTypes::ValueType::reference
457      getDataByTag(int tag, DataTypes::ValueType::size_type i);
458    
459    
460      /**
461          \brief
462          getOffsetForTag
463    
464          \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      */
469      ESCRIPT_DLL_API
470      DataTypes::ValueType::size_type
471      getOffsetForTag(int tag) const;
472    
473    //  /**
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      /**
492         \brief
493         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       \brief
508       getDataPoint       getData
509    
510       Description:       Description:
511       Return the data-point specified by the given sample and data-point       Return pointer to the data
      numbers as a DataArrayView.  
      \param sampleNo - Input.  
      \param dataPointNo - Input.  
512      T      T
513    */    */
514    virtual  //   ESCRIPT_DLL_API
515    DataArrayView  //   const DataTypes::ValueType::ElementType*
516    getDataPoint(int sampleNo,  //   getData() const;
                int dataPointNo);  
517    
518    /**    /**
519       \brief       \brief
# Line 281  class DataTagged : public DataAbstract { Line 523  class DataTagged : public DataAbstract {
523       Return a reference to the tag offset lookup table.       Return a reference to the tag offset lookup table.
524      T      T
525    */    */
526      ESCRIPT_DLL_API
527    const DataMapType&    const DataMapType&
528    getTagLookup() const;    getTagLookup() const;
529    
# Line 295  class DataTagged : public DataAbstract { Line 538  class DataTagged : public DataAbstract {
538       keys in the associated function space.       keys in the associated function space.
539      T      T
540    */    */
541      ESCRIPT_DLL_API
542    bool    bool
543    isCurrentTag(int tag) const;    isCurrentTag(int tag) const;
544    
545    // /**
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    /**    /**
563       \brief       \brief
564       getDefaultValue       getDefaultValue
# Line 305  class DataTagged : public DataAbstract { Line 566  class DataTagged : public DataAbstract {
566       Description:       Description:
567       Return the default value. This value is associated with any tag which       Return the default value. This value is associated with any tag which
568       is not explicitly recorded in this DataTagged object's tag map.       is not explicitly recorded in this DataTagged object's tag map.
569         \param i - position in the underlying datastructure
570      T      T
571    */    */
572    DataArrayView&    ESCRIPT_DLL_API
573    getDefaultValue();    DataTypes::ValueType::reference
574      getDefaultValue(DataTypes::ValueType::size_type i);
575    
576      ESCRIPT_DLL_API
577      DataTypes::ValueType::const_reference
578      getDefaultValue(DataTypes::ValueType::size_type i) const;
579    
580    
581    
   const DataArrayView&  
   getDefaultValue() const;  
582    
583    /**    /**
584       \brief       \brief
# Line 321  class DataTagged : public DataAbstract { Line 588  class DataTagged : public DataAbstract {
588       Return the total number of doubles stored for this DataTagged object.       Return the total number of doubles stored for this DataTagged object.
589      T      T
590    */    */
591      ESCRIPT_DLL_API
592    virtual    virtual
593    ValueType::size_type    ValueType::size_type
594    getLength() const;    getLength() const;
# Line 335  class DataTagged : public DataAbstract { Line 603  class DataTagged : public DataAbstract {
603       The caller is reponsible for managing the returned object.       The caller is reponsible for managing the returned object.
604      T      T
605    */    */
606      ESCRIPT_DLL_API
607    virtual    virtual
608    DataAbstract*    DataAbstract*
609    getSlice(const DataArrayView::RegionType& region) const;    getSlice(const DataTypes::RegionType& region) const;
610    
611    /**    /**
612       \brief       \brief
# Line 350  class DataTagged : public DataAbstract { Line 619  class DataTagged : public DataAbstract {
619       \param region - Input - Region to slice.       \param region - Input - Region to slice.
620      T      T
621    */    */
622      ESCRIPT_DLL_API
623    DataTagged(const DataTagged& other,    DataTagged(const DataTagged& other,
624           const DataArrayView::RegionType& region);           const DataTypes::RegionType& region);
625    
626    /**    /**
627       \brief       \brief
# Line 363  class DataTagged : public DataAbstract { Line 633  class DataTagged : public DataAbstract {
633       \param region - Input - Region to copy into (NB: must have same shape as other!).       \param region - Input - Region to copy into (NB: must have same shape as other!).
634      T      T
635    */    */
636      ESCRIPT_DLL_API
637    virtual    virtual
638    void    void
639    setSlice(const DataAbstract* other,    setSlice(const DataAbstract* other,
640             const DataArrayView::RegionType& region);             const DataTypes::RegionType& region);
641    
642    
643    /**    /**
644       \brief       \brief
645       reshapeDataPoint       Computes a symmetric matrix (A + AT) / 2
646    
647         \param ev - Output - symmetric matrix
648    
      Description:  
      Reshape each data-point in this object to the given shape, only  
      if current data-points are scalars. An exception is thrown if  
      the current data-points have rank other than 0.  
      The original values of the data-points are used for all values  
      of the new data-points.  
     T  
649    */    */
650    void    ESCRIPT_DLL_API
651    reshapeDataPoint(const DataArrayView::ShapeType& shape);    virtual void
652      symmetric(DataAbstract* ev);
653    
654    /**    /**
655       \brief       \brief
656       Archive the underlying data values to the file referenced       Computes a nonsymmetric matrix (A - AT) / 2
657       by ofstream. A count of the number of values expected to be written  
658       is provided as a cross-check.       \param ev - Output - nonsymmetric matrix
659    
      The return value indicates success (0) or otherwise (1).  
660    */    */
661    int    ESCRIPT_DLL_API
662    archiveData(std::ofstream& archiveFile,    virtual void
663                const DataArrayView::ValueType::size_type noValues) const;    nonsymmetric(DataAbstract* ev);
664    
665    /**    /**
666       \brief       \brief
667       Extract the number of values specified by noValues from the file       Computes the trace of a matrix
668       referenced by ifstream to the underlying data structure.  
669         \param ev - Output - the trace of a matrix
670    
      The return value indicates success (0) or otherwise (1).  
671    */    */
672    int    ESCRIPT_DLL_API
673    extractData(std::ifstream& archiveFile,    virtual void
674                const DataArrayView::ValueType::size_type noValues);    trace(DataAbstract* ev, int axis_offset);
675    
676      /**
677         \brief
678         swaps components axis0 and axis1
679    
680         \param ev - Output - swapped components
681    
682      */
683      ESCRIPT_DLL_API
684      virtual void
685      swapaxes(DataAbstract* ev, int axis0, int axis1);
686    
687      /**
688         \brief
689         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      ESCRIPT_DLL_API
695      virtual void
696      transpose(DataAbstract* ev, int axis_offset);
697    
698    /**    /**
699       \brief       \brief
# Line 413  class DataTagged : public DataAbstract { Line 702  class DataTagged : public DataAbstract {
702       \param ev - Output - eigenvalues in increasing order at each data point       \param ev - Output - eigenvalues in increasing order at each data point
703    
704    */    */
705      ESCRIPT_DLL_API
706    virtual void    virtual void
707    eigenvalues(DataAbstract* ev);    eigenvalues(DataAbstract* ev);
708    
# Line 427  class DataTagged : public DataAbstract { Line 717  class DataTagged : public DataAbstract {
717    
718    */    */
719    
720      ESCRIPT_DLL_API
721    virtual void    virtual void
722    eigenvalues_and_eigenvectors(DataAbstract* ev,DataAbstract* V,const double tol=1.e-13);    eigenvalues_and_eigenvectors(DataAbstract* ev,DataAbstract* V,const double tol=1.e-13);
723    
724    
725      /**
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   protected:   protected:
733    
734   private:   private:
# Line 457  DataTagged::isCurrentTag(int tag) const Line 755  DataTagged::isCurrentTag(int tag) const
755    return (pos!=m_offsetLookup.end());    return (pos!=m_offsetLookup.end());
756  }  }
757    
758    // 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    {
779      return m_defaultValueOffset;  
780    }
781    
782  inline  inline
783  DataArrayView&  DataTypes::ValueType::reference
784  DataTagged::getDefaultValue()  DataTagged::getDefaultValue(DataTypes::ValueType::size_type i)
785  {  {
786    // The default value is always the first value.      return getVector()[i];
   return getPointDataView();  
787  }  }
788    
789  inline  inline
790  const DataArrayView&  DataTypes::ValueType::const_reference
791  DataTagged::getDefaultValue() const  DataTagged::getDefaultValue(DataTypes::ValueType::size_type i) const
792  {  {
793    // The default value is always the first value.      return getVector()[i];
   return getPointDataView();  
794  }  }
795    
796    
797    
798    
799    // inline
800    // const DataTypes::ValueType::ElementType*
801    // DataTagged::getData() const
802    // {
803    //    return &(m_data[0]);
804    // }
805    
806  inline  inline
807  const DataTagged::DataMapType&  const DataTagged::DataMapType&
808  DataTagged::getTagLookup() const  DataTagged::getTagLookup() const
# Line 481  DataTagged::getTagLookup() const Line 811  DataTagged::getTagLookup() const
811  }  }
812    
813  inline  inline
814  DataArrayView::ValueType::size_type  DataTypes::ValueType::size_type
815  DataTagged::getLength() const  DataTagged::getLength() const
816  {  {
817    return m_data.size();    return m_data.size();

Legend:
Removed from v.580  
changed lines
  Added in v.1796

  ViewVC Help
Powered by ViewVC 1.1.26