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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 4657 - (show 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
2 /*****************************************************************************
3 *
4 * Copyright (c) 2003-2014 by University of Queensland
5 * http://www.uq.edu.au
6 *
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 * Development until 2012 by Earth Systems Science Computational Center (ESSCC)
12 * Development 2012-2013 by School of Earth Sciences
13 * Development from 2014 by Centre for Geoscience Computing (GeoComp)
14 *
15 *****************************************************************************/
16
17
18 #if !defined escript_DataConstant_20040323_H
19 #define escript_DataConstant_20040323_H
20 #include "system_dep.h"
21
22 #include "DataReady.h"
23 #include "WrappedArray.h"
24
25
26 namespace escript {
27
28 /**
29 \brief
30 DataConstant stores a single data point which represents the entire
31 function space.
32
33 Description:
34 DataConstant stores a single data point which represents the entire
35 function space.
36 */
37 class DataConstant : public DataReady {
38 typedef DataReady parent;
39 public:
40
41 /**
42 \brief
43 Constructor for DataConstant objects.
44
45 Description:
46 Constructor for DataConstant objects.
47
48 \param value - Input - Data value for a single point.
49 \param what - Input - A description of what this data object represents.
50 */
51 ESCRIPT_DLL_API
52 DataConstant(const WrappedArray& value,
53 const FunctionSpace& what);
54
55
56 /**
57 \brief
58 Copy constructor. Performs a deep copy.
59 */
60 ESCRIPT_DLL_API
61 DataConstant(const DataConstant& other);
62
63
64 /**
65 \brief
66 Alternative constructor for DataConstant objects.
67
68 Description:
69 Alternative Constructor for DataConstant objects.
70 \param other - Input - Data object to copy from.
71 \param region - Input - region to copy.
72 */
73 ESCRIPT_DLL_API
74 DataConstant(const DataConstant& other,
75 const DataTypes::RegionType& region);
76
77 /**
78 \brief
79 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 ESCRIPT_DLL_API
88 DataConstant(const FunctionSpace& what,
89 const DataTypes::ShapeType &shape,
90 const DataTypes::ValueType &data);
91
92 ESCRIPT_DLL_API
93 DataConstant(const FunctionSpace& what,
94 const DataTypes::ShapeType &shape,
95 const double v);
96
97
98 ESCRIPT_DLL_API
99 bool
100 isConstant() const
101 {
102 return true;
103 };
104
105 /**
106 \brief Return true if the value contains a NaN.
107 */
108 ESCRIPT_DLL_API
109 bool
110 hasNaN() const;
111
112 /**
113 \brief
114 Write the data as a string.
115 */
116 ESCRIPT_DLL_API
117 std::string
118 toString() const;
119
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 /**
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
138 /**
139 \brief
140 sets all values to zero
141 */
142 ESCRIPT_DLL_API
143 virtual
144 void
145 setToZero();
146
147 /**
148 \brief
149 Return the offset for the given sample. This is a somewhat artificial notion
150 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 \param sampleNo - Input - sample number.
154 \param dataPointNo - Input - data point number for the sample.
155 */
156 ESCRIPT_DLL_API
157 virtual
158 DataTypes::ValueType::size_type
159 getPointOffset(int sampleNo,
160 int dataPointNo) const;
161
162 ESCRIPT_DLL_API
163 virtual
164 DataTypes::ValueType::size_type
165 getPointOffset(int sampleNo,
166 int dataPointNo);
167
168 /**
169 \brief
170 Return the number of doubles stored for the Data object.
171 */
172 ESCRIPT_DLL_API
173 virtual
174 DataTypes::ValueType::size_type
175 getLength() const;
176
177 /**
178 \brief
179 Factory method that returns a newly created DataConstant object
180 sliced from the specified region of this object.
181 The caller is reponsible for managing the object created.
182 \param region - Input - region to slice from this object.
183 */
184 ESCRIPT_DLL_API
185 virtual
186 DataAbstract*
187 getSlice(const DataTypes::RegionType& region) const;
188
189 /**
190 \brief
191 Copy the specified region from the given value.
192 \param value - Input - Data object to copy from.
193 \param region - Input - Region to copy.
194 */
195 ESCRIPT_DLL_API
196 virtual
197 void
198 setSlice(const DataAbstract* value,
199 const DataTypes::RegionType& region);
200
201
202 /**
203 \brief
204 Computes a symmetric matrix (A + AT) / 2
205
206 \param ev - Output - symmetric matrix
207
208 */
209 ESCRIPT_DLL_API
210 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 ESCRIPT_DLL_API
221 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 \param axis_offset
230
231 */
232 ESCRIPT_DLL_API
233 virtual void
234 trace(DataAbstract* ev, int axis_offset);
235
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 \param axis_offset
242 */
243 ESCRIPT_DLL_API
244 virtual void
245 transpose(DataAbstract* ev, int axis_offset);
246
247 /**
248 \brief
249 swaps components axis0 and axis1
250
251 \param ev - Output - swapped components
252 \param axis0
253 \param axis1
254 */
255 ESCRIPT_DLL_API
256 virtual void
257 swapaxes(DataAbstract* ev, int axis0, int axis1);
258
259
260 /**
261 \brief
262 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 ESCRIPT_DLL_API
268 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 ESCRIPT_DLL_API
283 virtual void
284 eigenvalues_and_eigenvectors(DataAbstract* ev,DataAbstract* V,const double tol=1.e-13);
285
286
287 /**
288 \brief invert square matricies
289 \param out - Where to store the results
290 \return errorcode (0 indicates success)
291 */
292 ESCRIPT_DLL_API
293 virtual int
294 matrixInverse(DataAbstract* out) const;
295
296 /**
297 \brief
298 Return a reference to the underlying DataVector.
299 */
300 ESCRIPT_DLL_API
301 DataTypes::ValueType&
302 getVectorRW();
303
304
305 ESCRIPT_DLL_API
306 const DataTypes::ValueType&
307 getVectorRO() const;
308
309 protected:
310
311 private:
312 //
313 // the actual data
314 DataTypes::ValueType m_data;
315
316 };
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