DataConstant.h
Go to the documentation of this file.
/*****************************************************************************
*
* Copyright (c) 2003-2017 by The University of Queensland
* http://www.uq.edu.au
*
* Primary Business: Queensland, Australia
* Licensed under the Apache License, version 2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Development until 2012 by Earth Systems Science Computational Center (ESSCC)
* Development 2012-2013 by School of Earth Sciences
* Development from 2014 by Centre for Geoscience Computing (GeoComp)
*
*****************************************************************************/
#if !defined escript_DataConstant_20040323_H
#define escript_DataConstant_20040323_H
#include "system_dep.h"
#include "DataReady.h"
#include "WrappedArray.h"
namespace escript {
class DataConstant : public DataReady {
typedef DataReady parent;
public:
ESCRIPT_DLL_API
explicit DataConstant(const WrappedArray& value,
const FunctionSpace& what);
ESCRIPT_DLL_API
DataConstant(const DataConstant& other);
ESCRIPT_DLL_API
explicit DataConstant(const DataConstant& other,
const DataTypes::RegionType& region);
ESCRIPT_DLL_API
explicit DataConstant(const FunctionSpace& what,
const DataTypes::ShapeType &shape,
const DataTypes::RealVectorType &data);
explicit DataConstant(const FunctionSpace& what,
const DataTypes::ShapeType &shape,
const DataTypes::CplxVectorType &data);
ESCRIPT_DLL_API
explicit DataConstant(const FunctionSpace& what,
const DataTypes::ShapeType &shape,
const DataTypes::real_t v);
explicit DataConstant(const FunctionSpace& what,
const DataTypes::ShapeType &shape,
const DataTypes::cplx_t v);
ESCRIPT_DLL_API
bool
isConstant() const
{
return true;
};
ESCRIPT_DLL_API
bool
hasNaN() const;
ESCRIPT_DLL_API
void
replaceNaN(DataTypes::real_t value);
ESCRIPT_DLL_API
void
replaceNaN(DataTypes::cplx_t value);
ESCRIPT_DLL_API
std::string
toString() const;
ESCRIPT_DLL_API
virtual
DataAbstract*
deepCopy() const;
ESCRIPT_DLL_API
virtual
DataAbstract*
zeroedCopy() const;
ESCRIPT_DLL_API
virtual
void
dump(const std::string fileName) const;
ESCRIPT_DLL_API
virtual
void
setToZero();
ESCRIPT_DLL_API
virtual
DataTypes::RealVectorType::size_type
getPointOffset(int sampleNo,
int dataPointNo) const;
ESCRIPT_DLL_API
virtual
DataTypes::RealVectorType::size_type
getPointOffset(int sampleNo,
int dataPointNo);
ESCRIPT_DLL_API
virtual
DataTypes::RealVectorType::size_type
getLength() const;
ESCRIPT_DLL_API
virtual
DataAbstract*
getSlice(const DataTypes::RegionType& region) const;
ESCRIPT_DLL_API
virtual
void
setSlice(const DataAbstract* value,
const DataTypes::RegionType& region);
ESCRIPT_DLL_API
virtual void
symmetric(DataAbstract* ev);
ESCRIPT_DLL_API
virtual void
antisymmetric(DataAbstract* ev);
ESCRIPT_DLL_API
virtual void
hermitian(DataAbstract* ev);
ESCRIPT_DLL_API
virtual void
antihermitian(DataAbstract* ev);
ESCRIPT_DLL_API
virtual void
trace(DataAbstract* ev, int axis_offset);
ESCRIPT_DLL_API
virtual void
transpose(DataAbstract* ev, int axis_offset);
ESCRIPT_DLL_API
virtual void
swapaxes(DataAbstract* ev, int axis0, int axis1);
ESCRIPT_DLL_API
virtual void
eigenvalues(DataAbstract* ev);
ESCRIPT_DLL_API
virtual void
eigenvalues_and_eigenvectors(DataAbstract* ev,DataAbstract* V,const double tol=1.e-13);
ESCRIPT_DLL_API
virtual int
matrixInverse(DataAbstract* out) const;
ESCRIPT_DLL_API
DataTypes::RealVectorType&
getVectorRW();
ESCRIPT_DLL_API
const DataTypes::RealVectorType&
getVectorRO() const;
ESCRIPT_DLL_API
DataTypes::CplxVectorType&
getVectorRWC();
ESCRIPT_DLL_API
const DataTypes::CplxVectorType&
getVectorROC() const;
ESCRIPT_DLL_API
virtual DataTypes::RealVectorType&
getTypedVectorRW(DataTypes::real_t dummy);
ESCRIPT_DLL_API
virtual const DataTypes::RealVectorType&
getTypedVectorRO(DataTypes::real_t dummy) const;
ESCRIPT_DLL_API
virtual DataTypes::CplxVectorType&
getTypedVectorRW(DataTypes::cplx_t dummy);
ESCRIPT_DLL_API
virtual const DataTypes::CplxVectorType&
getTypedVectorRO(DataTypes::cplx_t dummy) const;
ESCRIPT_DLL_API
void complicate();
protected:
private:
//
// the actual data
DataTypes::RealVectorType m_data_r;
DataTypes::CplxVectorType m_data_c;
};
} // end of namespace
#endif
escript::FunctionSpace
Definition: FunctionSpace.h:34
escript::DataConstant::getVectorRWC
DataTypes::CplxVectorType & getVectorRWC()
Definition: DataConstant.cpp:766
escript::DataConstant::m_data_r
DataTypes::RealVectorType m_data_r
Definition: DataConstant.h:399
escript::DataConstant::trace
virtual void trace(DataAbstract *ev, int axis_offset)
Computes the trace of a matrix.
Definition: DataConstant.cpp:412
WrappedArray.h
escript::DataConstant::hermitian
virtual void hermitian(DataAbstract *ev)
Computes an hermitian matrix (A + A*) / 2.
Definition: DataConstant.cpp:383
escript::DataConstant::symmetric
virtual void symmetric(DataAbstract *ev)
Computes a symmetric matrix (A + AT) / 2.
Definition: DataConstant.cpp:349
escript::DataConstant::swapaxes
virtual void swapaxes(DataAbstract *ev, int axis0, int axis1)
swaps components axis0 and axis1
Definition: DataConstant.cpp:430
escript::DataReady
Definition: DataReady.h:35
escript::DataTypes::DataVectorAlt< real_t >::size_type
DataTypes::vec_size_type size_type
Definition: DataVectorAlt.h:49
escript::DataConstant::getVectorRO
const DataTypes::RealVectorType & getVectorRO() const
Definition: DataConstant.cpp:760
escript::DataTypes::RegionType
std::vector< std::pair< int, int > > RegionType
Definition: DataTypes.h:43
escript
Definition: AbstractContinuousDomain.cpp:22
escript::DataConstant::getVectorROC
const DataTypes::CplxVectorType & getVectorROC() const
Definition: DataConstant.cpp:773
escript::DataConstant::setToZero
virtual void setToZero()
sets all values to zero
Definition: DataConstant.cpp:514
escript::DataConstant
DataConstant stores a single data point which represents the entire function space.
Definition: DataConstant.h:37
escript::DataConstant::getTypedVectorRO
virtual const DataTypes::RealVectorType & getTypedVectorRO(DataTypes::real_t dummy) const
Definition: DataConstant.cpp:786
escript::DataTypes::ShapeType
std::vector< int > ShapeType
The shape of a single datapoint.
Definition: DataTypes.h:42
escript::DataConstant::getVectorRW
DataTypes::RealVectorType & getVectorRW()
Return a reference to the underlying DataVector.
Definition: DataConstant.cpp:753
escript::DataConstant::DataConstant
DataConstant(const WrappedArray &value, const FunctionSpace &what)
Constructor for DataConstant objects.
Definition: DataConstant.cpp:64
DataReady.h
escript::DataConstant::hasNaN
bool hasNaN() const
Return true if the value contains a NaN.
Definition: DataConstant.cpp:152
escript::DataConstant::zeroedCopy
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:251
system_dep.h
escript::DataConstant::isConstant
bool isConstant() const
Definition: DataConstant.h:107
escript::DataConstant::toString
std::string toString() const
Write the data as a string.
Definition: DataConstant.cpp:236
escript::DataConstant::m_data_c
DataTypes::CplxVectorType m_data_c
Definition: DataConstant.h:400
escript::DataConstant::eigenvalues_and_eigenvectors
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:481
escript::DataTypes::DataVectorAlt< real_t >
escript::DataConstant::getTypedVectorRW
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:779
escript::DataConstant::deepCopy
virtual DataAbstract * deepCopy() const
Return a deep copy of the current object.
Definition: DataConstant.cpp:245
escript::DataConstant::eigenvalues
virtual void eigenvalues(DataAbstract *ev)
solves the eigenvalue problem this*V=ev*V for the eigenvalues ev
Definition: DataConstant.cpp:464
escript::DataConstant::dump
virtual void dump(const std::string fileName) const
dumps the object into a netCDF file
Definition: DataConstant.cpp:672
escript::DataConstant::matrixInverse
virtual int matrixInverse(DataAbstract *out) const
invert square matricies
Definition: DataConstant.cpp:497
V
#define V(_K_, _I_)
Definition: ShapeFunctions.cpp:120
escript::DataTypes::cplx_t
std::complex< real_t > cplx_t
complex data type
Definition: DataTypes.h:53
ESCRIPT_DLL_API
#define ESCRIPT_DLL_API
Definition: escriptcore/src/system_dep.h:29
escript::DataAbstract
Definition: DataAbstract.h:61
escript::DataConstant::getSlice
virtual DataAbstract * getSlice(const DataTypes::RegionType &region) const
Factory method that returns a newly created DataConstant object sliced from the specified region of t...
Definition: DataConstant.cpp:304
escript::DataConstant::complicate
void complicate()
Convert from real data to complex data.
Definition: DataConstant.cpp:804
escript::WrappedArray
Definition: WrappedArray.h:31
escript::DataConstant::getPointOffset
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:268
escript::DataConstant::transpose
virtual void transpose(DataAbstract *ev, int axis_offset)
Transpose each data point of this Data object around the given axis.
Definition: DataConstant.cpp:447
escript::DataConstant::setSlice
virtual void setSlice(const DataAbstract *value, const DataTypes::RegionType &region)
Copy the specified region from the given value.
Definition: DataConstant.cpp:310
escript::DataTypes::real_t
double real_t
type of all real-valued scalars in escript
Definition: DataTypes.h:50
escript::DataConstant::getLength
virtual DataTypes::RealVectorType::size_type getLength() const
Return the number of doubles stored for the Data object.
Definition: DataConstant.cpp:298
escript::DataConstant::parent
DataReady parent
Definition: DataConstant.h:38
escript::DataConstant::antihermitian
virtual void antihermitian(DataAbstract *ev)
Computes an anti-hermitian matrix (A - A*) / 2.
Definition: DataConstant.cpp:397
escript::DataConstant::antisymmetric
virtual void antisymmetric(DataAbstract *ev)
Computes a nonsymmetric matrix (A - AT) / 2.
Definition: DataConstant.cpp:366
escript::DataConstant::replaceNaN
void replaceNaN(DataTypes::real_t value)
replaces all NaN values with value
Definition: DataConstant.cpp:187