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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 155 - (hide annotations)
Wed Nov 9 02:02:19 2005 UTC (13 years, 11 months ago) by jgs
Original Path: trunk/escript/src/Data/DataArray.h
File MIME type: text/plain
File size: 3689 byte(s)
move all directories from trunk/esys2 into trunk and remove esys2

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