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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 474 - (hide annotations)
Mon Jan 30 04:23:44 2006 UTC (13 years, 8 months ago) by jgs
File MIME type: text/plain
File size: 3761 byte(s)
restructure escript source tree
move src/Data/* -> src
remove inc
modify #includes and cpppath settings accordingly

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 jgs 474 #include <boost/python/numeric.hpp>
23     #include <boost/python/extract.hpp>
24 jgs 82
25     namespace escript {
26    
27     /**
28     \brief
29 jgs 108 DataArray contains a DataArrayView plus the vector of data values
30     associated with the View.
31 jgs 82
32     Description:
33 jgs 108 DataArray implements the management of the underlying data values contained in
34     an escript Data object. It consists of a vector (m_data) which holds all the individual
35     data values, plus a DataArrayView (m_dataView) which defines the shape of the data
36     points contained in the Data object.
37 jgs 82
38     */
39    
40     class DataArray {
41    
42     public:
43 jgs 108
44 jgs 82 /**
45     \brief
46     Default constructor for DataArray.
47    
48     Description:
49 jgs 108 Default constructor for DataArray.
50     Creates a data vector containing a single value, plus a DataArrayView
51     which presents this data value as a scalar Data object.
52 jgs 82 */
53     DataArray(double value=0.0);
54    
55 jgs 108 /**
56 jgs 82 \brief
57     Constructor for DataArray.
58    
59     Description:
60 jgs 108 Constructor for DataArray of given shape.
61     Assigns each element of the shape the given value.
62 jgs 82 */
63     DataArray(const DataArrayView::ShapeType& shape,
64     double value=0.0);
65    
66     /**
67     \brief
68     Copy constructor for DataArray.
69    
70     Description:
71 jgs 108 Copy constructor for DataArray.
72     Takes a DataArray and performs a deep copy.
73 jgs 82 */
74     DataArray(const DataArray& value);
75    
76     /**
77     \brief
78     Constructor for DataArray.
79    
80     Description:
81     Constructor for DataArray.
82 jgs 108 Takes a DataArrayView and performs a deep copy.
83 jgs 82 */
84     DataArray(const DataArrayView& value);
85    
86     /**
87     \brief
88     Constructor for DataArray.
89    
90     Description:
91     Constructor for DataArray.
92     Takes a boost::python::object.
93    
94     Throws:
95 jgs 108 A DataException if a DataArray cannot be created from the python object.
96 jgs 82 */
97     DataArray(const boost::python::object& value);
98    
99     /**
100     \brief
101     Constructor for DataArray.
102    
103     Description:
104     Constructor for DataArray.
105     Takes a boost::python::numeric::array.
106     */
107     DataArray(const boost::python::numeric::array& value);
108    
109     /**
110     \brief
111 jgs 108 Return a reference to the DataArrayView.
112 jgs 82 */
113     const DataArrayView&
114     getView() const;
115    
116     DataArrayView&
117     getView();
118    
119     /**
120     \brief
121 jgs 108 Return a reference to the the data vector.
122 jgs 82 */
123     const DataArrayView::ValueType&
124     getData() const;
125    
126     DataArrayView::ValueType&
127     getData();
128    
129     protected:
130    
131     private:
132    
133     /**
134     \brief
135 jgs 108 Performs initialisation common to DataArray.
136 jgs 82 */
137     void
138     initialise(const boost::python::numeric::array& value);
139    
140     //
141 jgs 108 // data vector
142 jgs 82 DataArrayView::ValueType m_data;
143    
144     //
145 jgs 108 // pointer to view of the data vector
146     // this is a DataArrayView
147 jgs 82 boost::scoped_ptr<DataArrayView> m_dataView;
148    
149     };
150    
151     } // end of namespace
152     #endif

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26