Public Member Functions | Private Types | Private Member Functions | Private Attributes

escript::DataExpanded Class Reference

Give a short description of what DataExpanded does. More...

#include <DataExpanded.h>

Inheritance diagram for escript::DataExpanded:
escript::DataReady escript::DataAbstract

List of all members.

Public Member Functions

ESCRIPT_DLL_API DataExpanded (const WrappedArray &value, const FunctionSpace &what)
 Constructor for DataExpanded.
ESCRIPT_DLL_API DataExpanded (const DataExpanded &other, const DataTypes::RegionType &region)
 Alternative constructor for DataExpanded that copies a slice from another DataExpanded.
ESCRIPT_DLL_API DataExpanded (const FunctionSpace &what, const DataTypes::ShapeType &shape, const DataTypes::ValueType &data)
 Alternative constructor for DataExpanded objects.
ESCRIPT_DLL_API DataExpanded (const FunctionSpace &what, const DataTypes::ShapeType &shape, const double data)
ESCRIPT_DLL_API DataExpanded (const DataExpanded &other)
 Copy constructor for DataExpanded. Performs a deep copy from another DataExpanded.
ESCRIPT_DLL_API DataExpanded (const DataConstant &other)
 Copy constructor for DataExpanded. Construct a DataExpanded from a DataConstant.
ESCRIPT_DLL_API DataExpanded (const DataTagged &other)
 Copy constructor for DataExpanded. Construct a DataExpanded from a DataTagged.
virtual ESCRIPT_DLL_API ~DataExpanded ()
 Default destructor for DataExpanded.
ESCRIPT_DLL_API bool isExpanded () const
ESCRIPT_DLL_API bool actsExpanded () const
 Return true if this Data is expanded or resolves to expanded. That is, if it has a separate value for each datapoint in the sample.
ESCRIPT_DLL_API bool hasNaN () const
 Return true if any value in the data contains a NaN.
virtual ESCRIPT_DLL_API std::string toString () const
 Return a textual representation of the data.
virtual ESCRIPT_DLL_API
DataAbstract
deepCopy ()
 Return a deep copy of the current object.
virtual ESCRIPT_DLL_API void dump (const std::string fileName) const
 dumps the object into a netCDF file
virtual ESCRIPT_DLL_API int matrixInverse (DataAbstract *out) const
 invert square matricies
virtual ESCRIPT_DLL_API void setToZero ()
 sets all values to zero
virtual ESCRIPT_DLL_API
DataTypes::ValueType::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 point into the container holding the point data.
virtual ESCRIPT_DLL_API
DataTypes::ValueType::size_type 
getPointOffset (int sampleNo, int dataPointNo)
ESCRIPT_DLL_API
DataTypes::ValueType
getVectorRW ()
 Return a a reference to the underlying DataVector.
ESCRIPT_DLL_API const
DataTypes::ValueType
getVectorRO () const
virtual ESCRIPT_DLL_API
ValueType::size_type 
getLength () const
 Return the number of doubles stored for the Data.
virtual ESCRIPT_DLL_API
DataAbstract
getSlice (const DataTypes::RegionType &region) const
 Factory method that returns a newly created DataExpanded. The caller is reponsible for managing the object created.
virtual ESCRIPT_DLL_API void setSlice (const DataAbstract *value, const DataTypes::RegionType &region)
 Copy the specified region from the given value.
void setTaggedValue (int tagKey, const DataTypes::ShapeType &pointshape, const DataTypes::ValueType &value, int dataOffset=0)
 setTaggedValue
virtual ESCRIPT_DLL_API void symmetric (DataAbstract *ev)
 Computes a symmetric matrix (A + AT) / 2.
virtual ESCRIPT_DLL_API void nonsymmetric (DataAbstract *ev)
 Computes a nonsymmetric matrix (A - AT) / 2.
virtual ESCRIPT_DLL_API void trace (DataAbstract *ev, int axis_offset)
 Computes the trace of a matrix.
virtual ESCRIPT_DLL_API void transpose (DataAbstract *ev, int axis_offset)
 Transpose each data point of this Data object around the given axis.
virtual ESCRIPT_DLL_API void swapaxes (DataAbstract *ev, int axis0, int axis1)
 swaps components axis0 and axis1
virtual ESCRIPT_DLL_API void eigenvalues (DataAbstract *ev)
 solves the eigenvalue problem this*V=ev*V for the eigenvalues ev
virtual ESCRIPT_DLL_API 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
virtual ESCRIPT_DLL_API void reorderByReferenceIDs (int *reference_ids)
 reorders data sample ordered by reference_ids to the ordering of the functions space
ESCRIPT_DLL_API void randomFill (long seed)
 Fill the object with random values.

Private Types

typedef DataReady parent

Private Member Functions

void initialise (int noSamples, int noDataPointsPerSample)
 Common initialisation called from constructors.
void copy (const DataConstant &value)
 Copy the given data point value to all data points in this object.
void copy (const WrappedArray &value)
 Copy the given data point value to all data points in this object.
virtual ESCRIPT_DLL_API void copyToDataPoint (const int sampleNo, const int dataPointNo, const double value)
 Copy a double value to the data point dataPointNo of sample sampleNo in this object.
virtual ESCRIPT_DLL_API void copyToDataPoint (const int sampleNo, const int dataPointNo, const WrappedArray &value)
 Copy the value to the data point dataPointNo of sample sampleNo in this object.

Private Attributes

DataBlocks2D m_data

Detailed Description

Give a short description of what DataExpanded does.

Description: Give a detailed description of DataExpanded.

Template Parameters: For templates describe any conditions that the parameters used in the template must satisfy.


Member Typedef Documentation

Reimplemented from escript::DataReady.


Constructor & Destructor Documentation

escript::DataExpanded::DataExpanded ( const WrappedArray value,
const FunctionSpace what 
)

Constructor for DataExpanded.

Description: Constructor for DataExpanded.

The given single data value is copied to all the data points in this data object, where the number of data points is defined by the given function space.

Parameters:
value - Input - The value of a single data point.
what - Input - A description of what this data represents.

References copy(), escript::FunctionSpace::getNumDPPSample(), escript::FunctionSpace::getNumSamples(), and initialise().

Referenced by deepCopy(), and getSlice().

escript::DataExpanded::DataExpanded ( const DataExpanded other,
const DataTypes::RegionType region 
)
escript::DataExpanded::DataExpanded ( const FunctionSpace what,
const DataTypes::ShapeType shape,
const DataTypes::ValueType data 
)

Alternative constructor for DataExpanded objects.

Description: Alternative Constructor for DataExpanded objects.

Parameters:
what - Input - A description of what this data object represents.
shape - Input - the shape of each data-point.
data - the array of data values for the data-points.

TODO Note that this constructor will also copy data to all points if it only contains enough elements to hold a single point. ie this is the merge of two separate constructors.

References EsysAssert, escript::DataBlocks2D::getData(), getLength(), escript::DataAbstract::getNoValues(), escript::FunctionSpace::getNumDPPSample(), escript::FunctionSpace::getNumSamples(), initialise(), m_data, and escript::DataVector::size().

escript::DataExpanded::DataExpanded ( const FunctionSpace what,
const DataTypes::ShapeType shape,
const double  data 
)
escript::DataExpanded::DataExpanded ( const DataExpanded other  ) 

Copy constructor for DataExpanded. Performs a deep copy from another DataExpanded.

escript::DataExpanded::DataExpanded ( const DataConstant other  ) 
escript::DataExpanded::~DataExpanded (  )  [virtual]

Default destructor for DataExpanded.


Member Function Documentation

ESCRIPT_DLL_API bool escript::DataExpanded::actsExpanded (  )  const [inline, virtual]

Return true if this Data is expanded or resolves to expanded. That is, if it has a separate value for each datapoint in the sample.

Reimplemented from escript::DataAbstract.

void escript::DataExpanded::copy ( const DataConstant value  )  [private]

Copy the given data point value to all data points in this object.

Description: Copy the given data point to all data points in this object.

Parameters:
value Input - A single data point value.

References escript::DataTypes::checkShape(), escript::DataTypes::copyPoint(), escript::DataTypes::createShapeErrorMessage(), EsysAssert, escript::DataAbstract::getNoValues(), escript::DataBlocks2D::getNumCols(), escript::DataBlocks2D::getNumRows(), getPointOffset(), escript::DataAbstract::getShape(), escript::DataConstant::getVectorRO(), getVectorRW(), and m_data.

Referenced by DataExpanded().

void escript::DataExpanded::copy ( const WrappedArray value  )  [private]
void escript::DataExpanded::copyToDataPoint ( const int  sampleNo,
const int  dataPointNo,
const double  value 
) [private, virtual]

Copy a double value to the data point dataPointNo of sample sampleNo in this object.

Description: Copy a double value to the data point dataPointNo of sample sampleNo in this object.

Parameters:
sampleNo Input - sample number
dataPointNo Input - data point of the sample
value Input - new values for the data point

Reimplemented from escript::DataAbstract.

References CHECK_FOR_EX_WRITE, escript::DataAbstract::getNumDPPSample(), escript::DataAbstract::getNumSamples(), getPointOffset(), escript::DataAbstract::getRank(), escript::DataTypes::getRelIndex(), escript::DataAbstract::getShape(), and getVectorRW().

void escript::DataExpanded::copyToDataPoint ( const int  sampleNo,
const int  dataPointNo,
const WrappedArray value 
) [private, virtual]

Copy the value to the data point dataPointNo of sample sampleNo in this object.

Parameters:
sampleNo Input - sample number
dataPointNo Input - data point of the sample
value Input - new values for the data point

Reimplemented from escript::DataAbstract.

References CHECK_FOR_EX_WRITE, escript::DataVector::copyFromArrayToOffset(), escript::DataAbstract::getNumDPPSample(), escript::DataAbstract::getNumSamples(), getPointOffset(), escript::DataAbstract::getRank(), escript::WrappedArray::getRank(), and getVectorRW().

DataAbstract * escript::DataExpanded::deepCopy (  )  [virtual]

Return a deep copy of the current object.

Implements escript::DataAbstract.

References DataExpanded().

void escript::DataExpanded::eigenvalues ( DataAbstract ev  )  [virtual]

solves the eigenvalue problem this*V=ev*V for the eigenvalues ev

Parameters:
ev - Output - eigenvalues in increasing order at each data point

Reimplemented from escript::DataAbstract.

References escript::DataAbstract::getNumDPPSample(), escript::DataAbstract::getNumSamples(), escript::DataAbstract::getPointOffset(), getPointOffset(), escript::DataAbstract::getShape(), getVectorRO(), and getVectorRW().

void escript::DataExpanded::eigenvalues_and_eigenvectors ( DataAbstract ev,
DataAbstract V,
const double  tol = 1.e-13 
) [virtual]

solves the eigenvalue problem this*V=ev*V for the eigenvalues ev and eigenvectors V

Parameters:
ev - Output - eigenvalues in increasing order at each data point
V - Output - corresponding eigenvectors. They are normalized such that their length is one and the first nonzero component is positive.
tol - Input - eigenvalue with relative distance tol are treated as equal.

Reimplemented from escript::DataAbstract.

References escript::DataAbstract::getNumDPPSample(), escript::DataAbstract::getNumSamples(), escript::DataAbstract::getPointOffset(), getPointOffset(), escript::DataAbstract::getShape(), getVectorRO(), and getVectorRW().

DataTypes::ValueType::size_type escript::DataExpanded::getLength (  )  const [virtual]

Return the number of doubles stored for the Data.

Implements escript::DataAbstract.

References m_data, and escript::DataBlocks2D::size().

Referenced by DataExpanded().

DataTypes::ValueType::size_type escript::DataExpanded::getPointOffset ( int  sampleNo,
int  dataPointNo 
) const [virtual]

Return the offset for the given given data point. This returns the offset in bytes for the given point into the container holding the point data.

Parameters:
sampleNo - Input - sample number.
dataPointNo - Input - data point number.

Implements escript::DataAbstract.

References escript::DataBlocks2D::index(), and m_data.

Referenced by escript::algorithm(), escript::binaryOp(), escript::C_GeneralTensorProduct(), escript::C_TensorBinaryOperation(), escript::C_TensorUnaryOperation(), copy(), copyToDataPoint(), DataExpanded(), escript::dp_algorithm(), eigenvalues(), eigenvalues_and_eigenvectors(), matrixInverse(), nonsymmetric(), reorderByReferenceIDs(), escript::DataLazy::resolveNodeWorker(), setSlice(), setTaggedValue(), setToZero(), swapaxes(), symmetric(), toString(), trace(), transpose(), and escript::unaryOp().

DataTypes::ValueType::size_type escript::DataExpanded::getPointOffset ( int  sampleNo,
int  dataPointNo 
) [virtual]
DataAbstract * escript::DataExpanded::getSlice ( const DataTypes::RegionType region  )  const [virtual]

Factory method that returns a newly created DataExpanded. The caller is reponsible for managing the object created.

Parameters:
region - Input - Region to copy.

Implements escript::DataAbstract.

References DataExpanded().

bool escript::DataExpanded::hasNaN (  )  const [virtual]

Return true if any value in the data contains a NaN.

Implements escript::DataReady.

References escript::DataBlocks2D::getData(), m_data, escript::nancheck(), and escript::DataVector::size().

void escript::DataExpanded::initialise ( int  noSamples,
int  noDataPointsPerSample 
) [private]

Common initialisation called from constructors.

Description: Common initialisation called from constructors.

Resizes the underlying data array to provide sufficient storage for the given shape and number of data points, and creates the corresponding DataArrayView of this data.

Parameters:
noSamples - Input - number of samples.
noDataPointsPerSample - Input - number of data points per sample.

References escript::DataAbstract::getNoValues(), m_data, and escript::DataBlocks2D::resize().

Referenced by DataExpanded().

ESCRIPT_DLL_API bool escript::DataExpanded::isExpanded (  )  const [inline, virtual]

Reimplemented from escript::DataAbstract.

int escript::DataExpanded::matrixInverse ( DataAbstract out  )  const [virtual]
void escript::DataExpanded::nonsymmetric ( DataAbstract ev  )  [virtual]

Computes a nonsymmetric matrix (A - AT) / 2.

Parameters:
ev - Output - nonsymmetric matrix

Reimplemented from escript::DataAbstract.

References escript::DataAbstract::getNumDPPSample(), escript::DataAbstract::getNumSamples(), escript::DataAbstract::getPointOffset(), getPointOffset(), escript::DataAbstract::getShape(), getVectorRO(), and getVectorRW().

void escript::DataExpanded::randomFill ( long  seed  ) 
void escript::DataExpanded::reorderByReferenceIDs ( int *  reference_ids  )  [virtual]

reorders data sample ordered by reference_ids to the ordering of the functions space

Parameters:
reference_ids - Input - reference_ids used for current ordering

Reimplemented from escript::DataAbstract.

References CHECK_FOR_EX_WRITE, escript::DataAbstract::getFunctionSpace(), escript::DataAbstract::getNoValues(), escript::DataAbstract::getNumDPPSample(), escript::DataAbstract::getNumSamples(), getPointOffset(), escript::FunctionSpace::getReferenceIDOfSample(), and m_data.

void escript::DataExpanded::setTaggedValue ( int  tagKey,
const DataTypes::ShapeType pointshape,
const DataTypes::ValueType value,
int  dataOffset = 0 
) [virtual]

setTaggedValue

Description: uses tag to set a new value

Parameters:
tagKey - Input - Integer key.
pointshape - Input - The shape of the value parameter
value - Input -
dataOffset - Input - where in the value parameter to start reading the data point value.

Reimplemented from escript::DataAbstract.

References CHECK_FOR_EX_WRITE, escript::DataAbstract::getFunctionSpace(), escript::DataAbstract::getNoValues(), escript::DataAbstract::getNumDPPSample(), escript::DataAbstract::getNumSamples(), getPointOffset(), m_data, and escript::DataVector::size().

void escript::DataExpanded::setToZero (  )  [virtual]
void escript::DataExpanded::swapaxes ( DataAbstract ev,
int  axis0,
int  axis1 
) [virtual]

swaps components axis0 and axis1

Parameters:
ev - Output - swapped components
axis0 
axis1 

Reimplemented from escript::DataAbstract.

References escript::DataAbstract::getNumDPPSample(), escript::DataAbstract::getNumSamples(), escript::DataAbstract::getPointOffset(), getPointOffset(), escript::DataAbstract::getShape(), getVectorRO(), and getVectorRW().

void escript::DataExpanded::symmetric ( DataAbstract ev  )  [virtual]
void escript::DataExpanded::trace ( DataAbstract ev,
int  axis_offset 
) [virtual]

Computes the trace of a matrix.

Parameters:
ev - Output - trace of your matrix
axis_offset -

Reimplemented from escript::DataAbstract.

References escript::DataAbstract::getNumDPPSample(), escript::DataAbstract::getNumSamples(), escript::DataAbstract::getPointOffset(), getPointOffset(), escript::DataAbstract::getShape(), getVectorRO(), and getVectorRW().

void escript::DataExpanded::transpose ( DataAbstract ev,
int  axis_offset 
) [virtual]

Transpose each data point of this Data object around the given axis.

Parameters:
ev - Output - transpose of your matrix
axis_offset -

Reimplemented from escript::DataAbstract.

References escript::DataAbstract::getNumDPPSample(), escript::DataAbstract::getNumSamples(), escript::DataAbstract::getPointOffset(), getPointOffset(), escript::DataAbstract::getShape(), getVectorRO(), and getVectorRW().


Member Data Documentation


The documentation for this class was generated from the following files: