FunctionSpace.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_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;
#ifdef ESYS_HAVE_BOOST_NUMPY
boost::python::numpy::ndarray getNumpyX() const;
#endif
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::getReferenceIDFromDataPointNo
DataTypes::dim_t getReferenceIDFromDataPointNo(DataTypes::dim_t dataPointNo) const
Returns the reference number associated with the given data-point number.
Definition: FunctionSpace.cpp:179
DataFactory.h
ESCRIPT_DLL_API
#define ESCRIPT_DLL_API
Definition: escriptcore/src/system_dep.h:30
escript::Data::getNumDataPointsPerSample
int getNumDataPointsPerSample() const
Return the number of data points per sample.
Definition: Data.h:544
escript::FunctionSpace::getTagFromSampleNo
int getTagFromSampleNo(DataTypes::dim_t sampleNo) const
Returns the tag associated with the given sample number.
Definition: FunctionSpace.cpp:144
escript::FunctionSpace::getSize
escript::Data getSize() const
Returns the sample size (e.g. the diameter of elements, radius of particles).
Definition: FunctionSpace.cpp:295
escript::FunctionSpace::getDomainPython
Domain_ptr getDomainPython() const
Return the function space domain. Internal use only! This gets around some python difficulties by cas...
Definition: FunctionSpace.cpp:109
escript::DataTypes::real_t
double real_t
type of all real-valued scalars in escript
Definition: DataTypes.h:79
escript::FunctionSpace::m_functionSpaceType
int m_functionSpaceType
Definition: FunctionSpace.h:240
escript::NullDomain
NullDomain provides a null value for domain. Needed for the construction of a default FunctionSpace.
Definition: NullDomain.h:54
escript::FunctionSpace::getDataShape
std::pair< int, DataTypes::dim_t > getDataShape() const
Returns the shape of the data needed to represent the function space.
Definition: FunctionSpace.cpp:89
escript::FunctionSpace::getNumSamples
DataTypes::dim_t getNumSamples() const
Returns the number of samples.
Definition: FunctionSpace.h:182
escript::Data::getDataPointShape
const DataTypes::ShapeType & getDataPointShape() const
Return a reference to the data point shape.
Definition: Data.h:705
escript::Domain_ptr
boost::shared_ptr< AbstractDomain > Domain_ptr
Definition: AbstractDomain.h:55
escript::FunctionSpace::operator=
FunctionSpace & operator=(const FunctionSpace &other)
Assignment operator. This method is only defined (private) to prevent people from using it.
Definition: FunctionSpace.cpp:207
escript::FunctionSpace
Definition: FunctionSpace.h:49
escript::FunctionSpace::getListOfTagsSTL
std::list< int > getListOfTagsSTL() const
Returns an stl list of the tags used in this function space.
Definition: FunctionSpace.cpp:335
escript::Data::getFunctionSpace
const FunctionSpace & getFunctionSpace() const
Return the function space.
Definition: Data.h:463
escript::FunctionSpace::canTag
bool canTag() const
Returns true if this function space support tags.
Definition: FunctionSpace.cpp:353
escript::FunctionSpace::getDomain
const_Domain_ptr getDomain() const
Returns the function space domain.
Definition: FunctionSpace.cpp:103
weipa::VisItControl::initialize
bool initialize(const std::string &simFile, const std::string &comment)
Definition: VisItControl.cpp:206
system_dep.h
escript::Data::getNumSamples
int getNumSamples() const
Return the number of samples.
Definition: Data.h:533
escript::FunctionSpace::getNormal
escript::Data getNormal() const
Returns the surface normal field.
Definition: FunctionSpace.cpp:286
escript::Data
Data represents a collection of datapoints.
Definition: Data.h:64
escript::DataException
Definition: DataException.h:41
escript::FunctionSpace::m_domain
const_Domain_ptr m_domain
Definition: FunctionSpace.h:238
escript::FunctionSpace::getX
escript::Data getX() const
Returns the spatial locations of the data points.
Definition: FunctionSpace.cpp:229
escript::DataTypes::dim_t
index_t dim_t
Definition: DataTypes.h:93
escript::FunctionSpace::setTags
void setTags(const int newTag, const escript::Data &mask) const
Assigns new tag newTag to all samples with a positive value of mask for any of its sample points.
Definition: FunctionSpace.cpp:304
escript::Data::getSampleDataRW
DataTypes::real_t * getSampleDataRW(DataTypes::RealVectorType::size_type sampleNo, DataTypes::real_t dummy=0)
Return the sample data for the given sample no. Please do not use this unless you NEED to access samp...
Definition: Data.h:1954
escript::FunctionSpace::getNumDPPSample
int getNumDPPSample() const
Returns the number of data points per sample.
Definition: FunctionSpace.h:188
escript::FunctionSpace::getApproximationOrder
int getApproximationOrder() const
Returns the approximation order used for this function space.
Definition: FunctionSpace.cpp:359
AbstractDomain.h
escript::FunctionSpace::getListOfTags
boost::python::list getListOfTags() const
Returns a list of the tags used in this function space.
Definition: FunctionSpace.cpp:343
escript::FunctionSpaceException
Definition: FunctionSpaceException.h:42
escript::FunctionSpace::borrowListOfTagsInUse
const int * borrowListOfTagsInUse() const
Definition: FunctionSpace.cpp:330
escript::canInterpolate
bool canInterpolate(FunctionSpace src, FunctionSpace dest)
Definition: FunctionSpace.cpp:34
FunctionSpaceException.h
escript
Definition: AbstractContinuousDomain.cpp:23
escript::FunctionSpace::setTagsByString
void setTagsByString(const std::string &name, const escript::Data &mask) const
Definition: FunctionSpace.cpp:314
NullDomain.h
escript::FunctionSpace::getTypeCode
int getTypeCode() const
Returns the function space type code.
Definition: FunctionSpace.cpp:95
escript::FunctionSpace::toString
std::string toString() const
Returns a text description of the function space.
Definition: FunctionSpace.cpp:118
escript::Vector
Data Vector(double value, const FunctionSpace &what, bool expanded)
Return a Data object containing vector data-points. ie: rank 1 data-points.
Definition: DataFactory.cpp:139
escript::Data::getShapeProduct
long getShapeProduct() const
Returns the product of the data point shapes.
Definition: Data.cpp:745
escript::FunctionSpace::borrowSampleReferenceIDs
const DataTypes::dim_t * borrowSampleReferenceIDs() const
Returns a borrowed reference to the list of sample reference IDs.
Definition: FunctionSpace.cpp:199
Data.h
escript::FunctionSpace::operator!=
bool operator!=(const FunctionSpace &other) const
Definition: FunctionSpace.cpp:223
escript::Scalar
Data Scalar(double value, const FunctionSpace &what, bool expanded)
A collection of factory functions for creating Data objects which contain data points of various shap...
Definition: DataFactory.cpp:63
escript::const_Domain_ptr
boost::shared_ptr< const AbstractDomain > const_Domain_ptr
Definition: AbstractDomain.h:58
escript::FunctionSpace::FunctionSpace
FunctionSpace()
Definition: FunctionSpace.cpp:47
escript::Data::setProtection
void setProtection()
switches on update protection
Definition: Data.cpp:1166
escript::FunctionSpace::operator==
bool operator==(const FunctionSpace &other) const
Comparison operator. Returns true if function spaces are equal. (i.e. same domain and same function s...
Definition: FunctionSpace.cpp:217
escript::FunctionSpace::getNumberOfTagsInUse
int getNumberOfTagsInUse() const
Returns the number of tags in use.
Definition: FunctionSpace.cpp:325
escript::FunctionSpace::getTagFromDataPointNo
int getTagFromDataPointNo(DataTypes::dim_t dataPointNo) const
Returns the tag associated with the given data-point number.
Definition: FunctionSpace.cpp:150
FunctionSpace.h