escript
Revision_
|
DataConstant stores a single data point which represents the entire function space. More...
#include <DataConstant.h>
Public Member Functions | |
DataConstant (const WrappedArray &value, const FunctionSpace &what) | |
Constructor for DataConstant objects. | |
DataConstant (const DataConstant &other) | |
Copy constructor. Performs a deep copy. | |
DataConstant (const DataConstant &other, const DataTypes::RegionType ®ion) | |
Alternative constructor for DataConstant objects. | |
DataConstant (const FunctionSpace &what, const DataTypes::ShapeType &shape, const DataTypes::ValueType &data) | |
Alternative constructor for DataConstant objects. | |
DataConstant (const FunctionSpace &what, const DataTypes::ShapeType &shape, const double v) | |
bool | isConstant () const |
bool | hasNaN () const |
Return true if the value contains a NaN. | |
std::string | toString () const |
Write the data as a string. | |
virtual DataAbstract * | deepCopy () |
Return a deep copy of the current object. | |
virtual void | dump (const std::string fileName) const |
dumps the object into a netCDF file | |
virtual void | setToZero () |
sets all values to zero | |
virtual DataTypes::ValueType::size_type | getPointOffset (int sampleNo, int dataPointNo) const |
Return the offset for the given sample. This is a somewhat artificial notion but returns the offset in bytes for the given point into the container holding the point data. Only really necessary to avoid many DataArrayView objects. | |
virtual DataTypes::ValueType::size_type | getPointOffset (int sampleNo, int dataPointNo) |
virtual DataTypes::ValueType::size_type | getLength () const |
Return the number of doubles stored for the Data object. | |
virtual DataAbstract * | getSlice (const DataTypes::RegionType ®ion) const |
Factory method that returns a newly created DataConstant object sliced from the specified region of this object. The caller is reponsible for managing the object created. | |
virtual void | setSlice (const DataAbstract *value, const DataTypes::RegionType ®ion) |
Copy the specified region from the given value. | |
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 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 int | matrixInverse (DataAbstract *out) const |
invert square matricies | |
DataTypes::ValueType & | getVectorRW () |
Return a reference to the underlying DataVector. | |
const DataTypes::ValueType & | getVectorRO () const |
Private Types | |
typedef DataReady | parent |
Private Attributes | |
DataTypes::ValueType | m_data |
DataConstant stores a single data point which represents the entire function space.
Description: DataConstant stores a single data point which represents the entire function space.
typedef DataReady escript::DataConstant::parent [private] |
Reimplemented from escript::DataReady.
escript::DataConstant::DataConstant | ( | const WrappedArray & | value, |
const FunctionSpace & | what | ||
) |
Constructor for DataConstant objects.
Description: Constructor for DataConstant objects.
value | - Input - Data value for a single point. |
what | - Input - A description of what this data object represents. |
References escript::DataVector::copyFromArray(), and m_data.
Referenced by deepCopy(), and getSlice().
escript::DataConstant::DataConstant | ( | const DataConstant & | other | ) |
Copy constructor. Performs a deep copy.
References m_data.
escript::DataConstant::DataConstant | ( | const DataConstant & | other, |
const DataTypes::RegionType & | region | ||
) |
Alternative constructor for DataConstant objects.
Description: Alternative Constructor for DataConstant objects.
other | - Input - Data object to copy from. |
region | - Input - region to copy. |
References escript::DataTypes::copySlice(), escript::DataAbstract::getNoValues(), escript::DataAbstract::getShape(), escript::DataTypes::getSliceRegionLoopRange(), getVectorRO(), m_data, and escript::DataVector::resize().
escript::DataConstant::DataConstant | ( | const FunctionSpace & | what, |
const DataTypes::ShapeType & | shape, | ||
const DataTypes::ValueType & | data | ||
) |
Alternative constructor for DataConstant objects.
Description: Alternative Constructor for DataConstant objects.
what | - Input - A description of what this data object represents. |
shape | - Input - the shape of each data-point. |
data | - the data values for each data-point. |
References m_data.
escript::DataConstant::DataConstant | ( | const FunctionSpace & | what, |
const DataTypes::ShapeType & | shape, | ||
const double | v | ||
) |
DataAbstract * escript::DataConstant::deepCopy | ( | ) | [virtual] |
Return a deep copy of the current object.
Implements escript::DataAbstract.
References DataConstant().
void escript::DataConstant::dump | ( | const std::string | fileName | ) | const [virtual] |
dumps the object into a netCDF file
Reimplemented from escript::DataAbstract.
References esysUtils::appendRankToFileName(), escript::FunctionSpace::getDomain(), escript::DataAbstract::getFunctionSpace(), escript::DataAbstract::getRank(), escript::DataAbstract::getShape(), escript::FunctionSpace::getTypeCode(), m_data, escript::DataTypes::maxRank, MPI_COMM_WORLD, and MPI_INT.
void escript::DataConstant::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 from escript::DataAbstract.
References escript::DataAbstract::getShape(), getVectorRW(), and m_data.
void escript::DataConstant::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 from escript::DataAbstract.
References escript::DataAbstract::getShape(), getVectorRW(), m_data, and V.
DataTypes::ValueType::size_type escript::DataConstant::getLength | ( | ) | const [virtual] |
Return the number of doubles stored for the Data object.
Implements escript::DataAbstract.
References m_data, and escript::DataVector::size().
DataTypes::ValueType::size_type escript::DataConstant::getPointOffset | ( | int | sampleNo, |
int | dataPointNo | ||
) | const [virtual] |
Return the offset for the given sample. This is a somewhat artificial notion but returns the offset in bytes for the given point into the container holding the point data. Only really necessary to avoid many DataArrayView objects.
sampleNo | - Input - sample number. |
dataPointNo | - Input - data point number for the sample. |
Implements escript::DataAbstract.
Referenced by escript::C_GeneralTensorProduct(), and escript::C_TensorBinaryOperation().
DataTypes::ValueType::size_type escript::DataConstant::getPointOffset | ( | int | sampleNo, |
int | dataPointNo | ||
) | [virtual] |
Implements escript::DataAbstract.
DataAbstract * escript::DataConstant::getSlice | ( | const DataTypes::RegionType & | region | ) | const [virtual] |
Factory method that returns a newly created DataConstant object sliced from the specified region of this object. The caller is reponsible for managing the object created.
region | - Input - region to slice from this object. |
Implements escript::DataAbstract.
References DataConstant().
const DataTypes::ValueType & escript::DataConstant::getVectorRO | ( | ) | const [virtual] |
Implements escript::DataReady.
References m_data.
Referenced by escript::algorithm(), escript::binaryOp(), escript::DataExpanded::copy(), DataConstant(), escript::DataTagged::DataTagged(), escript::dp_algorithm(), and setSlice().
DataTypes::ValueType & escript::DataConstant::getVectorRW | ( | ) | [virtual] |
Return a reference to the underlying DataVector.
Implements escript::DataReady.
References CHECK_FOR_EX_WRITE, and m_data.
Referenced by escript::binaryOp(), escript::dp_algorithm(), eigenvalues(), eigenvalues_and_eigenvectors(), matrixInverse(), nonsymmetric(), swapaxes(), symmetric(), trace(), transpose(), and escript::unaryOp().
bool escript::DataConstant::hasNaN | ( | ) | const [virtual] |
Return true if the value contains a NaN.
Implements escript::DataReady.
References m_data, escript::nancheck(), and escript::DataVector::size().
bool escript::DataConstant::isConstant | ( | ) | const [inline, virtual] |
Reimplemented from escript::DataAbstract.
int escript::DataConstant::matrixInverse | ( | DataAbstract * | out | ) | const [virtual] |
invert square matricies
out | - Where to store the results |
Reimplemented from escript::DataAbstract.
References escript::DataAbstract::getRank(), escript::DataAbstract::getShape(), getVectorRW(), m_data, and escript::DataMaths::matrix_inverse().
void escript::DataConstant::nonsymmetric | ( | DataAbstract * | ev | ) | [virtual] |
Computes a nonsymmetric matrix (A - AT) / 2.
ev | - Output - nonsymmetric matrix |
Reimplemented from escript::DataAbstract.
References escript::DataAbstract::getShape(), getVectorRW(), and m_data.
void escript::DataConstant::setSlice | ( | const DataAbstract * | value, |
const DataTypes::RegionType & | region | ||
) | [virtual] |
Copy the specified region from the given value.
value | - Input - Data object to copy from. |
region | - Input - Region to copy. |
Implements escript::DataReady.
References CHECK_FOR_EX_WRITE, escript::DataTypes::checkShape(), escript::DataTypes::copySliceFrom(), escript::DataTypes::createShapeErrorMessage(), escript::DataAbstract::getRank(), escript::DataTypes::getResultSliceShape(), escript::DataAbstract::getShape(), escript::DataTypes::getSliceRegionLoopRange(), getVectorRO(), and m_data.
void escript::DataConstant::setToZero | ( | ) | [virtual] |
sets all values to zero
Reimplemented from escript::DataAbstract.
References CHECK_FOR_EX_WRITE, m_data, and escript::DataVector::size().
void escript::DataConstant::swapaxes | ( | DataAbstract * | ev, |
int | axis0, | ||
int | axis1 | ||
) | [virtual] |
swaps components axis0 and axis1
ev | - Output - swapped components |
axis0 | |
axis1 |
Reimplemented from escript::DataAbstract.
References escript::DataAbstract::getShape(), getVectorRW(), and m_data.
void escript::DataConstant::symmetric | ( | DataAbstract * | ev | ) | [virtual] |
Computes a symmetric matrix (A + AT) / 2.
ev | - Output - symmetric matrix |
Reimplemented from escript::DataAbstract.
References escript::DataAbstract::getShape(), getVectorRW(), and m_data.
string escript::DataConstant::toString | ( | ) | const [virtual] |
Write the data as a string.
Implements escript::DataAbstract.
References escript::DataAbstract::getShape(), m_data, and escript::DataTypes::pointToString().
void escript::DataConstant::trace | ( | DataAbstract * | ev, |
int | axis_offset | ||
) | [virtual] |
Computes the trace of a matrix.
ev | - Output - trace of matrix |
axis_offset |
Reimplemented from escript::DataAbstract.
References escript::DataAbstract::getShape(), getVectorRW(), and m_data.
void escript::DataConstant::transpose | ( | DataAbstract * | ev, |
int | axis_offset | ||
) | [virtual] |
Transpose each data point of this Data object around the given axis.
ev | - Output - transpose of matrix |
axis_offset |
Reimplemented from escript::DataAbstract.
References escript::DataAbstract::getShape(), getVectorRW(), and m_data.