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

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

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

revision 82 by jgs, Tue Oct 26 06:53:54 2004 UTC revision 108 by jgs, Thu Jan 27 06:21:59 2005 UTC
# Line 11  Line 11 
11   *                                                                            *   *                                                                            *
12   ******************************************************************************   ******************************************************************************
13  */  */
14                                                                              
15  #if !defined escript_DataArray_20040421_H  #if !defined escript_DataArray_20040421_H
16  #define escript_DataArray_20040421_H  #define escript_DataArray_20040421_H
17    
# Line 24  namespace escript { Line 24  namespace escript {
24    
25  /**  /**
26     \brief     \brief
27     DataArray contains a DataArrayView plus the Vector data associated with the view.     DataArray contains a DataArrayView plus the vector of data values
28       associated with the View.
29    
30     Description:     Description:
31       DataArray implements the management of the underlying data values contained in
32       an escript Data object. It consists of a vector (m_data) which holds all the individual
33       data values, plus a DataArrayView (m_dataView) which defines the shape of the data
34       points contained in the Data object.
35    
36  */  */
37    
38  class DataArray {  class DataArray {
39    
40   public:   public:
41    
42    /**    /**
43       \brief       \brief
44       Default constructor for DataArray.       Default constructor for DataArray.
45    
46       Description:       Description:
47       Default constructor for DataArray. Creates a scalar.       Default constructor for DataArray.
48         Creates a data vector containing a single value, plus a DataArrayView
49         which presents this data value as a scalar Data object.
50    */    */
51    DataArray(double value=0.0);    DataArray(double value=0.0);
52    
53   /**    /**
54       \brief       \brief
55       Constructor for DataArray.       Constructor for DataArray.
56    
57       Description:       Description:
58       Constructor for DataArray of shape "shape".       Constructor for DataArray of given shape.
59       Assigns each element the given value.       Assigns each element of the shape the given value.
60    */    */
61    DataArray(const DataArrayView::ShapeType& shape,    DataArray(const DataArrayView::ShapeType& shape,
62              double value=0.0);              double value=0.0);
# Line 58  class DataArray { Line 66  class DataArray {
66       Copy constructor for DataArray.       Copy constructor for DataArray.
67            
68       Description:       Description:
69       Copy constructor for DataArray. Takes a DataArray.       Copy constructor for DataArray.
70         Takes a DataArray and performs a deep copy.
71    */    */
72    DataArray(const DataArray& value);    DataArray(const DataArray& value);
73    
# Line 68  class DataArray { Line 77  class DataArray {
77            
78       Description:       Description:
79       Constructor for DataArray.       Constructor for DataArray.
80       Takes a DataArrayView.       Takes a DataArrayView and performs a deep copy.
81    */    */
82    DataArray(const DataArrayView& value);    DataArray(const DataArrayView& value);
83    
# Line 81  class DataArray { Line 90  class DataArray {
90       Takes a boost::python::object.       Takes a boost::python::object.
91    
92       Throws:       Throws:
93       A DataException if a DataArray cannot be created from the python object       A DataException if a DataArray cannot be created from the python object.
94    */    */
95    DataArray(const boost::python::object& value);    DataArray(const boost::python::object& value);
96    
# Line 97  class DataArray { Line 106  class DataArray {
106    
107    /**    /**
108       \brief       \brief
109       Return the DataArrayView of the data.       Return a reference to the DataArrayView.
110    */    */
111    const DataArrayView&    const DataArrayView&
112    getView() const;    getView() const;
113    
   /**  
      \brief  
      Return the DataArrayView of the data.  
      Non-const version.  
   */  
114    DataArrayView&    DataArrayView&
115    getView();    getView();
116    
117    /**    /**
118       \brief       \brief
119       Return the data.       Return a reference to the the data vector.
120    */    */
121    const DataArrayView::ValueType&    const DataArrayView::ValueType&
122    getData() const;    getData() const;
123    
   /**  
      \brief  
      Return the data, non-const version.  
   */  
124    DataArrayView::ValueType&    DataArrayView::ValueType&
125    getData();    getData();
126    
# Line 130  class DataArray { Line 130  class DataArray {
130    
131    /**    /**
132       \brief       \brief
133       Performs initialisation common of DataArray.       Performs initialisation common to DataArray.
134    */    */
135    void    void
136    initialise(const boost::python::numeric::array& value);    initialise(const boost::python::numeric::array& value);
137    
138    //    //
139    // data    // data vector
140      // this is a simple STL vector of floats
141    DataArrayView::ValueType m_data;    DataArrayView::ValueType m_data;
142    
143    //    //
144    // view of the data    // pointer to view of the data vector
145      // this is a DataArrayView
146    boost::scoped_ptr<DataArrayView> m_dataView;    boost::scoped_ptr<DataArrayView> m_dataView;
147    
148  };  };

Legend:
Removed from v.82  
changed lines
  Added in v.108

  ViewVC Help
Powered by ViewVC 1.1.26