DataExpanded.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_DataExpanded_20040323_H
#define escript_DataExpanded_20040323_H
#include "system_dep.h"
#include "DataReady.h"
namespace escript {
//
// Forward declarations of other Data types.
class DataConstant;
class DataTagged;
class DataExpanded : public DataReady {
typedef DataReady parent;
public:
ESCRIPT_DLL_API
explicit DataExpanded(const WrappedArray& value,
const FunctionSpace& what);
ESCRIPT_DLL_API
explicit DataExpanded(const DataExpanded& other,
const DataTypes::RegionType& region);
ESCRIPT_DLL_API
explicit DataExpanded(const FunctionSpace& what,
const DataTypes::ShapeType &shape,
const DataTypes::RealVectorType &data);
ESCRIPT_DLL_API
explicit DataExpanded(const FunctionSpace& what,
const DataTypes::ShapeType &shape,
const DataTypes::CplxVectorType &data);
ESCRIPT_DLL_API
explicit DataExpanded(const FunctionSpace& what,
const DataTypes::ShapeType &shape,
const DataTypes::real_t data);
ESCRIPT_DLL_API
explicit DataExpanded(const FunctionSpace& what,
const DataTypes::ShapeType &shape,
const DataTypes::cplx_t data);
ESCRIPT_DLL_API
DataExpanded(const DataExpanded& other);
ESCRIPT_DLL_API
explicit DataExpanded(const DataConstant& other);
ESCRIPT_DLL_API
explicit DataExpanded(const DataTagged& other);
ESCRIPT_DLL_API
virtual
~DataExpanded();
ESCRIPT_DLL_API
bool
isExpanded() const
{
return true;
};
ESCRIPT_DLL_API
bool
actsExpanded() 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
virtual
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 int
matrixInverse(DataAbstract* out) 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
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;
virtual DataTypes::RealVectorType&
getTypedVectorRW(DataTypes::real_t dummy);
virtual const DataTypes::RealVectorType&
getTypedVectorRO(DataTypes::real_t dummy) const;
virtual DataTypes::CplxVectorType&
getTypedVectorRW(DataTypes::cplx_t dummy);
virtual const DataTypes::CplxVectorType&
getTypedVectorRO(DataTypes::cplx_t dummy) const;
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);
void
setTaggedValue(int tagKey,
const DataTypes::ShapeType& pointshape,
const DataTypes::RealVectorType& value,
int dataOffset=0);
void
setTaggedValue(int tagKey,
const DataTypes::ShapeType& pointshape,
const DataTypes::CplxVectorType& value,
int dataOffset=0);
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 void
reorderByReferenceIDs(DataTypes::dim_t *reference_ids);
ESCRIPT_DLL_API
void
complicate();
protected:
private:
void
initialise(int noSamples,
int noDataPointsPerSample,
bool cplx
);
void
copy(const DataConstant& value);
void
copy(const WrappedArray& value);
ESCRIPT_DLL_API
virtual void
copyToDataPoint(const int sampleNo, const int dataPointNo, const DataTypes::real_t value);
ESCRIPT_DLL_API
virtual void
copyToDataPoint(const int sampleNo, const int dataPointNo, const DataTypes::cplx_t value);
ESCRIPT_DLL_API
virtual void
copyToDataPoint(const int sampleNo, const int dataPointNo, const WrappedArray& value);
//
// The main data storage array, a 2D array of data blocks.
// noSamples * noDataPointsPerSample
DataTypes::RealVectorType m_data_r;
DataTypes::CplxVectorType m_data_c;
};
} // end of namespace
#endif
escript::DataExpanded::swapaxes
virtual void swapaxes(DataAbstract *ev, int axis0, int axis1)
swaps components axis0 and axis1
Definition: DataExpanded.cpp:925
escript::FunctionSpace
Definition: FunctionSpace.h:34
escript::DataExpanded::m_data_r
DataTypes::RealVectorType m_data_r
Definition: DataExpanded.h:552
escript::DataExpanded::deepCopy
virtual DataAbstract * deepCopy() const
Return a deep copy of the current object.
Definition: DataExpanded.cpp:264
escript::DataExpanded::symmetric
virtual void symmetric(DataAbstract *ev)
Computes a symmetric matrix (A + AT) / 2.
Definition: DataExpanded.cpp:714
escript::DataExpanded::parent
DataReady parent
Definition: DataExpanded.h:45
escript::DataExpanded::setTaggedValue
void setTaggedValue(int tagKey, const DataTypes::ShapeType &pointshape, const DataTypes::RealVectorType &value, int dataOffset=0)
setTaggedValue
Definition: DataExpanded.cpp:1318
escript::DataExpanded::m_data_c
DataTypes::CplxVectorType m_data_c
Definition: DataExpanded.h:553
escript::DataExpanded::setToZero
virtual void setToZero()
sets all values to zero
Definition: DataExpanded.cpp:1072
escript::DataExpanded::getTypedVectorRW
virtual DataTypes::RealVectorType & getTypedVectorRW(DataTypes::real_t dummy)
These versions use the type system rather than method name to determine return type.
Definition: DataExpanded.cpp:1438
escript::DataReady
Definition: DataReady.h:35
escript::DataTypes::DataVectorAlt< real_t >::size_type
DataTypes::vec_size_type size_type
Definition: DataVectorAlt.h:49
escript::DataTypes::RegionType
std::vector< std::pair< int, int > > RegionType
Definition: DataTypes.h:43
escript
Definition: AbstractContinuousDomain.cpp:22
escript::DataExpanded::trace
virtual void trace(DataAbstract *ev, int axis_offset)
Computes the trace of a matrix.
Definition: DataExpanded.cpp:848
escript::DataExpanded::dump
virtual void dump(const std::string fileName) const
dumps the object into a netCDF file
Definition: DataExpanded.cpp:1247
escript::DataExpanded::antihermitian
virtual void antihermitian(DataAbstract *ev)
Computes an antihermitian matrix (A - A*) / 2.
Definition: DataExpanded.cpp:819
escript::DataConstant
DataConstant stores a single data point which represents the entire function space.
Definition: DataConstant.h:37
escript::DataExpanded::DataExpanded
DataExpanded(const WrappedArray &value, const FunctionSpace &what)
Constructor for DataExpanded.
Definition: DataExpanded.cpp:63
escript::DataExpanded::eigenvalues
virtual void eigenvalues(DataAbstract *ev)
solves the eigenvalue problem this*V=ev*V for the eigenvalues ev
Definition: DataExpanded.cpp:964
escript::DataExpanded
Give a short description of what DataExpanded does.
Definition: DataExpanded.h:43
escript::DataExpanded::matrixInverse
virtual int matrixInverse(DataAbstract *out) const
invert square matricies
Definition: DataExpanded.cpp:1034
escript::DataExpanded::complicate
void complicate()
Definition: DataExpanded.cpp:553
escript::DataTypes::ShapeType
std::vector< int > ShapeType
The shape of a single datapoint.
Definition: DataTypes.h:42
escript::DataTagged
Simulates a full dataset accessible via sampleNo and dataPointNo.
Definition: DataTagged.h:44
escript::DataExpanded::actsExpanded
bool actsExpanded() const
Return true if this Data is expanded or resolves to expanded. That is, if it has a separate value for...
Definition: DataExpanded.h:156
DataReady.h
escript::DataExpanded::copyToDataPoint
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.
Definition: DataExpanded.cpp:625
escript::DataExpanded::getVectorROC
const DataTypes::CplxVectorType & getVectorROC() const
Definition: DataExpanded.cpp:1433
system_dep.h
escript::DataExpanded::getSlice
virtual DataAbstract * getSlice(const DataTypes::RegionType &region) const
Factory method that returns a newly created DataExpanded. The caller is reponsible for managing the o...
Definition: DataExpanded.cpp:284
escript::DataExpanded::transpose
virtual void transpose(DataAbstract *ev, int axis_offset)
Transpose each data point of this Data object around the given axis.
Definition: DataExpanded.cpp:887
escript::DataExpanded::toString
virtual std::string toString() const
Return a textual representation of the data.
Definition: DataExpanded.cpp:506
escript::DataExpanded::antisymmetric
virtual void antisymmetric(DataAbstract *ev)
Computes a antisymmetric matrix (A - AT) / 2.
Definition: DataExpanded.cpp:752
escript::DataExpanded::getVectorRO
const DataTypes::RealVectorType & getVectorRO() const
Definition: DataExpanded.cpp:1422
escript::DataExpanded::copy
void copy(const DataConstant &value)
Copy the given data point value to all data points in this object.
Definition: DataExpanded.cpp:350
escript::DataExpanded::getPointOffset
virtual DataTypes::RealVectorType::size_type getPointOffset(int sampleNo, int dataPointNo) const
Return the offset for the given given data point. This returns the offset in bytes for the given poin...
Definition: DataExpanded.cpp:534
escript::DataTypes::DataVectorAlt< real_t >
escript::DataExpanded::hasNaN
bool hasNaN() const
Return true if any value in the data contains a NaN.
Definition: DataExpanded.cpp:423
escript::DataExpanded::hermitian
virtual void hermitian(DataAbstract *ev)
Computes an hermitian matrix (A + A*) / 2.
Definition: DataExpanded.cpp:794
escript::DataExpanded::reorderByReferenceIDs
virtual void reorderByReferenceIDs(DataTypes::dim_t *reference_ids)
reorders data sample ordered by reference_ids to the ordering of the functions space ...
Definition: DataExpanded.cpp:1383
V
#define V(_K_, _I_)
Definition: ShapeFunctions.cpp:120
escript::DataExpanded::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: DataExpanded.cpp:270
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::DataExpanded::getTypedVectorRO
virtual const DataTypes::RealVectorType & getTypedVectorRO(DataTypes::real_t dummy) const
Definition: DataExpanded.cpp:1444
escript::DataExpanded::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: DataExpanded.cpp:1003
escript::DataAbstract
Definition: DataAbstract.h:61
escript::DataExpanded::getVectorRW
DataTypes::RealVectorType & getVectorRW()
Return a a reference to the underlying DataVector.
Definition: DataExpanded.cpp:1416
escript::DataExpanded::~DataExpanded
virtual ~DataExpanded()
Default destructor for DataExpanded.
Definition: DataExpanded.cpp:260
escript::WrappedArray
Definition: WrappedArray.h:31
escript::DataExpanded::setSlice
virtual void setSlice(const DataAbstract *value, const DataTypes::RegionType &region)
Copy the specified region from the given value.
Definition: DataExpanded.cpp:289
escript::DataExpanded::isExpanded
bool isExpanded() const
Definition: DataExpanded.h:149
escript::DataExpanded::replaceNaN
void replaceNaN(DataTypes::real_t value)
replaces all NaN values with value
Definition: DataExpanded.cpp:459
escript::DataTypes::real_t
double real_t
type of all real-valued scalars in escript
Definition: DataTypes.h:50
escript::DataTypes::dim_t
index_t dim_t
Definition: DataTypes.h:64
escript::DataExpanded::getVectorRWC
DataTypes::CplxVectorType & getVectorRWC()
Definition: DataExpanded.cpp:1427
escript::DataExpanded::initialise
void initialise(int noSamples, int noDataPointsPerSample, bool cplx)
Common initialisation called from constructors.
Definition: DataExpanded.cpp:404
escript::DataExpanded::getLength
virtual DataTypes::RealVectorType::size_type getLength() const
Return the number of doubles stored for the Data.
Definition: DataExpanded.cpp:564