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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1312 - (show annotations)
Mon Sep 24 06:18:44 2007 UTC (11 years, 11 months ago) by ksteube
File MIME type: text/plain
File size: 3481 byte(s)
The MPI branch is hereby closed. All future work should be in trunk.

Previously in revision 1295 I merged the latest changes to trunk into trunk-mpi-branch.
In this revision I copied all files from trunk-mpi-branch over the corresponding
trunk files. I did not use 'svn merge', it was a copy.

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

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26