/[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 513 by jgs, Mon Feb 13 04:46:51 2006 UTC revision 804 by gross, Thu Aug 10 01:12:16 2006 UTC
# Line 1  Line 1 
1  // $Id$  // $Id$
2    
3  /*  /*
4   ******************************************************************************   ************************************************************
5   *                                                                            *   *          Copyright 2006 by ACcESS MNRF                   *
6   *       COPYRIGHT  ACcESS 2004 -  All Rights Reserved                        *   *                                                          *
7   *                                                                            *   *              http://www.access.edu.au                    *
8   * This software is the property of ACcESS. No part of this code              *   *       Primary Business: Queensland, Australia            *
9   * may be copied in any form or by any means without the expressed written    *   *  Licensed under the Open Software License version 3.0    *
10   * consent of ACcESS.  Copying, use or modification of this software          *   *     http://www.opensource.org/licenses/osl-3.0.php       *
11   * by any unauthorised person is illegal unless that person has a software    *   *                                                          *
12   * license agreement with ACcESS.                                             *   ************************************************************
  *                                                                            *  
  ******************************************************************************  
13  */  */
14    
15  #if !defined escript_DataTagged_20040615_H  #if !defined escript_DataTagged_20040615_H
16  #define escript_DataTagged_20040615_H  #define escript_DataTagged_20040615_H
17    #include "system_dep.h"
18    
19  #include "DataAbstract.h"  #include "DataAbstract.h"
20  #include "DataArrayView.h"  #include "DataArrayView.h"
# Line 62  class DataTagged : public DataAbstract { Line 61  class DataTagged : public DataAbstract {
61       tag values are stored.       tag values are stored.
62      T      T
63    */    */
64      ESCRIPT_DLL_API
65    DataTagged();    DataTagged();
66    
67    /**    /**
# Line 82  class DataTagged : public DataAbstract { Line 82  class DataTagged : public DataAbstract {
82       \param what - Input - A description of what this data represents.       \param what - Input - A description of what this data represents.
83      T      T
84    */    */
85      ESCRIPT_DLL_API
86    DataTagged(const TagListType& tagKeys,    DataTagged(const TagListType& tagKeys,
87               const ValueListType& values,               const ValueListType& values,
88           const DataArrayView& defaultValue,           const DataArrayView& defaultValue,
# Line 97  class DataTagged : public DataAbstract { Line 98  class DataTagged : public DataAbstract {
98       \param shape - Input - The shape of each data-point.       \param shape - Input - The shape of each data-point.
99       \param tags - Input - An array of tags, one for each sample number.       \param tags - Input - An array of tags, one for each sample number.
100       \param data - The data values for each tag.       \param data - The data values for each tag.
101        NB: no unit testing yet
102    */    */
103      ESCRIPT_DLL_API
104    DataTagged(const FunctionSpace& what,    DataTagged(const FunctionSpace& what,
105               const DataArrayView::ShapeType &shape,               const DataArrayView::ShapeType &shape,
106               const int tags[],               const int tags[],
# Line 105  class DataTagged : public DataAbstract { Line 108  class DataTagged : public DataAbstract {
108    
109    /**    /**
110       \brief       \brief
111         Alternative Constructor for DataTagged.
112    
113         Description:
114         Alternative Constructor for DataTagged.
115         \param what - Input - A description of what this data object represents.
116         \param shape - Input - The shape of each data-point.
117         \param tags - Input - An vector of tags, one for each sample number.
118         \param data - The data values for each tag.
119        NB: no unit testing yet
120      */
121      ESCRIPT_DLL_API
122      DataTagged(const FunctionSpace& what,
123                 const DataArrayView::ShapeType &shape,
124                 const TagListType& tags,
125                 const ValueType& data);
126    
127      /**
128         \brief
129       Copy Constructor for DataTagged.       Copy Constructor for DataTagged.
130       Performs a deep copy from the given DataTagged object.       Performs a deep copy from the given DataTagged object.
131      T      T
132    */    */
133      ESCRIPT_DLL_API
134    DataTagged(const DataTagged& other);    DataTagged(const DataTagged& other);
135    
136    /**    /**
# Line 118  class DataTagged : public DataAbstract { Line 140  class DataTagged : public DataAbstract {
140       The default value will be the value of the DataConstant object.       The default value will be the value of the DataConstant object.
141      T      T
142    */    */
143      ESCRIPT_DLL_API
144    DataTagged(const DataConstant& other);    DataTagged(const DataConstant& other);
145    
146    /**    /**
# Line 132  class DataTagged : public DataAbstract { Line 155  class DataTagged : public DataAbstract {
155       ** NB: need to do array bounds checking when accessing returned value!       ** NB: need to do array bounds checking when accessing returned value!
156      T      T
157    */    */
158      ESCRIPT_DLL_API
159    virtual    virtual
160    double*    double*
161    getSampleDataByTag(int tag);    getSampleDataByTag(int tag);
# Line 143  class DataTagged : public DataAbstract { Line 167  class DataTagged : public DataAbstract {
167       associated with each tag.       associated with each tag.
168      T      T
169    */    */
170      ESCRIPT_DLL_API
171    virtual    virtual
172    std::string    std::string
173    toString() const;    toString() const;
# Line 153  class DataTagged : public DataAbstract { Line 178  class DataTagged : public DataAbstract {
178       according to the associated function space.       according to the associated function space.
179      T      T
180    */    */
181      ESCRIPT_DLL_API
182    virtual    virtual
183    int    int
184    getTagNumber(int dpno);    getTagNumber(int dpno);
# Line 169  class DataTagged : public DataAbstract { Line 195  class DataTagged : public DataAbstract {
195       \param dataPointNo - Input - data-point number.       \param dataPointNo - Input - data-point number.
196      T      T
197    */    */
198      ESCRIPT_DLL_API
199    virtual    virtual
200    ValueType::size_type    ValueType::size_type
201    getPointOffset(int sampleNo,    getPointOffset(int sampleNo,
# Line 190  class DataTagged : public DataAbstract { Line 217  class DataTagged : public DataAbstract {
217               will be generated.               will be generated.
218      T      T
219    */    */
220      ESCRIPT_DLL_API
221    void    void
222    addTaggedValues(const TagListType& tagKeys,    addTaggedValues(const TagListType& tagKeys,
223                    const ValueListType& values);                      const ValueListType& values);  
# Line 205  class DataTagged : public DataAbstract { Line 233  class DataTagged : public DataAbstract {
233       \param value - Input - Single DataArrayView value to be assigned to the tag.       \param value - Input - Single DataArrayView value to be assigned to the tag.
234      T      T
235    */    */
236      ESCRIPT_DLL_API
237    void    void
238    addTaggedValue(int tagKey,    addTaggedValue(int tagKey,
239                   const DataArrayView& value);                   const DataArrayView& value);
# Line 225  class DataTagged : public DataAbstract { Line 254  class DataTagged : public DataAbstract {
254               will be generated.               will be generated.
255      T      T
256    */    */
257      ESCRIPT_DLL_API
258    void    void
259    setTaggedValues(const TagListType& tagKeys,    setTaggedValues(const TagListType& tagKeys,
260                    const ValueListType& values);                    const ValueListType& values);
# Line 239  class DataTagged : public DataAbstract { Line 269  class DataTagged : public DataAbstract {
269       \param value - Input - Single DataArrayView value to be assigned to the tag.       \param value - Input - Single DataArrayView value to be assigned to the tag.
270      T      T
271    */    */
272      ESCRIPT_DLL_API
273    virtual    virtual
274    void    void
275    setTaggedValue(int tagKey,    setTaggedValue(int tagKey,
# Line 253  class DataTagged : public DataAbstract { Line 284  class DataTagged : public DataAbstract {
284       \param tag - Input - Integer key.       \param tag - Input - Integer key.
285      T      T
286    */    */
287      ESCRIPT_DLL_API
288    DataArrayView    DataArrayView
289    getDataPointByTag(int tag) const;    getDataPointByTag(int tag) const;
290    
# Line 267  class DataTagged : public DataAbstract { Line 299  class DataTagged : public DataAbstract {
299       \param dataPointNo - Input.       \param dataPointNo - Input.
300      T      T
301    */    */
302      ESCRIPT_DLL_API
303    virtual    virtual
304    DataArrayView    DataArrayView
305    getDataPoint(int sampleNo,    getDataPoint(int sampleNo,
# Line 280  class DataTagged : public DataAbstract { Line 313  class DataTagged : public DataAbstract {
313       Return a reference to the tag offset lookup table.       Return a reference to the tag offset lookup table.
314      T      T
315    */    */
316      ESCRIPT_DLL_API
317    const DataMapType&    const DataMapType&
318    getTagLookup() const;    getTagLookup() const;
319    
# Line 294  class DataTagged : public DataAbstract { Line 328  class DataTagged : public DataAbstract {
328       keys in the associated function space.       keys in the associated function space.
329      T      T
330    */    */
331      ESCRIPT_DLL_API
332    bool    bool
333    isCurrentTag(int tag) const;    isCurrentTag(int tag) const;
334    
# Line 306  class DataTagged : public DataAbstract { Line 341  class DataTagged : public DataAbstract {
341       is not explicitly recorded in this DataTagged object's tag map.       is not explicitly recorded in this DataTagged object's tag map.
342      T      T
343    */    */
344      ESCRIPT_DLL_API
345    DataArrayView&    DataArrayView&
346    getDefaultValue();    getDefaultValue();
347    
348      ESCRIPT_DLL_API
349    const DataArrayView&    const DataArrayView&
350    getDefaultValue() const;    getDefaultValue() const;
351    
# Line 320  class DataTagged : public DataAbstract { Line 357  class DataTagged : public DataAbstract {
357       Return the total number of doubles stored for this DataTagged object.       Return the total number of doubles stored for this DataTagged object.
358      T      T
359    */    */
360      ESCRIPT_DLL_API
361    virtual    virtual
362    ValueType::size_type    ValueType::size_type
363    getLength() const;    getLength() const;
# Line 332  class DataTagged : public DataAbstract { Line 370  class DataTagged : public DataAbstract {
370       Factory method that returns a newly created DataTagged object generated       Factory method that returns a newly created DataTagged object generated
371       by taking the specified slice from this DataTagged object.       by taking the specified slice from this DataTagged object.
372       The caller is reponsible for managing the returned object.       The caller is reponsible for managing the returned object.
373        T
374    */    */
375      ESCRIPT_DLL_API
376    virtual    virtual
377    DataAbstract*    DataAbstract*
378    getSlice(const DataArrayView::RegionType& region) const;    getSlice(const DataArrayView::RegionType& region) const;
# Line 342  class DataTagged : public DataAbstract { Line 382  class DataTagged : public DataAbstract {
382       Slice Constructor for DataTagged.       Slice Constructor for DataTagged.
383    
384       Description:       Description:
      Slice Constructor for DataTagged.  
385       Creates a DataTagged object which is the specified slice       Creates a DataTagged object which is the specified slice
386       from another DataTagged object.       from the given DataTagged object.
387       \param other - Input - DataTagged object to copy from.       \param other - Input - DataTagged object to slice from.
388       \param region - Input - Region to copy.       \param region - Input - Region to slice.
389        T
390    */    */
391      ESCRIPT_DLL_API
392    DataTagged(const DataTagged& other,    DataTagged(const DataTagged& other,
393           const DataArrayView::RegionType& region);           const DataArrayView::RegionType& region);
394    
# Line 356  class DataTagged : public DataAbstract { Line 397  class DataTagged : public DataAbstract {
397       setSlice       setSlice
398    
399       Description:       Description:
400       Copy the specified region from the given Data object into this object.       Copy the given Data object into the specified region in this object.
401       \param other - Input - Data object to copy from.       \param other - Input - Data object to copy from.
402       \param region - Input - Region to copy (NB: must have same shape as this!).       \param region - Input - Region to copy into (NB: must have same shape as other!).
403        T
404    */    */
405      ESCRIPT_DLL_API
406    virtual    virtual
407    void    void
408    setSlice(const DataAbstract* other,    setSlice(const DataAbstract* other,
# Line 377  class DataTagged : public DataAbstract { Line 420  class DataTagged : public DataAbstract {
420       of the new data-points.       of the new data-points.
421      T      T
422    */    */
423      ESCRIPT_DLL_API
424    void    void
425    reshapeDataPoint(const DataArrayView::ShapeType& shape);    reshapeDataPoint(const DataArrayView::ShapeType& shape);
426    
# Line 388  class DataTagged : public DataAbstract { Line 432  class DataTagged : public DataAbstract {
432    
433       The return value indicates success (0) or otherwise (1).       The return value indicates success (0) or otherwise (1).
434    */    */
435      ESCRIPT_DLL_API
436    int    int
437    archiveData(std::ofstream& archiveFile,    archiveData(std::ofstream& archiveFile,
438                const DataArrayView::ValueType::size_type noValues) const;                const DataArrayView::ValueType::size_type noValues) const;
# Line 399  class DataTagged : public DataAbstract { Line 444  class DataTagged : public DataAbstract {
444    
445       The return value indicates success (0) or otherwise (1).       The return value indicates success (0) or otherwise (1).
446    */    */
447      ESCRIPT_DLL_API
448    int    int
449    extractData(std::ifstream& archiveFile,    extractData(std::ifstream& archiveFile,
450                const DataArrayView::ValueType::size_type noValues);                const DataArrayView::ValueType::size_type noValues);
451    
452      /**
453         \brief
454         Computes a symmetric matrix (A + AT) / 2
455    
456         \param ev - Output - symmetric matrix
457    
458      */
459      ESCRIPT_DLL_API
460      virtual void
461      symmetric(DataAbstract* ev);
462    
463      /**
464         \brief
465         Computes a nonsymmetric matrix (A - AT) / 2
466    
467         \param ev - Output - nonsymmetric matrix
468    
469      */
470      ESCRIPT_DLL_API
471      virtual void
472      nonsymmetric(DataAbstract* ev);
473    
474      /**
475         \brief
476         Computes the trace of a matrix
477    
478         \param ev - Output - the trace of a matrix
479    
480      */
481      ESCRIPT_DLL_API
482      virtual void
483      trace(DataAbstract* ev, int axis_offset);
484    
485      /**
486         \brief
487         swaps components axis0 and axis1
488    
489         \param ev - Output - swapped components
490    
491      */
492      ESCRIPT_DLL_API
493      virtual void
494      swapaxes(DataAbstract* ev, int axis0, int axis1);
495    
496      /**
497         \brief
498         Transpose each data point of this Data object around the given axis.
499    
500         \param ev - Output - the transpose of a matrix
501    
502      */
503      ESCRIPT_DLL_API
504      virtual void
505      transpose(DataAbstract* ev, int axis_offset);
506    
507      /**
508         \brief
509         solves the eigenvalue problem this*V=ev*V for the eigenvalues ev
510    
511         \param ev - Output - eigenvalues in increasing order at each data point
512    
513      */
514      ESCRIPT_DLL_API
515      virtual void
516      eigenvalues(DataAbstract* ev);
517    
518      /**
519         \brief
520         solves the eigenvalue problem this*V=ev*V for the eigenvalues ev and eigenvectors V
521    
522         \param ev - Output - eigenvalues in increasing order at each data point
523         \param V - Output - corresponding eigenvectors. They are normalized such that their length is one
524                             and the first nonzero component is positive.
525         \param tol - Input - eigenvalue with relative distance tol are treated as equal.
526    
527      */
528    
529      ESCRIPT_DLL_API
530      virtual void
531      eigenvalues_and_eigenvectors(DataAbstract* ev,DataAbstract* V,const double tol=1.e-13);
532    
533    
534   protected:   protected:
535    
536   private:   private:

Legend:
Removed from v.513  
changed lines
  Added in v.804

  ViewVC Help
Powered by ViewVC 1.1.26