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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 757 - (hide annotations)
Mon Jun 26 13:12:56 2006 UTC (13 years, 1 month ago) by woo409
File MIME type: text/plain
File size: 6586 byte(s)
+ Merge of intelc_win32 branch (revision 741:755) with trunk. Tested on iVEC altix (run_tests and py_tests all pass)

1 jgs 102 //$Id$
2 jgs 82 /*
3 elspeth 615 ************************************************************
4     * Copyright 2006 by ACcESS MNRF *
5     * *
6     * http://www.access.edu.au *
7     * Primary Business: Queensland, Australia *
8     * Licensed under the Open Software License version 3.0 *
9     * http://www.opensource.org/licenses/osl-3.0.php *
10     * *
11     ************************************************************
12 jgs 82 */
13 jgs 480
14 jgs 102 #if !defined escript_DataConstant_20040323_H
15 jgs 82 #define escript_DataConstant_20040323_H
16 woo409 757 #include "system_dep.h"
17 jgs 82
18 jgs 474 #include "DataAbstract.h"
19     #include "DataArrayView.h"
20 jgs 82
21     #include <boost/python/numeric.hpp>
22    
23     namespace escript {
24 jgs 102
25 jgs 82 /**
26     \brief
27 jgs 102 DataConstant stores a single data point which represents the entire
28 jgs 82 function space.
29    
30     Description:
31 jgs 102 DataConstant stores a single data point which represents the entire
32 jgs 82 function space.
33     */
34 jgs 102 class DataConstant : public DataAbstract {
35 jgs 82
36     public:
37    
38     /**
39     \brief
40 jgs 102 Constructor for DataConstant objects.
41 jgs 82
42     Description:
43 jgs 102 Constructor for DataConstant objects.
44 jgs 82
45 jgs 102 \param value - Input - Data value for a single point.
46     \param what - Input - A description of what this data object represents.
47     */
48 woo409 757 ESCRIPT_DLL_API
49 jgs 102 DataConstant(const boost::python::numeric::array& value,
50     const FunctionSpace& what);
51 jgs 100
52 jgs 82 /**
53     \brief
54     Copy constructor. Performs a deep copy.
55     */
56 woo409 757 ESCRIPT_DLL_API
57 jgs 82 DataConstant(const DataConstant& other);
58 jgs 102
59 jgs 82 /**
60     \brief
61 jgs 102 Alternative constructor for DataConstant objects.
62 jgs 82
63     Description:
64 jgs 102 Alternative Constructor for DataConstant objects.
65     \param value - Input - Data value for a single point.
66     \param what - Input - A description of what this data object represents.
67 jgs 82 */
68 woo409 757 ESCRIPT_DLL_API
69 jgs 102 DataConstant(const DataArrayView& value,
70     const FunctionSpace& what);
71    
72 jgs 82 /**
73     \brief
74 jgs 102 Alternative constructor for DataConstant objects.
75 jgs 82
76     Description:
77 jgs 102 Alternative Constructor for DataConstant objects.
78     \param other - Input - Data object to copy from.
79     \param region - Input - region to copy.
80 jgs 82 */
81 woo409 757 ESCRIPT_DLL_API
82 jgs 102 DataConstant(const DataConstant& other,
83     const DataArrayView::RegionType& region);
84    
85 jgs 82 /**
86     \brief
87 jgs 119 Alternative constructor for DataConstant objects.
88    
89     Description:
90     Alternative Constructor for DataConstant objects.
91     \param what - Input - A description of what this data object represents.
92     \param shape - Input - the shape of each data-point.
93     \param data - the data values for each data-point.
94     */
95 woo409 757 ESCRIPT_DLL_API
96 jgs 119 DataConstant(const FunctionSpace& what,
97     const DataArrayView::ShapeType &shape,
98     const DataArrayView::ValueType &data);
99    
100     /**
101     \brief
102 jgs 82 Write the data as a string.
103     */
104 woo409 757 ESCRIPT_DLL_API
105 jgs 102 std::string
106     toString() const;
107    
108 jgs 82 /**
109     \brief
110 jgs 102 Return the offset for the given sample. This is a somewhat artificial notion
111 jgs 82 but returns the offset in bytes for the given point into the container
112     holding the point data. Only really necessary to avoid many DataArrayView
113     objects.
114 jgs 102 \param sampleNo - Input - sample number.
115     \param dataPointNo - Input - data point number for the sample.
116 jgs 82 */
117 woo409 757 ESCRIPT_DLL_API
118 jgs 102 virtual
119     DataArrayView::ValueType::size_type
120     getPointOffset(int sampleNo,
121     int dataPointNo) const;
122    
123 jgs 82 /**
124     \brief
125     Return a view into the data for the data point specified.
126 jgs 102 \param sampleNo - Input - sample number.
127     \param dataPointNo - Input - data point number for the sample.
128 jgs 82 */
129 woo409 757 ESCRIPT_DLL_API
130 jgs 102 virtual
131     DataArrayView
132     getDataPoint(int sampleNo,
133     int dataPointNo);
134    
135 jgs 82 /**
136     \brief
137 jgs 102 Return the number of doubles stored for the Data object.
138 jgs 82 */
139 woo409 757 ESCRIPT_DLL_API
140 jgs 102 virtual
141 jgs 117 DataArrayView::ValueType::size_type
142 jgs 102 getLength() const;
143    
144 jgs 82 /**
145     \brief
146 jgs 102 Factory method that returns a newly created DataConstant object
147     sliced from the specified region of this object.
148 jgs 82 The caller is reponsible for managing the object created.
149 jgs 102 \param region - Input - region to slice from this object.
150 jgs 82 */
151 woo409 757 ESCRIPT_DLL_API
152 jgs 102 virtual
153     DataAbstract*
154     getSlice(const DataArrayView::RegionType& region) const;
155    
156     /**
157 jgs 82 \brief
158     Copy the specified region from the given value.
159 jgs 102 \param value - Input - Data object to copy from.
160     \param region - Input - Region to copy.
161 jgs 82 */
162 woo409 757 ESCRIPT_DLL_API
163 jgs 102 virtual
164     void
165     setSlice(const DataAbstract* value,
166     const DataArrayView::RegionType& region);
167    
168 jgs 82 /**
169     \brief
170     Reshape the data point if the data point is currently rank 0.
171     The original data point value is used for all values of the new
172     data point.
173     */
174 woo409 757 ESCRIPT_DLL_API
175 jgs 102 void
176     reshapeDataPoint(const DataArrayView::ShapeType& shape);
177    
178 jgs 123 /**
179     \brief
180     Archive the underlying data values to the file referenced
181     by ofstream. A count of the number of values expected to be written
182     is provided as a cross-check.
183    
184     The return value indicates success (0) or otherwise (1).
185     */
186 woo409 757 ESCRIPT_DLL_API
187 jgs 123 int
188     archiveData(std::ofstream& archiveFile,
189     const DataArrayView::ValueType::size_type noValues) const;
190    
191     /**
192     \brief
193     Extract the number of values specified by noValues from the file
194     referenced by ifstream to the underlying data structure.
195    
196     The return value indicates success (0) or otherwise (1).
197     */
198 woo409 757 ESCRIPT_DLL_API
199 jgs 123 int
200     extractData(std::ifstream& archiveFile,
201     const DataArrayView::ValueType::size_type noValues);
202    
203 gross 580 /**
204     \brief
205     solves the eigenvalue problem this*V=ev*V for the eigenvalues ev
206    
207     \param ev - Output - eigenvalues in increasing order at each data point
208    
209     */
210 woo409 757 ESCRIPT_DLL_API
211 gross 580 virtual void
212     eigenvalues(DataAbstract* ev);
213    
214     /**
215     \brief
216     solves the eigenvalue problem this*V=ev*V for the eigenvalues ev and eigenvectors V
217    
218     \param ev - Output - eigenvalues in increasing order at each data point
219     \param V - Output - corresponding eigenvectors. They are normalized such that their length is one
220     and the first nonzero component is positive.
221     \param tol - Input - eigenvalue with relative distance tol are treated as equal.
222    
223     */
224    
225 woo409 757 ESCRIPT_DLL_API
226 gross 580 virtual void
227     eigenvalues_and_eigenvectors(DataAbstract* ev,DataAbstract* V,const double tol=1.e-13);
228    
229    
230 jgs 82 protected:
231    
232     private:
233     //
234 jgs 102 // the actual data
235 jgs 82 DataArrayView::ValueType m_data;
236 jgs 102
237 jgs 82 };
238    
239     } // end of namespace
240     #endif

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26