/[escript]/branches/trilinos_from_5897/escriptcore/src/DataConstant.h
ViewVC logotype

Diff of /branches/trilinos_from_5897/escriptcore/src/DataConstant.h

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

revision 99 by jgs, Tue Dec 14 05:39:33 2004 UTC revision 100 by jgs, Wed Dec 15 03:48:48 2004 UTC
# Line 1  Line 1 
 //$Id$  
1  /*  /*
2   ******************************************************************************   ******************************************************************************
3   *                                                                            *   *                                                                            *
# Line 13  Line 12 
12   ******************************************************************************   ******************************************************************************
13  */  */
14                                                                                                                                                        
15  #if !defined escript_DataConstant_20040323_H  #if !defined  escript_DataConstant_20040323_H
16  #define escript_DataConstant_20040323_H  #define escript_DataConstant_20040323_H
17    
18  #include "escript/Data/DataAbstract.h"  #include "escript/Data/DataAbstract.h"
# Line 23  Line 22 
22  #include <boost/python/numeric.hpp>  #include <boost/python/numeric.hpp>
23    
24  namespace escript {  namespace escript {
   
25  /**  /**
26     \brief     \brief
27     DataConstant stores a single data point which represents the entire     DataConstant stores single data point which represents the entire
28     function space.     function space.
29    
30     Description:     Description:
31     DataConstant stores a single data point which represents the entire     DataConstant stores single data point which represents the entire
32     function space.     function space.
33  */  */
34  class DataConstant : public DataAbstract  {  class DataConstant:public DataAbstract  {
35    
36   public:   public:
37    
38    /**    /**
39       \brief       \brief
40       Constructor for DataConstant objects.       Default constructor for DataConstant
41    
42       Description:       Description:
43       Constructor for DataConstant objects.       Default constructor for DataConstant
44    
45       \param value - Input - Data value for a single point.       \param value Input - Data value for a single point.
46       \param what - Input - A description of what this data object represents.       \param noSamples Input - number of samples.
47    */       \param noDataPointsPerSample Input - Input.
48    DataConstant(const boost::python::numeric::array& value,       \param what Input - A description of what this data represents.
                const FunctionSpace& what);  
49    
50      */
51      DataConstant(const boost::python::numeric::array& value, const FunctionSpace& what);
52    /**    /**
53       \brief       \brief
54       Copy constructor. Performs a deep copy.       Copy constructor. Performs a deep copy.
55    */    */
56    DataConstant(const DataConstant& other);    DataConstant(const DataConstant& other);
   
57    /**    /**
58       \brief       \brief
59       Alternative constructor for DataConstant objects.       Alternative constructor for DataConstant
60    
61       Description:       Description:
62       Alternative Constructor for DataConstant objects.       Alternative Constructor for DataConstant
63       \param value - Input - Data value for a single point.       \param value Input - Data value for a single point.
64       \param what - Input - A description of what this data object represents.       \param noSamples Input - number of samples.
65         \param noDataPointsPerSample Input - Input.
66         \param what Input - A description of what this data represents.
67    */    */
68    DataConstant(const DataArrayView& value,    DataConstant(const DataArrayView& value, const FunctionSpace& what);
                const FunctionSpace& what);  
   
69    /**    /**
70       \brief       \brief
71       Alternative constructor for DataConstant objects.       Alternative constructor for DataConstant
72    
73       Description:       Description:
74       Alternative Constructor for DataConstant objects.       Alternative Constructor for DataConstant
75       \param other - Input - Data object to copy from.       \param other Input - Other DataConstant
76       \param region - Input - region to copy.       \param region Input - region to copy
77    */    */
78    DataConstant(const DataConstant& other,    DataConstant(const DataConstant& other, const DataArrayView::RegionType& region);
                const DataArrayView::RegionType& region);  
   
79    /**    /**
80       \brief       \brief
81       Write the data as a string.       Write the data as a string.
82    */    */
83    std::string    std::string toString() const;
   toString() const;  
   
84    /**    /**
85       \brief       \brief
86       Return the offset for the given sample. This is a somewhat artificial notion       Return the offset for the given sample. This is somewhat artificial notion
87       but returns the offset in bytes for the given point into the container       but returns the offset in bytes for the given point into the container
88       holding the point data. Only really necessary to avoid many DataArrayView       holding the point data. Only really necessary to avoid many DataArrayView
89       objects.       objects.
90       \param sampleNo - Input - sample number.       \param sampleNo - Input, sample number.
91       \param dataPointNo - Input - data point number for the sample.       \param dataPointNo - Input, data point number for the sample.
92     */     */
93    virtual    virtual DataArrayView::ValueType::size_type getPointOffset(int sampleNo, int dataPointNo) const;
   DataArrayView::ValueType::size_type  
   getPointOffset(int sampleNo,  
                  int dataPointNo) const;  
   
94    /**    /**
95       \brief       \brief
96       Return a view into the data for the data point specified.       Return a view into the data for the data point specified.
97       \param sampleNo - Input - sample number.       NOTE: Construction of the DataArrayView is a relatively expensive
98       \param dataPointNo - Input - data point number for the sample.       operation
99         \param sampleNo Input
100         \param dataPointNo Input
101    */    */
102    virtual    virtual DataArrayView getDataPoint(int sampleNo, int dataPointNo);
   DataArrayView  
   getDataPoint(int sampleNo,  
                int dataPointNo);  
   
103    /**    /**
104       \brief       \brief
105       Return the number of doubles stored for the Data object.       Return the number of doubles stored for the Data
106    */    */
107    virtual    virtual ValueType::size_type getLength() const;
   ValueType::size_type  
   getLength() const;  
   
108    /**    /**
109       \brief       \brief
110       Factory method that returns a newly created DataConstant object       Factory method that returns a newly created DataConstant.
      sliced from the specified region of this object.  
111       The caller is reponsible for managing the object created.       The caller is reponsible for managing the object created.
      \param region - Input - region to slice from this object.  
112    */    */
113    virtual    virtual DataAbstract* getSlice(const DataArrayView::RegionType& region) const;  /**
   DataAbstract*  
   getSlice(const DataArrayView::RegionType& region) const;  
   
   /**  
114       \brief       \brief
115       Copy the specified region from the given value.       Copy the specified region from the given value.
116       \param value - Input - Data object to copy from.       \param value Input - Data to copy from
117       \param region - Input - Region to copy.       \param region Input - Region to copy.
118    */    */
119    virtual    virtual void setSlice(const DataAbstract* value, const DataArrayView::RegionType& region);
   void  
   setSlice(const DataAbstract* value,  
            const DataArrayView::RegionType& region);  
   
120    /**    /**
121       \brief       \brief
122       Reshape the data point if the data point is currently rank 0.       Reshape the data point if the data point is currently rank 0.
123       The original data point value is used for all values of the new       The original data point value is used for all values of the new
124       data point.       data point.
125    */    */
126    void    void reshapeDataPoint(const DataArrayView::ShapeType& shape);
   reshapeDataPoint(const DataArrayView::ShapeType& shape);  
   
127   protected:   protected:
128    
129   private:   private:
130    //    //
131    // the actual data    // data
132    DataArrayView::ValueType m_data;    DataArrayView::ValueType m_data;
   
133  };  };
134    
135  } // end of namespace  } // end of namespace
136  #endif  #endif
137    

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

  ViewVC Help
Powered by ViewVC 1.1.26