1 |
jgs |
478 |
|
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 |
106 |
#if !defined escript_DataAbstract_20040315_H |
16 |
jgs |
82 |
#define escript_DataAbstract_20040315_H |
17 |
woo409 |
757 |
#include "system_dep.h" |
18 |
jgs |
82 |
|
19 |
jfenwick |
1796 |
#include "DataTypes.h" |
20 |
jgs |
474 |
#include "FunctionSpace.h" |
21 |
jgs |
82 |
|
22 |
|
|
#include <boost/scoped_ptr.hpp> |
23 |
jgs |
478 |
#include <boost/python/numeric.hpp> |
24 |
jgs |
480 |
|
25 |
jfenwick |
1803 |
#include "DataException.h" |
26 |
|
|
|
27 |
jgs |
82 |
#include <string> |
28 |
jgs |
480 |
#include <fstream> |
29 |
jgs |
82 |
|
30 |
jfenwick |
1872 |
#include "Pointers.h" |
31 |
|
|
|
32 |
jgs |
82 |
namespace escript { |
33 |
|
|
|
34 |
|
|
/** |
35 |
|
|
\brief |
36 |
jgs |
117 |
DataAbstract provides an abstract interface for the class of containers |
37 |
matt |
1325 |
which hold ESyS data. |
38 |
jgs |
82 |
|
39 |
|
|
Description: |
40 |
jgs |
117 |
DataAbstract provides an abstract interface for the class of containers |
41 |
jgs |
82 |
which hold ESyS data. The container may be thought of as a 2 dimensional |
42 |
jgs |
117 |
array of data points where one dimension corresponds to the number of samples |
43 |
|
|
and the other to the number of data points per sample as defined by the function |
44 |
|
|
space associated with each Data object. The data points themselves are arrays of |
45 |
|
|
doubles of rank 0-4. |
46 |
jgs |
82 |
*/ |
47 |
|
|
|
48 |
jfenwick |
1872 |
class DataAbstract; |
49 |
jgs |
82 |
|
50 |
jfenwick |
1872 |
typedef POINTER_WRAPPER_CLASS(DataAbstract) DataAbstract_ptr; |
51 |
|
|
typedef POINTER_WRAPPER_CLASS(const DataAbstract) const_DataAbstract_ptr; |
52 |
|
|
|
53 |
|
|
|
54 |
|
|
class DataAbstract : public REFCOUNT_BASE_CLASS(DataAbstract) |
55 |
|
|
{ |
56 |
|
|
|
57 |
jgs |
82 |
public: |
58 |
|
|
|
59 |
jfenwick |
1796 |
typedef DataTypes::ValueType ValueType; |
60 |
|
|
typedef DataTypes::ShapeType ShapeType; |
61 |
jgs |
82 |
|
62 |
jfenwick |
1872 |
ESCRIPT_DLL_API |
63 |
|
|
DataAbstract_ptr getPtr(); |
64 |
|
|
ESCRIPT_DLL_API |
65 |
|
|
const_DataAbstract_ptr getPtr() const; |
66 |
|
|
|
67 |
jgs |
82 |
/** |
68 |
|
|
\brief |
69 |
|
|
Constructor for DataAbstract. |
70 |
|
|
|
71 |
|
|
Description: |
72 |
|
|
Constructor for DataAbstract. |
73 |
jgs |
117 |
|
74 |
jgs |
82 |
\param what - Input - A description of what this data represents. |
75 |
|
|
*/ |
76 |
woo409 |
757 |
ESCRIPT_DLL_API |
77 |
jfenwick |
1803 |
DataAbstract(const FunctionSpace& what, const ShapeType& shape, bool isDataEmpty=false); |
78 |
jgs |
82 |
|
79 |
|
|
/** |
80 |
|
|
\brief |
81 |
|
|
Destructor for DataAbstract. |
82 |
|
|
*/ |
83 |
woo409 |
757 |
ESCRIPT_DLL_API |
84 |
jgs |
106 |
virtual |
85 |
|
|
~DataAbstract(); |
86 |
jgs |
82 |
|
87 |
|
|
/** |
88 |
|
|
\brief |
89 |
|
|
Write the data as a string. |
90 |
|
|
*/ |
91 |
woo409 |
757 |
ESCRIPT_DLL_API |
92 |
jgs |
82 |
virtual |
93 |
|
|
std::string |
94 |
|
|
toString() const = 0; |
95 |
|
|
|
96 |
jfenwick |
1799 |
/** |
97 |
|
|
\brief Return a deep copy of the current object. |
98 |
|
|
*/ |
99 |
|
|
ESCRIPT_DLL_API |
100 |
|
|
virtual |
101 |
|
|
DataAbstract* |
102 |
|
|
deepCopy()=0; |
103 |
|
|
|
104 |
gross |
950 |
/** |
105 |
|
|
\brief |
106 |
|
|
dumps the object into a netCDF file |
107 |
|
|
*/ |
108 |
|
|
ESCRIPT_DLL_API |
109 |
|
|
virtual |
110 |
|
|
void |
111 |
|
|
dump(const std::string fileName) const; |
112 |
|
|
|
113 |
jgs |
82 |
/** |
114 |
|
|
\brief |
115 |
|
|
Return the number of data points per sample. |
116 |
|
|
*/ |
117 |
woo409 |
757 |
ESCRIPT_DLL_API |
118 |
jgs |
82 |
int |
119 |
|
|
getNumDPPSample() const; |
120 |
|
|
|
121 |
|
|
/** |
122 |
|
|
\brief |
123 |
|
|
Return the number of samples. |
124 |
|
|
*/ |
125 |
woo409 |
757 |
ESCRIPT_DLL_API |
126 |
jgs |
82 |
int |
127 |
|
|
getNumSamples() const; |
128 |
|
|
|
129 |
|
|
/** |
130 |
jfenwick |
1796 |
\brief |
131 |
|
|
Return the shape information for the point data. |
132 |
|
|
|
133 |
|
|
The omission of a non-constant form is deliberate. |
134 |
jgs |
82 |
*/ |
135 |
woo409 |
757 |
ESCRIPT_DLL_API |
136 |
jfenwick |
1796 |
const DataTypes::ShapeType& |
137 |
|
|
getShape() const; |
138 |
jgs |
117 |
|
139 |
jfenwick |
1796 |
/** |
140 |
|
|
\brief |
141 |
|
|
Return the rank information for the point data. |
142 |
|
|
*/ |
143 |
woo409 |
757 |
ESCRIPT_DLL_API |
144 |
jfenwick |
1952 |
unsigned int |
145 |
jfenwick |
1796 |
getRank() const; |
146 |
jgs |
82 |
|
147 |
jfenwick |
1796 |
|
148 |
|
|
|
149 |
jgs |
82 |
/** |
150 |
|
|
\brief |
151 |
jgs |
117 |
Return the offset for the given sample. This returns the offset for the given |
152 |
|
|
point into the container holding the point data. Only really necessary to |
153 |
|
|
avoid creating many DataArrayView objects. |
154 |
|
|
|
155 |
jgs |
82 |
\param sampleNo - Input - sample number. |
156 |
jgs |
117 |
\param dataPointNo - Input - data point number. |
157 |
jgs |
82 |
*/ |
158 |
woo409 |
757 |
ESCRIPT_DLL_API |
159 |
jgs |
82 |
virtual |
160 |
|
|
ValueType::size_type |
161 |
|
|
getPointOffset(int sampleNo, |
162 |
|
|
int dataPointNo) const = 0; |
163 |
|
|
|
164 |
jfenwick |
1796 |
// /** |
165 |
|
|
// return the container storing points for this object |
166 |
|
|
// */ |
167 |
|
|
// ESCRIPT_DLL_API |
168 |
|
|
// virtual |
169 |
|
|
// ValueType& |
170 |
|
|
// getVector(); |
171 |
|
|
// |
172 |
|
|
// ESCRIPT_DLL_API |
173 |
|
|
// virtual |
174 |
|
|
// const ValueType& |
175 |
|
|
// getVector() const; |
176 |
|
|
|
177 |
|
|
|
178 |
jgs |
82 |
/** |
179 |
|
|
\brief |
180 |
jgs |
117 |
Return the sample data for the given sample number. |
181 |
jgs |
82 |
*/ |
182 |
woo409 |
757 |
ESCRIPT_DLL_API |
183 |
jgs |
82 |
double* |
184 |
|
|
getSampleData(ValueType::size_type sampleNo); |
185 |
|
|
|
186 |
|
|
/** |
187 |
|
|
\brief |
188 |
jgs |
117 |
Return the number of doubles stored for this Data object. |
189 |
jgs |
82 |
*/ |
190 |
woo409 |
757 |
ESCRIPT_DLL_API |
191 |
jgs |
82 |
virtual |
192 |
|
|
ValueType::size_type |
193 |
|
|
getLength() const = 0; |
194 |
|
|
|
195 |
|
|
/** |
196 |
|
|
\brief |
197 |
|
|
Return the sample data for the given tag key. |
198 |
|
|
NB: If the data isn't tagged an exception will be thrown. |
199 |
|
|
*/ |
200 |
woo409 |
757 |
ESCRIPT_DLL_API |
201 |
jgs |
82 |
virtual |
202 |
|
|
double* |
203 |
|
|
getSampleDataByTag(int tag); |
204 |
|
|
|
205 |
jgs |
110 |
|
206 |
|
|
/** |
207 |
|
|
\brief |
208 |
jgs |
117 |
Check this and the given RHS operands are compatible. Throws |
209 |
jgs |
82 |
an exception if they aren't. |
210 |
jgs |
117 |
|
211 |
jgs |
82 |
\param right - Input - The right hand side. |
212 |
|
|
*/ |
213 |
woo409 |
757 |
ESCRIPT_DLL_API |
214 |
jgs |
82 |
void |
215 |
|
|
operandCheck(const DataAbstract& right) const; |
216 |
|
|
|
217 |
|
|
/** |
218 |
|
|
\brief |
219 |
|
|
Return true if a valid sample point number. |
220 |
|
|
*/ |
221 |
woo409 |
757 |
ESCRIPT_DLL_API |
222 |
jgs |
82 |
bool |
223 |
|
|
validSamplePointNo(int samplePointNo) const; |
224 |
|
|
|
225 |
|
|
/** |
226 |
|
|
\brief |
227 |
jgs |
117 |
Return true if a valid sample number. |
228 |
jgs |
82 |
*/ |
229 |
woo409 |
757 |
ESCRIPT_DLL_API |
230 |
jgs |
82 |
bool |
231 |
|
|
validSampleNo(int sampleNo) const; |
232 |
matt |
1325 |
|
233 |
jgs |
117 |
|
234 |
jgs |
82 |
/** |
235 |
|
|
\brief |
236 |
jgs |
117 |
Return the function space associated with this Data object. |
237 |
jgs |
82 |
*/ |
238 |
woo409 |
757 |
ESCRIPT_DLL_API |
239 |
jgs |
117 |
const |
240 |
|
|
FunctionSpace& |
241 |
jgs |
82 |
getFunctionSpace() const; |
242 |
|
|
|
243 |
|
|
/** |
244 |
|
|
\brief |
245 |
jgs |
117 |
Return the given slice from this object. |
246 |
|
|
|
247 |
|
|
NB: The caller is responsible for managing the object created. |
248 |
jgs |
82 |
*/ |
249 |
woo409 |
757 |
ESCRIPT_DLL_API |
250 |
jgs |
82 |
virtual |
251 |
|
|
DataAbstract* |
252 |
jfenwick |
1796 |
getSlice(const DataTypes::RegionType& region) const = 0; |
253 |
jgs |
82 |
|
254 |
|
|
/** |
255 |
|
|
\brief |
256 |
jgs |
117 |
Copy the specified region from the given object. |
257 |
|
|
|
258 |
jgs |
82 |
\param value - Input - Data to copy from |
259 |
|
|
\param region - Input - Region to copy. |
260 |
|
|
*/ |
261 |
woo409 |
757 |
ESCRIPT_DLL_API |
262 |
jgs |
82 |
virtual |
263 |
|
|
void |
264 |
|
|
setSlice(const DataAbstract* value, |
265 |
jfenwick |
1796 |
const DataTypes::RegionType& region) = 0; |
266 |
jgs |
82 |
|
267 |
|
|
/** |
268 |
|
|
\brief |
269 |
|
|
setTaggedValue |
270 |
matt |
1325 |
|
271 |
jgs |
82 |
Description: |
272 |
|
|
Assign the given value to the given tag. |
273 |
jgs |
117 |
|
274 |
|
|
NB: If the data isn't tagged an exception will be thrown. |
275 |
|
|
|
276 |
jgs |
82 |
\param tagKey - Input - Integer key. |
277 |
jfenwick |
1796 |
\param pointshape - Input - the shape of the value parameter. |
278 |
|
|
\param value - Input - |
279 |
jgs |
82 |
*/ |
280 |
woo409 |
757 |
ESCRIPT_DLL_API |
281 |
jgs |
82 |
virtual |
282 |
|
|
void |
283 |
|
|
setTaggedValue(int tagKey, |
284 |
jfenwick |
1796 |
const DataTypes::ShapeType& pointshape, |
285 |
|
|
const DataTypes::ValueType& value, |
286 |
|
|
int dataOffset=0); |
287 |
jgs |
82 |
|
288 |
jgs |
123 |
|
289 |
|
|
|
290 |
|
|
|
291 |
jgs |
126 |
/** |
292 |
|
|
\brief |
293 |
|
|
Copy the numarray object to the data points in this object. |
294 |
|
|
|
295 |
|
|
Description: |
296 |
|
|
Copy the numarray object to the data points in this object. |
297 |
|
|
|
298 |
|
|
\param value Input - new values for the data points |
299 |
|
|
*/ |
300 |
woo409 |
757 |
ESCRIPT_DLL_API |
301 |
jgs |
126 |
virtual void |
302 |
|
|
copyAll(const boost::python::numeric::array& value); |
303 |
|
|
|
304 |
jgs |
149 |
/** |
305 |
|
|
\brief |
306 |
gross |
922 |
Copy a double value to the data point dataPointNo of sample sampleNo in this object. |
307 |
|
|
|
308 |
|
|
Description: |
309 |
|
|
Copy a double value to the data point dataPointNo of sample sampleNo in this object. |
310 |
|
|
|
311 |
|
|
\param sampleNo Input - sample number |
312 |
|
|
\param dataPointNo Input - data point of the sample |
313 |
|
|
\param value Input - new values for the data point |
314 |
|
|
*/ |
315 |
|
|
ESCRIPT_DLL_API |
316 |
|
|
virtual void |
317 |
|
|
copyToDataPoint(const int sampleNo, const int dataPointNo, const double value); |
318 |
|
|
|
319 |
|
|
/** |
320 |
|
|
\brief |
321 |
gross |
921 |
Copy the numarray object to the data point dataPointNo of sample sampleNo in this object. |
322 |
|
|
|
323 |
|
|
Description: |
324 |
|
|
Copy the numarray object to the data point dataPointNo of sample sampleNo in this object. |
325 |
|
|
|
326 |
|
|
\param sampleNo Input - sample number |
327 |
|
|
\param dataPointNo Input - data point of the sample |
328 |
|
|
\param value Input - new values for the data point |
329 |
|
|
*/ |
330 |
|
|
ESCRIPT_DLL_API |
331 |
|
|
virtual void |
332 |
|
|
copyToDataPoint(const int sampleNo, const int dataPointNo, const boost::python::numeric::array& value); |
333 |
|
|
|
334 |
|
|
|
335 |
|
|
/** |
336 |
|
|
\brief |
337 |
jgs |
149 |
Return the tag number associated with the given data-point number. |
338 |
jgs |
126 |
|
339 |
jgs |
149 |
If the object cannot be referenced by tag numbers, an exception |
340 |
|
|
will be thrown. |
341 |
|
|
*/ |
342 |
woo409 |
757 |
ESCRIPT_DLL_API |
343 |
jgs |
149 |
virtual |
344 |
|
|
int |
345 |
|
|
getTagNumber(int dpno); |
346 |
|
|
|
347 |
gross |
576 |
/** |
348 |
|
|
\brief |
349 |
ksteube |
775 |
Computes a symmetric matrix (A + AT) / 2 |
350 |
|
|
|
351 |
|
|
\param ev - Output - a symmetric matrix |
352 |
|
|
|
353 |
|
|
*/ |
354 |
gross |
800 |
ESCRIPT_DLL_API |
355 |
ksteube |
775 |
virtual void |
356 |
|
|
symmetric(DataAbstract* ev); |
357 |
|
|
|
358 |
|
|
/** |
359 |
|
|
\brief |
360 |
|
|
Computes a nonsymmetric matrix (A - AT) / 2 |
361 |
|
|
|
362 |
|
|
\param ev - Output - a nonsymmetric matrix |
363 |
|
|
|
364 |
|
|
*/ |
365 |
gross |
800 |
ESCRIPT_DLL_API |
366 |
ksteube |
775 |
virtual void |
367 |
|
|
nonsymmetric(DataAbstract* ev); |
368 |
|
|
|
369 |
|
|
/** |
370 |
|
|
\brief |
371 |
|
|
Computes the trace of a matrix |
372 |
|
|
|
373 |
|
|
\param ev - Output - the trace of a matrix |
374 |
|
|
|
375 |
|
|
*/ |
376 |
gross |
800 |
ESCRIPT_DLL_API |
377 |
ksteube |
775 |
virtual void |
378 |
gross |
800 |
trace(DataAbstract* ev, int axis_offset); |
379 |
ksteube |
775 |
|
380 |
|
|
/** |
381 |
|
|
\brief |
382 |
|
|
Transpose each data point of this Data object around the given axis. |
383 |
|
|
|
384 |
|
|
\param ev - Output - the transpose of a matrix |
385 |
|
|
|
386 |
|
|
*/ |
387 |
gross |
800 |
ESCRIPT_DLL_API |
388 |
ksteube |
775 |
virtual void |
389 |
|
|
transpose(DataAbstract* ev, int axis_offset); |
390 |
|
|
|
391 |
|
|
/** |
392 |
|
|
\brief |
393 |
gross |
804 |
swaps components axis0 and axis1 |
394 |
gross |
800 |
|
395 |
|
|
\param ev - Output - swapped components |
396 |
|
|
|
397 |
|
|
*/ |
398 |
|
|
ESCRIPT_DLL_API |
399 |
|
|
virtual void |
400 |
gross |
804 |
swapaxes(DataAbstract* ev, int axis0, int axis1); |
401 |
gross |
800 |
/** |
402 |
|
|
\brief |
403 |
gross |
576 |
solves the eigenvalue problem this*V=ev*V for the eigenvalues ev |
404 |
|
|
|
405 |
|
|
\param ev - Output - eigenvalues in increasing order at each data point |
406 |
|
|
|
407 |
|
|
*/ |
408 |
woo409 |
757 |
ESCRIPT_DLL_API |
409 |
gross |
576 |
virtual void |
410 |
|
|
eigenvalues(DataAbstract* ev); |
411 |
|
|
|
412 |
|
|
/** |
413 |
|
|
\brief |
414 |
gross |
1118 |
sets values to zero |
415 |
|
|
|
416 |
|
|
*/ |
417 |
|
|
ESCRIPT_DLL_API |
418 |
|
|
virtual void |
419 |
|
|
setToZero(); |
420 |
|
|
|
421 |
|
|
/** |
422 |
|
|
\brief |
423 |
gross |
576 |
solves the eigenvalue problem this*V=ev*V for the eigenvalues ev and eigenvectors V |
424 |
|
|
|
425 |
|
|
\param ev - Output - eigenvalues in increasing order at each data point |
426 |
|
|
\param V - Output - corresponding eigenvectors. They are normalized such that their length is one |
427 |
|
|
and the first nonzero component is positive. |
428 |
|
|
\param tol - Input - eigenvalue with relative distance tol are treated as equal. |
429 |
|
|
|
430 |
|
|
*/ |
431 |
|
|
|
432 |
woo409 |
757 |
ESCRIPT_DLL_API |
433 |
gross |
576 |
virtual void |
434 |
|
|
eigenvalues_and_eigenvectors(DataAbstract* ev,DataAbstract* V,const double tol=1.e-13); |
435 |
|
|
|
436 |
gross |
1487 |
/** |
437 |
|
|
\brief |
438 |
|
|
reorders data sample ordered by reference_ids to the ordering of the functions space |
439 |
|
|
|
440 |
|
|
\param reference_ids - Input - reference_ids used for current ordering |
441 |
|
|
*/ |
442 |
|
|
ESCRIPT_DLL_API |
443 |
|
|
virtual void |
444 |
|
|
reorderByReferenceIDs(int *reference_ids); |
445 |
|
|
|
446 |
jgs |
82 |
|
447 |
jfenwick |
1796 |
|
448 |
jgs |
82 |
/** |
449 |
jfenwick |
1796 |
\brief |
450 |
|
|
Return the number of values in the shape for this object. |
451 |
|
|
*/ |
452 |
|
|
ESCRIPT_DLL_API |
453 |
|
|
int |
454 |
|
|
getNoValues() const; |
455 |
jgs |
117 |
|
456 |
jfenwick |
1796 |
|
457 |
|
|
|
458 |
|
|
/** |
459 |
|
|
\brief get a reference to the beginning of a data point |
460 |
jgs |
82 |
*/ |
461 |
woo409 |
757 |
ESCRIPT_DLL_API |
462 |
jfenwick |
1796 |
DataTypes::ValueType::const_reference |
463 |
|
|
getDataAtOffset(DataTypes::ValueType::size_type i) const; |
464 |
jgs |
82 |
|
465 |
jfenwick |
1796 |
|
466 |
woo409 |
757 |
ESCRIPT_DLL_API |
467 |
jfenwick |
1796 |
DataTypes::ValueType::reference |
468 |
|
|
getDataAtOffset(DataTypes::ValueType::size_type i); |
469 |
jgs |
119 |
|
470 |
gross |
1487 |
|
471 |
jfenwick |
1796 |
/** |
472 |
|
|
\brief Provide access to underlying storage. Internal use only! |
473 |
|
|
*/ |
474 |
|
|
ESCRIPT_DLL_API |
475 |
|
|
virtual DataTypes::ValueType& |
476 |
|
|
getVector()=0; |
477 |
gross |
1487 |
|
478 |
jfenwick |
1796 |
ESCRIPT_DLL_API |
479 |
|
|
virtual const DataTypes::ValueType& |
480 |
|
|
getVector() const=0; |
481 |
|
|
|
482 |
jfenwick |
1897 |
ESCRIPT_DLL_API |
483 |
|
|
bool isEmpty() const; // a fast test to determine if this object is an instance of DataEmpty |
484 |
|
|
|
485 |
jfenwick |
1796 |
protected: |
486 |
|
|
|
487 |
|
|
|
488 |
|
|
|
489 |
|
|
|
490 |
|
|
|
491 |
jfenwick |
1897 |
|
492 |
jgs |
82 |
private: |
493 |
|
|
|
494 |
jgs |
117 |
// |
495 |
|
|
// The number of samples in this Data object. |
496 |
|
|
// This is derived directly from the FunctionSpace. |
497 |
jgs |
82 |
int m_noSamples; |
498 |
|
|
|
499 |
|
|
// |
500 |
jgs |
117 |
// The number of data points per sample in this Data object. |
501 |
|
|
// This is derived directly from the FunctionSpace. |
502 |
|
|
int m_noDataPointsPerSample; |
503 |
|
|
|
504 |
|
|
// |
505 |
|
|
// A FunctionSpace which provides a description of the data associated |
506 |
|
|
// with this Data object. |
507 |
jgs |
82 |
FunctionSpace m_functionSpace; |
508 |
|
|
|
509 |
jfenwick |
1796 |
// |
510 |
|
|
// The shape of the points stored in this view |
511 |
|
|
DataTypes::ShapeType m_shape; |
512 |
|
|
|
513 |
|
|
// |
514 |
|
|
// The number of values in each point |
515 |
|
|
int m_novalues; |
516 |
|
|
|
517 |
|
|
// |
518 |
|
|
// The rank of the points stored in this view |
519 |
jfenwick |
1952 |
unsigned int m_rank; |
520 |
jfenwick |
1796 |
|
521 |
jfenwick |
1803 |
// |
522 |
|
|
// Is this an instance of DataEmpty? |
523 |
|
|
bool m_isempty; |
524 |
jgs |
82 |
}; |
525 |
|
|
|
526 |
jfenwick |
1796 |
|
527 |
jgs |
82 |
inline |
528 |
jfenwick |
1803 |
bool |
529 |
|
|
DataAbstract::isEmpty() const |
530 |
|
|
{ |
531 |
|
|
return m_isempty; |
532 |
|
|
} |
533 |
|
|
|
534 |
|
|
|
535 |
|
|
inline |
536 |
jfenwick |
1796 |
DataTypes::ValueType::const_reference |
537 |
|
|
DataAbstract::getDataAtOffset(DataTypes::ValueType::size_type i) const |
538 |
|
|
{ |
539 |
|
|
return getVector()[i]; |
540 |
|
|
} |
541 |
|
|
|
542 |
|
|
inline |
543 |
|
|
DataTypes::ValueType::reference |
544 |
|
|
DataAbstract::getDataAtOffset(DataTypes::ValueType::size_type i) |
545 |
|
|
{ |
546 |
|
|
return getVector()[i]; |
547 |
|
|
} |
548 |
|
|
|
549 |
|
|
|
550 |
|
|
inline |
551 |
jgs |
82 |
bool |
552 |
matt |
1325 |
DataAbstract::validSamplePointNo(int samplePointNo) const |
553 |
jgs |
82 |
{ |
554 |
|
|
return ((0 <= samplePointNo) && (samplePointNo < m_noDataPointsPerSample)); |
555 |
|
|
} |
556 |
|
|
|
557 |
|
|
inline |
558 |
|
|
bool |
559 |
|
|
DataAbstract::validSampleNo(int sampleNo) const |
560 |
|
|
{ |
561 |
|
|
return ((0 <= sampleNo) && (sampleNo < m_noSamples)); |
562 |
|
|
} |
563 |
|
|
|
564 |
|
|
inline |
565 |
|
|
DataAbstract::ValueType::value_type* |
566 |
|
|
DataAbstract::getSampleData(ValueType::size_type sampleNo) |
567 |
|
|
{ |
568 |
jfenwick |
1796 |
// return &(m_pointDataView->getData(getPointOffset(sampleNo,0))); |
569 |
|
|
return &(getVector()[getPointOffset(sampleNo,0)]); |
570 |
jgs |
82 |
} |
571 |
|
|
|
572 |
|
|
inline |
573 |
|
|
int |
574 |
matt |
1325 |
DataAbstract::getNumDPPSample() const |
575 |
jgs |
82 |
{ |
576 |
jfenwick |
1803 |
if (isEmpty()) |
577 |
|
|
{ |
578 |
|
|
throw DataException("Error - Operations not permitted on instances of DataEmpty."); |
579 |
|
|
} |
580 |
jgs |
82 |
return m_noDataPointsPerSample; |
581 |
|
|
} |
582 |
|
|
|
583 |
|
|
inline |
584 |
|
|
int |
585 |
|
|
DataAbstract::getNumSamples() const |
586 |
|
|
{ |
587 |
jfenwick |
1803 |
if (isEmpty()) |
588 |
|
|
{ |
589 |
|
|
throw DataException("Error - Operations not permitted on instances of DataEmpty."); |
590 |
|
|
} |
591 |
jgs |
82 |
return m_noSamples; |
592 |
|
|
} |
593 |
|
|
|
594 |
|
|
inline |
595 |
jgs |
106 |
const |
596 |
|
|
FunctionSpace& |
597 |
jgs |
82 |
DataAbstract::getFunctionSpace() const |
598 |
|
|
{ |
599 |
|
|
return m_functionSpace; |
600 |
|
|
} |
601 |
|
|
|
602 |
|
|
inline |
603 |
jfenwick |
1796 |
const DataTypes::ShapeType& |
604 |
|
|
DataAbstract::getShape() const |
605 |
jgs |
82 |
{ |
606 |
jfenwick |
1803 |
if (isEmpty()) |
607 |
|
|
{ |
608 |
|
|
throw DataException("Error - Operations not permitted on instances of DataEmpty."); |
609 |
|
|
} |
610 |
jfenwick |
1796 |
return m_shape; |
611 |
jgs |
82 |
} |
612 |
|
|
|
613 |
jfenwick |
1796 |
inline |
614 |
jfenwick |
1952 |
unsigned int |
615 |
jfenwick |
1796 |
DataAbstract::getRank() const |
616 |
|
|
{ |
617 |
jfenwick |
1803 |
if (isEmpty()) |
618 |
|
|
{ |
619 |
|
|
throw DataException("Error - Operations not permitted on instances of DataEmpty."); |
620 |
|
|
} |
621 |
jfenwick |
1796 |
return m_rank; |
622 |
|
|
} |
623 |
|
|
|
624 |
jgs |
82 |
inline |
625 |
jfenwick |
1796 |
int |
626 |
|
|
DataAbstract::getNoValues() const |
627 |
jfenwick |
1803 |
{ |
628 |
|
|
if (isEmpty()) |
629 |
|
|
{ |
630 |
|
|
throw DataException("Error - Operations not permitted on instances of DataEmpty."); |
631 |
|
|
} |
632 |
jfenwick |
1796 |
return m_novalues; |
633 |
jgs |
82 |
} |
634 |
jfenwick |
1796 |
|
635 |
jfenwick |
1803 |
|
636 |
jgs |
82 |
} // end of namespace |
637 |
jgs |
117 |
|
638 |
jgs |
82 |
#endif |