Escript
Revision_4320
|
Give a short description of what DataExpanded does. More...
#include <DataExpanded.h>
Public Member Functions | |
DataExpanded (const WrappedArray &value, const FunctionSpace &what) | |
Constructor for DataExpanded. | |
DataExpanded (const DataExpanded &other, const DataTypes::RegionType ®ion) | |
Alternative constructor for DataExpanded that copies a slice from another DataExpanded. | |
DataExpanded (const FunctionSpace &what, const DataTypes::ShapeType &shape, const DataTypes::ValueType &data) | |
Alternative constructor for DataExpanded objects. | |
DataExpanded (const FunctionSpace &what, const DataTypes::ShapeType &shape, const double data) | |
DataExpanded (const DataExpanded &other) | |
Copy constructor for DataExpanded. Performs a deep copy from another DataExpanded. | |
DataExpanded (const DataConstant &other) | |
Copy constructor for DataExpanded. Construct a DataExpanded from a DataConstant. | |
DataExpanded (const DataTagged &other) | |
Copy constructor for DataExpanded. Construct a DataExpanded from a DataTagged. | |
virtual | ~DataExpanded () |
Default destructor for DataExpanded. | |
bool | isExpanded () const |
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. | |
bool | hasNaN () const |
Return true if any value in the data contains a NaN. | |
virtual std::string | toString () const |
Return a textual representation of the data. | |
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 int | matrixInverse (DataAbstract *out) const |
invert square matricies | |
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 given data point. This returns the offset in bytes for the given point into the container holding the point data. | |
virtual DataTypes::ValueType::size_type | getPointOffset (int sampleNo, int dataPointNo) |
DataTypes::ValueType & | getVectorRW () |
Return a a reference to the underlying DataVector. | |
const DataTypes::ValueType & | getVectorRO () const |
virtual ValueType::size_type | getLength () const |
Return the number of doubles stored for the Data. | |
virtual DataAbstract * | getSlice (const DataTypes::RegionType ®ion) const |
Factory method that returns a newly created DataExpanded. 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. | |
void | setTaggedValue (int tagKey, const DataTypes::ShapeType &pointshape, const DataTypes::ValueType &value, int dataOffset=0) |
setTaggedValue | |
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 void | reorderByReferenceIDs (int *reference_ids) |
reorders data sample ordered by reference_ids to the ordering of the functions space | |
void | randomFill (long seed) |
Fill the object with random values. | |
![]() | |
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. | |
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 | |
DataTypes::ValueType::reference | getDataAtOffsetRW (DataTypes::ValueType::size_type i) |
DataReady_ptr | resolve () |
Return a data object with all points resolved. | |
![]() | |
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. | |
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 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 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. | |
unsigned int | getNoValues () const |
Return the number of values in the shape for this object. | |
bool | isLazy () const |
virtual bool | isConstant () const |
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. |
Private Types | |
typedef DataReady | parent |
Private Member Functions | |
void | initialise (int noSamples, int noDataPointsPerSample) |
Common initialisation called from constructors. | |
void | copy (const DataConstant &value) |
Copy the given data point value to all data points in this object. | |
void | copy (const WrappedArray &value) |
Copy the given data point value to all data points in this object. | |
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 value to the data point dataPointNo of sample sampleNo in this object. |
Private Attributes | |
DataBlocks2D | m_data |
Additional Inherited Members | |
![]() | |
typedef DataTypes::ValueType | ValueType |
typedef DataTypes::ShapeType | ShapeType |
![]() | |
std::vector< Data * > | m_owners |
bool | m_lazyshared |
![]() | |
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. |
Give a short description of what DataExpanded does.
Description: Give a detailed description of DataExpanded.
Template Parameters: For templates describe any conditions that the parameters used in the template must satisfy.
|
private |
escript::DataExpanded::DataExpanded | ( | const WrappedArray & | value, |
const FunctionSpace & | what | ||
) |
Constructor for DataExpanded.
Description: Constructor for DataExpanded.
The given single data value is copied to all the data points in this data object, where the number of data points is defined by the given function space.
value | - Input - The value of a single data point. |
what | - Input - A description of what this data represents. |
References copy(), escript::FunctionSpace::getNumDPPSample(), escript::FunctionSpace::getNumSamples(), and initialise().
Referenced by deepCopy(), and getSlice().
escript::DataExpanded::DataExpanded | ( | const DataExpanded & | other, |
const DataTypes::RegionType & | region | ||
) |
Alternative constructor for DataExpanded that copies a slice from another DataExpanded.
other | - Input - DataExpanded object to slice from. |
region | - Input - region to copy. |
References escript::DataTypes::copySlice(), escript::DataBlocks2D::getNumCols(), escript::DataAbstract::getNumDPPSample(), escript::DataBlocks2D::getNumRows(), escript::DataAbstract::getNumSamples(), getPointOffset(), escript::DataAbstract::getShape(), escript::DataTypes::getSliceRegionLoopRange(), getVectorRO(), getVectorRW(), initialise(), and m_data.
escript::DataExpanded::DataExpanded | ( | const FunctionSpace & | what, |
const DataTypes::ShapeType & | shape, | ||
const DataTypes::ValueType & | data | ||
) |
Alternative constructor for DataExpanded objects.
Description: Alternative Constructor for DataExpanded objects. \param what - Input - A description of what this data object represents. \param shape - Input - the shape of each data-point. \param data - the array of data values for the data-points.
TODO Note that this constructor will also copy data to all points if it only contains enough elements to hold a single point. ie this is the merge of two separate constructors.
References EsysAssert, escript::DataBlocks2D::getData(), getLength(), escript::DataAbstract::getNoValues(), escript::FunctionSpace::getNumDPPSample(), escript::FunctionSpace::getNumSamples(), initialise(), m_data, and escript::DataVector::size().
escript::DataExpanded::DataExpanded | ( | const FunctionSpace & | what, |
const DataTypes::ShapeType & | shape, | ||
const double | data | ||
) |
escript::DataExpanded::DataExpanded | ( | const DataExpanded & | other | ) |
Copy constructor for DataExpanded. Performs a deep copy from another DataExpanded.
escript::DataExpanded::DataExpanded | ( | const DataConstant & | other | ) |
Copy constructor for DataExpanded. Construct a DataExpanded from a DataConstant.
References copy(), escript::DataAbstract::getNumDPPSample(), escript::DataAbstract::getNumSamples(), and initialise().
escript::DataExpanded::DataExpanded | ( | const DataTagged & | other | ) |
Copy constructor for DataExpanded. Construct a DataExpanded from a DataTagged.
References escript::DataTypes::copyPoint(), escript::DataAbstract::getNoValues(), escript::DataBlocks2D::getNumCols(), escript::DataAbstract::getNumDPPSample(), escript::DataBlocks2D::getNumRows(), escript::DataAbstract::getNumSamples(), getPointOffset(), escript::DataTagged::getPointOffset(), escript::DataTagged::getVectorRO(), getVectorRW(), initialise(), and m_data.
|
virtual |
Default destructor for DataExpanded.
|
inlinevirtual |
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 from escript::DataAbstract.
|
private |
Copy the given data point value to all data points in this object.
Description: Copy the given data point to all data points in this object.
value | Input - A single data point value. |
References escript::DataTypes::checkShape(), escript::DataTypes::copyPoint(), escript::DataTypes::createShapeErrorMessage(), EsysAssert, escript::DataAbstract::getNoValues(), escript::DataBlocks2D::getNumCols(), escript::DataBlocks2D::getNumRows(), getPointOffset(), escript::DataAbstract::getShape(), escript::DataConstant::getVectorRO(), getVectorRW(), and m_data.
Referenced by DataExpanded().
|
private |
Copy the given data point value to all data points in this object.
value | Input - A single data point value. |
References escript::DataTypes::checkShape(), escript::DataVector::copyFromArray(), escript::DataTypes::createShapeErrorMessage(), escript::DataAbstract::getNumDPPSample(), escript::DataAbstract::getNumSamples(), escript::WrappedArray::getShape(), escript::DataAbstract::getShape(), and getVectorRW().
|
privatevirtual |
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 |
References CHECK_FOR_EX_WRITE, escript::DataAbstract::getNumDPPSample(), escript::DataAbstract::getNumSamples(), getPointOffset(), escript::DataAbstract::getRank(), escript::DataTypes::getRelIndex(), escript::DataAbstract::getShape(), and getVectorRW().
|
privatevirtual |
Copy the 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 |
References CHECK_FOR_EX_WRITE, escript::DataVector::copyFromArrayToOffset(), escript::DataAbstract::getNumDPPSample(), escript::DataAbstract::getNumSamples(), getPointOffset(), escript::WrappedArray::getRank(), escript::DataAbstract::getRank(), and getVectorRW().
|
virtual |
Return a deep copy of the current object.
Implements escript::DataAbstract.
References DataExpanded().
|
virtual |
dumps the object into a netCDF file
Reimplemented from escript::DataAbstract.
References escript::FunctionSpace::borrowSampleReferenceIDs(), escript::Escript_MPI_appendRankToFileName(), escript::FunctionSpace::getDomain(), escript::DataAbstract::getFunctionSpace(), escript::FunctionSpace::getNumDataPointsPerSample(), escript::DataAbstract::getNumSamples(), escript::FunctionSpace::getNumSamples(), escript::DataAbstract::getRank(), escript::DataAbstract::getShape(), escript::FunctionSpace::getTypeCode(), m_data, escript::DataTypes::maxRank, MPI_COMM_WORLD, and MPI_INT.
|
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::getNumDPPSample(), escript::DataAbstract::getNumSamples(), escript::DataAbstract::getPointOffset(), getPointOffset(), escript::DataAbstract::getShape(), getVectorRO(), and getVectorRW().
|
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::getNumDPPSample(), escript::DataAbstract::getNumSamples(), escript::DataAbstract::getPointOffset(), getPointOffset(), escript::DataAbstract::getShape(), getVectorRO(), getVectorRW(), and V.
|
virtual |
Return the number of doubles stored for the Data.
Implements escript::DataAbstract.
References m_data, and escript::DataBlocks2D::size().
Referenced by DataExpanded().
|
virtual |
Return the offset for the given given data point. This returns the offset in bytes for the given point into the container holding the point data.
sampleNo | - Input - sample number. |
dataPointNo | - Input - data point number. |
Implements escript::DataAbstract.
References escript::DataBlocks2D::index(), and m_data.
Referenced by escript::algorithm(), escript::binaryOp(), escript::C_GeneralTensorProduct(), escript::C_TensorBinaryOperation(), escript::C_TensorUnaryOperation(), copy(), copyToDataPoint(), DataExpanded(), escript::dp_algorithm(), eigenvalues(), eigenvalues_and_eigenvectors(), matrixInverse(), nonsymmetric(), reorderByReferenceIDs(), escript::DataLazy::resolveNodeWorker(), setSlice(), setTaggedValue(), setToZero(), swapaxes(), symmetric(), toString(), trace(), transpose(), and escript::unaryOp().
|
virtual |
Implements escript::DataAbstract.
References escript::DataBlocks2D::index(), and m_data.
|
virtual |
Factory method that returns a newly created DataExpanded. The caller is reponsible for managing the object created.
region | - Input - Region to copy. |
Implements escript::DataAbstract.
References DataExpanded().
|
virtual |
Implements escript::DataReady.
References escript::DataBlocks2D::getData(), and m_data.
Referenced by escript::algorithm(), DataExpanded(), escript::dp_algorithm(), eigenvalues(), eigenvalues_and_eigenvectors(), nonsymmetric(), setSlice(), swapaxes(), symmetric(), toString(), trace(), and transpose().
|
virtual |
Return a a reference to the underlying DataVector.
Implements escript::DataReady.
References CHECK_FOR_EX_WRITE, escript::DataBlocks2D::getData(), and m_data.
Referenced by escript::binaryOp(), copy(), copyToDataPoint(), DataExpanded(), escript::dp_algorithm(), eigenvalues(), eigenvalues_and_eigenvectors(), matrixInverse(), nonsymmetric(), randomFill(), escript::DataLazy::resolveNodeWorker(), setSlice(), swapaxes(), symmetric(), trace(), transpose(), and escript::unaryOp().
|
virtual |
Return true if any value in the data contains a NaN.
Implements escript::DataReady.
References escript::DataBlocks2D::getData(), m_data, escript::nancheck(), and escript::DataVector::size().
|
private |
Common initialisation called from constructors.
Description: Common initialisation called from constructors.
Resizes the underlying data array to provide sufficient storage for the given shape and number of data points, and creates the corresponding DataArrayView of this data.
noSamples | - Input - number of samples. |
noDataPointsPerSample | - Input - number of data points per sample. |
References escript::DataAbstract::getNoValues(), m_data, and escript::DataBlocks2D::resize().
Referenced by DataExpanded().
|
inlinevirtual |
Reimplemented from escript::DataAbstract.
|
virtual |
invert square matricies
out | - Where to store the results |
Reimplemented from escript::DataAbstract.
References escript::DataBlocks2D::getData(), escript::DataAbstract::getNumDPPSample(), escript::DataAbstract::getNumSamples(), getPointOffset(), escript::DataAbstract::getRank(), escript::DataAbstract::getShape(), getVectorRW(), m_data, escript::DataMaths::matrix_inverse(), and escript::DataMaths::matrixInverseError().
|
virtual |
Computes a nonsymmetric matrix (A - AT) / 2.
ev | - Output - nonsymmetric matrix |
Reimplemented from escript::DataAbstract.
References escript::DataAbstract::getNumDPPSample(), escript::DataAbstract::getNumSamples(), escript::DataAbstract::getPointOffset(), getPointOffset(), escript::DataAbstract::getShape(), getVectorRO(), and getVectorRW().
void escript::DataExpanded::randomFill | ( | long | seed | ) |
Fill the object with random values.
seed | - random seed |
References CHECK_FOR_EX_WRITE, escript::FunctionSpace::getDomain(), escript::DataAbstract::getFunctionSpace(), getVectorRW(), omp_get_max_threads, omp_get_thread_num, and escript::DataVector::size().
|
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 from escript::DataAbstract.
References CHECK_FOR_EX_WRITE, escript::DataAbstract::getFunctionSpace(), escript::DataAbstract::getNoValues(), escript::DataAbstract::getNumDPPSample(), escript::DataAbstract::getNumSamples(), getPointOffset(), escript::FunctionSpace::getReferenceIDOfSample(), and m_data.
|
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::DataBlocks2D::getNumCols(), escript::DataBlocks2D::getNumRows(), getPointOffset(), escript::DataAbstract::getRank(), escript::DataTypes::getResultSliceShape(), escript::DataAbstract::getShape(), escript::DataTypes::getSliceRegionLoopRange(), getVectorRO(), getVectorRW(), and m_data.
|
virtual |
setTaggedValue
Description: uses tag to set a new value
tagKey | - Input - Integer key. |
pointshape | - Input - The shape of the value parameter |
value | - Input - |
dataOffset | - Input - where in the value parameter to start reading the data point value. |
Reimplemented from escript::DataAbstract.
References CHECK_FOR_EX_WRITE, escript::DataAbstract::getFunctionSpace(), escript::DataAbstract::getNoValues(), escript::DataAbstract::getNumDPPSample(), escript::DataAbstract::getNumSamples(), getPointOffset(), m_data, and escript::DataVector::size().
|
virtual |
sets all values to zero
Reimplemented from escript::DataAbstract.
References CHECK_FOR_EX_WRITE, escript::DataAbstract::getNoValues(), escript::DataAbstract::getNumDPPSample(), escript::DataAbstract::getNumSamples(), getPointOffset(), and m_data.
|
virtual |
swaps components axis0 and axis1
ev | - Output - swapped components |
axis0 | |
axis1 |
Reimplemented from escript::DataAbstract.
References escript::DataAbstract::getNumDPPSample(), escript::DataAbstract::getNumSamples(), escript::DataAbstract::getPointOffset(), getPointOffset(), escript::DataAbstract::getShape(), getVectorRO(), and getVectorRW().
|
virtual |
Computes a symmetric matrix (A + AT) / 2.
ev | - Output - symmetric matrix |
Reimplemented from escript::DataAbstract.
References escript::DataAbstract::getNumDPPSample(), escript::DataAbstract::getNumSamples(), escript::DataAbstract::getPointOffset(), getPointOffset(), escript::DataAbstract::getShape(), getVectorRO(), and getVectorRW().
|
virtual |
Return a textual representation of the data.
Implements escript::DataAbstract.
References escript::DataAbstract::getFunctionSpace(), escript::DataBlocks2D::getNumCols(), escript::DataBlocks2D::getNumRows(), getPointOffset(), escript::FunctionSpace::getReferenceIDOfSample(), escript::DataAbstract::getShape(), getVectorRO(), m_data, and escript::DataTypes::pointToString().
|
virtual |
Computes the trace of a matrix.
ev | - Output - trace of your matrix |
axis_offset | - |
Reimplemented from escript::DataAbstract.
References escript::DataAbstract::getNumDPPSample(), escript::DataAbstract::getNumSamples(), escript::DataAbstract::getPointOffset(), getPointOffset(), escript::DataAbstract::getShape(), getVectorRO(), and getVectorRW().
|
virtual |
Transpose each data point of this Data object around the given axis.
ev | - Output - transpose of your matrix |
axis_offset | - |
Reimplemented from escript::DataAbstract.
References escript::DataAbstract::getNumDPPSample(), escript::DataAbstract::getNumSamples(), escript::DataAbstract::getPointOffset(), getPointOffset(), escript::DataAbstract::getShape(), getVectorRO(), and getVectorRW().
|
private |
Referenced by copy(), DataExpanded(), dump(), getLength(), getPointOffset(), getVectorRO(), getVectorRW(), hasNaN(), initialise(), matrixInverse(), reorderByReferenceIDs(), setSlice(), setTaggedValue(), setToZero(), and toString().