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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 121 - (show annotations)
Fri May 6 04:26:16 2005 UTC (14 years, 5 months ago) by jgs
Original Path: trunk/esys2/escript/src/Data/DataArray.h
File MIME type: text/plain
File size: 3689 byte(s)
Merge of development branch back to main trunk on 2005-05-06

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/scoped_ptr.hpp>
21 #include <boost/python/object.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 DataArray(double value=0.0);
52
53 /**
54 \brief
55 Constructor for DataArray.
56
57 Description:
58 Constructor for DataArray of given shape.
59 Assigns each element of the shape the given value.
60 */
61 DataArray(const DataArrayView::ShapeType& shape,
62 double value=0.0);
63
64 /**
65 \brief
66 Copy constructor for DataArray.
67
68 Description:
69 Copy constructor for DataArray.
70 Takes a DataArray and performs a deep copy.
71 */
72 DataArray(const DataArray& value);
73
74 /**
75 \brief
76 Constructor for DataArray.
77
78 Description:
79 Constructor for DataArray.
80 Takes a DataArrayView and performs a deep copy.
81 */
82 DataArray(const DataArrayView& value);
83
84 /**
85 \brief
86 Constructor for DataArray.
87
88 Description:
89 Constructor for DataArray.
90 Takes a boost::python::object.
91
92 Throws:
93 A DataException if a DataArray cannot be created from the python object.
94 */
95 DataArray(const boost::python::object& value);
96
97 /**
98 \brief
99 Constructor for DataArray.
100
101 Description:
102 Constructor for DataArray.
103 Takes a boost::python::numeric::array.
104 */
105 DataArray(const boost::python::numeric::array& value);
106
107 /**
108 \brief
109 Return a reference to the DataArrayView.
110 */
111 const DataArrayView&
112 getView() const;
113
114 DataArrayView&
115 getView();
116
117 /**
118 \brief
119 Return a reference to the the data vector.
120 */
121 const DataArrayView::ValueType&
122 getData() const;
123
124 DataArrayView::ValueType&
125 getData();
126
127 protected:
128
129 private:
130
131 /**
132 \brief
133 Performs initialisation common to DataArray.
134 */
135 void
136 initialise(const boost::python::numeric::array& value);
137
138 //
139 // data vector
140 DataArrayView::ValueType m_data;
141
142 //
143 // pointer to view of the data vector
144 // this is a DataArrayView
145 boost::scoped_ptr<DataArrayView> m_dataView;
146
147 };
148
149 } // end of namespace
150 #endif

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26