escript Revision_
FunctionSpace.h
Go to the documentation of this file.
1
2/*****************************************************************************
3*
4* Copyright (c) 2003-2020 by The University of Queensland
5* http://www.uq.edu.au
6*
7* Primary Business: Queensland, Australia
8* Licensed under the Apache License, version 2.0
9* http://www.apache.org/licenses/LICENSE-2.0
10*
11* Development until 2012 by Earth Systems Science Computational Center (ESSCC)
12* Development 2012-2013 by School of Earth Sciences
13* Development from 2014-2017 by Centre for Geoscience Computing (GeoComp)
14* Development from 2019 by School of Earth and Environmental Sciences
15**
16*****************************************************************************/
17
18
19#ifndef __ESCRIPT_FUNCTIONSPACE_H__
20#define __ESCRIPT_FUNCTIONSPACE_H__
21
22#include "system_dep.h"
23
24#include "AbstractDomain.h"
25
26#include <boost/python/list.hpp>
27#include <list>
28
29namespace escript {
30
31//
32// Forward declaration for class Data.
33class Data;
34
36{
37public:
39
40 FunctionSpace(const_Domain_ptr domain, int functionSpaceType);
41
42 FunctionSpace(const FunctionSpace& other);
43
49 int getTypeCode() const;
50
54 const_Domain_ptr getDomain() const;
55
61 Domain_ptr getDomainPython() const;
62
66 bool canTag() const;
67
71 int getApproximationOrder() const;
72
77 void setTags(const int newTag, const escript::Data& mask) const;
78
79 void setTagsByString(const std::string& name, const escript::Data& mask) const;
80
85 std::pair<int,DataTypes::dim_t> getDataShape() const;
86
91 bool operator==(const FunctionSpace& other) const;
92
93 bool operator!=(const FunctionSpace& other) const;
94
98 std::string toString() const;
99
103 int getTagFromSampleNo(DataTypes::dim_t sampleNo) const;
104
108 int getTagFromDataPointNo(DataTypes::dim_t dataPointNo) const;
109
114 DataTypes::dim_t getReferenceIDFromDataPointNo(DataTypes::dim_t dataPointNo) const;
115
122 inline
124 return borrowSampleReferenceIDs()[sampleNo];
125 }
126
131 inline
132 bool ownSample(DataTypes::dim_t sampleNo) const {
133 return m_domain->ownSample(m_functionSpaceType, sampleNo);
134 }
135
139 const DataTypes::dim_t* borrowSampleReferenceIDs() const;
140
144 escript::Data getX() const;
145
146#ifdef ESYS_HAVE_BOOST_NUMPY
150 boost::python::numpy::ndarray getNumpyX() const;
151#endif
152
156 escript::Data getNormal() const;
157
162 escript::Data getSize() const;
163
167 inline
168 DataTypes::dim_t getNumSamples() const { return getDataShape().second; }
169
173 inline
174 int getNumDPPSample() const { return getNumDataPointsPerSample(); }
175
176 inline
177 int getNumDataPointsPerSample() const { return getDataShape().first; }
178
182 inline
183 int getDim() const { return getDomain()->getDim(); }
184
188 boost::python::list getListOfTags() const;
189
193 std::list<int> getListOfTagsSTL() const;
194
198 int getNumberOfTagsInUse() const;
199
200 const int* borrowListOfTagsInUse() const;
201
202 inline
203 bool probeInterpolation(const FunctionSpace& other) const
204 {
205 if (*this == other)
206 return true;
207 const_Domain_ptr domain(getDomain());
208 if (*domain == *other.getDomain()) {
209 return domain->probeInterpolationOnDomain(
210 getTypeCode(), other.getTypeCode());
211 }
212 return domain->probeInterpolationAcross(
213 getTypeCode(), *(other.getDomain()), other.getTypeCode());
214 }
215
216private:
222 FunctionSpace& operator=(const FunctionSpace& other);
223
225
227};
228
231
232} // end of namespace
233
234#endif // __ESCRIPT_FUNCTIONSPACE_H__
Data represents a collection of datapoints.
Definition: Data.h:64
Definition: FunctionSpace.h:36
int getDim() const
Return the number of spatial dimensions of the underlying domain.
Definition: FunctionSpace.h:183
DataTypes::dim_t getNumSamples() const
Returns the number of samples.
Definition: FunctionSpace.h:168
const_Domain_ptr getDomain() const
Returns the function space domain.
Definition: FunctionSpace.cpp:103
const_Domain_ptr m_domain
Definition: FunctionSpace.h:224
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:123
int getTypeCode() const
Returns the function space type code.
Definition: FunctionSpace.cpp:95
bool probeInterpolation(const FunctionSpace &other) const
Definition: FunctionSpace.h:203
bool ownSample(DataTypes::dim_t sampleNo) const
Does this process own the sample? For non-MPI builds will always return true.
Definition: FunctionSpace.h:132
int getNumDataPointsPerSample() const
Definition: FunctionSpace.h:177
int getNumDPPSample() const
Returns the number of data points per sample.
Definition: FunctionSpace.h:174
int m_functionSpaceType
Definition: FunctionSpace.h:226
#define ESCRIPT_DLL_API
Definition: escriptcore/src/system_dep.h:30
index_t dim_t
Definition: DataTypes.h:66
Definition: AbstractContinuousDomain.cpp:23
boost::shared_ptr< const AbstractDomain > const_Domain_ptr
Definition: AbstractDomain.h:44
bool canInterpolate(FunctionSpace src, FunctionSpace dest)
Definition: FunctionSpace.cpp:34
boost::shared_ptr< AbstractDomain > Domain_ptr
Definition: AbstractDomain.h:43