escript
Revision_
|
#include <DataAbstract.h>
Public Types | |
typedef DataTypes::ValueType | ValueType |
typedef DataTypes::ShapeType | ShapeType |
Public Member Functions | |
DataAbstract_ptr | getPtr () |
Return shared pointer managing this object. | |
const_DataAbstract_ptr | getPtr () const |
DataAbstract (const FunctionSpace &what, const ShapeType &shape, bool isDataEmpty=false) | |
Constructor for DataAbstract. | |
virtual | ~DataAbstract () |
Destructor for DataAbstract. | |
virtual std::string | toString () const =0 |
Write the data as a string. | |
virtual DataAbstract * | deepCopy ()=0 |
Return a deep copy of the current object. | |
virtual DataReady_ptr | resolve ()=0 |
Return a data object with all points resolved. | |
virtual void | dump (const std::string fileName) const |
dumps the object into a netCDF file | |
int | getNumDPPSample () const |
Return the number of data points per sample. | |
int | getNumSamples () const |
Return the number of samples. | |
const DataTypes::ShapeType & | getShape () const |
Return the shape information for the point data. | |
unsigned int | getRank () const |
Return the rank information for the point data. | |
virtual ValueType::size_type | getPointOffset (int sampleNo, int dataPointNo) const =0 |
Return the offset for the given sample. This returns the offset for the given point into the container holding the point data. | |
virtual ValueType::size_type | getPointOffset (int sampleNo, int dataPointNo)=0 |
virtual ValueType::size_type | getLength () const =0 |
Return the number of doubles stored for this Data object. | |
virtual double * | getSampleDataByTag (int tag) |
Return the sample data for the given tag key. NB: If the data isn't tagged an exception will be thrown. | |
void | operandCheck (const DataAbstract &right) const |
Check this and the given RHS operands are compatible. Throws an exception if they aren't. | |
bool | validSamplePointNo (int samplePointNo) const |
Return true if a valid sample point number. | |
bool | validSampleNo (int sampleNo) const |
Return true if a valid sample number. | |
const FunctionSpace & | getFunctionSpace () const |
Return the function space associated with this Data object. | |
virtual DataAbstract * | getSlice (const DataTypes::RegionType ®ion) const =0 |
Return the given slice from this object. | |
virtual void | setTaggedValue (int tagKey, const DataTypes::ShapeType &pointshape, const DataTypes::ValueType &value, int dataOffset=0) |
setTaggedValue | |
virtual void | copyToDataPoint (const int sampleNo, const int dataPointNo, const double value) |
Copy a double value to the data point dataPointNo of sample sampleNo in this object. | |
virtual void | copyToDataPoint (const int sampleNo, const int dataPointNo, const WrappedArray &value) |
Copy the array object to the data point dataPointNo of sample sampleNo in this object. | |
virtual int | getTagNumber (int dpno) |
Return the tag number associated with the given data-point number. | |
virtual void | symmetric (DataAbstract *ev) |
Computes a symmetric matrix (A + AT) / 2. | |
virtual void | nonsymmetric (DataAbstract *ev) |
Computes a nonsymmetric matrix (A - AT) / 2. | |
virtual void | trace (DataAbstract *ev, int axis_offset) |
Computes the trace of a matrix. | |
virtual void | transpose (DataAbstract *ev, int axis_offset) |
Transpose each data point of this Data object around the given axis. | |
virtual void | swapaxes (DataAbstract *ev, int axis0, int axis1) |
swaps components axis0 and axis1 | |
virtual void | eigenvalues (DataAbstract *ev) |
solves the eigenvalue problem this*V=ev*V for the eigenvalues ev | |
virtual int | matrixInverse (DataAbstract *out) const |
invert square matricies | |
virtual void | setToZero () |
sets values to zero | |
virtual void | eigenvalues_and_eigenvectors (DataAbstract *ev, DataAbstract *V, const double tol=1.e-13) |
solves the eigenvalue problem this*V=ev*V for the eigenvalues ev and eigenvectors V | |
virtual void | reorderByReferenceIDs (int *reference_ids) |
reorders data sample ordered by reference_ids to the ordering of the functions space | |
unsigned int | getNoValues () const |
Return the number of values in the shape for this object. | |
bool | isLazy () const |
virtual bool | isConstant () const |
virtual bool | isExpanded () const |
virtual bool | actsExpanded () const |
Return true if this Data is expanded or resolves to expanded. That is, if it has a separate value for each datapoint in the sample. | |
virtual bool | isTagged () const |
bool | isEmpty () const |
void | addOwner (Data *) |
void | removeOwner (Data *) |
bool | isShared () const |
Is this object owned by more than one Data object. | |
Public Attributes | |
std::vector< Data * > | m_owners |
bool | m_lazyshared |
Protected Member Functions | |
bool | checkNoSharing () const |
Returns true if this object is not shared. For internal use only. - It may not be particularly fast. | |
void | makeLazyShared () |
Marks this DataAbstract shared as LazyData For internal use only. | |
Private Attributes | |
int | m_noSamples |
int | m_noDataPointsPerSample |
FunctionSpace | m_functionSpace |
DataTypes::ShapeType | m_shape |
unsigned int | m_novalues |
unsigned int | m_rank |
bool | m_isempty |
Friends | |
class | DataLazy |
Reimplemented in escript::DataLazy.
Reimplemented in escript::DataLazy, and escript::DataTagged.
escript::DataAbstract::DataAbstract | ( | const FunctionSpace & | what, |
const ShapeType & | shape, | ||
bool | isDataEmpty = false |
||
) |
Constructor for DataAbstract.
what | - Input - The functionspace to use. |
shape | - Input - Shape of each data value. |
isDataEmpty | - Input - Is this an instance of DataEmpty (for internal use only) |
References ESCRIPT_MAX_DATA_RANK, m_isempty, and m_rank.
escript::DataAbstract::~DataAbstract | ( | ) | [virtual] |
Destructor for DataAbstract.
virtual bool escript::DataAbstract::actsExpanded | ( | ) | const [inline, virtual] |
Return true if this Data is expanded or resolves to expanded. That is, if it has a separate value for each datapoint in the sample.
Reimplemented in escript::DataLazy, and escript::DataExpanded.
void escript::DataAbstract::addOwner | ( | Data * | d | ) |
References m_owners.
bool escript::DataAbstract::checkNoSharing | ( | ) | const [protected] |
Returns true if this object is not shared. For internal use only. - It may not be particularly fast.
void escript::DataAbstract::copyToDataPoint | ( | const int | sampleNo, |
const int | dataPointNo, | ||
const double | value | ||
) | [virtual] |
Copy a double value to the data point dataPointNo of sample sampleNo in this object.
Description: Copy a double value to the data point dataPointNo of sample sampleNo in this object.
sampleNo | Input - sample number |
dataPointNo | Input - data point of the sample |
value | Input - new values for the data point |
Reimplemented in escript::DataExpanded.
void escript::DataAbstract::copyToDataPoint | ( | const int | sampleNo, |
const int | dataPointNo, | ||
const WrappedArray & | value | ||
) | [virtual] |
Copy the array object to the data point dataPointNo of sample sampleNo in this object.
sampleNo | Input - sample number |
dataPointNo | Input - data point of the sample |
value | Input - new values for the data point |
Reimplemented in escript::DataExpanded.
virtual DataAbstract* escript::DataAbstract::deepCopy | ( | ) | [pure virtual] |
Return a deep copy of the current object.
Implemented in escript::DataLazy, escript::DataExpanded, escript::DataTagged, escript::DataConstant, and escript::DataEmpty.
void escript::DataAbstract::dump | ( | const std::string | fileName | ) | const [virtual] |
dumps the object into a netCDF file
Reimplemented in escript::DataTagged, escript::DataExpanded, escript::DataEmpty, and escript::DataConstant.
void escript::DataAbstract::eigenvalues | ( | DataAbstract * | ev | ) | [virtual] |
solves the eigenvalue problem this*V=ev*V for the eigenvalues ev
ev | - Output - eigenvalues in increasing order at each data point |
Reimplemented in escript::DataTagged, escript::DataExpanded, and escript::DataConstant.
void escript::DataAbstract::eigenvalues_and_eigenvectors | ( | DataAbstract * | ev, |
DataAbstract * | V, | ||
const double | tol = 1.e-13 |
||
) | [virtual] |
solves the eigenvalue problem this*V=ev*V for the eigenvalues ev and eigenvectors V
ev | - Output - eigenvalues in increasing order at each data point |
V | - Output - corresponding eigenvectors. They are normalized such that their length is one and the first nonzero component is positive. |
tol | - Input - eigenvalue with relative distance tol are treated as equal. |
Reimplemented in escript::DataTagged, escript::DataExpanded, and escript::DataConstant.
const FunctionSpace & escript::DataAbstract::getFunctionSpace | ( | ) | const [inline] |
Return the function space associated with this Data object.
References m_functionSpace.
Referenced by escript::algorithm(), escript::DataLazy::DataLazy(), escript::DataTagged::DataTagged(), escript::DataConstant::dump(), escript::DataExpanded::dump(), escript::DataTagged::dump(), escript::DataTagged::getPointOffset(), escript::DataTagged::getTagNumber(), operandCheck(), escript::DataExpanded::reorderByReferenceIDs(), escript::DataLazy::resolveGroupWorker(), escript::DataLazy::resolveNodeWorker(), escript::DataExpanded::setTaggedValue(), and escript::DataExpanded::toString().
virtual ValueType::size_type escript::DataAbstract::getLength | ( | ) | const [pure virtual] |
Return the number of doubles stored for this Data object.
Implemented in escript::DataTagged, escript::DataExpanded, escript::DataLazy, escript::DataConstant, and escript::DataEmpty.
unsigned int escript::DataAbstract::getNoValues | ( | ) | const [inline] |
Return the number of values in the shape for this object.
References isEmpty(), and m_novalues.
Referenced by escript::DataTagged::addTag(), escript::DataTagged::addTaggedValue(), escript::DataTagged::addTaggedValues(), escript::DataExpanded::copy(), escript::DataConstant::DataConstant(), escript::DataExpanded::DataExpanded(), escript::DataLazy::DataLazy(), escript::DataTagged::DataTagged(), escript::DataExpanded::initialise(), escript::DataExpanded::reorderByReferenceIDs(), escript::DataLazy::resolveGroupWorker(), escript::DataLazy::resolveNodeNP1OUT(), escript::DataLazy::resolveNodeNP1OUT_2P(), escript::DataLazy::resolveNodeNP1OUT_P(), escript::DataLazy::resolveNodeTProd(), escript::DataLazy::resolveNodeWorker(), escript::DataExpanded::setTaggedValue(), escript::DataTagged::setTaggedValue(), and escript::DataExpanded::setToZero().
int escript::DataAbstract::getNumDPPSample | ( | ) | const [inline] |
Return the number of data points per sample.
References isEmpty(), and m_noDataPointsPerSample.
Referenced by escript::algorithm(), escript::binaryOp(), escript::DataExpanded::copy(), escript::DataExpanded::copyToDataPoint(), escript::DataExpanded::DataExpanded(), escript::DataLazy::DataLazy(), escript::dp_algorithm(), escript::DataExpanded::eigenvalues(), escript::DataExpanded::eigenvalues_and_eigenvectors(), escript::DataTagged::getTagNumber(), escript::DataExpanded::matrixInverse(), escript::DataExpanded::nonsymmetric(), operandCheck(), escript::DataExpanded::reorderByReferenceIDs(), escript::DataLazy::resolveNodeNP1OUT(), escript::DataLazy::resolveNodeNP1OUT_2P(), escript::DataLazy::resolveNodeNP1OUT_P(), escript::DataLazy::resolveNodeReduction(), escript::DataLazy::resolveNodeTProd(), escript::DataExpanded::setTaggedValue(), escript::DataExpanded::setToZero(), escript::DataExpanded::swapaxes(), escript::DataExpanded::symmetric(), escript::DataExpanded::trace(), escript::DataExpanded::transpose(), and escript::unaryOp().
int escript::DataAbstract::getNumSamples | ( | ) | const [inline] |
Return the number of samples.
References isEmpty(), and m_noSamples.
Referenced by escript::algorithm(), escript::binaryOp(), escript::DataExpanded::copy(), escript::DataExpanded::copyToDataPoint(), escript::DataExpanded::DataExpanded(), escript::dp_algorithm(), escript::DataExpanded::dump(), escript::DataExpanded::eigenvalues(), escript::DataExpanded::eigenvalues_and_eigenvectors(), escript::DataTagged::getTagNumber(), escript::DataExpanded::matrixInverse(), escript::DataExpanded::nonsymmetric(), operandCheck(), escript::DataExpanded::reorderByReferenceIDs(), escript::DataLazy::resolveNodeWorker(), escript::DataExpanded::setTaggedValue(), escript::DataExpanded::setToZero(), escript::DataExpanded::swapaxes(), escript::DataExpanded::symmetric(), escript::DataExpanded::trace(), escript::DataExpanded::transpose(), and escript::unaryOp().
virtual ValueType::size_type escript::DataAbstract::getPointOffset | ( | int | sampleNo, |
int | dataPointNo | ||
) | const [pure virtual] |
Return the offset for the given sample. This returns the offset for the given point into the container holding the point data.
sampleNo | - Input - sample number. |
dataPointNo | - Input - data point number. |
Implemented in escript::DataTagged, escript::DataLazy, escript::DataExpanded, escript::DataConstant, and escript::DataEmpty.
Referenced by escript::binaryOp(), escript::DataExpanded::eigenvalues(), escript::DataExpanded::eigenvalues_and_eigenvectors(), escript::Data::getDataPointRO(), escript::Data::getDataPointRW(), escript::DataReady::getSampleDataRO(), escript::DataReady::getSampleDataRW(), escript::DataExpanded::nonsymmetric(), escript::DataExpanded::swapaxes(), escript::DataExpanded::symmetric(), escript::DataExpanded::trace(), and escript::DataExpanded::transpose().
virtual ValueType::size_type escript::DataAbstract::getPointOffset | ( | int | sampleNo, |
int | dataPointNo | ||
) | [pure virtual] |
Implemented in escript::DataTagged, escript::DataLazy, escript::DataExpanded, escript::DataConstant, and escript::DataEmpty.
Return shared pointer managing this object.
If there is not already a shared pointer managing this object then create one. Once a shared pointer is created for an object, the deallocation of the object must be handled by shared_ptr.
Note: This is _not_ equivalent to weak_ptr::lock.
Referenced by escript::Data::copy(), escript::Data::Data(), escript::Data::expand(), escript::Data::initialise(), escript::DataReady::resolve(), escript::DataLazy::resolveGroupWorker(), escript::Data::setToZero(), and escript::Data::tag().
unsigned int escript::DataAbstract::getRank | ( | ) | const [inline] |
Return the rank information for the point data.
References isEmpty(), and m_rank.
Referenced by escript::binaryOp(), escript::DataExpanded::copyToDataPoint(), escript::DataConstant::dump(), escript::DataExpanded::dump(), escript::DataTagged::dump(), escript::DataExpanded::matrixInverse(), escript::DataTagged::matrixInverse(), escript::DataConstant::matrixInverse(), operandCheck(), escript::DataConstant::setSlice(), escript::DataExpanded::setSlice(), and escript::DataTagged::setSlice().
DataAbstract::ValueType::value_type * escript::DataAbstract::getSampleDataByTag | ( | int | tag | ) | [virtual] |
Return the sample data for the given tag key. NB: If the data isn't tagged an exception will be thrown.
Reimplemented in escript::DataTagged.
const DataTypes::ShapeType & escript::DataAbstract::getShape | ( | ) | const [inline] |
Return the shape information for the point data.
The omission of a non-constant form is deliberate.
References isEmpty(), and m_shape.
Referenced by escript::DataTagged::addTaggedValue(), escript::algorithm(), escript::binaryOp(), escript::DataExpanded::copy(), escript::DataExpanded::copyToDataPoint(), escript::DataConstant::DataConstant(), escript::DataExpanded::DataExpanded(), escript::DataTagged::DataTagged(), escript::dp_algorithm(), escript::DataConstant::dump(), escript::DataExpanded::dump(), escript::DataTagged::dump(), escript::DataConstant::eigenvalues(), escript::DataExpanded::eigenvalues(), escript::DataTagged::eigenvalues(), escript::DataConstant::eigenvalues_and_eigenvectors(), escript::DataExpanded::eigenvalues_and_eigenvectors(), escript::DataTagged::eigenvalues_and_eigenvectors(), escript::DataExpanded::matrixInverse(), escript::DataTagged::matrixInverse(), escript::DataConstant::matrixInverse(), escript::DataConstant::nonsymmetric(), escript::DataExpanded::nonsymmetric(), escript::DataTagged::nonsymmetric(), operandCheck(), escript::DataLazy::resolveGroupWorker(), escript::DataLazy::resolveNodeNP1OUT(), escript::DataLazy::resolveNodeNP1OUT_2P(), escript::DataLazy::resolveNodeNP1OUT_P(), escript::DataLazy::resolveNodeTProd(), escript::DataLazy::resolveNodeWorker(), escript::DataConstant::setSlice(), escript::DataExpanded::setSlice(), escript::DataTagged::setSlice(), escript::DataTagged::setTaggedValue(), escript::DataConstant::swapaxes(), escript::DataExpanded::swapaxes(), escript::DataTagged::swapaxes(), escript::DataConstant::symmetric(), escript::DataExpanded::symmetric(), escript::DataTagged::symmetric(), escript::DataConstant::toString(), escript::DataExpanded::toString(), escript::DataTagged::toString(), escript::DataConstant::trace(), escript::DataExpanded::trace(), escript::DataTagged::trace(), escript::DataConstant::transpose(), escript::DataExpanded::transpose(), escript::DataTagged::transpose(), and escript::unaryOp().
virtual DataAbstract* escript::DataAbstract::getSlice | ( | const DataTypes::RegionType & | region | ) | const [pure virtual] |
Return the given slice from this object.
NB: The caller is responsible for managing the object created.
Implemented in escript::DataTagged, escript::DataExpanded, escript::DataLazy, escript::DataConstant, and escript::DataEmpty.
Referenced by escript::Data::Data().
int escript::DataAbstract::getTagNumber | ( | int | dpno | ) | [virtual] |
Return the tag number associated with the given data-point number.
If the object cannot be referenced by tag numbers, an exception will be thrown.
Reimplemented in escript::DataTagged.
virtual bool escript::DataAbstract::isConstant | ( | ) | const [inline, virtual] |
Reimplemented in escript::DataConstant.
bool escript::DataAbstract::isEmpty | ( | ) | const [inline] |
References m_isempty.
Referenced by getNoValues(), getNumDPPSample(), getNumSamples(), getRank(), and getShape().
virtual bool escript::DataAbstract::isExpanded | ( | ) | const [inline, virtual] |
Reimplemented in escript::DataExpanded.
bool escript::DataAbstract::isLazy | ( | ) | const |
bool escript::DataAbstract::isShared | ( | ) | const [inline] |
Is this object owned by more than one Data object.
Referenced by removeOwner().
virtual bool escript::DataAbstract::isTagged | ( | ) | const [inline, virtual] |
Reimplemented in escript::DataTagged.
void escript::DataAbstract::makeLazyShared | ( | ) | [protected] |
Marks this DataAbstract shared as LazyData For internal use only.
References m_lazyshared, and m_owners.
int escript::DataAbstract::matrixInverse | ( | DataAbstract * | out | ) | const [virtual] |
invert square matricies
out | - Where to store the results |
Reimplemented in escript::DataConstant, escript::DataTagged, escript::DataExpanded, and escript::DataEmpty.
void escript::DataAbstract::nonsymmetric | ( | DataAbstract * | ev | ) | [virtual] |
Computes a nonsymmetric matrix (A - AT) / 2.
ev | - Output - a nonsymmetric matrix |
Reimplemented in escript::DataTagged, escript::DataExpanded, and escript::DataConstant.
Referenced by escript::DataLazy::resolveNodeNP1OUT().
void escript::DataAbstract::operandCheck | ( | const DataAbstract & | right | ) | const |
Check this and the given RHS operands are compatible. Throws an exception if they aren't.
right | - Input - The right hand side. |
References getFunctionSpace(), getNumDPPSample(), getNumSamples(), getRank(), getShape(), escript::DataTypes::shapeToString(), and escript::FunctionSpace::toString().
void escript::DataAbstract::removeOwner | ( | Data * | d | ) |
References isShared(), and m_owners.
void escript::DataAbstract::reorderByReferenceIDs | ( | int * | reference_ids | ) | [virtual] |
reorders data sample ordered by reference_ids to the ordering of the functions space
reference_ids | - Input - reference_ids used for current ordering |
Reimplemented in escript::DataExpanded.
Referenced by escript::load().
virtual DataReady_ptr escript::DataAbstract::resolve | ( | ) | [pure virtual] |
Return a data object with all points resolved.
Implemented in escript::DataLazy, and escript::DataReady.
void escript::DataAbstract::setTaggedValue | ( | int | tagKey, |
const DataTypes::ShapeType & | pointshape, | ||
const DataTypes::ValueType & | value, | ||
int | dataOffset = 0 |
||
) | [virtual] |
setTaggedValue
Description: Assign the given value to the given tag.
NB: If the data isn't tagged an exception will be thrown.
tagKey | - Input - Integer key. |
pointshape | - Input - the shape of the value parameter. |
value | - Input - vector to copy data value from |
dataOffset | - Input - Offset within value to begin copying from |
The final parameter is to allow for the case whete the vector contains multiple data values.
Reimplemented in escript::DataTagged, and escript::DataExpanded.
void escript::DataAbstract::setToZero | ( | ) | [virtual] |
sets values to zero
Reimplemented in escript::DataLazy, escript::DataTagged, escript::DataExpanded, and escript::DataConstant.
void escript::DataAbstract::swapaxes | ( | DataAbstract * | ev, |
int | axis0, | ||
int | axis1 | ||
) | [virtual] |
swaps components axis0 and axis1
ev | - Output - swapped components |
axis0 | |
axis1 |
Reimplemented in escript::DataTagged, escript::DataExpanded, and escript::DataConstant.
Referenced by escript::DataLazy::resolveNodeNP1OUT_2P().
void escript::DataAbstract::symmetric | ( | DataAbstract * | ev | ) | [virtual] |
Computes a symmetric matrix (A + AT) / 2.
ev | - Output - a symmetric matrix |
Reimplemented in escript::DataTagged, escript::DataExpanded, and escript::DataConstant.
Referenced by escript::DataLazy::resolveNodeNP1OUT().
virtual std::string escript::DataAbstract::toString | ( | ) | const [pure virtual] |
Write the data as a string.
Implemented in escript::DataLazy, escript::DataTagged, escript::DataExpanded, escript::DataConstant, and escript::DataEmpty.
void escript::DataAbstract::trace | ( | DataAbstract * | ev, |
int | axis_offset | ||
) | [virtual] |
Computes the trace of a matrix.
ev | - Output - the trace of a matrix |
axis_offset |
Reimplemented in escript::DataTagged, escript::DataExpanded, and escript::DataConstant.
Referenced by escript::DataLazy::resolveNodeNP1OUT_P().
void escript::DataAbstract::transpose | ( | DataAbstract * | ev, |
int | axis_offset | ||
) | [virtual] |
Transpose each data point of this Data object around the given axis.
ev | - Output - the transpose of a matrix |
axis_offset |
Reimplemented in escript::DataTagged, escript::DataExpanded, and escript::DataConstant.
Referenced by escript::DataLazy::resolveNodeNP1OUT_P().
bool escript::DataAbstract::validSampleNo | ( | int | sampleNo | ) | const [inline] |
Return true if a valid sample number.
References m_noSamples.
bool escript::DataAbstract::validSamplePointNo | ( | int | samplePointNo | ) | const [inline] |
Return true if a valid sample point number.
References m_noDataPointsPerSample.
friend class DataLazy [friend] |
Referenced by getFunctionSpace().
bool escript::DataAbstract::m_isempty [private] |
Referenced by DataAbstract(), and isEmpty().
Referenced by makeLazyShared().
int escript::DataAbstract::m_noDataPointsPerSample [private] |
Referenced by getNumDPPSample(), and validSamplePointNo().
int escript::DataAbstract::m_noSamples [private] |
Referenced by getNumSamples(), and validSampleNo().
unsigned int escript::DataAbstract::m_novalues [private] |
Referenced by getNoValues().
std::vector<Data*> escript::DataAbstract::m_owners |
Referenced by addOwner(), makeLazyShared(), and removeOwner().
unsigned int escript::DataAbstract::m_rank [private] |
Referenced by DataAbstract(), getRank(), and escript::DataLazy::intoTreeString().
Referenced by getShape().