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
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__
ESCRIPT_DLL_API
#define ESCRIPT_DLL_API
Definition: escriptcore/src/system_dep.h:30
getTag
int getTag(unsigned char sourcex, unsigned char sourcey, unsigned char sourcez, unsigned char targetx, unsigned char targety, unsigned char targetz)
Definition: blocktools.cpp:413
POINTER_WRAPPER_CLASS
#define POINTER_WRAPPER_CLASS(x)
Definition: Pointers.h:33
escript::AbstractDomain::isValidTagName
virtual bool isValidTagName(const std::string &name) const
Returns True if name is a defined tag name.
Definition: AbstractDomain.cpp:67
escript::AbstractDomain::throwStandardException
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 functi...
Definition: AbstractDomain.cpp:57
escript::AbstractDomain::StatusType
int StatusType
Definition: AbstractDomain.h:67
escript::Domain_ptr
boost::shared_ptr< AbstractDomain > Domain_ptr
Definition: AbstractDomain.h:55
escript::FunctionSpace
Definition: FunctionSpace.h:49
speckley::probeInterpolationAcross
bool probeInterpolationAcross(int fsType_source, const escript::AbstractDomain &domain, int fsType_target, int dim)
Definition: CrossDomainCoupler.cpp:32
REFCOUNT_BASE_CLASS
#define REFCOUNT_BASE_CLASS(x)
Definition: Pointers.h:31
escript::AbstractDomain::getStatus
virtual StatusType getStatus() const
Returns a status indicator of the domain. The status identifier should be unique over the live time i...
Definition: AbstractDomain.cpp:62
system_dep.h
Pointers.h
Typedefs and macros for reference counted storage.
escript::Data
Data represents a collection of datapoints.
Definition: Data.h:64
escript::DataTypes::dim_t
index_t dim_t
Definition: DataTypes.h:93
escript::DataTypes::ShapeType
std::vector< int > ShapeType
The shape of a single datapoint.
Definition: DataTypes.h:71
escript::JMPI
boost::shared_ptr< JMPI_ > JMPI
Definition: EsysMPI.h:72
DomainException.h
AbstractDomain.h
escript::DataTypes::index_t
int index_t
type for array/matrix indices used both globally and on each rank
Definition: DataTypes.h:88
escript
Definition: AbstractContinuousDomain.cpp:23
DataTypes.h
escript::AbstractDomain::getPtr
Domain_ptr getPtr()
Returns smart pointer which is managing this object. If one does not exist yet it creates one.
Definition: AbstractDomain.cpp:39
escript::AbstractDomain::supportsFilter
virtual bool supportsFilter(const boost::python::tuple &t) const
true if this domain can handle to specified tuple of filter options.
Definition: AbstractDomain.cpp:72
MPI_Comm
int MPI_Comm
Definition: EsysMPI.h:42
escript::AbstractDomain
Base class for all escript domains.
Definition: AbstractDomain.h:64
escript::const_Domain_ptr
boost::shared_ptr< const AbstractDomain > const_Domain_ptr
Definition: AbstractDomain.h:58
EsysMPI.h