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

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

Parent Directory Parent Directory | Revision Log Revision Log


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

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