Go to the documentation of this file.
18 #if !defined escript_DataConstant_20040323_H
19 #define escript_DataConstant_20040323_H
37 class DataConstant :
public DataReady {
53 const FunctionSpace& what);
186 dump(
const std::string fileName)
const;
210 int dataPointNo)
const;
static const int maxRank
The maximum number of dimensions a datapoint can have.
Definition: DataTypes.h:68
virtual DataTypes::RealVectorType::size_type getLength() const
Return the number of doubles stored for the Data object.
Definition: DataConstant.cpp:382
virtual bool hasInf() const
Return true if data contains Inf or -Inf.
Definition: DataConstant.cpp:235
int MPI_Status
Definition: EsysMPI.h:43
#define ESCRIPT_DLL_API
Definition: escriptcore/src/system_dep.h:28
virtual void hermitian(DataAbstract *ev)
Computes an hermitian matrix (A + A*) / 2.
Definition: DataConstant.cpp:467
virtual void symmetric(DataAbstract *ev)
Computes a symmetric matrix (A + AT) / 2.
Definition: DataConstant.cpp:433
double real_t
type of all real-valued scalars in escript
Definition: DataTypes.h:73
virtual void swapaxes(DataAbstract *ev, int axis0, int axis1)
swaps components axis0 and axis1
Definition: DataConstant.cpp:514
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:172
DataTypes::CplxVectorType & getVectorRWC()
Definition: DataConstant.cpp:850
virtual void transpose(DataAbstract *ev, int axis_offset)
Transpose each data point of this Data object around the given axis.
Definition: DataConstant.cpp:531
virtual const DataTypes::RealVectorType & getTypedVectorRO(DataTypes::real_t dummy) const
Definition: DataConstant.cpp:870
DataTypes::RealVectorType m_data_r
Definition: DataConstant.h:445
const DataTypes::RealVectorType & getVectorRO() const
Definition: DataConstant.cpp:844
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:961
DataReady parent
Definition: DataConstant.h:61
#define CHECK_FOR_EX_WRITE
Definition: DataConstant.cpp:50
virtual void setToZero()
sets all values to zero
Definition: DataConstant.cpp:598
virtual void replaceInf(DataTypes::real_t value)
replaces all (+/-)Inf values with value
Definition: DataConstant.cpp:270
bool checkShape(const ShapeType &s1, const ShapeType &s2)
Test if two shapes are equal.
Definition: DataTypes.h:327
DataTypes::RealVectorType & getVectorRW()
Return a reference to the underlying DataVector.
Definition: DataConstant.cpp:837
DataConstant stores a single data point which represents the entire function space.
Definition: DataConstant.h:48
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:637
Definition: WrappedArray.h:30
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:313
DataTypes::vec_size_type size_type
Definition: DataVectorAlt.h:84
virtual void trace(DataAbstract *ev, int axis_offset)
Computes the trace of a matrix.
Definition: DataConstant.cpp:496
bool isComplex() const
Definition: WrappedArray.h:69
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:101
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:341
unsigned int getRank() const
Return the rank information for the point data.
Definition: DataAbstract.h:663
Definition: FunctionSpace.h:45
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:186
bool hasNaN() const
Return true if the value contains a NaN.
Definition: DataConstant.cpp:151
Definition: DataReady.h:46
const DataTypes::CplxVectorType & getVectorROC() const
Definition: DataConstant.cpp:857
#define MPI_INT
Definition: EsysMPI.h:44
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:565
Definition: LapackInverseHelper.h:37
#define MPI_COMM_WORLD
Definition: EsysMPI.h:46
DataConstant(const WrappedArray &value, const FunctionSpace &what)
Constructor for DataConstant objects.
Definition: DataConstant.cpp:63
Definition: DataException.h:37
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:914
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:863
std::vector< int > ShapeType
The shape of a single datapoint.
Definition: DataTypes.h:65
boost::shared_ptr< JMPI_ > JMPI
Definition: EsysMPI.h:70
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:279
virtual DataAbstract * deepCopy() const
Return a deep copy of the current object.
Definition: DataConstant.cpp:329
std::vector< std::pair< int, int > > RegionType
Definition: DataTypes.h:66
int noValues(const ShapeType &shape)
Calculate the number of values in a datapoint with the given shape.
Definition: DataTypes.cpp:89
const DataTypes::ShapeType & getShape() const
Return the shape information for the point data.
Definition: DataAbstract.h:652
DataTypes::ShapeType getResultSliceShape(const RegionType ®ion)
Determine the shape of the specified slice region.
Definition: DataTypes.cpp:171
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:504
bool isConstant() const
Definition: DataConstant.h:130
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:335
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:205
bool m_iscompl
Definition: DataAbstract.h:574
DataTypes::CplxVectorType m_data_c
Definition: DataConstant.h:446
std::string toString() const
Write the data as a string.
Definition: DataConstant.cpp:320
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:486
std::vector< std::pair< int, int > > RegionLoopRangeType
Definition: DataTypes.h:67
virtual int matrixInverse(DataAbstract *out) const
invert square matricies
Definition: DataConstant.cpp:581
#define V(_K_, _I_)
Definition: ShapeFunctions.cpp:133
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:388
virtual void dump(const std::string fileName) const
dumps the object into a netCDF file
Definition: DataConstant.cpp:756
void complicate()
Convert from real data to complex data.
Definition: DataConstant.cpp:888
Definition: AbstractContinuousDomain.cpp:22
size_type size() const
Return the number of elements in this DataVectorAlt.
Definition: DataVectorAlt.h:237
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:72
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:394
std::string createShapeErrorMessage(const std::string &messagePrefix, const DataTypes::ShapeType &other, const DataTypes::ShapeType &thisShape)
Produce a string containing two shapes.
Definition: DataTypes.cpp:204
int getTypeCode() const
Returns the function space type code.
Definition: FunctionSpace.cpp:93
virtual void eigenvalues(DataAbstract *ev)
solves the eigenvalue problem this*V=ev*V for the eigenvalues ev
Definition: DataConstant.cpp:548
DataReady(const FunctionSpace &what, const ShapeType &shape, bool isDataEmpty=false)
Definition: DataReady.cpp:33
virtual void antisymmetric(DataAbstract *ev)
Computes a nonsymmetric matrix (A - AT) / 2.
Definition: DataConstant.cpp:450
virtual void antihermitian(DataAbstract *ev)
Computes an anti-hermitian matrix (A - A*) / 2.
Definition: DataConstant.cpp:481
bool isComplex() const
true if the components of datapoints are complex
Definition: DataAbstract.cpp:68
unsigned int getNoValues() const
Return the number of values in the shape for this object.
Definition: DataAbstract.h:674
void replaceNaN(DataTypes::real_t value)
replaces all NaN values with value
Definition: DataConstant.cpp:186
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:150
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:352
const FunctionSpace & getFunctionSpace() const
Return the function space associated with this Data object.
Definition: DataAbstract.h:645
std::complex< real_t > cplx_t
complex data type
Definition: DataTypes.h:76
DataTypes::ShapeType ShapeType
Definition: DataAbstract.h:77
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:240
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:748