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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 615 - (hide annotations)
Wed Mar 22 02:12:00 2006 UTC (13 years, 7 months ago) by elspeth
File MIME type: text/plain
File size: 3403 byte(s)
More copyright information.

1 jgs 82 /*
2 elspeth 615 ************************************************************
3     * Copyright 2006 by ACcESS MNRF *
4     * *
5     * http://www.access.edu.au *
6     * Primary Business: Queensland, Australia *
7     * Licensed under the Open Software License version 3.0 *
8     * http://www.opensource.org/licenses/osl-3.0.php *
9     * *
10     ************************************************************
11 jgs 82 */
12 jgs 108
13 jgs 82 #if !defined escript_DataArray_20040421_H
14     #define escript_DataArray_20040421_H
15    
16     #include "DataArrayView.h"
17    
18     #include <boost/python/object.hpp>
19 jgs 474 #include <boost/python/numeric.hpp>
20 jgs 478 #include <boost/scoped_ptr.hpp>
21 jgs 82
22     namespace escript {
23    
24     /**
25     \brief
26 jgs 108 DataArray contains a DataArrayView plus the vector of data values
27     associated with the View.
28 jgs 82
29     Description:
30 jgs 108 DataArray implements the management of the underlying data values contained in
31     an escript Data object. It consists of a vector (m_data) which holds all the individual
32     data values, plus a DataArrayView (m_dataView) which defines the shape of the data
33     points contained in the Data object.
34 jgs 82
35     */
36    
37     class DataArray {
38    
39     public:
40 jgs 108
41 jgs 82 /**
42     \brief
43     Default constructor for DataArray.
44    
45     Description:
46 jgs 108 Default constructor for DataArray.
47     Creates a data vector containing a single value, plus a DataArrayView
48     which presents this data value as a scalar Data object.
49 jgs 82 */
50     DataArray(double value=0.0);
51    
52 jgs 108 /**
53 jgs 82 \brief
54     Constructor for DataArray.
55    
56     Description:
57 jgs 108 Constructor for DataArray of given shape.
58     Assigns each element of the shape the given value.
59 jgs 82 */
60     DataArray(const DataArrayView::ShapeType& shape,
61     double value=0.0);
62    
63     /**
64     \brief
65     Copy constructor for DataArray.
66    
67     Description:
68 jgs 108 Copy constructor for DataArray.
69     Takes a DataArray and performs a deep copy.
70 jgs 82 */
71     DataArray(const DataArray& value);
72    
73     /**
74     \brief
75     Constructor for DataArray.
76    
77     Description:
78     Constructor for DataArray.
79 jgs 108 Takes a DataArrayView and performs a deep copy.
80 jgs 82 */
81     DataArray(const DataArrayView& value);
82    
83     /**
84     \brief
85     Constructor for DataArray.
86    
87     Description:
88     Constructor for DataArray.
89     Takes a boost::python::object.
90    
91     Throws:
92 jgs 108 A DataException if a DataArray cannot be created from the python object.
93 jgs 82 */
94     DataArray(const boost::python::object& value);
95    
96     /**
97     \brief
98     Constructor for DataArray.
99    
100     Description:
101     Constructor for DataArray.
102     Takes a boost::python::numeric::array.
103     */
104     DataArray(const boost::python::numeric::array& value);
105    
106     /**
107     \brief
108 jgs 108 Return a reference to the DataArrayView.
109 jgs 82 */
110     const DataArrayView&
111     getView() const;
112    
113     DataArrayView&
114     getView();
115    
116     /**
117     \brief
118 jgs 108 Return a reference to the the data vector.
119 jgs 82 */
120     const DataArrayView::ValueType&
121     getData() const;
122    
123     DataArrayView::ValueType&
124     getData();
125    
126     protected:
127    
128     private:
129    
130     /**
131     \brief
132 jgs 108 Performs initialisation common to DataArray.
133 jgs 82 */
134     void
135     initialise(const boost::python::numeric::array& value);
136    
137     //
138 jgs 108 // data vector
139 jgs 82 DataArrayView::ValueType m_data;
140    
141     //
142 jgs 108 // pointer to view of the data vector
143     // this is a DataArrayView
144 jgs 82 boost::scoped_ptr<DataArrayView> m_dataView;
145    
146     };
147    
148     } // end of namespace
149     #endif

Properties

Name Value
svn:eol-style native
svn:keywords Author Date Id Revision

  ViewVC Help
Powered by ViewVC 1.1.26