Go to the documentation of this file.
19 #if !defined escript_DataConstant_20040323_H
20 #define escript_DataConstant_20040323_H
38 class DataConstant :
public DataReady {
54 const FunctionSpace& what);
187 dump(
const std::string fileName)
const;
211 int dataPointNo)
const;
static const int maxRank
The maximum number of dimensions a datapoint can have.
Definition: DataTypes.h:71
virtual DataTypes::RealVectorType::size_type getLength() const
Return the number of doubles stored for the Data object.
Definition: DataConstant.cpp:383
virtual bool hasInf() const
Return true if data contains Inf or -Inf.
Definition: DataConstant.cpp:236
int MPI_Status
Definition: EsysMPI.h:44
#define ESCRIPT_DLL_API
Definition: escriptcore/src/system_dep.h:29
virtual void hermitian(DataAbstract *ev)
Computes an hermitian matrix (A + A*) / 2.
Definition: DataConstant.cpp:468
virtual void symmetric(DataAbstract *ev)
Computes a symmetric matrix (A + AT) / 2.
Definition: DataConstant.cpp:434
double real_t
type of all real-valued scalars in escript
Definition: DataTypes.h:76
virtual void swapaxes(DataAbstract *ev, int axis0, int axis1)
swaps components axis0 and axis1
Definition: DataConstant.cpp:515
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:173
DataTypes::CplxVectorType & getVectorRWC()
Definition: DataConstant.cpp:851
virtual void transpose(DataAbstract *ev, int axis_offset)
Transpose each data point of this Data object around the given axis.
Definition: DataConstant.cpp:532
virtual const DataTypes::RealVectorType & getTypedVectorRO(DataTypes::real_t dummy) const
Definition: DataConstant.cpp:871
DataTypes::RealVectorType m_data_r
Definition: DataConstant.h:448
const DataTypes::RealVectorType & getVectorRO() const
Definition: DataConstant.cpp:845
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:962
DataReady parent
Definition: DataConstant.h:64
#define CHECK_FOR_EX_WRITE
Definition: DataConstant.cpp:51
virtual void setToZero()
sets all values to zero
Definition: DataConstant.cpp:599
virtual void replaceInf(DataTypes::real_t value)
replaces all (+/-)Inf values with value
Definition: DataConstant.cpp:271
bool checkShape(const ShapeType &s1, const ShapeType &s2)
Test if two shapes are equal.
Definition: DataTypes.h:330
DataTypes::RealVectorType & getVectorRW()
Return a reference to the underlying DataVector.
Definition: DataConstant.cpp:838
DataConstant stores a single data point which represents the entire function space.
Definition: DataConstant.h:50
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:638
Definition: WrappedArray.h:31
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:316
DataTypes::vec_size_type size_type
Definition: DataVectorAlt.h:88
virtual void trace(DataAbstract *ev, int axis_offset)
Computes the trace of a matrix.
Definition: DataConstant.cpp:497
bool isComplex() const
Definition: WrappedArray.h:70
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:102
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:342
unsigned int getRank() const
Return the rank information for the point data.
Definition: DataAbstract.h:665
Definition: FunctionSpace.h:47
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:187
bool hasNaN() const
Return true if the value contains a NaN.
Definition: DataConstant.cpp:152
Definition: DataReady.h:48
const DataTypes::CplxVectorType & getVectorROC() const
Definition: DataConstant.cpp:858
#define MPI_INT
Definition: EsysMPI.h:45
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: DataConstant.cpp:566
Definition: LapackInverseHelper.h:39
#define MPI_COMM_WORLD
Definition: EsysMPI.h:47
DataConstant(const WrappedArray &value, const FunctionSpace &what)
Constructor for DataConstant objects.
Definition: DataConstant.cpp:64
Definition: DataException.h:39
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:915
virtual DataTypes::RealVectorType & getTypedVectorRW(DataTypes::real_t dummy)
These versions use the type system rather than method name to determine return type.
Definition: DataConstant.cpp:864
std::vector< int > ShapeType
The shape of a single datapoint.
Definition: DataTypes.h:68
boost::shared_ptr< JMPI_ > JMPI
Definition: EsysMPI.h:71
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:280
virtual DataAbstract * deepCopy() const
Return a deep copy of the current object.
Definition: DataConstant.cpp:330
std::vector< std::pair< int, int > > RegionType
Definition: DataTypes.h:69
int noValues(const ShapeType &shape)
Calculate the number of values in a datapoint with the given shape.
Definition: DataTypes.cpp:90
const DataTypes::ShapeType & getShape() const
Return the shape information for the point data.
Definition: DataAbstract.h:654
DataTypes::ShapeType getResultSliceShape(const RegionType ®ion)
Determine the shape of the specified slice region.
Definition: DataTypes.cpp:172
void copyFromArray(const WrappedArray &value, size_type copies)
Populates the vector with the data from value. This method currently throws an exception if the speci...
Definition: DataVectorAlt.h:507
bool isConstant() const
Definition: DataConstant.h:133
virtual DataAbstract * zeroedCopy() const
Return an object with the same type, domain (and tags if appropriate) as this, but all values are zer...
Definition: DataConstant.cpp:336
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:206
bool m_iscompl
Definition: DataAbstract.h:576
DataTypes::CplxVectorType m_data_c
Definition: DataConstant.h:449
std::string toString() const
Write the data as a string.
Definition: DataConstant.cpp:321
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:487
std::vector< std::pair< int, int > > RegionLoopRangeType
Definition: DataTypes.h:70
virtual int matrixInverse(DataAbstract *out) const
invert square matricies
Definition: DataConstant.cpp:582
#define V(_K_, _I_)
Definition: ShapeFunctions.cpp:135
virtual DataAbstract * getSlice(const DataTypes::RegionType ®ion) const
Factory method that returns a newly created DataConstant object sliced from the specified region of t...
Definition: DataConstant.cpp:389
virtual void dump(const std::string fileName) const
dumps the object into a netCDF file
Definition: DataConstant.cpp:757
void complicate()
Convert from real data to complex data.
Definition: DataConstant.cpp:889
Definition: AbstractContinuousDomain.cpp:23
size_type size() const
Return the number of elements in this DataVectorAlt.
Definition: DataVectorAlt.h:240
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:74
Describes binary operations performed on DataVector.
virtual void setSlice(const DataAbstract *value, const DataTypes::RegionType ®ion)
Copy the specified region from the given value.
Definition: DataConstant.cpp:395
std::string createShapeErrorMessage(const std::string &messagePrefix, const DataTypes::ShapeType &other, const DataTypes::ShapeType &thisShape)
Produce a string containing two shapes.
Definition: DataTypes.cpp:205
int getTypeCode() const
Returns the function space type code.
Definition: FunctionSpace.cpp:94
virtual void eigenvalues(DataAbstract *ev)
solves the eigenvalue problem this*V=ev*V for the eigenvalues ev
Definition: DataConstant.cpp:549
DataReady(const FunctionSpace &what, const ShapeType &shape, bool isDataEmpty=false)
Definition: DataReady.cpp:35
virtual void antisymmetric(DataAbstract *ev)
Computes a nonsymmetric matrix (A - AT) / 2.
Definition: DataConstant.cpp:451
virtual void antihermitian(DataAbstract *ev)
Computes an anti-hermitian matrix (A - A*) / 2.
Definition: DataConstant.cpp:482
bool isComplex() const
true if the components of datapoints are complex
Definition: DataAbstract.cpp:69
unsigned int getNoValues() const
Return the number of values in the shape for this object.
Definition: DataAbstract.h:676
void replaceNaN(DataTypes::real_t value)
replaces all NaN values with value
Definition: DataConstant.cpp:187
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:151
virtual DataTypes::RealVectorType::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 i...
Definition: DataConstant.cpp:353
const FunctionSpace & getFunctionSpace() const
Return the function space associated with this Data object.
Definition: DataAbstract.h:647
std::complex< real_t > cplx_t
complex data type
Definition: DataTypes.h:79
DataTypes::ShapeType ShapeType
Definition: DataAbstract.h:79
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:241
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:749