/[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 1628 by phornby, Fri Jul 11 13:12: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 "DataArrayView.h"
# Line 62  class DataTagged : public DataAbstract { Line 62  class DataTagged : public DataAbstract {
62       tag values are stored.       tag values are stored.
63      T      T
64    */    */
65      ESCRIPT_DLL_API
66    DataTagged();    DataTagged();
67    
68    /**    /**
# Line 82  class DataTagged : public DataAbstract { Line 83  class DataTagged : public DataAbstract {
83       \param what - Input - A description of what this data represents.       \param what - Input - A description of what this data represents.
84      T      T
85    */    */
86      ESCRIPT_DLL_API
87    DataTagged(const TagListType& tagKeys,    DataTagged(const TagListType& tagKeys,
88               const ValueListType& values,               const ValueListType& values,
89           const DataArrayView& defaultValue,           const DataArrayView& defaultValue,
# Line 99  class DataTagged : public DataAbstract { Line 101  class DataTagged : public DataAbstract {
101       \param data - The data values for each tag.       \param data - The data values for each tag.
102      NB: no unit testing yet      NB: no unit testing yet
103    */    */
104      ESCRIPT_DLL_API
105    DataTagged(const FunctionSpace& what,    DataTagged(const FunctionSpace& what,
106               const DataArrayView::ShapeType &shape,               const DataArrayView::ShapeType &shape,
107               const int tags[],               const int tags[],
# Line 106  class DataTagged : public DataAbstract { Line 109  class DataTagged : public DataAbstract {
109    
110    /**    /**
111       \brief       \brief
112         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        NB: no unit testing yet
121      */
122      ESCRIPT_DLL_API
123      DataTagged(const FunctionSpace& what,
124                 const DataArrayView::ShapeType &shape,
125                 const TagListType& tags,
126                 const ValueType& data);
127    
128      /**
129         \brief
130       Copy Constructor for DataTagged.       Copy Constructor for DataTagged.
131       Performs a deep copy from the given DataTagged object.       Performs a deep copy from the given DataTagged object.
132      T      T
133    */    */
134      ESCRIPT_DLL_API
135    DataTagged(const DataTagged& other);    DataTagged(const DataTagged& other);
136    
137    /**    /**
# Line 119  class DataTagged : public DataAbstract { Line 141  class DataTagged : public DataAbstract {
141       The default value will be the value of the DataConstant object.       The default value will be the value of the DataConstant object.
142      T      T
143    */    */
144      ESCRIPT_DLL_API
145    DataTagged(const DataConstant& other);    DataTagged(const DataConstant& other);
146    
147    /**    /**
148       \brief       \brief
149         Destructor
150      */
151      ESCRIPT_DLL_API
152      inline virtual
153      ~DataTagged() {};
154    
155      /**
156         \brief
157       getSampleDataByTag       getSampleDataByTag
158    
159       Description:       Description:
# Line 133  class DataTagged : public DataAbstract { Line 164  class DataTagged : public DataAbstract {
164       ** NB: need to do array bounds checking when accessing returned value!       ** NB: need to do array bounds checking when accessing returned value!
165      T      T
166    */    */
167      ESCRIPT_DLL_API
168    virtual    virtual
169    double*    double*
170    getSampleDataByTag(int tag);    getSampleDataByTag(int tag);
# Line 144  class DataTagged : public DataAbstract { Line 176  class DataTagged : public DataAbstract {
176       associated with each tag.       associated with each tag.
177      T      T
178    */    */
179      ESCRIPT_DLL_API
180    virtual    virtual
181    std::string    std::string
182    toString() const;    toString() const;
183     /**
184         \brief
185         dumps the object into a netCDF file
186      */
187      ESCRIPT_DLL_API
188      virtual
189      void
190      dump(const std::string fileName) const;
191    
192     /**
193         \brief
194        sets all values to zero
195      */
196      ESCRIPT_DLL_API
197      virtual
198      void
199      setToZero();
200    
201    /**    /**
202       \brief       \brief
# Line 154  class DataTagged : public DataAbstract { Line 204  class DataTagged : public DataAbstract {
204       according to the associated function space.       according to the associated function space.
205      T      T
206    */    */
207      ESCRIPT_DLL_API
208    virtual    virtual
209    int    int
210    getTagNumber(int dpno);    getTagNumber(int dpno);
# Line 170  class DataTagged : public DataAbstract { Line 221  class DataTagged : public DataAbstract {
221       \param dataPointNo - Input - data-point number.       \param dataPointNo - Input - data-point number.
222      T      T
223    */    */
224      ESCRIPT_DLL_API
225    virtual    virtual
226    ValueType::size_type    ValueType::size_type
227    getPointOffset(int sampleNo,    getPointOffset(int sampleNo,
# Line 191  class DataTagged : public DataAbstract { Line 243  class DataTagged : public DataAbstract {
243               will be generated.               will be generated.
244      T      T
245    */    */
246      ESCRIPT_DLL_API
247    void    void
248    addTaggedValues(const TagListType& tagKeys,    addTaggedValues(const TagListType& tagKeys,
249                    const ValueListType& values);                      const ValueListType& values);  
# Line 206  class DataTagged : public DataAbstract { Line 259  class DataTagged : public DataAbstract {
259       \param value - Input - Single DataArrayView value to be assigned to the tag.       \param value - Input - Single DataArrayView value to be assigned to the tag.
260      T      T
261    */    */
262      ESCRIPT_DLL_API
263    void    void
264    addTaggedValue(int tagKey,    addTaggedValue(int tagKey,
265                   const DataArrayView& value);                   const DataArrayView& value);
# Line 226  class DataTagged : public DataAbstract { Line 280  class DataTagged : public DataAbstract {
280               will be generated.               will be generated.
281      T      T
282    */    */
283      ESCRIPT_DLL_API
284    void    void
285    setTaggedValues(const TagListType& tagKeys,    setTaggedValues(const TagListType& tagKeys,
286                    const ValueListType& values);                    const ValueListType& values);
# Line 240  class DataTagged : public DataAbstract { Line 295  class DataTagged : public DataAbstract {
295       \param value - Input - Single DataArrayView value to be assigned to the tag.       \param value - Input - Single DataArrayView value to be assigned to the tag.
296      T      T
297    */    */
298      ESCRIPT_DLL_API
299    virtual    virtual
300    void    void
301    setTaggedValue(int tagKey,    setTaggedValue(int tagKey,
# Line 254  class DataTagged : public DataAbstract { Line 310  class DataTagged : public DataAbstract {
310       \param tag - Input - Integer key.       \param tag - Input - Integer key.
311      T      T
312    */    */
313      ESCRIPT_DLL_API
314    DataArrayView    DataArrayView
315    getDataPointByTag(int tag) const;    getDataPointByTag(int tag) const;
316    
# Line 268  class DataTagged : public DataAbstract { Line 325  class DataTagged : public DataAbstract {
325       \param dataPointNo - Input.       \param dataPointNo - Input.
326      T      T
327    */    */
328      ESCRIPT_DLL_API
329    virtual    virtual
330    DataArrayView    DataArrayView
331    getDataPoint(int sampleNo,    getDataPoint(int sampleNo,
332                 int dataPointNo);                 int dataPointNo);
333    
334    /**    /**
335         \brief
336         getData
337    
338         Description:
339         Return pointer to the data
340        T
341      */
342      ESCRIPT_DLL_API
343      const DataArrayView::ValueType::ElementType*
344      getData() const;
345    
346      /**
347       \brief       \brief
348       getTagLookup       getTagLookup
349    
# Line 281  class DataTagged : public DataAbstract { Line 351  class DataTagged : public DataAbstract {
351       Return a reference to the tag offset lookup table.       Return a reference to the tag offset lookup table.
352      T      T
353    */    */
354      ESCRIPT_DLL_API
355    const DataMapType&    const DataMapType&
356    getTagLookup() const;    getTagLookup() const;
357    
# Line 295  class DataTagged : public DataAbstract { Line 366  class DataTagged : public DataAbstract {
366       keys in the associated function space.       keys in the associated function space.
367      T      T
368    */    */
369      ESCRIPT_DLL_API
370    bool    bool
371    isCurrentTag(int tag) const;    isCurrentTag(int tag) const;
372    
# Line 307  class DataTagged : public DataAbstract { Line 379  class DataTagged : public DataAbstract {
379       is not explicitly recorded in this DataTagged object's tag map.       is not explicitly recorded in this DataTagged object's tag map.
380      T      T
381    */    */
382      ESCRIPT_DLL_API
383    DataArrayView&    DataArrayView&
384    getDefaultValue();    getDefaultValue();
385    
386      ESCRIPT_DLL_API
387    const DataArrayView&    const DataArrayView&
388    getDefaultValue() const;    getDefaultValue() const;
389    
# Line 321  class DataTagged : public DataAbstract { Line 395  class DataTagged : public DataAbstract {
395       Return the total number of doubles stored for this DataTagged object.       Return the total number of doubles stored for this DataTagged object.
396      T      T
397    */    */
398      ESCRIPT_DLL_API
399    virtual    virtual
400    ValueType::size_type    ValueType::size_type
401    getLength() const;    getLength() const;
# Line 335  class DataTagged : public DataAbstract { Line 410  class DataTagged : public DataAbstract {
410       The caller is reponsible for managing the returned object.       The caller is reponsible for managing the returned object.
411      T      T
412    */    */
413      ESCRIPT_DLL_API
414    virtual    virtual
415    DataAbstract*    DataAbstract*
416    getSlice(const DataArrayView::RegionType& region) const;    getSlice(const DataArrayView::RegionType& region) const;
# Line 350  class DataTagged : public DataAbstract { Line 426  class DataTagged : public DataAbstract {
426       \param region - Input - Region to slice.       \param region - Input - Region to slice.
427      T      T
428    */    */
429      ESCRIPT_DLL_API
430    DataTagged(const DataTagged& other,    DataTagged(const DataTagged& other,
431           const DataArrayView::RegionType& region);           const DataArrayView::RegionType& region);
432    
# Line 363  class DataTagged : public DataAbstract { Line 440  class DataTagged : public DataAbstract {
440       \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!).
441      T      T
442    */    */
443      ESCRIPT_DLL_API
444    virtual    virtual
445    void    void
446    setSlice(const DataAbstract* other,    setSlice(const DataAbstract* other,
# Line 370  class DataTagged : public DataAbstract { Line 448  class DataTagged : public DataAbstract {
448    
449    /**    /**
450       \brief       \brief
      reshapeDataPoint  
   
      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  
   */  
   void  
   reshapeDataPoint(const DataArrayView::ShapeType& shape);  
   
   /**  
      \brief  
451       Archive the underlying data values to the file referenced       Archive the underlying data values to the file referenced
452       by ofstream. A count of the number of values expected to be written       by ofstream. A count of the number of values expected to be written
453       is provided as a cross-check.       is provided as a cross-check.
454    
455       The return value indicates success (0) or otherwise (1).       The return value indicates success (0) or otherwise (1).
456    */    */
457      ESCRIPT_DLL_API
458    int    int
459    archiveData(std::ofstream& archiveFile,    archiveData(std::ofstream& archiveFile,
460                const DataArrayView::ValueType::size_type noValues) const;                const DataArrayView::ValueType::size_type noValues) const;
# Line 402  class DataTagged : public DataAbstract { Line 466  class DataTagged : public DataAbstract {
466    
467       The return value indicates success (0) or otherwise (1).       The return value indicates success (0) or otherwise (1).
468    */    */
469      ESCRIPT_DLL_API
470    int    int
471    extractData(std::ifstream& archiveFile,    extractData(std::ifstream& archiveFile,
472                const DataArrayView::ValueType::size_type noValues);                const DataArrayView::ValueType::size_type noValues);
473    
474    /**    /**
475       \brief       \brief
476         Computes a symmetric matrix (A + AT) / 2
477    
478         \param ev - Output - symmetric matrix
479    
480      */
481      ESCRIPT_DLL_API
482      virtual void
483      symmetric(DataAbstract* ev);
484    
485      /**
486         \brief
487         Computes a nonsymmetric matrix (A - AT) / 2
488    
489         \param ev - Output - nonsymmetric matrix
490    
491      */
492      ESCRIPT_DLL_API
493      virtual void
494      nonsymmetric(DataAbstract* ev);
495    
496      /**
497         \brief
498         Computes the trace of a matrix
499    
500         \param ev - Output - the trace of a matrix
501    
502      */
503      ESCRIPT_DLL_API
504      virtual void
505      trace(DataAbstract* ev, int axis_offset);
506    
507      /**
508         \brief
509         swaps components axis0 and axis1
510    
511         \param ev - Output - swapped components
512    
513      */
514      ESCRIPT_DLL_API
515      virtual void
516      swapaxes(DataAbstract* ev, int axis0, int axis1);
517    
518      /**
519         \brief
520         Transpose each data point of this Data object around the given axis.
521    
522         \param ev - Output - the transpose of a matrix
523    
524      */
525      ESCRIPT_DLL_API
526      virtual void
527      transpose(DataAbstract* ev, int axis_offset);
528    
529      /**
530         \brief
531       solves the eigenvalue problem this*V=ev*V for the eigenvalues ev       solves the eigenvalue problem this*V=ev*V for the eigenvalues ev
532    
533       \param ev - Output - eigenvalues in increasing order at each data point       \param ev - Output - eigenvalues in increasing order at each data point
534    
535    */    */
536      ESCRIPT_DLL_API
537    virtual void    virtual void
538    eigenvalues(DataAbstract* ev);    eigenvalues(DataAbstract* ev);
539    
# Line 427  class DataTagged : public DataAbstract { Line 548  class DataTagged : public DataAbstract {
548    
549    */    */
550    
551      ESCRIPT_DLL_API
552    virtual void    virtual void
553    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);
554    
# Line 474  DataTagged::getDefaultValue() const Line 596  DataTagged::getDefaultValue() const
596  }  }
597    
598  inline  inline
599    const DataArrayView::ValueType::ElementType*
600    DataTagged::getData() const
601    {
602       return &(m_data[0]);
603    }
604    
605    inline
606  const DataTagged::DataMapType&  const DataTagged::DataMapType&
607  DataTagged::getTagLookup() const  DataTagged::getTagLookup() const
608  {  {

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

  ViewVC Help
Powered by ViewVC 1.1.26