/[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 2881 - (hide annotations)
Thu Jan 28 02:03:15 2010 UTC (9 years, 6 months ago) by jfenwick
Original Path: trunk/escript/src/DataConstant.h
File MIME type: text/plain
File size: 6800 byte(s)
Don't panic.
Updating copyright stamps

1 jgs 480
2 ksteube 1312 /*******************************************************
3 ksteube 1811 *
4 jfenwick 2881 * Copyright (c) 2003-2010 by University of Queensland
5 ksteube 1811 * 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    
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 jfenwick 2005 class DataConstant : public DataReady {
35     typedef DataReady parent;
36 jgs 82 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 jfenwick 2271 DataConstant(const WrappedArray& value,
50 jgs 102 const FunctionSpace& what);
51 jgs 100
52 jfenwick 2271
53 jgs 82 /**
54     \brief
55     Copy constructor. Performs a deep copy.
56     */
57 woo409 757 ESCRIPT_DLL_API
58 jgs 82 DataConstant(const DataConstant& other);
59 jgs 102
60 jgs 82
61     /**
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 other - Input - Data object to copy from.
68     \param region - Input - region to copy.
69 jgs 82 */
70 woo409 757 ESCRIPT_DLL_API
71 jgs 102 DataConstant(const DataConstant& other,
72 jfenwick 1796 const DataTypes::RegionType& region);
73 jgs 102
74 jgs 82 /**
75     \brief
76 jgs 119 Alternative constructor for DataConstant objects.
77    
78     Description:
79     Alternative Constructor for DataConstant objects.
80     \param what - Input - A description of what this data object represents.
81     \param shape - Input - the shape of each data-point.
82     \param data - the data values for each data-point.
83     */
84 woo409 757 ESCRIPT_DLL_API
85 jgs 119 DataConstant(const FunctionSpace& what,
86 jfenwick 1796 const DataTypes::ShapeType &shape,
87     const DataTypes::ValueType &data);
88 jgs 119
89 jfenwick 2005
90     ESCRIPT_DLL_API
91     bool
92     isConstant() const
93     {
94     return true;
95     };
96    
97 jgs 119 /**
98 jfenwick 2766 \brief Return true if the value contains a NaN.
99     */
100     ESCRIPT_DLL_API
101     bool
102     hasNaN() const;
103    
104     /**
105 jgs 119 \brief
106 jgs 82 Write the data as a string.
107     */
108 woo409 757 ESCRIPT_DLL_API
109 jgs 102 std::string
110     toString() const;
111 jfenwick 1799
112     /**
113     \brief Return a deep copy of the current object.
114     */
115     ESCRIPT_DLL_API
116     virtual
117     DataAbstract*
118     deepCopy();
119    
120    
121 gross 950 /**
122     \brief
123     dumps the object into a netCDF file
124     */
125     ESCRIPT_DLL_API
126     virtual
127     void
128     dump(const std::string fileName) const;
129 jgs 102
130 gross 1118 /**
131     \brief
132     sets all values to zero
133     */
134     ESCRIPT_DLL_API
135     virtual
136     void
137     setToZero();
138 gross 950
139 jgs 82 /**
140     \brief
141 jgs 102 Return the offset for the given sample. This is a somewhat artificial notion
142 jgs 82 but returns the offset in bytes for the given point into the container
143     holding the point data. Only really necessary to avoid many DataArrayView
144     objects.
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 jfenwick 1796 DataTypes::ValueType::size_type
151 jgs 102 getPointOffset(int sampleNo,
152     int dataPointNo) const;
153    
154 jfenwick 2005 ESCRIPT_DLL_API
155     virtual
156     DataTypes::ValueType::size_type
157     getPointOffset(int sampleNo,
158     int dataPointNo);
159    
160 jgs 82 /**
161     \brief
162 jgs 102 Return the number of doubles stored for the Data object.
163 jgs 82 */
164 woo409 757 ESCRIPT_DLL_API
165 jgs 102 virtual
166 jfenwick 1796 DataTypes::ValueType::size_type
167 jgs 102 getLength() const;
168    
169 jgs 82 /**
170     \brief
171 jgs 102 Factory method that returns a newly created DataConstant object
172     sliced from the specified region of this object.
173 jgs 82 The caller is reponsible for managing the object created.
174 jgs 102 \param region - Input - region to slice from this object.
175 jgs 82 */
176 woo409 757 ESCRIPT_DLL_API
177 jgs 102 virtual
178     DataAbstract*
179 jfenwick 1796 getSlice(const DataTypes::RegionType& region) const;
180 jgs 102
181     /**
182 jgs 82 \brief
183     Copy the specified region from the given value.
184 jgs 102 \param value - Input - Data object to copy from.
185     \param region - Input - Region to copy.
186 jgs 82 */
187 woo409 757 ESCRIPT_DLL_API
188 jgs 102 virtual
189     void
190     setSlice(const DataAbstract* value,
191 jfenwick 1796 const DataTypes::RegionType& region);
192 jgs 102
193 jgs 123
194     /**
195 gross 580 \brief
196 ksteube 775 Computes a symmetric matrix (A + AT) / 2
197    
198     \param ev - Output - symmetric matrix
199    
200     */
201 gross 800 ESCRIPT_DLL_API
202 ksteube 775 virtual void
203     symmetric(DataAbstract* ev);
204    
205     /**
206     \brief
207     Computes a nonsymmetric matrix (A - AT) / 2
208    
209     \param ev - Output - nonsymmetric matrix
210    
211     */
212 gross 800 ESCRIPT_DLL_API
213 ksteube 775 virtual void
214     nonsymmetric(DataAbstract* ev);
215    
216     /**
217     \brief
218     Computes the trace of a matrix
219    
220     \param ev - Output - trace of matrix
221 jfenwick 2519 \param axis_offset
222 ksteube 775
223     */
224 gross 800 ESCRIPT_DLL_API
225 ksteube 775 virtual void
226 gross 800 trace(DataAbstract* ev, int axis_offset);
227 ksteube 775
228     /**
229     \brief
230     Transpose each data point of this Data object around the given axis.
231    
232     \param ev - Output - transpose of matrix
233 jfenwick 2519 \param axis_offset
234 ksteube 775 */
235 gross 800 ESCRIPT_DLL_API
236 ksteube 775 virtual void
237     transpose(DataAbstract* ev, int axis_offset);
238    
239     /**
240     \brief
241 gross 804 swaps components axis0 and axis1
242 gross 800
243     \param ev - Output - swapped components
244 jfenwick 2519 \param axis0
245     \param axis1
246 gross 800 */
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 jfenwick 2742 \brief invert square matricies
281     \param out - Where to store the results
282 jfenwick 2792 \return errorcode (0 indicates success)
283 jfenwick 2742 */
284     ESCRIPT_DLL_API
285 jfenwick 2792 virtual int
286 jfenwick 2742 matrixInverse(DataAbstract* out) const;
287    
288     /**
289 jfenwick 1796 \brief
290     Return a reference to the underlying DataVector.
291     */
292     ESCRIPT_DLL_API
293     DataTypes::ValueType&
294 jfenwick 2271 getVectorRW();
295 jfenwick 1796
296 jfenwick 2271
297 jfenwick 1796 ESCRIPT_DLL_API
298     const DataTypes::ValueType&
299 jfenwick 2271 getVectorRO() const;
300 jfenwick 1796
301 jgs 82 protected:
302    
303     private:
304     //
305 jgs 102 // the actual data
306 jfenwick 1796 DataTypes::ValueType m_data;
307 jgs 102
308 jgs 82 };
309    
310     } // end of namespace
311     #endif

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26