escript
Revision_Unversioneddirectory
|
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. More... | |
DataConstant (const DataConstant &other) | |
Copy constructor. Performs a deep copy. More... | |
DataConstant (const DataConstant &other, const DataTypes::RegionType ®ion) | |
Alternative constructor for DataConstant objects. More... | |
DataConstant (const FunctionSpace &what, const DataTypes::ShapeType &shape, const DataTypes::ValueType &data) | |
Alternative constructor for DataConstant objects. More... | |
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. More... | |
void | replaceNaN (double value) |
replaces all NaN values with value More... | |
std::string | toString () const |
Write the data as a string. More... | |
virtual DataAbstract * | deepCopy () |
Return a deep copy of the current object. More... | |
virtual void | dump (const std::string fileName) const |
dumps the object into a netCDF file More... | |
virtual void | setToZero () |
sets all values to zero More... | |
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. More... | |
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. More... | |
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. More... | |
virtual void | setSlice (const DataAbstract *value, const DataTypes::RegionType ®ion) |
Copy the specified region from the given value. More... | |
virtual void | symmetric (DataAbstract *ev) |
Computes a symmetric matrix (A + AT) / 2. More... | |
virtual void | nonsymmetric (DataAbstract *ev) |
Computes a nonsymmetric matrix (A - AT) / 2. More... | |
virtual void | trace (DataAbstract *ev, int axis_offset) |
Computes the trace of a matrix. More... | |
virtual void | transpose (DataAbstract *ev, int axis_offset) |
Transpose each data point of this Data object around the given axis. More... | |
virtual void | swapaxes (DataAbstract *ev, int axis0, int axis1) |
swaps components axis0 and axis1 More... | |
virtual void | eigenvalues (DataAbstract *ev) |
solves the eigenvalue problem this*V=ev*V for the eigenvalues ev More... | |
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 More... | |
virtual int | matrixInverse (DataAbstract *out) const |
invert square matricies More... | |
DataTypes::ValueType & | getVectorRW () |
Return a reference to the underlying DataVector. More... | |
const DataTypes::ValueType & | getVectorRO () const |
![]() | |
DataReady (const FunctionSpace &what, const ShapeType &shape, bool isDataEmpty=false) | |
~DataReady () | |
double * | getSampleDataRW (ValueType::size_type sampleNo) |
Return the sample data for the given sample number. More... | |
const double * | getSampleDataRO (ValueType::size_type sampleNo) const |
DataTypes::ValueType::const_reference | getDataAtOffsetRO (DataTypes::ValueType::size_type i) const |
get a reference to the beginning of a data point More... | |
DataTypes::ValueType::reference | getDataAtOffsetRW (DataTypes::ValueType::size_type i) |
DataReady_ptr | resolve () |
Return a data object with all points resolved. More... | |
![]() | |
DataAbstract_ptr | getPtr () |
Return shared pointer managing this object. More... | |
const_DataAbstract_ptr | getPtr () const |
DataAbstract (const FunctionSpace &what, const ShapeType &shape, bool isDataEmpty=false) | |
Constructor for DataAbstract. More... | |
virtual | ~DataAbstract () |
Destructor for DataAbstract. More... | |
int | getNumDPPSample () const |
Return the number of data points per sample. More... | |
int | getNumSamples () const |
Return the number of samples. More... | |
const DataTypes::ShapeType & | getShape () const |
Return the shape information for the point data. More... | |
unsigned int | getRank () const |
Return the rank information for the point data. More... | |
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. More... | |
virtual size_t | getTagCount () const |
Return number of tagged values stored in the data object. More... | |
void | operandCheck (const DataAbstract &right) const |
Check this and the given RHS operands are compatible. Throws an exception if they aren't. More... | |
bool | validSamplePointNo (int samplePointNo) const |
Return true if a valid sample point number. More... | |
bool | validSampleNo (int sampleNo) const |
Return true if a valid sample number. More... | |
const FunctionSpace & | getFunctionSpace () const |
Return the function space associated with this Data object. More... | |
virtual void | setTaggedValue (int tagKey, const DataTypes::ShapeType &pointshape, const DataTypes::ValueType &value, int dataOffset=0) |
setTaggedValue More... | |
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. More... | |
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. More... | |
virtual int | getTagNumber (int dpno) |
Return the tag number associated with the given data-point number. More... | |
virtual void | reorderByReferenceIDs (dim_t *reference_ids) |
reorders data sample ordered by reference_ids to the ordering of the functions space More... | |
unsigned int | getNoValues () const |
Return the number of values in the shape for this object. More... | |
bool | isLazy () 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. More... | |
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. More... | |
Private Types | |
typedef DataReady | parent |
Private Attributes | |
DataTypes::ValueType | m_data |
Additional Inherited Members | |
![]() | |
typedef DataTypes::ValueType | ValueType |
typedef DataTypes::ShapeType | ShapeType |
![]() | |
bool | checkNoSharing () const |
Returns true if this object is not shared. For internal use only. - It may not be particularly fast. More... | |
void | makeLazyShared () |
Marks this DataAbstract shared as LazyData For internal use only. More... | |
![]() | |
std::vector< Data * > | m_owners |
bool | m_lazyshared |
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.
|
private |
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 | ||
) |
|
virtual |
Return a deep copy of the current object.
Implements escript::DataAbstract.
References DataConstant().
Referenced by isConstant().
|
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.
Referenced by isConstant().
|
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::DataMaths::eigenvalues(), escript::DataAbstract::getShape(), getVectorRW(), and m_data.
Referenced by isConstant().
|
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::DataMaths::eigenvalues_and_eigenvectors(), escript::DataAbstract::getShape(), getVectorRW(), m_data, and V.
Referenced by isConstant().
|
virtual |
Return the number of doubles stored for the Data object.
Implements escript::DataAbstract.
References m_data, and escript::DataVector::size().
Referenced by isConstant().
|
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(), escript::C_TensorBinaryOperation(), and isConstant().
|
virtual |
Implements escript::DataAbstract.
|
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().
Referenced by isConstant().
|
virtual |
Implements escript::DataReady.
References m_data.
Referenced by escript::algorithm(), escript::binaryOp(), escript::DataExpanded::copy(), DataConstant(), escript::DataTagged::DataTagged(), escript::dp_algorithm(), isConstant(), and setSlice().
|
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(), isConstant(), matrixInverse(), nonsymmetric(), swapaxes(), symmetric(), trace(), transpose(), and escript::unaryOp().
|
virtual |
Return true if the value contains a NaN.
Implements escript::DataReady.
References m_data, escript::nancheck(), and escript::DataVector::size().
Referenced by isConstant().
|
inlinevirtual |
Reimplemented from escript::DataAbstract.
References deepCopy(), dump(), eigenvalues(), eigenvalues_and_eigenvectors(), ESCRIPT_DLL_API, getLength(), getPointOffset(), getSlice(), getVectorRO(), getVectorRW(), hasNaN(), matrixInverse(), nonsymmetric(), replaceNaN(), setSlice(), setToZero(), swapaxes(), symmetric(), toString(), trace(), transpose(), and V.
|
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().
Referenced by isConstant().
|
virtual |
Computes a nonsymmetric matrix (A - AT) / 2.
ev | - Output - nonsymmetric matrix |
Reimplemented from escript::DataAbstract.
References escript::DataAbstract::getShape(), getVectorRW(), m_data, and escript::DataMaths::nonsymmetric().
Referenced by isConstant().
|
virtual |
replaces all NaN values with value
Implements escript::DataReady.
References m_data, escript::nancheck(), and escript::DataVector::size().
Referenced by isConstant().
|
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.
Referenced by isConstant().
|
virtual |
sets all values to zero
Reimplemented from escript::DataAbstract.
References CHECK_FOR_EX_WRITE, m_data, and escript::DataVector::size().
Referenced by isConstant().
|
virtual |
swaps components axis0 and axis1
ev | - Output - swapped components |
axis0 | |
axis1 |
Reimplemented from escript::DataAbstract.
References escript::DataAbstract::getShape(), getVectorRW(), m_data, and escript::DataMaths::swapaxes().
Referenced by isConstant().
|
virtual |
Computes a symmetric matrix (A + AT) / 2.
ev | - Output - symmetric matrix |
Reimplemented from escript::DataAbstract.
References escript::DataAbstract::getShape(), getVectorRW(), m_data, and escript::DataMaths::symmetric().
Referenced by isConstant().
|
virtual |
Write the data as a string.
Implements escript::DataAbstract.
References escript::DataAbstract::getShape(), m_data, and escript::DataTypes::pointToString().
Referenced by isConstant().
|
virtual |
Computes the trace of a matrix.
ev | - Output - trace of matrix |
axis_offset |
Reimplemented from escript::DataAbstract.
References escript::DataAbstract::getShape(), getVectorRW(), m_data, and escript::DataMaths::trace().
Referenced by isConstant().
|
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(), m_data, and escript::DataMaths::transpose().
Referenced by isConstant().
|
private |