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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 615 - (show 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 /*
2 ************************************************************
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 */
12
13 #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 #include <boost/python/numeric.hpp>
20 #include <boost/scoped_ptr.hpp>
21
22 namespace escript {
23
24 /**
25 \brief
26 DataArray contains a DataArrayView plus the vector of data values
27 associated with the View.
28
29 Description:
30 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
35 */
36
37 class DataArray {
38
39 public:
40
41 /**
42 \brief
43 Default constructor for DataArray.
44
45 Description:
46 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 */
50 DataArray(double value=0.0);
51
52 /**
53 \brief
54 Constructor for DataArray.
55
56 Description:
57 Constructor for DataArray of given shape.
58 Assigns each element of the shape the given value.
59 */
60 DataArray(const DataArrayView::ShapeType& shape,
61 double value=0.0);
62
63 /**
64 \brief
65 Copy constructor for DataArray.
66
67 Description:
68 Copy constructor for DataArray.
69 Takes a DataArray and performs a deep copy.
70 */
71 DataArray(const DataArray& value);
72
73 /**
74 \brief
75 Constructor for DataArray.
76
77 Description:
78 Constructor for DataArray.
79 Takes a DataArrayView and performs a deep copy.
80 */
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 A DataException if a DataArray cannot be created from the python object.
93 */
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 Return a reference to the DataArrayView.
109 */
110 const DataArrayView&
111 getView() const;
112
113 DataArrayView&
114 getView();
115
116 /**
117 \brief
118 Return a reference to the the data vector.
119 */
120 const DataArrayView::ValueType&
121 getData() const;
122
123 DataArrayView::ValueType&
124 getData();
125
126 protected:
127
128 private:
129
130 /**
131 \brief
132 Performs initialisation common to DataArray.
133 */
134 void
135 initialise(const boost::python::numeric::array& value);
136
137 //
138 // data vector
139 DataArrayView::ValueType m_data;
140
141 //
142 // pointer to view of the data vector
143 // this is a DataArrayView
144 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