Go to the documentation of this file.
19 #ifndef __ESCRIPT_DATATAGGED_H__
20 #define __ESCRIPT_DATATAGGED_H__
54 typedef std::vector<DataTypes::CplxVectorType::ElementType>
CplxBatchType;
253 dump(
const std::string fileName)
const;
279 getTagNumber(
int dpno);
295 getPointOffset(
int sampleNo,
296 int dataPointNo)
const;
316 addTaggedValues(
const TagListType& tagKeys,
317 const FloatBatchType& values,
338 addTaggedValues(
const TagListType& tagKeys,
358 addTaggedValue(
int tagKey,
364 addTaggedValue(
int tagKey,
396 setTaggedValue(
int tagKey,
402 setTaggedValue(
int tagKey,
441 getOffsetForTag(
int tag)
const;
460 getVectorROC()
const;
488 getTagLookup()
const;
502 isCurrentTag(
int tag)
const;
684 getDefaultOffset()
const;
705 static const int m_defaultValueOffset = 0;
776 #endif // __ESCRIPT_DATATAGGED_H__
static const int maxRank
The maximum number of dimensions a datapoint can have.
Definition: DataTypes.h:46
virtual DataTypes::RealVectorType::size_type getLength() const
getLength
Definition: DataTagged.h:769
#define CHECK_FOR_EX_WRITE
Definition: DataTagged.cpp:40
int MPI_Status
Definition: EsysMPI.h:45
#define ESCRIPT_DLL_API
Definition: escriptcore/src/system_dep.h:30
int getTagFromSampleNo(DataTypes::dim_t sampleNo) const
Returns the tag associated with the given sample number.
Definition: FunctionSpace.cpp:144
double real_t
type of all real-valued scalars in escript
Definition: DataTypes.h:51
const DataMapType & getTagLookup() const
getTagLookup
Definition: DataTagged.h:762
virtual void swapaxes(DataAbstract *ev, int axis0, int axis1)
swaps components axis0 and axis1
Definition: DataTagged.cpp:1248
const ElementType & const_reference
Definition: DataVectorAlt.h:52
void addTag(int tagKey)
addTag - does not modify the default value for this object. ** Not unit tested **
Definition: DataTagged.cpp:685
virtual void setToZero()
sets all values to zero
Definition: DataTagged.cpp:1391
void copySlice(VEC &left, const ShapeType &leftShape, typename VEC::size_type leftOffset, const VEC &other, const ShapeType &otherShape, typename VEC::size_type otherOffset, const RegionLoopRangeType ®ion)
Copy a data slice specified by the given region and offset from the "other" vector into the "left" ve...
Definition: DataVector.h:174
void complicate()
Definition: DataTagged.cpp:1701
virtual void eigenvalues(DataAbstract *ev)
solves the eigenvalue problem this*V=ev*V for the eigenvalues ev
Definition: DataTagged.cpp:1283
virtual const DataTypes::RealVectorType & getTypedVectorRO(DataTypes::real_t dummy) const
Definition: DataConstant.cpp:872
DataTypes::RealVectorType::reference getDataByTagRW(int tag, DataTypes::RealVectorType::size_type i, DataTypes::real_t dummy=0)
getDataByTag
Definition: DataTagged.cpp:1017
DataTypes::RealVectorType & getVectorRW()
Return a reference to the underlying DataVector.
Definition: DataTagged.cpp:1643
void antihermitian(const DataTypes::CplxVectorType &in, const DataTypes::ShapeType &inShape, typename DataTypes::CplxVectorType::size_type inOffset, DataTypes::CplxVectorType &ev, const DataTypes::ShapeType &evShape, typename DataTypes::CplxVectorType::size_type evOffset)
computes a antihermitian matrix from your square matrix A: (A - adjoint(A)) / 2
Definition: DataVectorOps.cpp:963
virtual void trace(DataAbstract *ev, int axis_offset)
Computes the trace of a matrix.
Definition: DataTagged.cpp:1178
DataTypes::RealVectorType::size_type getDefaultOffset() const
Returns the offset in the structure which stores the default value.
Definition: DataTagged.h:724
DataTypes::CplxVectorType::reference getDataByTagRW(int tag, DataTypes::CplxVectorType::size_type i, DataTypes::cplx_t dummy)
bool checkShape(const ShapeType &s1, const ShapeType &s2)
Test if two shapes are equal.
Definition: DataTypes.h:305
DataConstant stores a single data point which represents the entire function space.
Definition: DataConstant.h:38
void eigenvalues(const DataTypes::RealVectorType &in, const DataTypes::ShapeType &inShape, typename DataTypes::RealVectorType::size_type inOffset, DataTypes::RealVectorType &ev, const DataTypes::ShapeType &evShape, typename DataTypes::RealVectorType::size_type evOffset)
solves a local eigenvalue problem
Definition: DataVectorOps.h:639
DataTypes::RealVectorType::reference getDefaultValueRW(DataTypes::RealVectorType::size_type i, DataTypes::real_t dummy=0)
getDefaultValue
Definition: DataTagged.h:731
void resize(const size_type newSize, const value_type newVal=0.0, const size_type newBlockSize=1)
Resize the DataVectorAlt to the given length "newSize". All current data is lost. All elements in the...
Definition: DataVectorAlt.h:291
DataTypes::vec_size_type size_type
Definition: DataVectorAlt.h:50
void symmetric(const VEC &in, const DataTypes::ShapeType &inShape, typename VEC::size_type inOffset, VEC &ev, const DataTypes::ShapeType &evShape, typename VEC::size_type evOffset)
computes a symmetric matrix from your square matrix A: (A + transpose(A)) / 2
Definition: DataVectorOps.h:103
static const int m_defaultValueOffset
Definition: DataTagged.h:705
void transpose(const VEC &in, const DataTypes::ShapeType &inShape, typename VEC::size_type inOffset, VEC &ev, const DataTypes::ShapeType &evShape, typename VEC::size_type evOffset, int axis_offset)
Transpose each data point of this Data object around the given axis.
Definition: DataVectorOps.h:343
DataTypes::RealVectorType::const_reference getDataByTagRO(int tag, DataTypes::RealVectorType::size_type i, DataTypes::real_t dummy=0) const
Definition: DataTagged.cpp:1006
unsigned int getRank() const
Return the rank information for the point data.
Definition: DataAbstract.h:653
DataTypes::CplxVectorType m_data_c
Definition: DataTagged.h:709
Definition: FunctionSpace.h:36
DataTypes::RegionLoopRangeType getSliceRegionLoopRange(const DataTypes::RegionType ®ion)
Modify region to copy from in order to deal with the case where one range in the region contains iden...
Definition: DataTypes.cpp:188
Definition: DataReady.h:37
bool canTag() const
Returns true if this function space support tags.
Definition: FunctionSpace.cpp:353
const DataTypes::RealVectorType & getVectorRO() const
Definition: DataTagged.cpp:1650
DataReady parent
Definition: DataTagged.h:47
std::vector< DataTypes::CplxVectorType::ElementType > CplxBatchType
Definition: DataTagged.h:54
std::map< int, int > DataMapType
Definition: DataTagged.h:58
#define MPI_INT
Definition: EsysMPI.h:46
virtual bool hasInf() const
Return true if data contains Inf or -Inf.
Definition: DataTagged.cpp:843
Definition: LapackInverseHelper.h:28
Simulates a full dataset accessible via sampleNo and dataPointNo.
Definition: DataTagged.h:46
int getNumDPPSample() const
Return the number of data points per sample.
Definition: DataAbstract.h:612
#define MPI_COMM_WORLD
Definition: EsysMPI.h:48
Definition: DataException.h:28
DataTypes::CplxVectorType::reference getDefaultValueRW(DataTypes::CplxVectorType::size_type i, DataTypes::cplx_t dummy)
void hermitian(const DataTypes::CplxVectorType &in, const DataTypes::ShapeType &inShape, DataTypes::CplxVectorType::size_type inOffset, DataTypes::CplxVectorType &ev, const DataTypes::ShapeType &evShape, DataTypes::CplxVectorType::size_type evOffset)
computes an hermitian matrix from your square matrix A: (A + adjoint(A)) / 2
Definition: DataVectorOps.cpp:916
std::vector< int > ShapeType
The shape of a single datapoint.
Definition: DataTypes.h:43
boost::shared_ptr< JMPI_ > JMPI
Definition: EsysMPI.h:72
DataTypes::CplxVectorType::const_reference getDataByTagRO(int tag, DataTypes::CplxVectorType::size_type i, DataTypes::cplx_t dummy) const
Contains the types to represent Shapes, Regions, RegionLoop ranges and vectors of data as well as the...
Definition: DataTypes.cpp:88
void fillComplexFromReal(const RealVectorType &r, CplxVectorType &c)
copy data from a real vector to a complex vector The complex vector will be resized as needed and any...
void copySliceFrom(VEC &left, const ShapeType &leftShape, typename VEC::size_type leftOffset, const VEC &other, const ShapeType &otherShape, typename VEC::size_type otherOffset, const RegionLoopRangeType ®ion)
Copy data into a slice specified by the given region and offset in the left vector from the other vec...
Definition: DataVector.h:281
virtual void setSlice(const DataAbstract *other, const DataTypes::RegionType ®ion)
setSlice
Definition: DataTagged.cpp:393
virtual void transpose(DataAbstract *ev, int axis_offset)
Transpose each data point of this Data object around the given axis.
Definition: DataTagged.cpp:1213
bool isTagged() const
Definition: DataTagged.h:153
std::vector< std::pair< int, int > > RegionType
Definition: DataTypes.h:44
int noValues(const ShapeType &shape)
Calculate the number of values in a datapoint with the given shape.
Definition: DataTypes.cpp:91
const DataTypes::ShapeType & getShape() const
Return the shape information for the point data.
Definition: DataAbstract.h:642
DataTypes::ShapeType getResultSliceShape(const RegionType ®ion)
Determine the shape of the specified slice region.
Definition: DataTypes.cpp:173
DataTypes::CplxVectorType & getVectorRWC()
Definition: DataTagged.cpp:1656
int getNumSamples() const
Return the number of samples.
Definition: DataAbstract.h:623
void setTaggedValue(int tagKey, const DataTypes::ShapeType &pointshape, const DataTypes::RealVectorType &value, int dataOffset=0)
setTaggedValue
Definition: DataTagged.cpp:497
virtual DataTypes::RealVectorType & getTypedVectorRW(DataTypes::real_t dummy)
These versions use the type system rather than method name to determine return type.
Definition: DataTagged.cpp:1669
DataTypes::RealVectorType m_data_r
Definition: DataTagged.h:708
virtual const DataTypes::RealVectorType & getTypedVectorRO(DataTypes::real_t dummy) const
Definition: DataTagged.cpp:1676
virtual DataAbstract * deepCopy() const
Return a deep copy of the current object.
Definition: DataTagged.cpp:306
void addTaggedValues(const TagListType &tagKeys, const FloatBatchType &values, const ShapeType &vShape)
addTaggedValues
Definition: DataTagged.cpp:554
int matrix_inverse(const DataTypes::RealVectorType &in, const DataTypes::ShapeType &inShape, DataTypes::RealVectorType::size_type inOffset, DataTypes::RealVectorType &out, const DataTypes::ShapeType &outShape, DataTypes::RealVectorType::size_type outOffset, int count, LapackInverseHelper &helper)
computes the inverses of square (up to 3x3) matricies
Definition: DataVectorOps.cpp:207
size_t getTagCount() const
Return the number of tags which have been given values (+the default)
Definition: DataTagged.cpp:1695
virtual DataTypes::RealVectorType::size_type getPointOffset(int sampleNo, int dataPointNo) const
getPointOffset
Definition: DataTagged.cpp:982
virtual DataAbstract * zeroedCopy() const
Return an object with the same type, domain (and tags if appropriate) as this, but all values are zer...
Definition: DataTagged.cpp:313
bool m_iscompl
Definition: DataAbstract.h:564
virtual int matrixInverse(DataAbstract *out) const
invert square matricies
Definition: DataTagged.cpp:1357
virtual void antihermitian(DataAbstract *ev)
Computes an antihermitian matrix (A - A*) / 2.
Definition: DataTagged.cpp:1152
void swapaxes(const VEC &in, const DataTypes::ShapeType &inShape, typename VEC::size_type inOffset, VEC &ev, const DataTypes::ShapeType &evShape, typename VEC::size_type evOffset, int axis0, int axis1)
swaps the components axis0 and axis1.
Definition: DataVectorOps.h:488
virtual void antisymmetric(DataAbstract *ev)
Computes a antisymmetric matrix (A - AT) / 2.
Definition: DataTagged.cpp:1089
std::vector< std::pair< int, int > > RegionLoopRangeType
Definition: DataTypes.h:45
#define V(_K_, _I_)
Definition: ShapeFunctions.cpp:121
virtual DataAbstract * getSlice(const DataTypes::RegionType ®ion) const
getSlice
Definition: DataTagged.cpp:334
DataTypes::RealVectorType::const_reference getDefaultValueRO(DataTypes::RealVectorType::size_type i, DataTypes::real_t dummy=0) const
Definition: DataTagged.h:738
const int * borrowListOfTagsInUse() const
Definition: FunctionSpace.cpp:330
const DataTypes::CplxVectorType & getVectorROC() const
Definition: DataTagged.cpp:1663
virtual void replaceInf(DataTypes::real_t value)
replaces all (+/-)Inf values with value
Definition: DataTagged.cpp:878
virtual ~DataTagged()
Destructor.
Definition: DataTagged.h:150
Definition: AbstractContinuousDomain.cpp:23
size_type size() const
Return the number of elements in this DataVectorAlt.
Definition: DataVectorAlt.h:215
std::string pointToString(const RealVectorType &data, const ShapeType &shape, int offset, const std::string &prefix)
Display a single value (with the specified shape) from the data.
Definition: DataAbstract.h:63
virtual void symmetric(DataAbstract *ev)
Computes a symmetric matrix (A + AT) / 2.
Definition: DataTagged.cpp:1052
DataTypes::RealVectorType::size_type getOffsetForTag(int tag) const
getOffsetForTag
Definition: DataTagged.cpp:995
bool isCurrentTag(int tag) const
isCurrentTag
Definition: DataTagged.h:716
Describes binary operations performed on DataVector.
std::string createShapeErrorMessage(const std::string &messagePrefix, const DataTypes::ShapeType &other, const DataTypes::ShapeType &thisShape)
Produce a string containing two shapes.
Definition: DataTypes.cpp:206
int getTypeCode() const
Returns the function space type code.
Definition: FunctionSpace.cpp:95
DataMapType m_offsetLookup
Definition: DataTagged.h:701
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
Definition: DataTagged.cpp:1319
bool isComplex() const
true if the components of datapoints are complex
Definition: DataAbstract.cpp:70
void addTaggedValue(int tagKey, const DataTypes::ShapeType &pointshape, const DataTypes::RealVectorType &value, int dataOffset=0)
addTaggedValue
Definition: DataTagged.cpp:608
unsigned int getNoValues() const
Return the number of values in the shape for this object.
Definition: DataAbstract.h:664
ElementType & reference
Definition: DataVectorAlt.h:51
std::vector< DataTypes::RealVectorType::ElementType > FloatBatchType
Definition: DataTagged.h:53
void antisymmetric(const VEC &in, const DataTypes::ShapeType &inShape, typename VEC::size_type inOffset, VEC &ev, const DataTypes::ShapeType &evShape, typename VEC::size_type evOffset)
computes a antisymmetric matrix from your square matrix A: (A - transpose(A)) / 2
Definition: DataVectorOps.h:152
const FunctionSpace & getFunctionSpace() const
Return the function space associated with this Data object.
Definition: DataAbstract.h:635
std::complex< real_t > cplx_t
complex data type
Definition: DataTypes.h:54
virtual int getTagNumber(int dpno)
Return the tag number associated with the given data-point number according to the associated functio...
Definition: DataTagged.cpp:467
virtual DataTypes::real_t * getSampleDataByTag(int tag, DataTypes::real_t dummy=0)
getSampleDataByTag
Definition: DataTagged.cpp:731
DataTypes::ShapeType ShapeType
Definition: DataAbstract.h:67
virtual std::string toString() const
Write the data as a string. Writes out each tag, including the default, and the data-point which is a...
Definition: DataTagged.cpp:928
virtual void dump(const std::string fileName) const
dumps the object into a netCDF file
Definition: DataTagged.cpp:1547
void trace(const VEC &in, const DataTypes::ShapeType &inShape, typename VEC::size_type inOffset, VEC &ev, const DataTypes::ShapeType &evShape, typename VEC::size_type evOffset, int axis_offset)
computes the trace of a matrix
Definition: DataVectorOps.h:242
DataTagged(const FunctionSpace &what, const DataTypes::ShapeType &shape, const int tags[], const DataTypes::RealVectorType &data)
Alternative Constructor for DataTagged.
Definition: DataTagged.cpp:51
virtual void hermitian(DataAbstract *ev)
Computes an hermitian matrix (A + A*) / 2.
Definition: DataTagged.cpp:1124
int getNumberOfTagsInUse() const
Returns the number of tags in use.
Definition: FunctionSpace.cpp:325
std::vector< int > TagListType
Definition: DataTagged.h:52
bool hasNaN() const
Return true if any one of the datapoints contains a NaN.
Definition: DataTagged.cpp:760
void replaceNaN(DataTypes::real_t value)
replaces all NaN values with value
Definition: DataTagged.cpp:795
void eigenvalues_and_eigenvectors(const DataTypes::RealVectorType &in, const DataTypes::ShapeType &inShape, DataTypes::RealVectorType::size_type inOffset, DataTypes::RealVectorType &ev, const DataTypes::ShapeType &evShape, DataTypes::RealVectorType::size_type evOffset, DataTypes::RealVectorType &V, const DataTypes::ShapeType &VShape, DataTypes::RealVectorType::size_type VOffset, const double tol=1.e-13)
solves a local eigenvalue problem
Definition: DataVectorOps.h:750