escript  Revision_
Public Types | Public Member Functions | Private Types | Private Attributes | Static Private Attributes | List of all members
escript::DataTagged Class Reference

Simulates a full dataset accessible via sampleNo and dataPointNo. More...

#include <DataTagged.h>

Inheritance diagram for escript::DataTagged:
escript::DataReady escript::DataAbstract

Public Types

typedef std::vector< int > TagListType
 
typedef std::vector< DataTypes::RealVectorType::ElementTypeFloatBatchType
 
typedef std::vector< DataTypes::CplxVectorType::ElementTypeCplxBatchType
 
typedef std::map< int, int > DataMapType
 
- Public Types inherited from escript::DataAbstract
typedef DataTypes::ShapeType ShapeType
 

Public Member Functions

 DataTagged (const FunctionSpace &what, const DataTypes::ShapeType &shape, const int tags[], const DataTypes::RealVectorType &data)
 Alternative Constructor for DataTagged. More...
 
 DataTagged (const FunctionSpace &what, const DataTypes::ShapeType &shape, const int tags[], const DataTypes::CplxVectorType &data)
 
 DataTagged (const FunctionSpace &what, const DataTypes::ShapeType &shape, const TagListType &tags, const DataTypes::RealVectorType &data)
 Alternative Constructor for DataTagged. More...
 
 DataTagged (const FunctionSpace &what, const DataTypes::ShapeType &shape, const TagListType &tags, const DataTypes::CplxVectorType &data)
 
 DataTagged (const DataTagged &other)
 Copy Constructor for DataTagged. Performs a deep copy from the given DataTagged object. T. More...
 
 DataTagged (const DataConstant &other)
 Copy Constructor for DataTagged. Construct a DataTagged object from a DataConstant object. The default value will be the value of the DataConstant object. T. More...
 
 DataTagged (const FunctionSpace &what, const DataTypes::ShapeType &shape, const DataTypes::RealVectorType &defaultvalue, const DataTagged *tagsource=0)
 Copies the tags from a DataTagged into a new Data Tagged and assigns them the default value. ** Not unit tested **. More...
 
 DataTagged (const FunctionSpace &what, const DataTypes::ShapeType &shape, const DataTypes::CplxVectorType &defaultvalue, const DataTagged *tagsource=0)
 
virtual ~DataTagged ()
 Destructor. More...
 
bool isTagged () const
 
bool hasNaN () const
 Return true if any one of the datapoints contains a NaN. More...
 
void replaceNaN (DataTypes::real_t value)
 replaces all NaN values with value More...
 
void replaceNaN (DataTypes::cplx_t value)
 replaces all NaN values with value More...
 
virtual DataAbstractdeepCopy () const
 Return a deep copy of the current object. More...
 
virtual DataTypes::real_tgetSampleDataByTag (int tag, DataTypes::real_t dummy=0)
 getSampleDataByTag More...
 
virtual DataTypes::cplx_tgetSampleDataByTag (int tag, DataTypes::cplx_t dummy)
 Return the complex sample data for the given tag key. NB: If the data isn't tagged an exception will be thrown. More...
 
virtual std::string toString () const
 Write the data as a string. Writes out each tag, including the default, and the data-point which is associated with each tag. T. More...
 
virtual void dump (const std::string fileName) const
 dumps the object into a netCDF file More...
 
virtual int matrixInverse (DataAbstract *out) const
 invert square matricies More...
 
virtual void setToZero ()
 sets all values to zero More...
 
virtual int getTagNumber (int dpno)
 Return the tag number associated with the given data-point number according to the associated function space. T. More...
 
virtual DataTypes::RealVectorType::size_type getPointOffset (int sampleNo, int dataPointNo) const
 getPointOffset More...
 
void addTaggedValues (const TagListType &tagKeys, const FloatBatchType &values, const ShapeType &vShape)
 addTaggedValues More...
 
void addTaggedValues (const TagListType &tagKeys, const DataTypes::RealVectorType &values, const ShapeType &vShape)
 
void addTaggedValue (int tagKey, const DataTypes::ShapeType &pointshape, const DataTypes::RealVectorType &value, int dataOffset=0)
 addTaggedValue More...
 
void addTaggedValue (int tagKey, const DataTypes::ShapeType &pointshape, const DataTypes::CplxVectorType &value, int dataOffset=0)
 
void addTag (int tagKey)
 addTag - does not modify the default value for this object. ** Not unit tested ** More...
 
void setTaggedValue (int tagKey, const DataTypes::ShapeType &pointshape, const DataTypes::RealVectorType &value, int dataOffset=0)
 setTaggedValue More...
 
void setTaggedValue (int tagKey, const DataTypes::ShapeType &pointshape, const DataTypes::CplxVectorType &value, int dataOffset=0)
 
DataTypes::RealVectorType::reference getDataByTagRW (int tag, DataTypes::RealVectorType::size_type i, DataTypes::real_t dummy=0)
 getDataByTag More...
 
DataTypes::RealVectorType::const_reference getDataByTagRO (int tag, DataTypes::RealVectorType::size_type i, DataTypes::real_t dummy=0) const
 
DataTypes::CplxVectorType::reference getDataByTagRW (int tag, DataTypes::CplxVectorType::size_type i, DataTypes::cplx_t dummy)
 
DataTypes::CplxVectorType::const_reference getDataByTagRO (int tag, DataTypes::CplxVectorType::size_type i, DataTypes::cplx_t dummy) const
 
DataTypes::RealVectorType::size_type getOffsetForTag (int tag) const
 getOffsetForTag More...
 
DataTypes::RealVectorTypegetVectorRW ()
 Return a reference to the underlying DataVector. More...
 
const DataTypes::RealVectorTypegetVectorRO () const
 
DataTypes::CplxVectorTypegetVectorRWC ()
 
const DataTypes::CplxVectorTypegetVectorROC () const
 
virtual DataTypes::RealVectorTypegetTypedVectorRW (DataTypes::real_t dummy)
 These versions use the type system rather than method name to determine return type. More...
 
virtual const DataTypes::RealVectorTypegetTypedVectorRO (DataTypes::real_t dummy) const
 
virtual DataTypes::CplxVectorTypegetTypedVectorRW (DataTypes::cplx_t dummy)
 
virtual const DataTypes::CplxVectorTypegetTypedVectorRO (DataTypes::cplx_t dummy) const
 
const DataMapTypegetTagLookup () const
 getTagLookup More...
 
bool isCurrentTag (int tag) const
 isCurrentTag More...
 
DataTypes::RealVectorType::reference getDefaultValueRW (DataTypes::RealVectorType::size_type i, DataTypes::real_t dummy=0)
 getDefaultValue More...
 
DataTypes::RealVectorType::const_reference getDefaultValueRO (DataTypes::RealVectorType::size_type i, DataTypes::real_t dummy=0) const
 
DataTypes::CplxVectorType::reference getDefaultValueRW (DataTypes::CplxVectorType::size_type i, DataTypes::cplx_t dummy)
 
DataTypes::CplxVectorType::const_reference getDefaultValueRO (DataTypes::CplxVectorType::size_type i, DataTypes::cplx_t dummy) const
 
virtual DataTypes::RealVectorType::size_type getLength () const
 getLength More...
 
virtual DataAbstractgetSlice (const DataTypes::RegionType &region) const
 getSlice More...
 
 DataTagged (const DataTagged &other, const DataTypes::RegionType &region)
 Slice Constructor for DataTagged. More...
 
virtual void setSlice (const DataAbstract *other, const DataTypes::RegionType &region)
 setSlice More...
 
virtual void symmetric (DataAbstract *ev)
 Computes a symmetric matrix (A + AT) / 2. More...
 
virtual void antisymmetric (DataAbstract *ev)
 Computes a antisymmetric matrix (A - AT) / 2. More...
 
virtual void hermitian (DataAbstract *ev)
 Computes an hermitian matrix (A + A*) / 2. More...
 
virtual void antihermitian (DataAbstract *ev)
 Computes an antihermitian matrix (A - A*) / 2. More...
 
virtual void trace (DataAbstract *ev, int axis_offset)
 Computes the trace of a matrix. More...
 
virtual void swapaxes (DataAbstract *ev, int axis0, int axis1)
 swaps components axis0 and axis1 More...
 
virtual void transpose (DataAbstract *ev, int axis_offset)
 Transpose each data point of this Data object around the given axis. 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...
 
DataTypes::RealVectorType::size_type getDefaultOffset () const
 Returns the offset in the structure which stores the default value. More...
 
size_t getTagCount () const
 Return the number of tags which have been given values (+the default) More...
 
void complicate ()
 
- Public Member Functions inherited from escript::DataReady
 DataReady (const FunctionSpace &what, const ShapeType &shape, bool isDataEmpty=false)
 
 ~DataReady ()
 
DataTypes::real_tgetSampleDataRW (DataTypes::RealVectorType::size_type sampleNo, DataTypes::real_t dummy=0)
 Return the sample data for the given sample number. More...
 
DataTypes::cplx_tgetSampleDataRW (DataTypes::RealVectorType::size_type sampleNo, DataTypes::cplx_t dummy)
 
const DataTypes::real_tgetSampleDataRO (DataTypes::RealVectorType::size_type sampleNo, DataTypes::real_t dummy=0) const
 
const DataTypes::cplx_tgetSampleDataRO (DataTypes::RealVectorType::size_type sampleNo, DataTypes::cplx_t dummy) const
 
DataTypes::RealVectorType::const_reference getDataAtOffsetRO (DataTypes::RealVectorType::size_type i) const
 get a reference to the beginning of a data point More...
 
DataTypes::RealVectorType::reference getDataAtOffsetRW (DataTypes::RealVectorType::size_type i)
 
DataTypes::CplxVectorType::const_reference getDataAtOffsetROC (DataTypes::CplxVectorType::size_type i) const
 
DataTypes::CplxVectorType::reference getDataAtOffsetRWC (DataTypes::CplxVectorType::size_type i)
 
DataReady_ptr resolve ()
 Return a data object with all points resolved. More...
 
- Public Member Functions inherited from escript::DataAbstract
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, bool isCplx=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...
 
bool hasNoSamples () const
 
const DataTypes::ShapeTypegetShape () const
 Return the shape information for the point data. More...
 
unsigned int getRank () const
 Return the rank information for the point data. 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 FunctionSpacegetFunctionSpace () const
 Return the function space associated with this Data object. More...
 
virtual void copyToDataPoint (const int sampleNo, const int dataPointNo, const DataTypes::real_t 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 DataTypes::cplx_t value)
 
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 void reorderByReferenceIDs (DataTypes::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 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. More...
 
bool isEmpty () const
 
bool isComplex () const
 true if the components of datapoints are complex More...
 

Private Types

typedef DataReady parent
 

Private Attributes

DataMapType m_offsetLookup
 
DataTypes::RealVectorType m_data_r
 
DataTypes::CplxVectorType m_data_c
 

Static Private Attributes

static const int m_defaultValueOffset = 0
 

Additional Inherited Members

- Protected Attributes inherited from escript::DataAbstract
int m_noSamples
 
int m_noDataPointsPerSample
 
bool m_iscompl
 

Detailed Description

Simulates a full dataset accessible via sampleNo and dataPointNo.

Description: Each data-point has an associated tag number, and a given tag can represent a range of dataPointNo and sampleNo. Each tag indexes only a single data-point. Thus only a single data-point needs to be stored for a range of sampleNo and dataPointNo values.

Member Typedef Documentation

◆ CplxBatchType

◆ DataMapType

typedef std::map<int, int> escript::DataTagged::DataMapType

◆ FloatBatchType

◆ parent

◆ TagListType

typedef std::vector<int> escript::DataTagged::TagListType

Constructor & Destructor Documentation

◆ DataTagged() [1/9]

escript::DataTagged::DataTagged ( const FunctionSpace what,
const DataTypes::ShapeType shape,
const int  tags[],
const DataTypes::RealVectorType data 
)
explicit

Alternative Constructor for DataTagged.

Description: Alternative Constructor for DataTagged.

Parameters
what- Input - A description of what this data object represents.
shape- Input - The shape of each data-point.
tags- Input - An array of tags, one for each sample number (starts at tag[1]).
data- The data values for each tag. NB: no unit testing yet

References escript::FunctionSpace::canTag(), m_data_r, m_offsetLookup, escript::DataTypes::noValues(), and escript::DataTypes::DataVectorAlt< T >::size().

Referenced by deepCopy(), and getSlice().

◆ DataTagged() [2/9]

escript::DataTagged::DataTagged ( const FunctionSpace what,
const DataTypes::ShapeType shape,
const int  tags[],
const DataTypes::CplxVectorType data 
)
explicit

◆ DataTagged() [3/9]

escript::DataTagged::DataTagged ( const FunctionSpace what,
const DataTypes::ShapeType shape,
const TagListType tags,
const DataTypes::RealVectorType data 
)
explicit

Alternative Constructor for DataTagged.

Description: Alternative Constructor for DataTagged.

Parameters
what- Input - A description of what this data object represents.
shape- Input - The shape of each data-point.
tags- Input - An vector of tags, one for each sample number.
data- The data values for each tag. TODO Make sure to document the relationship between tags and data, ie: data also contains the default value

References escript::FunctionSpace::canTag(), m_data_r, m_offsetLookup, escript::DataTypes::noValues(), and escript::DataTypes::DataVectorAlt< T >::size().

◆ DataTagged() [4/9]

escript::DataTagged::DataTagged ( const FunctionSpace what,
const DataTypes::ShapeType shape,
const TagListType tags,
const DataTypes::CplxVectorType data 
)
explicit

◆ DataTagged() [5/9]

escript::DataTagged::DataTagged ( const DataTagged other)

Copy Constructor for DataTagged. Performs a deep copy from the given DataTagged object. T.

References escript::DataAbstract::m_iscompl.

◆ DataTagged() [6/9]

escript::DataTagged::DataTagged ( const DataConstant other)
explicit

◆ DataTagged() [7/9]

escript::DataTagged::DataTagged ( const FunctionSpace what,
const DataTypes::ShapeType shape,
const DataTypes::RealVectorType defaultvalue,
const DataTagged tagsource = 0 
)
explicit

Copies the tags from a DataTagged into a new Data Tagged and assigns them the default value. ** Not unit tested **.

This is different from a deep copy because we are not copying shape or other information, just tags.

Parameters
what- Input - FunctionSpace for the new DataTagged
shape- Input - Shape for points in the new DataTagged
defaultvalue- Input - Default value for new DataTagged
tagsource- Input - A DataTagged object which supplies the tags.

References addTag(), escript::FunctionSpace::canTag(), getTagLookup(), m_data_r, escript::DataTypes::noValues(), escript::DataTypes::DataVectorAlt< T >::resize(), and escript::DataTypes::DataVectorAlt< T >::size().

◆ DataTagged() [8/9]

escript::DataTagged::DataTagged ( const FunctionSpace what,
const DataTypes::ShapeType shape,
const DataTypes::CplxVectorType defaultvalue,
const DataTagged tagsource = 0 
)
explicit

◆ ~DataTagged()

virtual escript::DataTagged::~DataTagged ( )
inlinevirtual

Destructor.

◆ DataTagged() [9/9]

escript::DataTagged::DataTagged ( const DataTagged other,
const DataTypes::RegionType region 
)

Member Function Documentation

◆ addTag()

void escript::DataTagged::addTag ( int  tagKey)

◆ addTaggedValue() [1/2]

void escript::DataTagged::addTaggedValue ( int  tagKey,
const DataTypes::ShapeType pointshape,
const DataTypes::RealVectorType value,
int  dataOffset = 0 
)

addTaggedValue

Description: Add a single tag and value to this DataTagged object. If this tag already has a value associated with it, setTaggedValue will be used to update this value.

Parameters
tagKey- Input - Integer tag.
pointshape- Shape of the value parameter
value- Input - Single DataArrayView value to be assigned to the tag.
dataOffset- Input - Offset of the beginning of the point in the value parameter

References CHECK_FOR_EX_WRITE, escript::DataTypes::checkShape(), escript::DataTypes::createShapeErrorMessage(), escript::DataAbstract::getNoValues(), escript::DataAbstract::getShape(), escript::DataAbstract::isComplex(), m_data_r, m_offsetLookup, escript::DataTypes::DataVectorAlt< T >::resize(), setTaggedValue(), and escript::DataTypes::DataVectorAlt< T >::size().

Referenced by addTaggedValues(), escript::condEval(), and setTaggedValue().

◆ addTaggedValue() [2/2]

void escript::DataTagged::addTaggedValue ( int  tagKey,
const DataTypes::ShapeType pointshape,
const DataTypes::CplxVectorType value,
int  dataOffset = 0 
)

◆ addTaggedValues() [1/2]

void escript::DataTagged::addTaggedValues ( const TagListType tagKeys,
const FloatBatchType values,
const ShapeType vShape 
)

addTaggedValues

Description: Add the given tags and values to this DataTagged object.

Parameters
tagKeys- Input - A vector of integer tags.
values- Input - A vector of doubles. If this is empty, the default value for this DataTagged will be used for all tags. If it contains one value all tag values will be assigned this value. Otherwise consecutive tags will be assigned consecutive values. If there is a mismatch between the number of keys and the number of values an exception will be generated.
vShape- shape of the datapoints in "values" T

◆ addTaggedValues() [2/2]

void escript::DataTagged::addTaggedValues ( const TagListType tagKeys,
const DataTypes::RealVectorType values,
const ShapeType vShape 
)

Description: Add the given tags and values to this DataTagged object.

Parameters
tagKeys- Input - A vector of integer tags.
values- Input - A DataVector containing the datapoints. If this is empty, the default value for this DataTagged will be used for all tags. If it contains one value all tag values will be assigned this value. Otherwise consecutive tags will be assigned consecutive values. If there is a mismatch between the number of keys and the number of values an exception will be generated.
vShape- shape of the datapoints in "values"

TODO Makesure this is properly unit tested

References addTag(), addTaggedValue(), escript::DataAbstract::getNoValues(), and escript::DataTypes::DataVectorAlt< T >::size().

◆ antihermitian()

void escript::DataTagged::antihermitian ( DataAbstract ev)
virtual

Computes an antihermitian matrix (A - A*) / 2.

Parameters
ev- Output - anti-hermitian matrix

Reimplemented from escript::DataAbstract.

References addTag(), escript::antihermitian(), getDefaultOffset(), getOffsetForTag(), escript::DataAbstract::getShape(), getTagLookup(), getTypedVectorRW(), escript::DataAbstract::isComplex(), and m_data_c.

◆ antisymmetric()

void escript::DataTagged::antisymmetric ( DataAbstract ev)
virtual

Computes a antisymmetric matrix (A - AT) / 2.

Parameters
ev- Output - antisymmetric matrix

Reimplemented from escript::DataAbstract.

References addTag(), escript::antisymmetric(), getDefaultOffset(), getOffsetForTag(), escript::DataAbstract::getShape(), getTagLookup(), getTypedVectorRW(), escript::DataAbstract::isComplex(), m_data_c, and m_data_r.

◆ complicate()

void escript::DataTagged::complicate ( )
virtual

◆ deepCopy()

DataAbstract * escript::DataTagged::deepCopy ( ) const
virtual

Return a deep copy of the current object.

Implements escript::DataAbstract.

References DataTagged().

◆ dump()

void escript::DataTagged::dump ( const std::string  fileName) const
virtual

◆ eigenvalues()

void escript::DataTagged::eigenvalues ( DataAbstract ev)
virtual

solves the eigenvalue problem this*V=ev*V for the eigenvalues ev

Parameters
ev- Output - eigenvalues in increasing order at each data point

Reimplemented from escript::DataAbstract.

References addTag(), escript::eigenvalues(), getDefaultOffset(), getOffsetForTag(), escript::DataAbstract::getShape(), getTagLookup(), getVectorRW(), getVectorRWC(), escript::DataAbstract::isComplex(), m_data_c, and m_data_r.

◆ eigenvalues_and_eigenvectors()

void escript::DataTagged::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

Parameters
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 addTag(), escript::eigenvalues_and_eigenvectors(), getDefaultOffset(), getOffsetForTag(), escript::DataAbstract::getShape(), getTagLookup(), getVectorRW(), m_data_r, and V.

◆ getDataByTagRO() [1/2]

DataTypes::RealVectorType::const_reference escript::DataTagged::getDataByTagRO ( int  tag,
DataTypes::RealVectorType::size_type  i,
DataTypes::real_t  dummy = 0 
) const

◆ getDataByTagRO() [2/2]

DataTypes::CplxVectorType::const_reference escript::DataTagged::getDataByTagRO ( int  tag,
DataTypes::CplxVectorType::size_type  i,
DataTypes::cplx_t  dummy 
) const

◆ getDataByTagRW() [1/2]

DataTypes::RealVectorType::reference escript::DataTagged::getDataByTagRW ( int  tag,
DataTypes::RealVectorType::size_type  i,
DataTypes::real_t  dummy = 0 
)

getDataByTag

Return a pointer to the beginning of the datapoint with the specified tag. TODO Eventually these should be inlined.

Parameters
tag- Input - Integer key.
i- position in the underlying datastructure

References CHECK_FOR_EX_WRITE, getDataByTagRO(), m_data_c, m_data_r, m_defaultValueOffset, and m_offsetLookup.

Referenced by escript::Data::bessel(), escript::C_GeneralTensorProduct(), escript::C_TensorUnaryOperation(), escript::Data::dp_algorithm(), and escript::Data::get_MPIComm().

◆ getDataByTagRW() [2/2]

DataTypes::CplxVectorType::reference escript::DataTagged::getDataByTagRW ( int  tag,
DataTypes::CplxVectorType::size_type  i,
DataTypes::cplx_t  dummy 
)

◆ getDefaultOffset()

DataTypes::RealVectorType::size_type escript::DataTagged::getDefaultOffset ( ) const
inline

◆ getDefaultValueRO() [1/2]

DataTypes::RealVectorType::const_reference escript::DataTagged::getDefaultValueRO ( DataTypes::RealVectorType::size_type  i,
DataTypes::real_t  dummy = 0 
) const
inline

◆ getDefaultValueRO() [2/2]

DataTypes::CplxVectorType::const_reference escript::DataTagged::getDefaultValueRO ( DataTypes::CplxVectorType::size_type  i,
DataTypes::cplx_t  dummy 
) const
inline

◆ getDefaultValueRW() [1/2]

DataTypes::RealVectorType::reference escript::DataTagged::getDefaultValueRW ( DataTypes::RealVectorType::size_type  i,
DataTypes::real_t  dummy = 0 
)
inline

getDefaultValue

Description: Return the default value. This value is associated with any tag which is not explicitly recorded in this DataTagged object's tag map.

Parameters
i- position in the underlying datastructure

Referenced by escript::Data::bessel(), escript::C_GeneralTensorProduct(), escript::C_TensorUnaryOperation(), escript::condEval(), escript::Data::get_MPIComm(), and getDefaultValueRO().

◆ getDefaultValueRW() [2/2]

DataTypes::CplxVectorType::reference escript::DataTagged::getDefaultValueRW ( DataTypes::CplxVectorType::size_type  i,
DataTypes::cplx_t  dummy 
)

◆ getLength()

DataTypes::RealVectorType::size_type escript::DataTagged::getLength ( ) const
inlinevirtual

getLength

Description: Return the total number of doubles stored for this DataTagged object. T

Implements escript::DataAbstract.

◆ getOffsetForTag()

DataTypes::RealVectorType::size_type escript::DataTagged::getOffsetForTag ( int  tag) const

getOffsetForTag

Parameters
tag
Returns
the offset of the beginning of the datapoint corresponding to tag.

Note: If the tag is not valid, the offset of the default value is returned instead.

References m_defaultValueOffset, and m_offsetLookup.

Referenced by antihermitian(), antisymmetric(), escript::binaryOpDataReadyHelperTCT(), escript::binaryOpDataReadyHelperTTC(), escript::binaryOpDataReadyHelperTTT(), escript::condEval(), escript::Data::copyWithMask(), escript::Data::dp_algorithm(), eigenvalues(), eigenvalues_and_eigenvectors(), hermitian(), matrixInverse(), setSlice(), swapaxes(), symmetric(), trace(), and transpose().

◆ getPointOffset()

DataTypes::RealVectorType::size_type escript::DataTagged::getPointOffset ( int  sampleNo,
int  dataPointNo 
) const
virtual

getPointOffset

Description: Return the offset to the given data-point value in the underlying data vector.

Parameters
sampleNo- Input - sample number.
dataPointNo- Input - data-point number. T

Implements escript::DataAbstract.

References escript::DataAbstract::getFunctionSpace(), escript::FunctionSpace::getTagFromSampleNo(), m_defaultValueOffset, and m_offsetLookup.

Referenced by escript::binaryOpVectorTagged(), escript::C_GeneralTensorProduct(), and escript::DataExpanded::DataExpanded().

◆ getSampleDataByTag() [1/2]

DataTypes::real_t * escript::DataTagged::getSampleDataByTag ( int  tag,
DataTypes::real_t  dummy = 0 
)
virtual

getSampleDataByTag

Description: Return the data-point for the given tag. All of the data for the sample will be visible via the returned pointer.

This provides an interface into the data suitable for legacy C code. NB: need to do array bounds checking when accessing returned value! T

Reimplemented from escript::DataAbstract.

References CHECK_FOR_EX_WRITE, m_data_r, and m_offsetLookup.

◆ getSampleDataByTag() [2/2]

DataTypes::cplx_t * escript::DataTagged::getSampleDataByTag ( int  tag,
DataTypes::cplx_t  dummy 
)
virtual

Return the complex sample data for the given tag key. NB: If the data isn't tagged an exception will be thrown.

Reimplemented from escript::DataAbstract.

References CHECK_FOR_EX_WRITE, m_data_c, and m_offsetLookup.

◆ getSlice()

DataAbstract * escript::DataTagged::getSlice ( const DataTypes::RegionType region) const
virtual

getSlice

Description: Factory method that returns a newly created DataTagged object generated by taking the specified slice from this DataTagged object. The caller is reponsible for managing the returned object. T

Implements escript::DataAbstract.

References DataTagged().

◆ getTagCount()

size_t escript::DataTagged::getTagCount ( ) const
virtual

Return the number of tags which have been given values (+the default)

Reimplemented from escript::DataAbstract.

References m_offsetLookup.

Referenced by escript::binaryOpDataReadyHelperTCT(), escript::binaryOpDataReadyHelperTTC(), and escript::binaryOpDataReadyHelperTTT().

◆ getTagLookup()

const DataTagged::DataMapType & escript::DataTagged::getTagLookup ( ) const
inline

◆ getTagNumber()

int escript::DataTagged::getTagNumber ( int  dpno)
virtual

Return the tag number associated with the given data-point number according to the associated function space. T.

Reimplemented from escript::DataAbstract.

References escript::DataAbstract::getFunctionSpace(), escript::DataAbstract::getNumDPPSample(), escript::DataAbstract::getNumSamples(), and escript::FunctionSpace::getTagFromSampleNo().

◆ getTypedVectorRO() [1/2]

const DataTypes::RealVectorType & escript::DataTagged::getTypedVectorRO ( DataTypes::real_t  dummy) const
virtual

◆ getTypedVectorRO() [2/2]

const DataTypes::CplxVectorType & escript::DataTagged::getTypedVectorRO ( DataTypes::cplx_t  dummy) const
virtual

Implements escript::DataReady.

References m_data_c.

◆ getTypedVectorRW() [1/2]

DataTypes::RealVectorType & escript::DataTagged::getTypedVectorRW ( DataTypes::real_t  dummy)
virtual

◆ getTypedVectorRW() [2/2]

DataTypes::CplxVectorType & escript::DataTagged::getTypedVectorRW ( DataTypes::cplx_t  dummy)
virtual

Implements escript::DataReady.

References CHECK_FOR_EX_WRITE, and m_data_c.

◆ getVectorRO()

const DataTypes::RealVectorType & escript::DataTagged::getVectorRO ( ) const
virtual

Implements escript::DataReady.

References m_data_r.

Referenced by escript::condEval().

◆ getVectorROC()

const DataTypes::CplxVectorType & escript::DataTagged::getVectorROC ( ) const
virtual

Implements escript::DataReady.

References m_data_c.

◆ getVectorRW()

DataTypes::RealVectorType & escript::DataTagged::getVectorRW ( )
virtual

Return a reference to the underlying DataVector.

Implements escript::DataReady.

References CHECK_FOR_EX_WRITE, and m_data_r.

Referenced by eigenvalues(), eigenvalues_and_eigenvectors(), matrixInverse(), swapaxes(), trace(), and transpose().

◆ getVectorRWC()

DataTypes::CplxVectorType & escript::DataTagged::getVectorRWC ( )
virtual

Implements escript::DataReady.

References CHECK_FOR_EX_WRITE, and m_data_c.

Referenced by eigenvalues(), swapaxes(), trace(), and transpose().

◆ hasNaN()

bool escript::DataTagged::hasNaN ( ) const
virtual

Return true if any one of the datapoints contains a NaN.

Implements escript::DataReady.

References escript::DataAbstract::isComplex(), m_data_c, m_data_r, and escript::DataTypes::DataVectorAlt< T >::size().

◆ hermitian()

void escript::DataTagged::hermitian ( DataAbstract ev)
virtual

Computes an hermitian matrix (A + A*) / 2.

Parameters
ev- Output - hermitian matrix

Reimplemented from escript::DataAbstract.

References addTag(), getDefaultOffset(), getOffsetForTag(), escript::DataAbstract::getShape(), getTagLookup(), getTypedVectorRW(), escript::hermitian(), escript::DataAbstract::isComplex(), and m_data_c.

◆ isCurrentTag()

bool escript::DataTagged::isCurrentTag ( int  tag) const
inline

isCurrentTag

Description: Return true if the given tag exists within the DataTagged tag map.

NB: The DataTagged tag map does not necessarily coincide with the tag

keys in the associated function space. T

Referenced by setSlice().

◆ isTagged()

bool escript::DataTagged::isTagged ( ) const
inlinevirtual

◆ matrixInverse()

int escript::DataTagged::matrixInverse ( DataAbstract out) const
virtual

invert square matricies

Parameters
out- Where to store the results
Returns
errorcode (0 indicates success)

Reimplemented from escript::DataAbstract.

References addTag(), getDefaultOffset(), getOffsetForTag(), escript::DataAbstract::getRank(), escript::DataAbstract::getShape(), getTagLookup(), getVectorRW(), m_data_r, and escript::matrix_inverse().

◆ replaceNaN() [1/2]

void escript::DataTagged::replaceNaN ( DataTypes::real_t  value)
virtual

◆ replaceNaN() [2/2]

void escript::DataTagged::replaceNaN ( DataTypes::cplx_t  value)
virtual

◆ setSlice()

void escript::DataTagged::setSlice ( const DataAbstract other,
const DataTypes::RegionType region 
)
virtual

◆ setTaggedValue() [1/2]

void escript::DataTagged::setTaggedValue ( int  tagKey,
const DataTypes::ShapeType pointshape,
const DataTypes::RealVectorType value,
int  dataOffset = 0 
)
virtual

setTaggedValue

Description: Assign the given value to the given tag.

Parameters
tagKey- Input - Integer tag.
pointshape- the shape of the value parameter
value- Input - Vector storing the datapoint to be assigned to the tag.
dataOffset- beginning of the datapoint within "value". T

Reimplemented from escript::DataAbstract.

References addTaggedValue(), CHECK_FOR_EX_WRITE, escript::DataTypes::checkShape(), escript::DataTypes::createShapeErrorMessage(), escript::DataAbstract::getNoValues(), escript::DataAbstract::getShape(), escript::DataAbstract::isComplex(), m_data_r, and m_offsetLookup.

Referenced by addTaggedValue().

◆ setTaggedValue() [2/2]

void escript::DataTagged::setTaggedValue ( int  tagKey,
const DataTypes::ShapeType pointshape,
const DataTypes::CplxVectorType value,
int  dataOffset = 0 
)
virtual

◆ setToZero()

void escript::DataTagged::setToZero ( )
virtual

sets all values to zero

Reimplemented from escript::DataAbstract.

References CHECK_FOR_EX_WRITE, m_data_r, and escript::DataTypes::DataVectorAlt< T >::size().

◆ swapaxes()

void escript::DataTagged::swapaxes ( DataAbstract ev,
int  axis0,
int  axis1 
)
virtual

swaps components axis0 and axis1

Parameters
ev- Output - swapped components
axis0
axis1

Reimplemented from escript::DataAbstract.

References addTag(), getDefaultOffset(), getOffsetForTag(), escript::DataAbstract::getShape(), getTagLookup(), getVectorRW(), getVectorRWC(), escript::DataAbstract::isComplex(), m_data_c, m_data_r, and escript::swapaxes().

◆ symmetric()

void escript::DataTagged::symmetric ( DataAbstract ev)
virtual

Computes a symmetric matrix (A + AT) / 2.

Parameters
ev- Output - symmetric matrix

Reimplemented from escript::DataAbstract.

References addTag(), getDefaultOffset(), getOffsetForTag(), escript::DataAbstract::getShape(), getTagLookup(), getTypedVectorRW(), escript::DataAbstract::isComplex(), m_data_c, m_data_r, and escript::symmetric().

◆ toString()

string escript::DataTagged::toString ( ) const
virtual

Write the data as a string. Writes out each tag, including the default, and the data-point which is associated with each tag. T.

Implements escript::DataAbstract.

References getDefaultOffset(), escript::DataAbstract::getShape(), escript::DataAbstract::isComplex(), m_data_c, m_data_r, m_offsetLookup, and escript::DataTypes::pointToString().

◆ trace()

void escript::DataTagged::trace ( DataAbstract ev,
int  axis_offset 
)
virtual

Computes the trace of a matrix.

Parameters
ev- Output - the trace of a matrix
axis_offset

Reimplemented from escript::DataAbstract.

References addTag(), getDefaultOffset(), getOffsetForTag(), escript::DataAbstract::getShape(), getTagLookup(), getVectorRW(), getVectorRWC(), escript::DataAbstract::isComplex(), m_data_c, m_data_r, and escript::trace().

◆ transpose()

void escript::DataTagged::transpose ( DataAbstract ev,
int  axis_offset 
)
virtual

Transpose each data point of this Data object around the given axis.

Parameters
ev- Output - the transpose of a matrix
axis_offset

Reimplemented from escript::DataAbstract.

References addTag(), getDefaultOffset(), getOffsetForTag(), escript::DataAbstract::getShape(), getTagLookup(), getVectorRW(), getVectorRWC(), escript::DataAbstract::isComplex(), m_data_c, m_data_r, and escript::transpose().

Member Data Documentation

◆ m_data_c

DataTypes::CplxVectorType escript::DataTagged::m_data_c
private

◆ m_data_r

DataTypes::RealVectorType escript::DataTagged::m_data_r
private

◆ m_defaultValueOffset

const int escript::DataTagged::m_defaultValueOffset = 0
staticprivate

◆ m_offsetLookup

DataMapType escript::DataTagged::m_offsetLookup
private

The documentation for this class was generated from the following files: