escript::TestDomain Class Reference

(Testing use only) Provides a domain to wrap a collection of values. More...

`#include <TestDomain.h>`

Inheritance diagram for escript::TestDomain:

## Public Member Functions

| TestDomain (int pointspersample, int numsamples, int dpsize=1)
virtual | ~TestDomain ()
virtual int | getMPISize () const
| return the number of processors used for this domain More...
virtual int | getMPIRank () const
| return the number MPI rank of this processor More...
virtual void | MPIBarrier () const
| If compiled for MPI then execute an MPI_Barrier, else do nothing. More...
virtual bool | onMasterProcessor () const
| Return true if on MPI master, else false. More...
virtual escript::JMPI | getMPI () const
| returns a shared pointer to the MPI information wrapper for this domain More...
virtual bool | isValidFunctionSpaceType (int functionSpaceType) const
| Returns true if the given integer is a valid function space type for this domain. More...
virtual std::string | getDescription () const
| Return a description for this domain. More...
virtual std::string | functionSpaceTypeAsString (int functionSpaceType) const
| Return a description for the given function space type code. More...
virtual void | interpolateOnDomain (escript::Data &target, const escript::Data &source) const
| Interpolates data given on source onto target where source and target have to be given on the same domain. More...
virtual bool | probeInterpolationOnDomain (int functionSpaceType_source, int functionSpaceType_target) const
| True if interpolation is possible from source to target. More...
bool | commonFunctionSpace (const std::vector< int > &fs, int &resultcode) const
| given a vector of FunctionSpace type codes, pass back a code which then can all be interpolated to. More...
virtual escript::Data | getX () const
| Returns locations in the domain. The function space is chosen appropriately. More...
virtual void | interpolateAcross (escript::Data &target, const escript::Data &source) const
| Interpolates data given on source onto target where source and target are given on different domains. More...
virtual bool | probeInterpolationAcross (int functionSpaceType_source, const AbstractDomain &targetDomain, int functionSpaceType_target) const
virtual int | getDefaultCode () const
virtual int | getContinuousFunctionCode () const
virtual int | getFunctionCode () const
virtual int | getFunctionOnBoundaryCode () const
virtual int | getFunctionOnContactZeroCode () const
virtual int | getFunctionOnContactOneCode () const
virtual int | getSolutionCode () const
virtual int | getReducedSolutionCode () const
virtual int | getDiracDeltaFunctionsCode () const
virtual std::pair< int, DataTypes::dim_t > | getDataShape (int functionSpaceCode) const
| Returns the number of data points per sample, and the number of samples as a pair. More...
virtual int | getTagFromSampleNo (int functionSpaceType, DataTypes::index_t sampleNo) const
| Return the tag key for the given sample number. More...
virtual const DataTypes::dim_t * | borrowSampleReferenceIDs (int functionSpaceType) const
| Returns a borrowed pointer to the sample reference number id list. More...
virtual int | getDim () const
| Returns the spatial dimension of the domain. More...
virtual bool | operator== (const AbstractDomain &other) const
| Return true if given domains are equal. More...
virtual bool | operator!= (const AbstractDomain &other) const
| Return true if given domains are not equal. More...
virtual bool | canTag (int functionSpaceCode) const
| Checks if this domain allows tags for the specified functionSpaceCode. More...
virtual int | getNumberOfTagsInUse (int functionSpaceCode) const
| returns the number of tags in use and a pointer to an array with the number of tags in use More...
virtual const int * | borrowListOfTagsInUse (int functionSpaceCode) const
virtual escript::Data | randomFill (const DataTypes::ShapeType &shape, const FunctionSpace &what, long seed, const boost::python::tuple &filter) const
| Fills the data object with filtered random values. More...
void | addUsedTag (int t)
void | clearUsedTags ()
void | assignTags (std::vector< int > t)
void | resetTagAssignments ()
Public Member Functions inherited from escript::NullDomain
| NullDomain ()
virtual MPI_Comm | getMPIComm () const
| get the communicator for this domain. Returns an integer on non-MPI builds Routine must be implemented by the DomainAdapter. More...
virtual void | write (const std::string &filename) const
| Writes the domain to an external file filename. More...
virtual void | dump (const std::string &filename) const
| dumps the domain to an external file filename. More...
virtual void | setTagMap (const std::string &name, int tag)
| sets a map from a clear tag name to a tag key More...
virtual int | getTag (const std::string &name) const
| Return the tag key for tag name. More...
virtual std::string | showTagNames () const
| Returns all tag names in a single string sperated by commas. More...
virtual void | setTags (int functionSpaceType, int newTag, const escript::Data &mask) const
| assigns new tag newTag to all samples of functionspace with a positive value of mask for any its sample point. More...
bool | supportsContactElements () const
virtual void | setNewX (const escript::Data &arg)
| Assigns new location to the domain. More...
virtual signed char | preferredInterpolationOnDomain (int functionSpaceType_source, int functionSpaceType_target) const
| Preferred direction of interpolation. If you really need to test for a particular direction, then use probeInterpolation. More...
virtual bool | isCellOriented (int functionSpaceCode) const
| returns true if data on this domain and a function space of type functionSpaceCode has to considered as cell centered data. More...
virtual int | getApproximationOrder (const int functionSpaceCode) const
| returns the approximation order used for a function space functionSpaceCode More...
virtual escript::Data | getNormal () const
| Return boundary normals. The function space is chosen appropriately. More...
virtual escript::Data | getSize () const
| Returns the local size of samples. The function space is chosen appropriately. More...
virtual void | setToX (escript::Data &out) const
| Copies the location of data points on the domain into out. The actual function space to be considered is defined by out. out has to be defined on this. More...
virtual void | setToNormal (escript::Data &out) const
| Copies the surface normals at data points into out. The actual function space to be considered is defined by out. out has to be defined on this. More...
virtual void | setToSize (escript::Data &out) const
| Copies the size of samples into out. The actual function space to be considered is defined by out. out has to be defined on this. More...
virtual void | setToGradient (escript::Data &grad, const escript::Data &arg) const
| Copies the gradient of arg into grad. The actual function space to be considered for the gradient is defined by grad. arg and grad have to be defined on this. More...
virtual bool | ownSample (int fs_code, DataTypes::index_t id) const
| True if this rank owns the sample(id) Must be implemented by the Domain adapter. More...
Public Member Functions inherited from escript::AbstractDomain
Domain_ptr | getPtr ()
| Returns smart pointer which is managing this object. If one does not exist yet it creates one. More...
const_Domain_ptr | getPtr () const
virtual | ~AbstractDomain ()
| Destructor for AbstractDomain. More...
virtual bool | isValidTagName (const std::string &name) const
| Returns True if name is a defined tag name. More...
virtual StatusType | getStatus () const
| Returns a status indicator of the domain. The status identifier should be unique over the live time if the object but may be updated if changes to the domain happen, e.g. modifications to its geometry. More...
void | throwStandardException (const std::string &functionName) const
| Throw a standard exception. This function is called if any attempt is made to use a base class function. More...
virtual bool | supportsFilter (const boost::python::tuple &t) const
| true if this domain can handle to specified tuple of filter options. More...

## Private Attributes

DataTypes::dim_t | m_totalsamples
DataTypes::dim_t | m_samples
DataTypes::dim_t | m_originsample
DataTypes::dim_t | m_endsample
int | m_dpps
int | m_dpsize
DataTypes::dim_t * | m_samplerefids
std::vector< int > | mytags
std::vector< int > | tag_assignment
escript::JMPI | myworld

## Additional Inherited Members

Public Types inherited from escript::AbstractDomain
typedef int | StatusType

## Detailed Description

(Testing use only) Provides a domain to wrap a collection of values.

This domain provides more functionality than NullDomain in that it can store varying numbers of samples and points per sample.

It currently supports a single function space which does not support tagging. No effort has been made to make this work with MPI

Warning
  This class exists to support testing and should not be used as a general domain without ensuring that it works the way you expect. Also, other doco says that this class can be removed without notice.

## Constructor & Destructor Documentation

## TestDomain()

escript::TestDomain::TestDomain | ( | int | pointspersample,
|  | int | numsamples,
|  | int | dpsize = `1`
| ) |  |

References escript::getMPIRankWorld(), escript::getMPISizeWorld(), m_endsample, m_originsample, m_samplerefids, m_samples, mytags, and resetTagAssignments().

## ~TestDomain()

escript::TestDomain::~TestDomain | ( |  | ) |

virtual

References m_samplerefids.

## Member Function Documentation

## addUsedTag()

void escript::TestDomain::addUsedTag | ( | int | t | ) |

References mytags.

## assignTags()

void escript::TestDomain::assignTags | ( | std::vector< int > | t | ) |

References m_endsample, m_originsample, m_samples, m_totalsamples, and tag_assignment.

## borrowListOfTagsInUse()

const int * escript::TestDomain::borrowListOfTagsInUse | ( | int | functionSpaceCode | ) | const

virtual

Reimplemented from escript::NullDomain.

References mytags.

## borrowSampleReferenceIDs()

const DataTypes::dim_t * escript::TestDomain::borrowSampleReferenceIDs | ( | int | functionSpaceType | ) | const

virtual

Returns a borrowed pointer to the sample reference number id list.

Parameters

  functionSpaceType | Input - The function space type.

Reimplemented from escript::NullDomain.

References m_samplerefids.

## canTag()

bool escript::TestDomain::canTag | ( | int | functionspacecode | ) | const

virtual

Checks if this domain allows tags for the specified functionSpaceCode.

Reimplemented from escript::NullDomain.

## clearUsedTags()

void escript::TestDomain::clearUsedTags | ( |  | ) |

References mytags.

## commonFunctionSpace()

bool escript::TestDomain::commonFunctionSpace | ( | const std::vector< int > & | fs,
|  | int & | resultcode
| ) |  | const

virtual

given a vector of FunctionSpace type codes, pass back a code which then can all be interpolated to.

Note
  This method must be called on the domain which the FunctionSpaces point to

Returns
  true is result is valid, false if not

Reimplemented from escript::NullDomain.

## functionSpaceTypeAsString()

std::string escript::TestDomain::functionSpaceTypeAsString | ( | int | functionSpaceType | ) | const

virtual

Return a description for the given function space type code.

Reimplemented from escript::NullDomain.

## getContinuousFunctionCode()

int escript::TestDomain::getContinuousFunctionCode | ( |  | ) | const

virtual

Reimplemented from escript::NullDomain.

## getDataShape()

std::pair< int, DataTypes::dim_t > escript::TestDomain::getDataShape | ( | int | functionSpaceCode | ) | const

virtual

Returns the number of data points per sample, and the number of samples as a pair.

This has to be implemented by the actual Domain adapter.

Parameters

  functionSpaceCode | Input - Code for the function space type.

Returns
  pair, first - number of data points per sample, second - number of samples

Reimplemented from escript::NullDomain.

References m_dpps, and m_samples.

## getDefaultCode()

int escript::TestDomain::getDefaultCode | ( |  | ) | const

virtual

Referenced by escript::getTestDomainFunctionSpace(), and getX().

## getDescription()

std::string escript::TestDomain::getDescription | ( |  | ) | const

virtual

Return a description for this domain.

Reimplemented from escript::NullDomain.

## getDim()

int escript::TestDomain::getDim | ( |  | ) | const

virtual

Returns the spatial dimension of the domain.

This has to be implemented by the actual Domain adapter.

Reimplemented from escript::NullDomain.

## getDiracDeltaFunctionsCode()

int escript::TestDomain::getDiracDeltaFunctionsCode | ( |  | ) | const

virtual

Reimplemented from escript::NullDomain.

## getFunctionCode()

int escript::TestDomain::getFunctionCode | ( |  | ) | const

virtual

Reimplemented from escript::NullDomain.

## getFunctionOnBoundaryCode()

int escript::TestDomain::getFunctionOnBoundaryCode | ( |  | ) | const

virtual

Reimplemented from escript::NullDomain.

## getFunctionOnContactOneCode()

int escript::TestDomain::getFunctionOnContactOneCode | ( |  | ) | const

virtual

Reimplemented from escript::NullDomain.

## getFunctionOnContactZeroCode()

int escript::TestDomain::getFunctionOnContactZeroCode | ( |  | ) | const

virtual

Reimplemented from escript::NullDomain.

## getMPI()

escript::JMPI escript::TestDomain::getMPI | ( |  | ) | const

virtual

returns a shared pointer to the MPI information wrapper for this domain

Reimplemented from escript::NullDomain.

References myworld.

## getMPIRank()

int escript::TestDomain::getMPIRank | ( |  | ) | const

virtual

return the number MPI rank of this processor

Reimplemented from escript::NullDomain.

References escript::getMPIRankWorld().

Referenced by onMasterProcessor().

## getMPISize()

int escript::TestDomain::getMPISize | ( |  | ) | const

virtual

return the number of processors used for this domain

Reimplemented from escript::NullDomain.

References escript::getMPISizeWorld().

## getNumberOfTagsInUse()

int escript::TestDomain::getNumberOfTagsInUse | ( | int | functionSpaceCode | ) | const

virtual

returns the number of tags in use and a pointer to an array with the number of tags in use

Reimplemented from escript::NullDomain.

References mytags.

## getReducedSolutionCode()

int escript::TestDomain::getReducedSolutionCode | ( |  | ) | const

virtual

Reimplemented from escript::NullDomain.

## getSolutionCode()

int escript::TestDomain::getSolutionCode | ( |  | ) | const

virtual

Reimplemented from escript::NullDomain.

## getTagFromSampleNo()

int escript::TestDomain::getTagFromSampleNo | ( | int | functionSpaceType,
|  | DataTypes::index_t | sampleNo
| ) |  | const

virtual

Return the tag key for the given sample number.

Parameters

  functionSpaceType | Input - The function space type.
  sampleNo | Input - The sample number.

Reimplemented from escript::NullDomain.

References tag_assignment.

## getX()

escript::Data escript::TestDomain::getX | ( |  | ) | const

virtual

Returns locations in the domain. The function space is chosen appropriately.

Reimplemented from escript::NullDomain.

References getDefaultCode(), escript::AbstractDomain::getPtr(), escript::Data::getReady(), escript::DataReady::getVectorRW(), m_dpps, m_dpsize, m_originsample, m_samples, and escript::DataTypes::scalarShape.

## interpolateAcross()

void escript::TestDomain::interpolateAcross | ( | escript::Data & | target,
|  | const escript::Data & | source
| ) |  | const

virtual

Interpolates data given on source onto target where source and target are given on different domains.

This has to be implemented by the actual Domain adapter.

Reimplemented from escript::NullDomain.

## interpolateOnDomain()

void escript::TestDomain::interpolateOnDomain | ( | escript::Data & | target,
|  | const escript::Data & | source
| ) |  | const

virtual

Interpolates data given on source onto target where source and target have to be given on the same domain.

This has to be implemented by the actual Domain adapter.

Reimplemented from escript::NullDomain.

References escript::FunctionSpace::getDomain(), and escript::Data::getFunctionSpace().

## isValidFunctionSpaceType()

bool escript::TestDomain::isValidFunctionSpaceType | ( | int | functionSpaceType | ) | const

virtual

Returns true if the given integer is a valid function space type for this domain.

Reimplemented from escript::NullDomain.

## MPIBarrier()

void escript::TestDomain::MPIBarrier | ( |  | ) | const

virtual

If compiled for MPI then execute an MPI_Barrier, else do nothing.

Reimplemented from escript::NullDomain.

References escript::MPIBarrierWorld().

## onMasterProcessor()

bool escript::TestDomain::onMasterProcessor | ( |  | ) | const

virtual

Return true if on MPI master, else false.

Reimplemented from escript::NullDomain.

References getMPIRank().

## operator!=()

bool escript::TestDomain::operator!= | ( | const AbstractDomain & | other | ) | const

virtual

Return true if given domains are not equal.

Reimplemented from escript::NullDomain.

## operator==()

bool escript::TestDomain::operator== | ( | const AbstractDomain & | other | ) | const

virtual

Return true if given domains are equal.

Reimplemented from escript::NullDomain.

## probeInterpolationAcross()

bool escript::TestDomain::probeInterpolationAcross | ( | int | functionSpaceType_source,
|  | const AbstractDomain & | targetDomain,
|  | int | functionSpaceType_target
| ) |  | const

virtual

Reimplemented from escript::NullDomain.

## probeInterpolationOnDomain()

bool escript::TestDomain::probeInterpolationOnDomain | ( | int | functionSpaceType_source,
|  | int | functionSpaceType_target
| ) |  | const

virtual

True if interpolation is possible from source to target.

Reimplemented from escript::NullDomain.

## randomFill()

escript::Data escript::TestDomain::randomFill | ( | const DataTypes::ShapeType & | shape,
|  | const FunctionSpace & | what,
|  | long | seed,
|  | const boost::python::tuple & | filter
| ) |  | const

virtual

Fills the data object with filtered random values.

Reimplemented from escript::NullDomain.

References escript::Data::getExpandedVectorReference(), escript::randomFillArray(), and escript::DataTypes::DataVectorAlt< T >::size().

## resetTagAssignments()

void escript::TestDomain::resetTagAssignments | ( |  | ) |

References m_samples, and tag_assignment.

Referenced by TestDomain().

## Member Data Documentation

## m_dpps

int escript::TestDomain::m_dpps

private

Referenced by getDataShape(), and getX().

## m_dpsize

int escript::TestDomain::m_dpsize

private

Referenced by getX().

## m_endsample

DataTypes::dim_t escript::TestDomain::m_endsample

private

Referenced by assignTags(), and TestDomain().

## m_originsample

DataTypes::dim_t escript::TestDomain::m_originsample

private

Referenced by assignTags(), getX(), and TestDomain().

## m_samplerefids

DataTypes::dim_t* escript::TestDomain::m_samplerefids

private

Referenced by borrowSampleReferenceIDs(), TestDomain(), and ~TestDomain().

## m_samples

DataTypes::dim_t escript::TestDomain::m_samples

private

Referenced by assignTags(), getDataShape(), getX(), resetTagAssignments(), and TestDomain().

## m_totalsamples

DataTypes::dim_t escript::TestDomain::m_totalsamples

private

Referenced by assignTags().

## mytags

std::vector<int> escript::TestDomain::mytags

private

Referenced by addUsedTag(), borrowListOfTagsInUse(), clearUsedTags(), getNumberOfTagsInUse(), and TestDomain().

## myworld

escript::JMPI escript::TestDomain::myworld

private

Referenced by getMPI().

## tag_assignment

std::vector<int> escript::TestDomain::tag_assignment

private

Referenced by assignTags(), getTagFromSampleNo(), and resetTagAssignments().

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

- TestDomain.h
- TestDomain.cpp