/[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 4657 - (hide annotations)
Thu Feb 6 06:12:20 2014 UTC (5 years, 5 months ago) by jfenwick
Original Path: trunk/escriptcore/src/DataConstant.h
File MIME type: text/plain
File size: 7170 byte(s)
I changed some files.
Updated copyright notices, added GeoComp.



1 jgs 480
2 jfenwick 3981 /*****************************************************************************
3 ksteube 1811 *
4 jfenwick 4657 * Copyright (c) 2003-2014 by University of Queensland
5 jfenwick 3981 * http://www.uq.edu.au
6 ksteube 1811 *
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 jfenwick 3981 * Development until 2012 by Earth Systems Science Computational Center (ESSCC)
12 jfenwick 4657 * Development 2012-2013 by School of Earth Sciences
13     * Development from 2014 by Centre for Geoscience Computing (GeoComp)
14 jfenwick 3981 *
15     *****************************************************************************/
16 ksteube 1312
17 ksteube 1811
18 jgs 102 #if !defined escript_DataConstant_20040323_H
19 jgs 82 #define escript_DataConstant_20040323_H
20 woo409 757 #include "system_dep.h"
21 jgs 82
22 jfenwick 2005 #include "DataReady.h"
23 jfenwick 2271 #include "WrappedArray.h"
24 jgs 82
25    
26     namespace escript {
27 jgs 102
28 jgs 82 /**
29     \brief
30 jgs 102 DataConstant stores a single data point which represents the entire
31 jgs 82 function space.
32    
33     Description:
34 jgs 102 DataConstant stores a single data point which represents the entire
35 jgs 82 function space.
36     */
37 jfenwick 2005 class DataConstant : public DataReady {
38     typedef DataReady parent;
39 jgs 82 public:
40    
41     /**
42     \brief
43 jgs 102 Constructor for DataConstant objects.
44 jgs 82
45     Description:
46 jgs 102 Constructor for DataConstant objects.
47 jgs 82
48 jgs 102 \param value - Input - Data value for a single point.
49     \param what - Input - A description of what this data object represents.
50     */
51 woo409 757 ESCRIPT_DLL_API
52 jfenwick 2271 DataConstant(const WrappedArray& value,
53 jgs 102 const FunctionSpace& what);
54 jgs 100
55 jfenwick 2271
56 jgs 82 /**
57     \brief
58     Copy constructor. Performs a deep copy.
59     */
60 woo409 757 ESCRIPT_DLL_API
61 jgs 82 DataConstant(const DataConstant& other);
62 jgs 102
63 jgs 82
64     /**
65     \brief
66 jgs 102 Alternative constructor for DataConstant objects.
67 jgs 82
68     Description:
69 jgs 102 Alternative Constructor for DataConstant objects.
70     \param other - Input - Data object to copy from.
71     \param region - Input - region to copy.
72 jgs 82 */
73 woo409 757 ESCRIPT_DLL_API
74 jgs 102 DataConstant(const DataConstant& other,
75 jfenwick 1796 const DataTypes::RegionType& region);
76 jgs 102
77 jgs 82 /**
78     \brief
79 jgs 119 Alternative constructor for DataConstant objects.
80    
81     Description:
82     Alternative Constructor for DataConstant objects.
83     \param what - Input - A description of what this data object represents.
84     \param shape - Input - the shape of each data-point.
85     \param data - the data values for each data-point.
86     */
87 woo409 757 ESCRIPT_DLL_API
88 jgs 119 DataConstant(const FunctionSpace& what,
89 jfenwick 1796 const DataTypes::ShapeType &shape,
90     const DataTypes::ValueType &data);
91 jgs 119
92 jfenwick 2005 ESCRIPT_DLL_API
93 jfenwick 3468 DataConstant(const FunctionSpace& what,
94     const DataTypes::ShapeType &shape,
95     const double v);
96    
97    
98     ESCRIPT_DLL_API
99 jfenwick 2005 bool
100     isConstant() const
101     {
102     return true;
103     };
104    
105 jgs 119 /**
106 jfenwick 2766 \brief Return true if the value contains a NaN.
107     */
108     ESCRIPT_DLL_API
109     bool
110     hasNaN() const;
111    
112     /**
113 jgs 119 \brief
114 jgs 82 Write the data as a string.
115     */
116 woo409 757 ESCRIPT_DLL_API
117 jgs 102 std::string
118     toString() const;
119 jfenwick 1799
120     /**
121     \brief Return a deep copy of the current object.
122     */
123     ESCRIPT_DLL_API
124     virtual
125     DataAbstract*
126     deepCopy();
127    
128    
129 gross 950 /**
130     \brief
131     dumps the object into a netCDF file
132     */
133     ESCRIPT_DLL_API
134     virtual
135     void
136     dump(const std::string fileName) const;
137 jgs 102
138 gross 1118 /**
139     \brief
140     sets all values to zero
141     */
142     ESCRIPT_DLL_API
143     virtual
144     void
145     setToZero();
146 gross 950
147 jgs 82 /**
148     \brief
149 jgs 102 Return the offset for the given sample. This is a somewhat artificial notion
150 jgs 82 but returns the offset in bytes for the given point into the container
151     holding the point data. Only really necessary to avoid many DataArrayView
152     objects.
153 jgs 102 \param sampleNo - Input - sample number.
154     \param dataPointNo - Input - data point number for the sample.
155 jgs 82 */
156 woo409 757 ESCRIPT_DLL_API
157 jgs 102 virtual
158 jfenwick 1796 DataTypes::ValueType::size_type
159 jgs 102 getPointOffset(int sampleNo,
160     int dataPointNo) const;
161    
162 jfenwick 2005 ESCRIPT_DLL_API
163     virtual
164     DataTypes::ValueType::size_type
165     getPointOffset(int sampleNo,
166     int dataPointNo);
167    
168 jgs 82 /**
169     \brief
170 jgs 102 Return the number of doubles stored for the Data object.
171 jgs 82 */
172 woo409 757 ESCRIPT_DLL_API
173 jgs 102 virtual
174 jfenwick 1796 DataTypes::ValueType::size_type
175 jgs 102 getLength() const;
176    
177 jgs 82 /**
178     \brief
179 jgs 102 Factory method that returns a newly created DataConstant object
180     sliced from the specified region of this object.
181 jgs 82 The caller is reponsible for managing the object created.
182 jgs 102 \param region - Input - region to slice from this object.
183 jgs 82 */
184 woo409 757 ESCRIPT_DLL_API
185 jgs 102 virtual
186     DataAbstract*
187 jfenwick 1796 getSlice(const DataTypes::RegionType& region) const;
188 jgs 102
189     /**
190 jgs 82 \brief
191     Copy the specified region from the given value.
192 jgs 102 \param value - Input - Data object to copy from.
193     \param region - Input - Region to copy.
194 jgs 82 */
195 woo409 757 ESCRIPT_DLL_API
196 jgs 102 virtual
197     void
198     setSlice(const DataAbstract* value,
199 jfenwick 1796 const DataTypes::RegionType& region);
200 jgs 102
201 jgs 123
202     /**
203 gross 580 \brief
204 ksteube 775 Computes a symmetric matrix (A + AT) / 2
205    
206     \param ev - Output - symmetric matrix
207    
208     */
209 gross 800 ESCRIPT_DLL_API
210 ksteube 775 virtual void
211     symmetric(DataAbstract* ev);
212    
213     /**
214     \brief
215     Computes a nonsymmetric matrix (A - AT) / 2
216    
217     \param ev - Output - nonsymmetric matrix
218    
219     */
220 gross 800 ESCRIPT_DLL_API
221 ksteube 775 virtual void
222     nonsymmetric(DataAbstract* ev);
223    
224     /**
225     \brief
226     Computes the trace of a matrix
227    
228     \param ev - Output - trace of matrix
229 jfenwick 2519 \param axis_offset
230 ksteube 775
231     */
232 gross 800 ESCRIPT_DLL_API
233 ksteube 775 virtual void
234 gross 800 trace(DataAbstract* ev, int axis_offset);
235 ksteube 775
236     /**
237     \brief
238     Transpose each data point of this Data object around the given axis.
239    
240     \param ev - Output - transpose of matrix
241 jfenwick 2519 \param axis_offset
242 ksteube 775 */
243 gross 800 ESCRIPT_DLL_API
244 ksteube 775 virtual void
245     transpose(DataAbstract* ev, int axis_offset);
246    
247     /**
248     \brief
249 gross 804 swaps components axis0 and axis1
250 gross 800
251     \param ev - Output - swapped components
252 jfenwick 2519 \param axis0
253     \param axis1
254 gross 800 */
255     ESCRIPT_DLL_API
256     virtual void
257 gross 804 swapaxes(DataAbstract* ev, int axis0, int axis1);
258 gross 800
259    
260     /**
261     \brief
262 gross 580 solves the eigenvalue problem this*V=ev*V for the eigenvalues ev
263    
264     \param ev - Output - eigenvalues in increasing order at each data point
265    
266     */
267 woo409 757 ESCRIPT_DLL_API
268 gross 580 virtual void
269     eigenvalues(DataAbstract* ev);
270    
271     /**
272     \brief
273     solves the eigenvalue problem this*V=ev*V for the eigenvalues ev and eigenvectors V
274    
275     \param ev - Output - eigenvalues in increasing order at each data point
276     \param V - Output - corresponding eigenvectors. They are normalized such that their length is one
277     and the first nonzero component is positive.
278     \param tol - Input - eigenvalue with relative distance tol are treated as equal.
279    
280     */
281    
282 woo409 757 ESCRIPT_DLL_API
283 gross 580 virtual void
284     eigenvalues_and_eigenvectors(DataAbstract* ev,DataAbstract* V,const double tol=1.e-13);
285    
286    
287 jfenwick 1796 /**
288 jfenwick 2742 \brief invert square matricies
289     \param out - Where to store the results
290 jfenwick 2792 \return errorcode (0 indicates success)
291 jfenwick 2742 */
292     ESCRIPT_DLL_API
293 jfenwick 2792 virtual int
294 jfenwick 2742 matrixInverse(DataAbstract* out) const;
295    
296     /**
297 jfenwick 1796 \brief
298     Return a reference to the underlying DataVector.
299     */
300     ESCRIPT_DLL_API
301     DataTypes::ValueType&
302 jfenwick 2271 getVectorRW();
303 jfenwick 1796
304 jfenwick 2271
305 jfenwick 1796 ESCRIPT_DLL_API
306     const DataTypes::ValueType&
307 jfenwick 2271 getVectorRO() const;
308 jfenwick 1796
309 jgs 82 protected:
310    
311     private:
312     //
313 jgs 102 // the actual data
314 jfenwick 1796 DataTypes::ValueType m_data;
315 jgs 102
316 jgs 82 };
317    
318     } // end of namespace
319     #endif

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26