/[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 2519 - (hide annotations)
Mon Jul 6 00:43:08 2009 UTC (10 years ago) by jfenwick
Original Path: trunk/escript/src/DataConstant.h
File MIME type: text/plain
File size: 6522 byte(s)
Correcting some doxygen errors
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 jfenwick 2005 #include "DataReady.h"
20 jfenwick 2271 #include "WrappedArray.h"
21 jgs 82
22     #include <boost/python/numeric.hpp>
23    
24     namespace escript {
25 jgs 102
26 jgs 82 /**
27     \brief
28 jgs 102 DataConstant stores a single data point which represents the entire
29 jgs 82 function space.
30    
31     Description:
32 jgs 102 DataConstant stores a single data point which represents the entire
33 jgs 82 function space.
34     */
35 jfenwick 2005 class DataConstant : public DataReady {
36     typedef DataReady parent;
37 jgs 82 public:
38    
39     /**
40     \brief
41 jgs 102 Constructor for DataConstant objects.
42 jgs 82
43     Description:
44 jgs 102 Constructor for DataConstant objects.
45 jgs 82
46 jgs 102 \param value - Input - Data value for a single point.
47     \param what - Input - A description of what this data object represents.
48     */
49 woo409 757 ESCRIPT_DLL_API
50 jfenwick 2271 DataConstant(const WrappedArray& value,
51 jgs 102 const FunctionSpace& what);
52 jgs 100
53 jfenwick 2271
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     /**
63     \brief
64 jgs 102 Alternative constructor for DataConstant objects.
65 jgs 82
66     Description:
67 jgs 102 Alternative Constructor for DataConstant objects.
68     \param other - Input - Data object to copy from.
69     \param region - Input - region to copy.
70 jgs 82 */
71 woo409 757 ESCRIPT_DLL_API
72 jgs 102 DataConstant(const DataConstant& other,
73 jfenwick 1796 const DataTypes::RegionType& region);
74 jgs 102
75 jgs 82 /**
76     \brief
77 jgs 119 Alternative constructor for DataConstant objects.
78    
79     Description:
80     Alternative Constructor for DataConstant objects.
81     \param what - Input - A description of what this data object represents.
82     \param shape - Input - the shape of each data-point.
83     \param data - the data values for each data-point.
84     */
85 woo409 757 ESCRIPT_DLL_API
86 jgs 119 DataConstant(const FunctionSpace& what,
87 jfenwick 1796 const DataTypes::ShapeType &shape,
88     const DataTypes::ValueType &data);
89 jgs 119
90 jfenwick 2005
91     ESCRIPT_DLL_API
92     bool
93     isConstant() const
94     {
95     return true;
96     };
97    
98    
99 jgs 119 /**
100     \brief
101 jgs 82 Write the data as a string.
102     */
103 woo409 757 ESCRIPT_DLL_API
104 jgs 102 std::string
105     toString() const;
106 jfenwick 1799
107     /**
108     \brief Return a deep copy of the current object.
109     */
110     ESCRIPT_DLL_API
111     virtual
112     DataAbstract*
113     deepCopy();
114    
115    
116 gross 950 /**
117     \brief
118     dumps the object into a netCDF file
119     */
120     ESCRIPT_DLL_API
121     virtual
122     void
123     dump(const std::string fileName) const;
124 jgs 102
125 gross 1118 /**
126     \brief
127     sets all values to zero
128     */
129     ESCRIPT_DLL_API
130     virtual
131     void
132     setToZero();
133 gross 950
134 jgs 82 /**
135     \brief
136 jgs 102 Return the offset for the given sample. This is a somewhat artificial notion
137 jgs 82 but returns the offset in bytes for the given point into the container
138     holding the point data. Only really necessary to avoid many DataArrayView
139     objects.
140 jgs 102 \param sampleNo - Input - sample number.
141     \param dataPointNo - Input - data point number for the sample.
142 jgs 82 */
143 woo409 757 ESCRIPT_DLL_API
144 jgs 102 virtual
145 jfenwick 1796 DataTypes::ValueType::size_type
146 jgs 102 getPointOffset(int sampleNo,
147     int dataPointNo) const;
148    
149 jfenwick 2005 ESCRIPT_DLL_API
150     virtual
151     DataTypes::ValueType::size_type
152     getPointOffset(int sampleNo,
153     int dataPointNo);
154    
155 jgs 82 /**
156     \brief
157 jgs 102 Return the number of doubles stored for the Data object.
158 jgs 82 */
159 woo409 757 ESCRIPT_DLL_API
160 jgs 102 virtual
161 jfenwick 1796 DataTypes::ValueType::size_type
162 jgs 102 getLength() const;
163    
164 jgs 82 /**
165     \brief
166 jgs 102 Factory method that returns a newly created DataConstant object
167     sliced from the specified region of this object.
168 jgs 82 The caller is reponsible for managing the object created.
169 jgs 102 \param region - Input - region to slice from this object.
170 jgs 82 */
171 woo409 757 ESCRIPT_DLL_API
172 jgs 102 virtual
173     DataAbstract*
174 jfenwick 1796 getSlice(const DataTypes::RegionType& region) const;
175 jgs 102
176     /**
177 jgs 82 \brief
178     Copy the specified region from the given value.
179 jgs 102 \param value - Input - Data object to copy from.
180     \param region - Input - Region to copy.
181 jgs 82 */
182 woo409 757 ESCRIPT_DLL_API
183 jgs 102 virtual
184     void
185     setSlice(const DataAbstract* value,
186 jfenwick 1796 const DataTypes::RegionType& region);
187 jgs 102
188 jgs 123
189     /**
190 gross 580 \brief
191 ksteube 775 Computes a symmetric matrix (A + AT) / 2
192    
193     \param ev - Output - symmetric matrix
194    
195     */
196 gross 800 ESCRIPT_DLL_API
197 ksteube 775 virtual void
198     symmetric(DataAbstract* ev);
199    
200     /**
201     \brief
202     Computes a nonsymmetric matrix (A - AT) / 2
203    
204     \param ev - Output - nonsymmetric matrix
205    
206     */
207 gross 800 ESCRIPT_DLL_API
208 ksteube 775 virtual void
209     nonsymmetric(DataAbstract* ev);
210    
211     /**
212     \brief
213     Computes the trace of a matrix
214    
215     \param ev - Output - trace of matrix
216 jfenwick 2519 \param axis_offset
217 ksteube 775
218     */
219 gross 800 ESCRIPT_DLL_API
220 ksteube 775 virtual void
221 gross 800 trace(DataAbstract* ev, int axis_offset);
222 ksteube 775
223     /**
224     \brief
225     Transpose each data point of this Data object around the given axis.
226    
227     \param ev - Output - transpose of matrix
228 jfenwick 2519 \param axis_offset
229 ksteube 775 */
230 gross 800 ESCRIPT_DLL_API
231 ksteube 775 virtual void
232     transpose(DataAbstract* ev, int axis_offset);
233    
234     /**
235     \brief
236 gross 804 swaps components axis0 and axis1
237 gross 800
238     \param ev - Output - swapped components
239 jfenwick 2519 \param axis0
240     \param axis1
241 gross 800 */
242     ESCRIPT_DLL_API
243     virtual void
244 gross 804 swapaxes(DataAbstract* ev, int axis0, int axis1);
245 gross 800
246    
247     /**
248     \brief
249 gross 580 solves the eigenvalue problem this*V=ev*V for the eigenvalues ev
250    
251     \param ev - Output - eigenvalues in increasing order at each data point
252    
253     */
254 woo409 757 ESCRIPT_DLL_API
255 gross 580 virtual void
256     eigenvalues(DataAbstract* ev);
257    
258     /**
259     \brief
260     solves the eigenvalue problem this*V=ev*V for the eigenvalues ev and eigenvectors V
261    
262     \param ev - Output - eigenvalues in increasing order at each data point
263     \param V - Output - corresponding eigenvectors. They are normalized such that their length is one
264     and the first nonzero component is positive.
265     \param tol - Input - eigenvalue with relative distance tol are treated as equal.
266    
267     */
268    
269 woo409 757 ESCRIPT_DLL_API
270 gross 580 virtual void
271     eigenvalues_and_eigenvectors(DataAbstract* ev,DataAbstract* V,const double tol=1.e-13);
272    
273    
274 jfenwick 1796 /**
275     \brief
276     Return a reference to the underlying DataVector.
277     */
278     ESCRIPT_DLL_API
279     DataTypes::ValueType&
280 jfenwick 2271 getVectorRW();
281 jfenwick 1796
282 jfenwick 2271
283 jfenwick 1796 ESCRIPT_DLL_API
284     const DataTypes::ValueType&
285 jfenwick 2271 getVectorRO() const;
286 jfenwick 1796
287 jgs 82 protected:
288    
289     private:
290     //
291 jgs 102 // the actual data
292 jfenwick 1796 DataTypes::ValueType m_data;
293 jgs 102
294 jgs 82 };
295    
296     } // end of namespace
297     #endif

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26