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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 478 - (show annotations)
Tue Jan 31 02:21:49 2006 UTC (13 years, 10 months ago) by jgs
File MIME type: text/plain
File size: 3725 byte(s)
rationalise #includes

1 /*
2 ******************************************************************************
3 * *
4 * COPYRIGHT ACcESS 2004 - All Rights Reserved *
5 * *
6 * This software is the property of ACcESS. No part of this code *
7 * may be copied in any form or by any means without the expressed written *
8 * consent of ACcESS. Copying, use or modification of this software *
9 * by any unauthorised person is illegal unless that person has a software *
10 * license agreement with ACcESS. *
11 * *
12 ******************************************************************************
13 */
14
15 #if !defined escript_DataArray_20040421_H
16 #define escript_DataArray_20040421_H
17
18 #include "DataArrayView.h"
19
20 #include <boost/python/object.hpp>
21 #include <boost/python/numeric.hpp>
22 #include <boost/scoped_ptr.hpp>
23
24 namespace escript {
25
26 /**
27 \brief
28 DataArray contains a DataArrayView plus the vector of data values
29 associated with the View.
30
31 Description:
32 DataArray implements the management of the underlying data values contained in
33 an escript Data object. It consists of a vector (m_data) which holds all the individual
34 data values, plus a DataArrayView (m_dataView) which defines the shape of the data
35 points contained in the Data object.
36
37 */
38
39 class DataArray {
40
41 public:
42
43 /**
44 \brief
45 Default constructor for DataArray.
46
47 Description:
48 Default constructor for DataArray.
49 Creates a data vector containing a single value, plus a DataArrayView
50 which presents this data value as a scalar Data object.
51 */
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 DataArray(const DataArrayView::ShapeType& shape,
63 double value=0.0);
64
65 /**
66 \brief
67 Copy constructor for DataArray.
68
69 Description:
70 Copy constructor for DataArray.
71 Takes a DataArray and performs a deep copy.
72 */
73 DataArray(const DataArray& value);
74
75 /**
76 \brief
77 Constructor for DataArray.
78
79 Description:
80 Constructor for DataArray.
81 Takes a DataArrayView and performs a deep copy.
82 */
83 DataArray(const DataArrayView& value);
84
85 /**
86 \brief
87 Constructor for DataArray.
88
89 Description:
90 Constructor for DataArray.
91 Takes a boost::python::object.
92
93 Throws:
94 A DataException if a DataArray cannot be created from the python object.
95 */
96 DataArray(const boost::python::object& value);
97
98 /**
99 \brief
100 Constructor for DataArray.
101
102 Description:
103 Constructor for DataArray.
104 Takes a boost::python::numeric::array.
105 */
106 DataArray(const boost::python::numeric::array& value);
107
108 /**
109 \brief
110 Return a reference to the DataArrayView.
111 */
112 const DataArrayView&
113 getView() const;
114
115 DataArrayView&
116 getView();
117
118 /**
119 \brief
120 Return a reference to the the data vector.
121 */
122 const DataArrayView::ValueType&
123 getData() const;
124
125 DataArrayView::ValueType&
126 getData();
127
128 protected:
129
130 private:
131
132 /**
133 \brief
134 Performs initialisation common to DataArray.
135 */
136 void
137 initialise(const boost::python::numeric::array& value);
138
139 //
140 // data vector
141 DataArrayView::ValueType m_data;
142
143 //
144 // pointer to view of the data vector
145 // this is a DataArrayView
146 boost::scoped_ptr<DataArrayView> m_dataView;
147
148 };
149
150 } // end of namespace
151 #endif

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26