1 |
// $Id$ |
/* $Id$ */ |
|
/* |
|
|
************************************************************ |
|
|
* Copyright 2006 by ACcESS MNRF * |
|
|
* * |
|
|
* http://www.access.edu.au * |
|
|
* Primary Business: Queensland, Australia * |
|
|
* Licensed under the Open Software License version 3.0 * |
|
|
* http://www.opensource.org/licenses/osl-3.0.php * |
|
|
* * |
|
|
************************************************************ |
|
2 |
|
|
3 |
*/ |
/******************************************************* |
4 |
|
* |
5 |
|
* Copyright 2003-2007 by ACceSS MNRF |
6 |
|
* Copyright 2007 by University of Queensland |
7 |
|
* |
8 |
|
* http://esscc.uq.edu.au |
9 |
|
* Primary Business: Queensland, Australia |
10 |
|
* Licensed under the Open Software License version 3.0 |
11 |
|
* http://www.opensource.org/licenses/osl-3.0.php |
12 |
|
* |
13 |
|
*******************************************************/ |
14 |
|
|
15 |
#if !defined escript_DataAbstract_20040315_H |
#if !defined escript_DataAbstract_20040315_H |
16 |
#define escript_DataAbstract_20040315_H |
#define escript_DataAbstract_20040315_H |
17 |
#include "system_dep.h" |
#include "system_dep.h" |
18 |
|
|
19 |
#include "DataArrayView.h" |
#include "DataArrayView.h" |
|
#include "DataArray.h" |
|
20 |
#include "FunctionSpace.h" |
#include "FunctionSpace.h" |
21 |
|
|
22 |
#include <boost/scoped_ptr.hpp> |
#include <boost/scoped_ptr.hpp> |
30 |
/** |
/** |
31 |
\brief |
\brief |
32 |
DataAbstract provides an abstract interface for the class of containers |
DataAbstract provides an abstract interface for the class of containers |
33 |
which hold ESyS data. |
which hold ESyS data. |
34 |
|
|
35 |
Description: |
Description: |
36 |
DataAbstract provides an abstract interface for the class of containers |
DataAbstract provides an abstract interface for the class of containers |
77 |
std::string |
std::string |
78 |
toString() const = 0; |
toString() const = 0; |
79 |
|
|
80 |
|
/** |
81 |
|
\brief |
82 |
|
dumps the object into a netCDF file |
83 |
|
*/ |
84 |
|
ESCRIPT_DLL_API |
85 |
|
virtual |
86 |
|
void |
87 |
|
dump(const std::string fileName) const; |
88 |
|
|
89 |
/** |
/** |
90 |
\brief |
\brief |
91 |
Return the number of data points per sample. |
Return the number of data points per sample. |
104 |
|
|
105 |
/** |
/** |
106 |
\brief |
\brief |
107 |
Return the DataArrayView of the point data. This essentially contains |
Return the DataArrayView of the point data. This essentially contains |
108 |
the shape information for each data point although it also may be used |
the shape information for each data point although it also may be used |
109 |
to manipulate the point data. |
to manipulate the point data. |
110 |
*/ |
*/ |
158 |
double* |
double* |
159 |
getSampleDataByTag(int tag); |
getSampleDataByTag(int tag); |
160 |
|
|
|
/** |
|
|
\brief |
|
|
Assign the given value to the data-points(s) referenced by the given |
|
|
reference number. |
|
|
|
|
|
If this Data object cannot be accessed by reference numbers an |
|
|
exception will be thrown. |
|
|
|
|
|
\param ref - Input - reference number. |
|
|
\param value - Input - value to assign to data-points associated with |
|
|
the given reference number. |
|
|
*/ |
|
|
ESCRIPT_DLL_API |
|
|
virtual |
|
|
void |
|
|
setRefValue(int ref, |
|
|
const DataArray& value); |
|
|
|
|
|
/** |
|
|
\brief |
|
|
Return the values associated with the data-point(s) referenced by the given |
|
|
reference number. |
|
|
|
|
|
If this Data object cannot be accessed by reference numbers an |
|
|
exception will be thrown. |
|
|
|
|
|
\param ref - Input - reference number. |
|
|
\param value - Output - object to receive data-points associated with |
|
|
the given reference number. |
|
|
*/ |
|
|
ESCRIPT_DLL_API |
|
|
virtual |
|
|
void |
|
|
getRefValue(int ref, |
|
|
DataArray& value); |
|
161 |
|
|
162 |
/** |
/** |
163 |
\brief |
\brief |
185 |
ESCRIPT_DLL_API |
ESCRIPT_DLL_API |
186 |
bool |
bool |
187 |
validSampleNo(int sampleNo) const; |
validSampleNo(int sampleNo) const; |
188 |
|
|
189 |
/** |
/** |
190 |
\brief |
\brief |
191 |
Return a view into the data for the data point specified. |
Return a view into the data for the data point specified. |
192 |
NOTE: Construction of the DataArrayView is a relatively expensive |
NOTE: Construction of the DataArrayView is a relatively expensive |
193 |
operation. |
operation. |
194 |
|
|
195 |
\param sampleNo - Input - the sample number. |
\param sampleNo - Input - the sample number. |
234 |
setSlice(const DataAbstract* value, |
setSlice(const DataAbstract* value, |
235 |
const DataArrayView::RegionType& region) = 0; |
const DataArrayView::RegionType& region) = 0; |
236 |
|
|
|
/** |
|
|
\brief |
|
|
Reshape the data points if they are currently rank 0. |
|
|
Will throw an exception if the data points are not rank 0. |
|
|
The original data point value is used for all values of the new |
|
|
data point. |
|
|
*/ |
|
|
ESCRIPT_DLL_API |
|
|
virtual |
|
|
void |
|
|
reshapeDataPoint(const ShapeType& shape) = 0; |
|
237 |
|
|
238 |
/** |
/** |
239 |
\brief |
\brief |
240 |
setTaggedValue |
setTaggedValue |
241 |
|
|
242 |
Description: |
Description: |
243 |
Assign the given value to the given tag. |
Assign the given value to the given tag. |
244 |
|
|
295 |
|
|
296 |
/** |
/** |
297 |
\brief |
\brief |
298 |
|
Copy a double value to the data point dataPointNo of sample sampleNo in this object. |
299 |
|
|
300 |
|
Description: |
301 |
|
Copy a double value to the data point dataPointNo of sample sampleNo in this object. |
302 |
|
|
303 |
|
\param sampleNo Input - sample number |
304 |
|
\param dataPointNo Input - data point of the sample |
305 |
|
\param value Input - new values for the data point |
306 |
|
*/ |
307 |
|
ESCRIPT_DLL_API |
308 |
|
virtual void |
309 |
|
copyToDataPoint(const int sampleNo, const int dataPointNo, const double value); |
310 |
|
|
311 |
|
/** |
312 |
|
\brief |
313 |
|
Copy the numarray object to the data point dataPointNo of sample sampleNo in this object. |
314 |
|
|
315 |
|
Description: |
316 |
|
Copy the numarray object to the data point dataPointNo of sample sampleNo in this object. |
317 |
|
|
318 |
|
\param sampleNo Input - sample number |
319 |
|
\param dataPointNo Input - data point of the sample |
320 |
|
\param value Input - new values for the data point |
321 |
|
*/ |
322 |
|
ESCRIPT_DLL_API |
323 |
|
virtual void |
324 |
|
copyToDataPoint(const int sampleNo, const int dataPointNo, const boost::python::numeric::array& value); |
325 |
|
|
326 |
|
|
327 |
|
/** |
328 |
|
\brief |
329 |
Return the tag number associated with the given data-point number. |
Return the tag number associated with the given data-point number. |
330 |
|
|
331 |
If the object cannot be referenced by tag numbers, an exception |
If the object cannot be referenced by tag numbers, an exception |
343 |
\param ev - Output - a symmetric matrix |
\param ev - Output - a symmetric matrix |
344 |
|
|
345 |
*/ |
*/ |
346 |
|
ESCRIPT_DLL_API |
347 |
virtual void |
virtual void |
348 |
symmetric(DataAbstract* ev); |
symmetric(DataAbstract* ev); |
349 |
|
|
354 |
\param ev - Output - a nonsymmetric matrix |
\param ev - Output - a nonsymmetric matrix |
355 |
|
|
356 |
*/ |
*/ |
357 |
|
ESCRIPT_DLL_API |
358 |
virtual void |
virtual void |
359 |
nonsymmetric(DataAbstract* ev); |
nonsymmetric(DataAbstract* ev); |
360 |
|
|
365 |
\param ev - Output - the trace of a matrix |
\param ev - Output - the trace of a matrix |
366 |
|
|
367 |
*/ |
*/ |
368 |
|
ESCRIPT_DLL_API |
369 |
virtual void |
virtual void |
370 |
matrixtrace(DataAbstract* ev, int axis_offset); |
trace(DataAbstract* ev, int axis_offset); |
371 |
|
|
372 |
/** |
/** |
373 |
\brief |
\brief |
376 |
\param ev - Output - the transpose of a matrix |
\param ev - Output - the transpose of a matrix |
377 |
|
|
378 |
*/ |
*/ |
379 |
|
ESCRIPT_DLL_API |
380 |
virtual void |
virtual void |
381 |
transpose(DataAbstract* ev, int axis_offset); |
transpose(DataAbstract* ev, int axis_offset); |
382 |
|
|
383 |
/** |
/** |
384 |
\brief |
\brief |
385 |
|
swaps components axis0 and axis1 |
386 |
|
|
387 |
|
\param ev - Output - swapped components |
388 |
|
|
389 |
|
*/ |
390 |
|
ESCRIPT_DLL_API |
391 |
|
virtual void |
392 |
|
swapaxes(DataAbstract* ev, int axis0, int axis1); |
393 |
|
/** |
394 |
|
\brief |
395 |
solves the eigenvalue problem this*V=ev*V for the eigenvalues ev |
solves the eigenvalue problem this*V=ev*V for the eigenvalues ev |
396 |
|
|
397 |
\param ev - Output - eigenvalues in increasing order at each data point |
\param ev - Output - eigenvalues in increasing order at each data point |
403 |
|
|
404 |
/** |
/** |
405 |
\brief |
\brief |
406 |
|
sets values to zero |
407 |
|
|
408 |
|
*/ |
409 |
|
ESCRIPT_DLL_API |
410 |
|
virtual void |
411 |
|
setToZero(); |
412 |
|
|
413 |
|
/** |
414 |
|
\brief |
415 |
solves the eigenvalue problem this*V=ev*V for the eigenvalues ev and eigenvectors V |
solves the eigenvalue problem this*V=ev*V for the eigenvalues ev and eigenvectors V |
416 |
|
|
417 |
\param ev - Output - eigenvalues in increasing order at each data point |
\param ev - Output - eigenvalues in increasing order at each data point |
469 |
|
|
470 |
inline |
inline |
471 |
bool |
bool |
472 |
DataAbstract::validSamplePointNo(int samplePointNo) const |
DataAbstract::validSamplePointNo(int samplePointNo) const |
473 |
{ |
{ |
474 |
return ((0 <= samplePointNo) && (samplePointNo < m_noDataPointsPerSample)); |
return ((0 <= samplePointNo) && (samplePointNo < m_noDataPointsPerSample)); |
475 |
} |
} |
490 |
|
|
491 |
inline |
inline |
492 |
int |
int |
493 |
DataAbstract::getNumDPPSample() const |
DataAbstract::getNumDPPSample() const |
494 |
{ |
{ |
495 |
return m_noDataPointsPerSample; |
return m_noDataPointsPerSample; |
496 |
} |
} |