AbstractDomain.h
Go to the documentation of this file.
/*****************************************************************************
*
* Copyright (c) 2003-2020 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-2017 by Centre for Geoscience Computing (GeoComp)
* Development from 2019 by School of Earth and Environmental Sciences
**
*****************************************************************************/
#ifndef __ESCRIPT_ABSTRACTDOMAIN_H__
#define __ESCRIPT_ABSTRACTDOMAIN_H__
#include "system_dep.h"
#include "DataTypes.h"
#include "EsysMPI.h"
#include "Pointers.h"
#include <boost/python/tuple.hpp>
#ifdef ESYS_HAVE_BOOST_NUMPY
#include <boost/python/numpy.hpp>
#endif
#include <vector>
#include <string>
namespace escript {
// class forward declarations
class Data;
class FunctionSpace;
class AbstractDomain;
typedef POINTER_WRAPPER_CLASS(AbstractDomain) Domain_ptr;
typedef POINTER_WRAPPER_CLASS(const AbstractDomain) const_Domain_ptr;
class ESCRIPT_DLL_API AbstractDomain: public REFCOUNT_BASE_CLASS(AbstractDomain)
{
public:
typedef int StatusType;
Domain_ptr getPtr();
const_Domain_ptr getPtr() const;
virtual ~AbstractDomain() {}
virtual JMPI getMPI() const = 0;
virtual int getMPISize() const = 0;
virtual int getMPIRank() const = 0;
virtual void MPIBarrier() const = 0;
virtual bool onMasterProcessor() const = 0;
virtual MPI_Comm getMPIComm() const = 0;
virtual bool isValidFunctionSpaceType(int functionSpaceType) const = 0;
virtual std::string getDescription() const = 0;
virtual std::string functionSpaceTypeAsString(int functionSpaceType) const = 0;
virtual int getDim() const = 0;
virtual bool operator==(const AbstractDomain& other) const = 0;
virtual bool operator!=(const AbstractDomain& other) const = 0;
virtual void write(const std::string& filename) const = 0;
virtual void dump(const std::string& filename) const = 0;
virtual std::pair<int,DataTypes::dim_t> getDataShape(int functionSpaceCode) const = 0;
virtual int getTagFromSampleNo(int functionSpaceType, DataTypes::index_t sampleNo) const = 0;
virtual void setTagMap(const std::string& name, int tag) = 0;
virtual int getTag(const std::string& name) const = 0;
virtual bool isValidTagName(const std::string& name) const;
virtual std::string showTagNames() const = 0;
// ESCRIPT_DLL_API class already exported
virtual const DataTypes::dim_t* borrowSampleReferenceIDs(int functionSpaceType) const = 0;
virtual void setNewX(const escript::Data& arg) = 0;
virtual void interpolateOnDomain(escript::Data& target, const escript::Data& source) const = 0;
virtual bool probeInterpolationOnDomain(int functionSpaceType_source,
int functionSpaceType_target) const = 0;
virtual signed char preferredInterpolationOnDomain(
int functionSpaceType_source,
int functionSpaceType_target) const = 0;
virtual bool
commonFunctionSpace(const std::vector<int>& fs, int& resultcode) const = 0;
virtual void interpolateAcross(escript::Data& target, const escript::Data& source) const = 0;
virtual bool probeInterpolationAcross(int functionSpaceType_source,
const AbstractDomain& targetDomain,
int functionSpaceType_target) const = 0;
virtual escript::Data getX() const = 0;
#ifdef ESYS_HAVE_BOOST_NUMPY
virtual boost::python::numpy::ndarray getNumpyX() const = 0;
#endif
virtual escript::Data getNormal() const = 0;
virtual escript::Data getSize() const = 0;
virtual void setToX(escript::Data& out) const = 0;
virtual void setToNormal(escript::Data& out) const = 0;
virtual void setToSize(escript::Data& out) const = 0;
virtual void setToGradient(escript::Data& grad, const escript::Data& arg) const = 0;
virtual bool ownSample(int fs_code, DataTypes::index_t id) const = 0;
virtual void setTags(int functionSpaceType, int newTag, const escript::Data& mask) const = 0;
virtual bool isCellOriented(int functionSpaceCode) const = 0;
virtual StatusType getStatus() const;
void throwStandardException(const std::string& functionName) const;
virtual int getNumberOfTagsInUse(int functionSpaceCode) const = 0;
virtual const int* borrowListOfTagsInUse(int functionSpaceCode) const = 0;
virtual bool canTag(int functionspacecode) const = 0;
virtual int getApproximationOrder(const int functionSpaceCode) const = 0;
virtual bool supportsContactElements() const = 0;
virtual bool supportsFilter(const boost::python::tuple& t) const;
virtual escript::Data randomFill(const DataTypes::ShapeType& shape,
const FunctionSpace& what, long seed,
const boost::python::tuple& filter) const = 0;
};
} // end of namespace
#endif // __ESCRIPT_ABSTRACTDOMAIN_H__
DataTypes.h
EsysMPI.h
MPI_Comm
int MPI_Comm
Definition: EsysMPI.h:44
Pointers.h
Typedefs and macros for reference counted storage.
POINTER_WRAPPER_CLASS
#define POINTER_WRAPPER_CLASS(x)
Definition: Pointers.h:33
REFCOUNT_BASE_CLASS
#define REFCOUNT_BASE_CLASS(x)
Definition: Pointers.h:31
escript::AbstractDomain
Base class for all escript domains.
Definition: AbstractDomain.h:51
escript::AbstractDomain::dump
virtual void dump(const std::string &filename) const =0
dumps the domain to an external file filename.
escript::AbstractDomain::getTag
virtual int getTag(const std::string &name) const =0
Return the tag key for tag name.
escript::AbstractDomain::probeInterpolationOnDomain
virtual bool probeInterpolationOnDomain(int functionSpaceType_source, int functionSpaceType_target) const =0
True if interpolation is possible from source to target.
escript::AbstractDomain::getSize
virtual escript::Data getSize() const =0
Returns the local size of samples. The function space is chosen appropriately.
escript::AbstractDomain::getMPIRank
virtual int getMPIRank() const =0
return the number MPI rank of this processor
escript::AbstractDomain::borrowListOfTagsInUse
virtual const int * borrowListOfTagsInUse(int functionSpaceCode) const =0
escript::AbstractDomain::getTagFromSampleNo
virtual int getTagFromSampleNo(int functionSpaceType, DataTypes::index_t sampleNo) const =0
Return the tag key for the given sample number.
escript::AbstractDomain::borrowSampleReferenceIDs
virtual const DataTypes::dim_t * borrowSampleReferenceIDs(int functionSpaceType) const =0
Returns a borrowed pointer to the sample reference number id list.
escript::AbstractDomain::interpolateOnDomain
virtual void interpolateOnDomain(escript::Data &target, const escript::Data &source) const =0
Interpolates data given on source onto target where source and target have to be given on the same do...
escript::AbstractDomain::operator==
virtual bool operator==(const AbstractDomain &other) const =0
Return true if given domains are equal.
escript::AbstractDomain::setTagMap
virtual void setTagMap(const std::string &name, int tag)=0
sets a map from a clear tag name to a tag key
escript::AbstractDomain::randomFill
virtual escript::Data randomFill(const DataTypes::ShapeType &shape, const FunctionSpace &what, long seed, const boost::python::tuple &filter) const =0
Fills the data object with filtered random values.
escript::AbstractDomain::isValidFunctionSpaceType
virtual bool isValidFunctionSpaceType(int functionSpaceType) const =0
Returns true if the given integer is a valid function space type for this domain.
escript::AbstractDomain::interpolateAcross
virtual void interpolateAcross(escript::Data &target, const escript::Data &source) const =0
Interpolates data given on source onto target where source and target are given on different domains.
escript::AbstractDomain::getDescription
virtual std::string getDescription() const =0
Return a description for this domain.
escript::AbstractDomain::getNumberOfTagsInUse
virtual int getNumberOfTagsInUse(int functionSpaceCode) const =0
returns the number of tags in use and a pointer to an array with the number of tags in use
escript::AbstractDomain::setToSize
virtual void setToSize(escript::Data &out) const =0
Copies the size of samples into out. The actual function space to be considered is defined by out....
escript::AbstractDomain::canTag
virtual bool canTag(int functionspacecode) const =0
Checks if this domain allows tags for the specified functionSpaceCode.
escript::AbstractDomain::preferredInterpolationOnDomain
virtual signed char preferredInterpolationOnDomain(int functionSpaceType_source, int functionSpaceType_target) const =0
Preferred direction of interpolation. If you really need to test for a particular direction,...
escript::AbstractDomain::getApproximationOrder
virtual int getApproximationOrder(const int functionSpaceCode) const =0
returns the approximation order used for a function space functionSpaceCode
escript::AbstractDomain::StatusType
int StatusType
Definition: AbstractDomain.h:53
escript::AbstractDomain::getDim
virtual int getDim() const =0
Returns the spatial dimension of the domain.
escript::AbstractDomain::showTagNames
virtual std::string showTagNames() const =0
Returns all tag names in a single string sperated by commas.
escript::AbstractDomain::~AbstractDomain
virtual ~AbstractDomain()
Destructor for AbstractDomain.
Definition: AbstractDomain.h:69
escript::AbstractDomain::commonFunctionSpace
virtual bool commonFunctionSpace(const std::vector< int > &fs, int &resultcode) const =0
given a vector of FunctionSpace type codes, pass back a code which then can all be interpolated to.
escript::AbstractDomain::ownSample
virtual bool ownSample(int fs_code, DataTypes::index_t id) const =0
True if this rank owns the sample(id) Must be implemented by the Domain adapter.
escript::AbstractDomain::setNewX
virtual void setNewX(const escript::Data &arg)=0
Assigns new location to the domain.
escript::AbstractDomain::onMasterProcessor
virtual bool onMasterProcessor() const =0
Return true if on MPI master, else false.
escript::AbstractDomain::functionSpaceTypeAsString
virtual std::string functionSpaceTypeAsString(int functionSpaceType) const =0
Return a description for the given function space type code.
escript::AbstractDomain::getX
virtual escript::Data getX() const =0
Returns locations in the domain. The function space is chosen appropriately.
escript::AbstractDomain::operator!=
virtual bool operator!=(const AbstractDomain &other) const =0
Return true if given domains are not equal.
escript::AbstractDomain::isCellOriented
virtual bool isCellOriented(int functionSpaceCode) const =0
returns true if data on this domain and a function space of type functionSpaceCode has to considered ...
escript::AbstractDomain::probeInterpolationAcross
virtual bool probeInterpolationAcross(int functionSpaceType_source, const AbstractDomain &targetDomain, int functionSpaceType_target) const =0
escript::AbstractDomain::MPIBarrier
virtual void MPIBarrier() const =0
If compiled for MPI then execute an MPI_Barrier, else do nothing.
escript::AbstractDomain::write
virtual void write(const std::string &filename) const =0
Writes the domain to an external file filename.
escript::AbstractDomain::getMPISize
virtual int getMPISize() const =0
return the number of processors used for this domain
escript::AbstractDomain::setTags
virtual void setTags(int functionSpaceType, int newTag, const escript::Data &mask) const =0
assigns new tag newTag to all samples of functionspace with a positive value of mask for any its samp...
escript::AbstractDomain::getMPIComm
virtual MPI_Comm getMPIComm() const =0
get the communicator for this domain. Returns an integer on non-MPI builds Routine must be implemente...
escript::AbstractDomain::getDataShape
virtual std::pair< int, DataTypes::dim_t > getDataShape(int functionSpaceCode) const =0
Returns the number of data points per sample, and the number of samples as a pair.
escript::AbstractDomain::setToX
virtual void setToX(escript::Data &out) const =0
Copies the location of data points on the domain into out. The actual function space to be considered...
escript::AbstractDomain::getNormal
virtual escript::Data getNormal() const =0
Return boundary normals. The function space is chosen appropriately.
escript::AbstractDomain::setToGradient
virtual void setToGradient(escript::Data &grad, const escript::Data &arg) const =0
Copies the gradient of arg into grad. The actual function space to be considered for the gradient is ...
escript::AbstractDomain::supportsContactElements
virtual bool supportsContactElements() const =0
escript::AbstractDomain::setToNormal
virtual void setToNormal(escript::Data &out) const =0
Copies the surface normals at data points into out. The actual function space to be considered is def...
escript::AbstractDomain::getMPI
virtual JMPI getMPI() const =0
returns a shared pointer to the MPI information wrapper for this domain
escript::Data
Data represents a collection of datapoints.
Definition: Data.h:64
escript::FunctionSpace
Definition: FunctionSpace.h:36
ESCRIPT_DLL_API
#define ESCRIPT_DLL_API
Definition: escriptcore/src/system_dep.h:30
escript::DataTypes::ShapeType
std::vector< int > ShapeType
The shape of a single datapoint.
Definition: DataTypes.h:44
escript::DataTypes::dim_t
index_t dim_t
Definition: DataTypes.h:66
escript::DataTypes::index_t
int index_t
type for array/matrix indices used both globally and on each rank
Definition: DataTypes.h:61
escript
Definition: AbstractContinuousDomain.cpp:23
escript::const_Domain_ptr
boost::shared_ptr< const AbstractDomain > const_Domain_ptr
Definition: AbstractDomain.h:44
escript::Domain_ptr
boost::shared_ptr< AbstractDomain > Domain_ptr
Definition: AbstractDomain.h:41
escript::JMPI
boost::shared_ptr< JMPI_ > JMPI
Definition: EsysMPI.h:74
system_dep.h