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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 757 - (show annotations)
Mon Jun 26 13:12:56 2006 UTC (13 years, 4 months ago) by woo409
File MIME type: text/plain
File size: 3607 byte(s)
+ Merge of intelc_win32 branch (revision 741:755) with trunk. Tested on iVEC altix (run_tests and py_tests all pass)

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 #include "system_dep.h"
16
17 #include "DataArrayView.h"
18
19 #include <boost/python/object.hpp>
20 #include <boost/python/numeric.hpp>
21 #include <boost/scoped_ptr.hpp>
22
23 namespace escript {
24
25 /**
26 \brief
27 DataArray contains a DataArrayView plus the vector of data values
28 associated with the View.
29
30 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 {
39
40 public:
41
42 /**
43 \brief
44 Default constructor for DataArray.
45
46 Description:
47 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 ESCRIPT_DLL_API
52 DataArray(double value=0.0);
53
54 /**
55 \brief
56 Constructor for DataArray.
57
58 Description:
59 Constructor for DataArray of given shape.
60 Assigns each element of the shape the given value.
61 */
62 ESCRIPT_DLL_API
63 DataArray(const DataArrayView::ShapeType& shape,
64 double value=0.0);
65
66 /**
67 \brief
68 Copy constructor for DataArray.
69
70 Description:
71 Copy constructor for DataArray.
72 Takes a DataArray and performs a deep copy.
73 */
74 ESCRIPT_DLL_API
75 DataArray(const DataArray& value);
76
77 /**
78 \brief
79 Constructor for DataArray.
80
81 Description:
82 Constructor for DataArray.
83 Takes a DataArrayView and performs a deep copy.
84 */
85 ESCRIPT_DLL_API
86 DataArray(const DataArrayView& value);
87
88 /**
89 \brief
90 Constructor for DataArray.
91
92 Description:
93 Constructor for DataArray.
94 Takes a boost::python::object.
95
96 Throws:
97 A DataException if a DataArray cannot be created from the python object.
98 */
99 ESCRIPT_DLL_API
100 DataArray(const boost::python::object& value);
101
102 /**
103 \brief
104 Constructor for DataArray.
105
106 Description:
107 Constructor for DataArray.
108 Takes a boost::python::numeric::array.
109 */
110 ESCRIPT_DLL_API
111 DataArray(const boost::python::numeric::array& value);
112
113 /**
114 \brief
115 Return a reference to the DataArrayView.
116 */
117 ESCRIPT_DLL_API
118 const DataArrayView&
119 getView() const;
120
121 ESCRIPT_DLL_API
122 DataArrayView&
123 getView();
124
125 /**
126 \brief
127 Return a reference to the the data vector.
128 */
129 ESCRIPT_DLL_API
130 const DataArrayView::ValueType&
131 getData() const;
132
133 ESCRIPT_DLL_API
134 DataArrayView::ValueType&
135 getData();
136
137 protected:
138
139 private:
140
141 /**
142 \brief
143 Performs initialisation common to DataArray.
144 */
145 void
146 initialise(const boost::python::numeric::array& value);
147
148 //
149 // data vector
150 DataArrayView::ValueType m_data;
151
152 //
153 // pointer to view of the data vector
154 // this is a DataArrayView
155 boost::scoped_ptr<DataArrayView> m_dataView;
156
157 };
158
159 } // end of namespace
160 #endif

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26