FunctionSpace.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)
*
*****************************************************************************/
#ifndef __ESCRIPT_FUNCTIONSPACE_H__
#define __ESCRIPT_FUNCTIONSPACE_H__
#include "system_dep.h"
#include "AbstractDomain.h"
#include <boost/python/list.hpp>
#include <list>
namespace escript {
//
// Forward declaration for class Data.
class Data;
class ESCRIPT_DLL_API FunctionSpace
{
public:
FunctionSpace();
FunctionSpace(const_Domain_ptr domain, int functionSpaceType);
FunctionSpace(const FunctionSpace& other);
int getTypeCode() const;
const_Domain_ptr getDomain() const;
Domain_ptr getDomainPython() const;
bool canTag() const;
int getApproximationOrder() const;
void setTags(const int newTag, const escript::Data& mask) const;
void setTagsByString(const std::string& name, const escript::Data& mask) const;
std::pair<int,DataTypes::dim_t> getDataShape() const;
bool operator==(const FunctionSpace& other) const;
bool operator!=(const FunctionSpace& other) const;
std::string toString() const;
int getTagFromSampleNo(DataTypes::dim_t sampleNo) const;
int getTagFromDataPointNo(DataTypes::dim_t dataPointNo) const;
DataTypes::dim_t getReferenceIDFromDataPointNo(DataTypes::dim_t dataPointNo) const;
inline
DataTypes::dim_t getReferenceIDOfSample(DataTypes::dim_t sampleNo) const {
return borrowSampleReferenceIDs()[sampleNo];
}
inline
bool ownSample(DataTypes::dim_t sampleNo) const {
return m_domain->ownSample(m_functionSpaceType, sampleNo);
}
const DataTypes::dim_t* borrowSampleReferenceIDs() const;
escript::Data getX() const;
escript::Data getNormal() const;
escript::Data getSize() const;
inline
DataTypes::dim_t getNumSamples() const { return getDataShape().second; }
inline
int getNumDPPSample() const { return getNumDataPointsPerSample(); }
inline
int getNumDataPointsPerSample() const { return getDataShape().first; }
inline
int getDim() const { return getDomain()->getDim(); }
boost::python::list getListOfTags() const;
std::list<int> getListOfTagsSTL() const;
int getNumberOfTagsInUse() const;
const int* borrowListOfTagsInUse() const;
inline
bool probeInterpolation(const FunctionSpace& other) const
{
if (*this == other)
return true;
const_Domain_ptr domain(getDomain());
if (*domain == *other.getDomain()) {
return domain->probeInterpolationOnDomain(
getTypeCode(), other.getTypeCode());
}
return domain->probeInterpolationAcross(
getTypeCode(), *(other.getDomain()), other.getTypeCode());
}
private:
FunctionSpace& operator=(const FunctionSpace& other);
const_Domain_ptr m_domain;
int m_functionSpaceType;
};
bool canInterpolate(FunctionSpace src, FunctionSpace dest);
} // end of namespace
#endif // __ESCRIPT_FUNCTIONSPACE_H__
escript::FunctionSpace
Definition: FunctionSpace.h:34
escript::Domain_ptr
boost::shared_ptr< AbstractDomain > Domain_ptr
Definition: AbstractDomain.h:36
escript::FunctionSpace::getNumSamples
DataTypes::dim_t getNumSamples() const
Returns the number of samples.
Definition: FunctionSpace.h:160
escript
Definition: AbstractContinuousDomain.cpp:22
escript::FunctionSpace::ownSample
bool ownSample(DataTypes::dim_t sampleNo) const
Does this process own the sample? For non-MPI builds will always return true.
Definition: FunctionSpace.h:131
escript::FunctionSpace::getDomain
const_Domain_ptr getDomain() const
Returns the function space domain.
Definition: FunctionSpace.cpp:102
escript::FunctionSpace::probeInterpolation
bool probeInterpolation(const FunctionSpace &other) const
Definition: FunctionSpace.h:195
system_dep.h
escript::FunctionSpace::m_domain
const_Domain_ptr m_domain
Definition: FunctionSpace.h:216
escript::Data
Data represents a collection of datapoints.
Definition: Data.h:63
escript::FunctionSpace::getTypeCode
int getTypeCode() const
Returns the function space type code.
Definition: FunctionSpace.cpp:94
escript::FunctionSpace::getNumDPPSample
int getNumDPPSample() const
Returns the number of data points per sample.
Definition: FunctionSpace.h:166
escript::FunctionSpace::m_functionSpaceType
int m_functionSpaceType
Definition: FunctionSpace.h:218
escript::FunctionSpace::getDim
int getDim() const
Return the number of spatial dimensions of the underlying domain.
Definition: FunctionSpace.h:175
escript::FunctionSpace::getReferenceIDOfSample
DataTypes::dim_t getReferenceIDOfSample(DataTypes::dim_t sampleNo) const
Returns the reference number associated with the given sample number. This function is not efficient...
Definition: FunctionSpace.h:122
AbstractDomain.h
ESCRIPT_DLL_API
#define ESCRIPT_DLL_API
Definition: escriptcore/src/system_dep.h:29
escript::canInterpolate
bool canInterpolate(FunctionSpace src, FunctionSpace dest)
Definition: FunctionSpace.cpp:33
escript::FunctionSpace::getNumDataPointsPerSample
int getNumDataPointsPerSample() const
Definition: FunctionSpace.h:169
escript::const_Domain_ptr
boost::shared_ptr< const AbstractDomain > const_Domain_ptr
Definition: AbstractDomain.h:39
escript::DataTypes::dim_t
index_t dim_t
Definition: DataTypes.h:64