/[escript]/trunk/esys2/escript/src/Data/DataExpanded.h
ViewVC logotype

Annotation of /trunk/esys2/escript/src/Data/DataExpanded.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 82 - (hide annotations)
Tue Oct 26 06:53:54 2004 UTC (15 years ago) by jgs
File MIME type: text/plain
File size: 5582 byte(s)
Initial revision

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    
15     #if !defined escript_DataExpanded_20040323_H
16     #define escript_DataExpanded_20040323_H
17    
18     #include "DataAbstract.h"
19     #include "DataBlocks2D.h"
20     #include "DataArrayView.h"
21    
22     #include <boost/scoped_ptr.hpp>
23     #include <boost/python/numeric.hpp>
24    
25     namespace escript {
26    
27     class DataConstant;
28     class DataTagged;
29    
30     /**
31     \brief
32     Give a short description of what DataExpanded does.
33    
34     Description:
35     Give a detailed description of DataExpanded
36    
37     Template Parameters:
38     For templates describe any conditions that the parameters used in the
39     template must satisfy
40     */
41    
42     class DataExpanded : public DataAbstract{
43    
44     public:
45    
46     /**
47     \brief
48     Copy constructor for DataExpanded. Performs a deep copy.
49     */
50     DataExpanded(const DataExpanded& other);
51    
52     /**
53     \brief
54     Construct a DataExpanded from a DataConstant
55     */
56     DataExpanded(const DataConstant& other);
57    
58     /**
59     \brief
60     Construct a DataExpanded from a DataTagged
61     */
62     DataExpanded(const DataTagged& other);
63    
64     /**
65     \brief
66     Constructor for DataExpanded
67    
68     Description:
69     Constructor for DataExpanded
70     \param value - Input - Data value for a single point.
71     \param what - Input - A description of what this data represents.
72     */
73     DataExpanded(const boost::python::numeric::array& value, const FunctionSpace& what);
74    
75     /**
76     \brief
77     Alternative constructor for DataExpanded
78    
79     Description:
80     Alternative Constructor for DataExpanded
81     \param value - Input - Data value for a single point.
82     \param what - Input - A description of what this data represents.
83    
84     */
85     DataExpanded(const DataArrayView& value, const FunctionSpace& what);
86    
87     /**
88     \brief
89     Alternative constructor for DataExpanded that copies a slice from
90     another DataExpanded.
91    
92     \param other - Input - DataExpanded object to slice from
93     \param region - Input - region to copy
94     */
95     DataExpanded(const DataExpanded& other, const DataArrayView::RegionType& region);
96    
97     /**
98     \brief
99     Destructor
100     */
101     virtual ~DataExpanded();
102    
103     /**
104     \brief
105     Return a textual representation of the data
106     */
107     virtual std::string toString() const;
108    
109     /**
110     \brief
111     Reshape the data point if the data point is currently rank 0.
112     The original data point value is used for all values of the new
113     data point.
114     */
115     void reshapeDataPoint(const DataArrayView::ShapeType& shape);
116    
117     /**
118     \brief
119     Return the offset for the given sample. This is somewhat artificial notion
120     but returns the offset in bytes for the given point into the container
121     holding the point data.
122     \param sampleNo - Input - number of samples.
123     \param dataPointNo - Input - Input.
124     */
125     virtual DataArrayView::ValueType::size_type getPointOffset(int sampleNo, int dataPointNo) const;
126    
127     /**
128     \brief
129     Return a view into the data for the data point specified.
130     NOTE: Construction of the DataArrayView is a relatively expensive
131     operation
132     \param sampleNo - Input
133     \param dataPointNo - Input
134     \return DataArrayView of the data point.
135     */
136     DataArrayView getDataPoint(int sampleNo, int dataPointNo);
137    
138     /**
139     \brief
140     Return the number of doubles stored for the Data
141     */
142     virtual ValueType::size_type getLength() const;
143    
144     /**
145     \brief
146     Factory method that returns a newly created DataExpanded.
147     The caller is reponsible for managing the object created.
148     \param region - Input - Region to copy.
149     */
150     virtual DataAbstract* getSlice(const DataArrayView::RegionType& region) const;
151    
152     /**
153     \brief
154     Copy the specified region from the given value.
155     \param value - Input - Data to copy from
156     \param region - Input - Region to copy.
157     */
158     virtual void setSlice(const DataAbstract* value, const DataArrayView::RegionType& region);
159    
160     protected:
161    
162     private:
163    
164     /**
165     \brief
166     Common initialisation called from constructors
167    
168     Description:
169     Common initialisation called from constructors
170     \param shape - Input - The shape of the point data.
171     \param noSamples - Input - number of samples.
172     \param noDataPointsPerSample - Input -
173     */
174     void initialise(const DataArrayView::ShapeType& shape, int noSamples, int noDataPointsPerSample);
175    
176     /**
177     \brief
178     Copy the given data point to all data points.
179    
180     Description:
181     Copy the given data point to all data points.
182     \param value Input - Value for a single data point
183     */
184     void copy(const DataArrayView& value);
185     void copy(const boost::python::numeric::array& value);
186    
187     //
188     // The main data storage, a 2D array of data blocks
189     DataBlocks2D m_data;
190    
191     };
192    
193     } // end of namespace
194     #endif
195    
196    
197    
198    

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26