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

Diff of /trunk/escript/src/DataEmpty.h

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

trunk/esys2/escript/src/Data/DataEmpty.h revision 100 by jgs, Wed Dec 15 03:48:48 2004 UTC trunk/escript/src/DataEmpty.h revision 854 by gross, Thu Sep 21 05:29:42 2006 UTC
# Line 1  Line 1 
1    //$Id$
2  /*  /*
3   ******************************************************************************   ************************************************************
4   *                                                                            *   *          Copyright 2006 by ACcESS MNRF                   *
5   *       COPYRIGHT  ACcESS 2004 -  All Rights Reserved                        *   *                                                          *
6   *                                                                            *   *              http://www.access.edu.au                    *
7   * This software is the property of ACcESS. No part of this code              *   *       Primary Business: Queensland, Australia            *
8   * may be copied in any form or by any means without the expressed written    *   *  Licensed under the Open Software License version 3.0    *
9   * consent of ACcESS.  Copying, use or modification of this software          *   *     http://www.opensource.org/licenses/osl-3.0.php       *
10   * by any unauthorised person is illegal unless that person has a software    *   *                                                          *
11   * license agreement with ACcESS.                                             *   ************************************************************
  *                                                                            *  
  ******************************************************************************  
12  */  */
13                                                                              
14  #if !defined  escript_DataEmpty_20040726_H  #if !defined escript_DataEmpty_20040726_H
15  #define escript_DataEmpty_20040726_H  #define escript_DataEmpty_20040726_H
16    #include "system_dep.h"
17    
18  #include "DataAbstract.h"  #include "DataAbstract.h"
19    
# Line 21  namespace escript { Line 21  namespace escript {
21    
22  /**  /**
23     \brief     \brief
24     Impliments the DataAbstract interface for an empty or null Data.     Implements the DataAbstract interface for an empty Data object.
25    
26     Description:     Description:
27     Impliments the DataAbstract interface for an empty or null Data.     Implements the DataAbstract interface for an empty Data object.
28  */  */
29  class DataEmpty:public DataAbstract {  
30    class DataEmpty : public DataAbstract {
31    
32   public:   public:
33    
34    /**    /**
35       \brief       \brief
36       Default constructor for DataEmpty       Default constructor for DataEmpty.
37    
38       Description:       Description:
39       Default constructor for DataEmpty       Default constructor for DataEmpty.
40    
41    */    */
42      ESCRIPT_DLL_API
43    DataEmpty();    DataEmpty();
44    
45    /**    /**
46       \brief       \brief
47       Destructor       Destructor for DataEmpty.
48    */    */
49    virtual ~DataEmpty();    ESCRIPT_DLL_API
50      virtual
51      ~DataEmpty();
52    
53    /**    /**
54       \brief       \brief
55       Return a textual representation of the data       Return a textual representation of the Data object.
56    */    */
57    virtual std::string toString() const;    ESCRIPT_DLL_API
58      virtual
59      std::string
60      toString() const;
61    
62    /**    /**
63       \brief       \brief
64       Return the offset for the given sample. This is somewhat artificial notion       Return the offset for the given sample.
65       but returns the offset in bytes for the given point into the container       NB: This will throw an exception as obviously an empty Data object contains no
66       holding the point data.       samples. An implementation is required by parent DataAbstract class.
67       \param sampleNo - Input, number of samples.       \param sampleNo - Input - Sample number.
68       \param dataPointNo - Input.       \param dataPointNo - Input - data-point number.
69     */     */
70    virtual DataArrayView::ValueType::size_type getPointOffset(int sampleNo,int dataPointNo) const;    ESCRIPT_DLL_API
71      virtual
72      DataArrayView::ValueType::size_type
73      getPointOffset(int sampleNo,
74                     int dataPointNo) const;
75    
76    /**    /**
77       \brief       \brief
78       Return a view into the data for the data point specified.       Return a view into the data for the data point specified.
79       NOTE: Construction of the DataArrayView is a relatively expensive       NB: This will throw an exception as obviously an empty Data object contains no
80       operation       data points. An implementation is required by parent DataAbstract class.
81       \param samplesNo - Input       \param sampleNo - Input - Sample number.
82       \param dataPointNo - Input       \param dataPointNo - Input - data-point number.
83    */    */
84    virtual DataArrayView getDataPoint(int samplesNo, int dataPointNo);    ESCRIPT_DLL_API
85   /**    virtual
86       \brief    DataArrayView
87       Return the sample data for the given tag key. If the data isn't tagged    getDataPoint(int sampleNo,
88       an exception will be thrown.                 int dataPointNo);
89    */  
   virtual double* getSampleDataByTag(int tag);  
90    /**    /**
91       \brief       \brief
92       Throw a standard exception. This function is called if an attempt       Return the number of doubles stored for the Data object.
93       is made to use functions of DataEmpty that are not allowed.       As this is an empty Data object, this method will always return 0.
94    */    */
95    void throwStandardException(const std::string& functionName) const;    ESCRIPT_DLL_API
96      virtual
97      ValueType::size_type
98      getLength() const;
99    
100    /**    /**
101       \brief       \brief
102       Return the number of doubles stored for the Data       Factory method that returns a newly created DataEmpty sliced from the
103         current Data object according to the specified region.
104         NB: This will throw an exception as obviously an empty Data object contains no
105         data to slice from. An implementation is required by parent DataAbstract class.
106    */    */
107    virtual ValueType::size_type getLength() const;    ESCRIPT_DLL_API
108      virtual
109      DataAbstract*
110      getSlice(const DataArrayView::RegionType& region) const;
111    
112    /**    /**
113       \brief       \brief
114       Factory method that returns a newly created DataEmpty.       Set the current Data object according to the specified slice from the
115       The caller is reponsible for managing the object created.       given input value.
116    */       NB: This will throw an exception as obviously an empty Data object contains no
117    virtual DataAbstract* getSlice(const DataArrayView::RegionType& region) const;  /**       data to slice to. An implementation is required by parent DataAbstract class.
      \brief  
      Copy the specified region from the given value.  
118       \param value Input - Data to copy from       \param value Input - Data to copy from
119       \param region Input - Region to copy.       \param region Input - Region to copy.
120    */    */
121    virtual void setSlice(const DataAbstract* value, const DataArrayView::RegionType& region);    ESCRIPT_DLL_API
122      virtual
123      void
124      setSlice(const DataAbstract* value,
125               const DataArrayView::RegionType& region);
126    
127     protected:
128    
129     private:
130    
131    /**    /**
132       \brief       \brief
133       Reshape the data point if the data point is currently rank 0.       Throw a standard exception. This function is called if an attempt
134       The original data point value is used for all values of the new       is made to use functions of DataEmpty that are not valid.
      data point.  
135    */    */
136    virtual void reshapeDataPoint(const DataArrayView::ShapeType& shape);    void
137   protected:    throwStandardException(const std::string& functionName) const;
138    
  private:  
139  };  };
140    
141  } // end of namespace  } // end of namespace
142    
143  #endif  #endif

Legend:
Removed from v.100  
changed lines
  Added in v.854

  ViewVC Help
Powered by ViewVC 1.1.26