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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1811 - (hide annotations)
Thu Sep 25 23:11:13 2008 UTC (11 years ago) by ksteube
File MIME type: text/plain
File size: 7109 byte(s)
Copyright updated in all files

1 jgs 480
2 ksteube 1312 /*******************************************************
3 ksteube 1811 *
4     * Copyright (c) 2003-2008 by University of Queensland
5     * Earth Systems Science Computational Center (ESSCC)
6     * http://www.uq.edu.au/esscc
7     *
8     * Primary Business: Queensland, Australia
9     * Licensed under the Open Software License version 3.0
10     * http://www.opensource.org/licenses/osl-3.0.php
11     *
12     *******************************************************/
13 ksteube 1312
14 ksteube 1811
15 jgs 102 #if !defined escript_DataConstant_20040323_H
16 jgs 82 #define escript_DataConstant_20040323_H
17 woo409 757 #include "system_dep.h"
18 jgs 82
19 jgs 474 #include "DataAbstract.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 jfenwick 1796 // /**
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 jfenwick 1796 \param what - Input - A description of what this data object represents.*/
67     // */
68     // ESCRIPT_DLL_API
69     // DataConstant(const DataArrayView& value,
70     // const FunctionSpace& what);
71 jgs 102
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 jfenwick 1796 const DataTypes::RegionType& region);
84 jgs 102
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 jfenwick 1796 const DataTypes::ShapeType &shape,
98     const DataTypes::ValueType &data);
99 jgs 119
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 jfenwick 1799
108     /**
109     \brief Return a deep copy of the current object.
110     */
111     ESCRIPT_DLL_API
112     virtual
113     DataAbstract*
114     deepCopy();
115    
116    
117 gross 950 /**
118     \brief
119     dumps the object into a netCDF file
120     */
121     ESCRIPT_DLL_API
122     virtual
123     void
124     dump(const std::string fileName) const;
125 jgs 102
126 gross 1118 /**
127     \brief
128     sets all values to zero
129     */
130     ESCRIPT_DLL_API
131     virtual
132     void
133     setToZero();
134 gross 950
135 jgs 82 /**
136     \brief
137 jgs 102 Return the offset for the given sample. This is a somewhat artificial notion
138 jgs 82 but returns the offset in bytes for the given point into the container
139     holding the point data. Only really necessary to avoid many DataArrayView
140     objects.
141 jgs 102 \param sampleNo - Input - sample number.
142     \param dataPointNo - Input - data point number for the sample.
143 jgs 82 */
144 woo409 757 ESCRIPT_DLL_API
145 jgs 102 virtual
146 jfenwick 1796 DataTypes::ValueType::size_type
147 jgs 102 getPointOffset(int sampleNo,
148     int dataPointNo) const;
149    
150 jfenwick 1796 // /**
151     /* \brief
152 jgs 82 Return a view into the data for the data point specified.
153 jgs 102 \param sampleNo - Input - sample number.
154 jfenwick 1796 \param dataPointNo - Input - data point number for the sample.*/
155     // */
156     // ESCRIPT_DLL_API
157     // virtual
158     // DataArrayView
159     // getDataPoint(int sampleNo,
160     // int dataPointNo);
161 jgs 102
162 jgs 82 /**
163     \brief
164 jgs 102 Return the number of doubles stored for the Data object.
165 jgs 82 */
166 woo409 757 ESCRIPT_DLL_API
167 jgs 102 virtual
168 jfenwick 1796 DataTypes::ValueType::size_type
169 jgs 102 getLength() const;
170    
171 jgs 82 /**
172     \brief
173 jgs 102 Factory method that returns a newly created DataConstant object
174     sliced from the specified region of this object.
175 jgs 82 The caller is reponsible for managing the object created.
176 jgs 102 \param region - Input - region to slice from this object.
177 jgs 82 */
178 woo409 757 ESCRIPT_DLL_API
179 jgs 102 virtual
180     DataAbstract*
181 jfenwick 1796 getSlice(const DataTypes::RegionType& region) const;
182 jgs 102
183     /**
184 jgs 82 \brief
185     Copy the specified region from the given value.
186 jgs 102 \param value - Input - Data object to copy from.
187     \param region - Input - Region to copy.
188 jgs 82 */
189 woo409 757 ESCRIPT_DLL_API
190 jgs 102 virtual
191     void
192     setSlice(const DataAbstract* value,
193 jfenwick 1796 const DataTypes::RegionType& region);
194 jgs 102
195 jgs 123
196     /**
197 gross 580 \brief
198 ksteube 775 Computes a symmetric matrix (A + AT) / 2
199    
200     \param ev - Output - symmetric matrix
201    
202     */
203 gross 800 ESCRIPT_DLL_API
204 ksteube 775 virtual void
205     symmetric(DataAbstract* ev);
206    
207     /**
208     \brief
209     Computes a nonsymmetric matrix (A - AT) / 2
210    
211     \param ev - Output - nonsymmetric matrix
212    
213     */
214 gross 800 ESCRIPT_DLL_API
215 ksteube 775 virtual void
216     nonsymmetric(DataAbstract* ev);
217    
218     /**
219     \brief
220     Computes the trace of a matrix
221    
222     \param ev - Output - trace of matrix
223    
224     */
225 gross 800 ESCRIPT_DLL_API
226 ksteube 775 virtual void
227 gross 800 trace(DataAbstract* ev, int axis_offset);
228 ksteube 775
229     /**
230     \brief
231     Transpose each data point of this Data object around the given axis.
232    
233     \param ev - Output - transpose of matrix
234    
235     */
236 gross 800 ESCRIPT_DLL_API
237 ksteube 775 virtual void
238     transpose(DataAbstract* ev, int axis_offset);
239    
240     /**
241     \brief
242 gross 804 swaps components axis0 and axis1
243 gross 800
244     \param ev - Output - swapped components
245    
246     */
247     ESCRIPT_DLL_API
248     virtual void
249 gross 804 swapaxes(DataAbstract* ev, int axis0, int axis1);
250 gross 800
251    
252     /**
253     \brief
254 gross 580 solves the eigenvalue problem this*V=ev*V for the eigenvalues ev
255    
256     \param ev - Output - eigenvalues in increasing order at each data point
257    
258     */
259 woo409 757 ESCRIPT_DLL_API
260 gross 580 virtual void
261     eigenvalues(DataAbstract* ev);
262    
263     /**
264     \brief
265     solves the eigenvalue problem this*V=ev*V for the eigenvalues ev and eigenvectors V
266    
267     \param ev - Output - eigenvalues in increasing order at each data point
268     \param V - Output - corresponding eigenvectors. They are normalized such that their length is one
269     and the first nonzero component is positive.
270     \param tol - Input - eigenvalue with relative distance tol are treated as equal.
271    
272     */
273    
274 woo409 757 ESCRIPT_DLL_API
275 gross 580 virtual void
276     eigenvalues_and_eigenvectors(DataAbstract* ev,DataAbstract* V,const double tol=1.e-13);
277    
278    
279 jfenwick 1796 /**
280     \brief
281     Return a reference to the underlying DataVector.
282     */
283     ESCRIPT_DLL_API
284     DataTypes::ValueType&
285     getVector();
286    
287     ESCRIPT_DLL_API
288     const DataTypes::ValueType&
289     getVector() const;
290    
291    
292 jgs 82 protected:
293    
294     private:
295     //
296 jgs 102 // the actual data
297 jfenwick 1796 DataTypes::ValueType m_data;
298 jgs 102
299 jgs 82 };
300    
301 jfenwick 1796 inline
302     DataTypes::ValueType&
303     DataConstant::getVector()
304     {
305     return m_data;
306     }
307    
308     inline
309     const DataTypes::ValueType&
310     DataConstant::getVector() const
311     {
312     return m_data;
313     }
314    
315    
316 jgs 82 } // end of namespace
317     #endif

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26