/[escript]/branches/trilinos_from_5897/escriptcore/src/DataConstant.h
ViewVC logotype

Annotation of /branches/trilinos_from_5897/escriptcore/src/DataConstant.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1388 - (hide annotations)
Fri Jan 11 07:45:58 2008 UTC (11 years, 6 months ago) by trankine
Original Path: trunk/escript/src/DataConstant.h
File MIME type: text/plain
File size: 7403 byte(s)
And get the *(&(*&(* name right
1 jgs 480
2 ksteube 1312 /* $Id$ */
3    
4     /*******************************************************
5     *
6     * Copyright 2003-2007 by ACceSS MNRF
7     * Copyright 2007 by University of Queensland
8     *
9     * http://esscc.uq.edu.au
10     * Primary Business: Queensland, Australia
11     * Licensed under the Open Software License version 3.0
12     * http://www.opensource.org/licenses/osl-3.0.php
13     *
14     *******************************************************/
15    
16 jgs 102 #if !defined escript_DataConstant_20040323_H
17 jgs 82 #define escript_DataConstant_20040323_H
18 woo409 757 #include "system_dep.h"
19 jgs 82
20 jgs 474 #include "DataAbstract.h"
21     #include "DataArrayView.h"
22 jgs 82
23     #include <boost/python/numeric.hpp>
24    
25     namespace escript {
26 jgs 102
27 jgs 82 /**
28     \brief
29 jgs 102 DataConstant stores a single data point which represents the entire
30 jgs 82 function space.
31    
32     Description:
33 jgs 102 DataConstant stores a single data point which represents the entire
34 jgs 82 function space.
35     */
36 jgs 102 class DataConstant : public DataAbstract {
37 jgs 82
38     public:
39    
40     /**
41     \brief
42 jgs 102 Constructor for DataConstant objects.
43 jgs 82
44     Description:
45 jgs 102 Constructor for DataConstant objects.
46 jgs 82
47 jgs 102 \param value - Input - Data value for a single point.
48     \param what - Input - A description of what this data object represents.
49     */
50 woo409 757 ESCRIPT_DLL_API
51 jgs 102 DataConstant(const boost::python::numeric::array& value,
52     const FunctionSpace& what);
53 jgs 100
54 jgs 82 /**
55     \brief
56     Copy constructor. Performs a deep copy.
57     */
58 woo409 757 ESCRIPT_DLL_API
59 jgs 82 DataConstant(const DataConstant& other);
60 jgs 102
61 jgs 82 /**
62     \brief
63 jgs 102 Alternative constructor for DataConstant objects.
64 jgs 82
65     Description:
66 jgs 102 Alternative Constructor for DataConstant objects.
67     \param value - Input - Data value for a single point.
68     \param what - Input - A description of what this data object represents.
69 jgs 82 */
70 woo409 757 ESCRIPT_DLL_API
71 jgs 102 DataConstant(const DataArrayView& value,
72     const FunctionSpace& what);
73    
74 jgs 82 /**
75     \brief
76 jgs 102 Alternative constructor for DataConstant objects.
77 jgs 82
78     Description:
79 jgs 102 Alternative Constructor for DataConstant objects.
80     \param other - Input - Data object to copy from.
81     \param region - Input - region to copy.
82 jgs 82 */
83 woo409 757 ESCRIPT_DLL_API
84 jgs 102 DataConstant(const DataConstant& other,
85     const DataArrayView::RegionType& region);
86    
87 jgs 82 /**
88     \brief
89 jgs 119 Alternative constructor for DataConstant objects.
90    
91     Description:
92     Alternative Constructor for DataConstant objects.
93     \param what - Input - A description of what this data object represents.
94     \param shape - Input - the shape of each data-point.
95     \param data - the data values for each data-point.
96     */
97 woo409 757 ESCRIPT_DLL_API
98 jgs 119 DataConstant(const FunctionSpace& what,
99     const DataArrayView::ShapeType &shape,
100     const DataArrayView::ValueType &data);
101    
102     /**
103     \brief
104 jgs 82 Write the data as a string.
105     */
106 woo409 757 ESCRIPT_DLL_API
107 jgs 102 std::string
108     toString() const;
109 gross 950 /**
110     \brief
111     dumps the object into a netCDF file
112     */
113     ESCRIPT_DLL_API
114     virtual
115     void
116     dump(const std::string fileName) const;
117 jgs 102
118 gross 1118 /**
119     \brief
120     sets all values to zero
121     */
122     ESCRIPT_DLL_API
123     virtual
124     void
125     setToZero();
126 gross 950
127 jgs 82 /**
128     \brief
129 jgs 102 Return the offset for the given sample. This is a somewhat artificial notion
130 jgs 82 but returns the offset in bytes for the given point into the container
131     holding the point data. Only really necessary to avoid many DataArrayView
132     objects.
133 jgs 102 \param sampleNo - Input - sample number.
134     \param dataPointNo - Input - data point number for the sample.
135 jgs 82 */
136 woo409 757 ESCRIPT_DLL_API
137 jgs 102 virtual
138     DataArrayView::ValueType::size_type
139     getPointOffset(int sampleNo,
140     int dataPointNo) const;
141    
142 jgs 82 /**
143     \brief
144     Return a view into the data for the data point specified.
145 jgs 102 \param sampleNo - Input - sample number.
146     \param dataPointNo - Input - data point number for the sample.
147 jgs 82 */
148 woo409 757 ESCRIPT_DLL_API
149 jgs 102 virtual
150     DataArrayView
151     getDataPoint(int sampleNo,
152     int dataPointNo);
153    
154 jgs 82 /**
155     \brief
156 jgs 102 Return the number of doubles stored for the Data object.
157 jgs 82 */
158 woo409 757 ESCRIPT_DLL_API
159 jgs 102 virtual
160 jgs 117 DataArrayView::ValueType::size_type
161 jgs 102 getLength() const;
162    
163 jgs 82 /**
164     \brief
165 jgs 102 Factory method that returns a newly created DataConstant object
166     sliced from the specified region of this object.
167 jgs 82 The caller is reponsible for managing the object created.
168 jgs 102 \param region - Input - region to slice from this object.
169 jgs 82 */
170 woo409 757 ESCRIPT_DLL_API
171 jgs 102 virtual
172     DataAbstract*
173     getSlice(const DataArrayView::RegionType& region) const;
174    
175     /**
176 jgs 82 \brief
177     Copy the specified region from the given value.
178 jgs 102 \param value - Input - Data object to copy from.
179     \param region - Input - Region to copy.
180 jgs 82 */
181 woo409 757 ESCRIPT_DLL_API
182 jgs 102 virtual
183     void
184     setSlice(const DataAbstract* value,
185     const DataArrayView::RegionType& region);
186    
187 jgs 82 /**
188 jgs 123 \brief
189     Archive the underlying data values to the file referenced
190     by ofstream. A count of the number of values expected to be written
191     is provided as a cross-check.
192    
193     The return value indicates success (0) or otherwise (1).
194     */
195 woo409 757 ESCRIPT_DLL_API
196 jgs 123 int
197     archiveData(std::ofstream& archiveFile,
198     const DataArrayView::ValueType::size_type noValues) const;
199    
200     /**
201     \brief
202     Extract the number of values specified by noValues from the file
203     referenced by ifstream to the underlying data structure.
204    
205     The return value indicates success (0) or otherwise (1).
206     */
207 woo409 757 ESCRIPT_DLL_API
208 jgs 123 int
209     extractData(std::ifstream& archiveFile,
210     const DataArrayView::ValueType::size_type noValues);
211    
212 gross 580 /**
213     \brief
214 ksteube 775 Computes a symmetric matrix (A + AT) / 2
215    
216     \param ev - Output - symmetric matrix
217    
218     */
219 gross 800 ESCRIPT_DLL_API
220 ksteube 775 virtual void
221     symmetric(DataAbstract* ev);
222    
223     /**
224     \brief
225     Computes a nonsymmetric matrix (A - AT) / 2
226    
227     \param ev - Output - nonsymmetric matrix
228    
229     */
230 gross 800 ESCRIPT_DLL_API
231 ksteube 775 virtual void
232     nonsymmetric(DataAbstract* ev);
233    
234     /**
235     \brief
236     Computes the trace of a matrix
237    
238     \param ev - Output - trace of matrix
239    
240     */
241 gross 800 ESCRIPT_DLL_API
242 ksteube 775 virtual void
243 gross 800 trace(DataAbstract* ev, int axis_offset);
244 ksteube 775
245     /**
246     \brief
247     Transpose each data point of this Data object around the given axis.
248    
249     \param ev - Output - transpose of matrix
250    
251     */
252 gross 800 ESCRIPT_DLL_API
253 ksteube 775 virtual void
254     transpose(DataAbstract* ev, int axis_offset);
255    
256     /**
257     \brief
258 gross 804 swaps components axis0 and axis1
259 gross 800
260     \param ev - Output - swapped components
261    
262     */
263     ESCRIPT_DLL_API
264     virtual void
265 gross 804 swapaxes(DataAbstract* ev, int axis0, int axis1);
266 gross 800
267    
268     /**
269     \brief
270 gross 580 solves the eigenvalue problem this*V=ev*V for the eigenvalues ev
271    
272     \param ev - Output - eigenvalues in increasing order at each data point
273    
274     */
275 woo409 757 ESCRIPT_DLL_API
276 gross 580 virtual void
277     eigenvalues(DataAbstract* ev);
278    
279     /**
280     \brief
281     solves the eigenvalue problem this*V=ev*V for the eigenvalues ev and eigenvectors V
282    
283     \param ev - Output - eigenvalues in increasing order at each data point
284     \param V - Output - corresponding eigenvectors. They are normalized such that their length is one
285     and the first nonzero component is positive.
286     \param tol - Input - eigenvalue with relative distance tol are treated as equal.
287    
288     */
289    
290 woo409 757 ESCRIPT_DLL_API
291 gross 580 virtual void
292     eigenvalues_and_eigenvectors(DataAbstract* ev,DataAbstract* V,const double tol=1.e-13);
293    
294    
295 jgs 82 protected:
296    
297     private:
298     //
299 jgs 102 // the actual data
300 jgs 82 DataArrayView::ValueType m_data;
301 jgs 102
302 jgs 82 };
303    
304     } // end of namespace
305     #endif

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26